Supplying img sizes automatically

Wednesday, April 4th, 2007

What if any tools are available for reading HTML, finding missing width and height attributes on img elements, and filling in the relevant values? So far all I’ve found is this Perl Script from Randal Schwartz circa 1999 and this Perl script based on ImageMagik from Marc Merlins. I haven’t been able to resolve the dependencies for Schwartz’s script yet. Merlins’ runs, but is not XHTML savvy. That may be easy to fix though.

BBEdit almost does this, but it replaces existing height and width attributes too, including ones you’ve deliberately set to a different size. I only want to fill in missing height and width attributes, not change existing ones.

I’d love to find a simple open source GUI tool that could pull this off for an entire site.

Death Threats, Anonymity, and Blogs

Sunday, April 1st, 2007

I’ve been avoiding comment on the whole Sierra/Locke/etc. dust-up lately. Most of the commentary seems pretty on-the-mark, but a few usually sensible people are starting to overreact and call for self-censorship. Once the mainstream media gets hold of this next week, expect the customary cast of Congressional idiots to elevate that to calls for government mandated censorship. However the problem has been blown way out of proportion. There’s one thing that I think needs to be said that hasn’t been said yet to put this whole sordid mess in its proper perspective:

Death threats are no big deal.
(more…)

Styling abbr with CSS

Wednesday, March 28th, 2007

Proper use of the abbr and acronym elements is good for accessibility and good for conversational style writing. No longer do you have to write phrases that grate on the ear such as, “Many problems are much easier to solve with a native Extensible Markup Language (XML) database and XQuery than with a relational database and Structured Query Language (SQL).” Instead, you just assume 99% of your audience knows what you’re talking about, and instead you write:

Many problems are much easier to solve with a native <abbr title="Extensible Markup Language">XML</abbr> database and XQuery than with a relational database and <abbr title="Structured Query Language">SQL</abbr>.

However, there are two problems with this:
(more…)

Will this ” cause a problem> and if so what?

Sunday, March 18th, 2007

Testing for some plain text problems in WordPress title formatting. Hmm, looks like this one is OK. WordPress turns the double quote into a curly quote which does not terminate the attribute value. The greater than sign is escaped inside the attribute value. so the problems only arise if there’s real markup.

The curly quote may be an accidental fix. I’m not sure what would happen if I figured out how to publish a real straight double quote in a title. I wonder if there’s a preference for that somewhere?

Is This a Security Issue?

Sunday, March 18th, 2007

More interesting results from yesterday’s experiments with dumping some markup in the title of a post and seeing what breaks. I noticed the markup made its way into the WordPress Admin section. Is that just because the markup I used (strong and span tags) was relatively innocuous or is there a potentially deeper problem? Let’s find out.
(more…)

A Strong Test for Markup In Titles & Summaries

Saturday, March 17th, 2007

I’ve been hacking on Benjamin Smedberg’s Atom 1.0 plug-in for WordPress. I’ve added a preference panel for choosing between full text and summary feeds. Now I’ve fixed the double escaping of content in titles and summaries. (Escaped HTML is evil and should never have been allowed into Atom.)

However I’m not sure how my hack will react when posts contain markup in titles and summaries so I’m playing with that now. Hence this post. I may delete it once I’m convinced I’ve covered the various special cases well enough.

Things may look a little funny in the feed until I’m done since I’ll be deliberately breaking things to see how WordPress behaves.
(more…)