Skip to content
Movable Type plugin to interface with tidylib.
Perl
Find file
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Failed to load latest commit information.
plugins/Tidings
LICENSE.txt
README.mkd
SUPPORT.txt

README.mkd

Tidings

Tidings is a simple wrapper around Andy Lester's HTML::Tidy, itself a wrapper around libtidy. It's a convenient way of making sure that all your tags are closed and that your HTML is in squinting distance of validation, to avoid late-night typos producing a page full of red at the W3 Validator.

Usage

Wrap ugly code in an <mt:section tidy="...","..."> tag:

<mt:section tidy="xhtml","numeric_entities:1;char_encoding:ascii;quote_marks:1;">
<blockquote><p>The sun comes up, the tide rolls out<br>
The trucks roll by the park still a park<br>
Where children play and pick up stones<br>
Anything to make them feel less alone - he's alone<br>
His mind is his own town where all his thoughts run aground<br>
They fall all over and down</p>
&mdash; Fugazi, "Glue Man", <i>13 Songs<i>
</mt:section>

This nasty code above, with its doubled italics tags and missing </blockquote> is tidied and reformatted to become:

<blockquote>
<p>The sun comes up, the tide rolls out<br />
The trucks roll by the park still a park<br />
Where children play and pick up stones<br />
Anything to make them feel less alone - he&#39;s alone<br />
His mind is his own town where all his thoughts run aground<br />
They fall all over and down</p>
&#8212; Fugazi, &quot;Glue Man&quot;, <i>13 Songs</i></blockquote>

The tidy attribute in the mt:section tag above is a content filter that takes "xml", "html", or "xhtml" as an argument -- "xhtml" is the default value -- and any number of HTML::Tidy arguments (strung together as key:value pairs and separated by semicolons) as an optional secondary argument. Using Tidings and HTML::Tidy to clean up character encoding issues is doable but can be tricky depending on your database and DOCTYPE; a dedicated tool like NaughtyWordChars is more likely to succeed.

Something went wrong with that request. Please try again.