NAME
Chronicle::Plugin::Filter - Filter individual blog entries.
DESCRIPTION
This plugin is designed to allow blog entries to be filtered via external commands.
This is achieved by opening the specified command and using it as a filter for the entry prior to the insertion into the database.
As an example the following blog-post would be 100% upper-cased:
Title: My Title
Date: 10th March 2015
Filter: tr a-z A-Z
<p>This is a line of text.</p>
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.
This plugin will look for a series of headers in the blog-post:
- pre-filter
-
This will be called first.
- filter
-
This will be called in the middle.
- post-filter
-
This will be called last.
Any such header will be assumed to contain a command that the blog-post should be piped through. The post itself will be replaced with STDOUT
from that command.
Because only single headers are examined there can be no more than three filters per-post. This constraint exists for compability purposes.
_order
We want this plugin to be called after the other plugins which filter new entries.
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>