Last Updated: April 20, 2004
TidyText is my new plugin for Moveable Type, which I’ve been working on while slacking on SongBuddy. It adds two new text formatting options for entries that will run them through HTML Tidy to make the XHTML valid before building the entry. Most of us want to support web standards, for me it’s a pain to remember to change & to & when linking to URLs. What TidyText does is fixes that broken XHTML and turns it into something valid.
Download TidyText
You can download it or read the documentation, which I’ve included in this post. If you want to see it in action, compare the source of the linked documentation with the source that I copied and pasted for the documentation in this post.
This has been tested on a couple systems but I can’t vouch for it working on yours. You will need to install HTML Tidy before this will work, and it isn’t the fastest plugin due to the use of the filesystem. On the other hand, you can start making valid pages again!
Changes are noted below, thanks to L. M. Orchard for his contributions.
NAME
TidyText - Plugin for Moveable Type
DESCRIPTION
A text-formatting plugin that uses HTML Tidy to make valid XHTML and HTML for blog entries in Moveable Type.
REQUIREMENTS
Moveable Type 2.6 or higher
HTML Tidy ( available at http://tidy.sourceforge.net/ )
INSTALLATION
Get and install HTML Tidy from http://tidy.sourceforge.net/ if you haven't already.
If you don't know which version to get try Linux/x86 first.
Open tidytext.pl in a text editor and set $TIDY to the location of Tidy,
$TIDYARGS to the arguments to give Tidy ( documented at http://tidy.sourceforge.net/docs/quickref.html ) and $TIDYTMP to the temp directory to use.
Put tidytext.pl in the plugins directory for your Moveable Type installation and make sure that the permissions make it readable by the web server
USAGE
When you create or edit a blog entry you will have two new options under Text Formatting:
- HTML Tidy (and Convert Line Breaks)
- This will turn your blog entry into valid XHTML or HTML,
enclose paragraphs in <p> and </p> tags and convert line breaks to <br /> tags.
This is similar to the Moveable Type Text Formatting "Convert Line Breaks." - HTML Tidy
- This will turn your blog entry into valid XHTML or HTML.
This is similar to the Moveable Type Text Formatting "None."
Or you can use TidyText in your template as a global filter or a container tag:
- Global Filter
- <$MTEntryBody tidy="1"$>
- Container Tag
- <MTTidy><$MTEntryBody$></MTTidy>
CHANGES
- Version 0.4
- Now works as a global filter: <$MTEntryBody tidy="1"$> ( Credit: L.M.
Orchard http://www.decafbad.com/ ) - Also works as a container tag: <MTTidy><$MTEntryBody$></MTTidy> ( Credit: L.M.
Orchard http://www.decafbad.com/ ) - Checks to see if Tidy exists before filtering your output.
- Version 0.3
- Initial release,
of course.
Why would an initial release start at 0.1 or even 1.0,
perish the thought!
BUGS
Uses temp files for processing,
which is slow,
but avoids deadlock issues that IPC::Open2 can have.
Hasn't been extensively tested,
use at your own risk.
Convert Line Breaks uses Moveable Type to add <p> and <br /> tags.
Because this is applied to the outside of multi-line container tags (i.e.
<blockquote> or <ins>) Tidy sees the nesting error and closes the container tag at the first </p>.
The solution is to turn off Convert Line Breaks and put <p> and </p> around your paragraphs for entries that use this tag.
COPYRIGHT
This program is copyright 2004 George Hotelling (http://george.hotelling.net) and licensed under the GPL.
8 responses to “TidyText”
I’ve been looking for something like this!!!
I’m going to give it a try. I’m going through all my pages and redesigning for accessibility anyways.
TidyText plugin makes MT posts valid XHTML
90% Crud: TidyText: TidyText is my new plugin for Moveable Type…. It adds two new text formatting options for entries that will run them through HTML Tidy to make the XHTML valid before building the entry. Most of us want to support web standards, fo…
Tidy Text
Will Ben Trott be adding tidylib to Movable Type 3.0?
TidyText
Install HTML Tidy on your server and edit tidytext.pl to set the path to HTML Tidy….
Shamless Plugging
I feel a little dirty doing this, but I have two new projects that ArborBloggers may be interested in.The first is the LinkText Project, which aims to come up with structure for what words should and shouldn’t be linked in…
This looks like a great plug-in. One question — when you say “Get and install HTML Tidy from http://tidy.sourceforge.net/“, what do you mean exactly? Do I copy the files onto some directory on my server? Or is there something else I need to do?
You need to download the program HTML Tidy and put it on your server. Then you need to edit the plugin and tell it where you put it on the server. Chances are you just need to grab the “Linux/x86” binary from that site and you’ll be set.
Okay, I’ve installed it and everything, but whenever I have it turned on, it makes the body of my entry disappear. It only shows the entry title. What am I doing wrong?