Technocrank

Icon

It Done Broke.

Typogrify WordPress Character Replacement

Typogrify 1.6

Something’s a little loose in Typogrify’s pattern matching code.  There’s an option for it to

Add <span class="amp"> to ampersands.

…which does just that, but it doesn’t check the context of the ampersand’s placement.  It will grab an ampersand in the middle of an anchor tag, for instance say, in a title attribute and nuke it.  The results are this:

<a title="Bob <span class="amp">&amp;</span> Doug McKenzie" href="http://www.hoser.com">Take off, eh?</a>

…which leaves a broken link and HTML guts all over the page.  Like, you really don’t need that many double quotes in there, do you now.  The regex code in Typogrify works if instead of “amp” it used ‘amp’ with single quotes (unless your attribute is enclosed with single quotes).  At least it doesn’t break the HTML into tiny little pieces.  However, there’s a larger question as to whether or not you really need a span inside an title attribute – or even anywhere inside HTML code.  It’s more code to do a check that you’re not pattern matching inside HTML tags, but it’s been done.  Maybe this will be addressed in wp-Hyphenate when it gets rolled in.

Category: Complaining, Troubleshooting, Web

Tagged: , ,

Leave a Reply

 

Twitter: crankietech

RSS This Day In Tech (From Wired)

  • An error has occurred, which probably means the feed is down. Try again later.