NAME
Chronicle::Plugin::Tidy - Attempt to fix malformed HTML.
DESCRIPTION
This plugin is designed to prevent malformed HTML from being generated.
It does that by using the HTML::TreeBuilder module to parse the HTML that has been inserted into the SQLite database and then rewalks the tree to try to fix broken entries.
As an example the following bogus HTML will be fixed:
<p>This is a line of text.</P>
Similarly tags that are not closed will be fixed up.
METHODS
Now follows documentation on the available methods.
on_insert
The on_insert
method is automatically invoked when a new blog post must be inserted into the SQLite database, that might be because a post is new, or because it has been updated.
The method is designed to return an updated blog-post structure, after performing any massaging required. If the method returns undef then the post is not inserted.
Here we walk the HTML entry, which might have been written by hand or which might have been created via Chronicle::Plugin::Markdown, or some other plugin, and try to ensure it is well-formed.
_order
We want this plugin to be called after the other plugins which filter new entries - so that we can fix their broken HTML.
This method is present such that Module::Pluggable::Ordered can order our plugins.
LICENSE
This module is free software; you can redistribute it and/or modify it under the terms of either:
a) the GNU General Public License as published by the Free Software Foundation; either version 2, or (at your option) any later version, or
b) the Perl "Artistic License".
AUTHOR
Steve Kemp <steve@steve.org.uk>