Parsers
Before this time it was only possible to write your articles in POD format. It is still possible of course, but can be easily extended to parse more formats.
A new parser must be created in Bootylicious::Parser namespace. It must return parser callback that accepts raw data and returns hash reference with parsed article. To explain this in more detail here is a simple parser example.
package Bootylicious::Parser::Foo;
use strict;
use warnings;
use base 'Mojo::Base';
sub parser_cb {
sub {
my ($head_string, $tail_string) = @_;
# Do some parsing
$head_string =~ ...
$tail_string =~ ...
my $title = $1;
my $tags = [...];
my $head = ...;
my $tail = ...;
return {
title => $title,
tags => $tags,
link => $link,
head => $head,
tail => $tail
}
}
}
1;
So what is $head and $tail? The head is everything before the cut ([cut] by default), tail is the rest of the article. If there is no cut, there is no tail. Your parser must provide these values separated because when displaying article to the end user bootylicious will concatenate them together with a special html marker.
Having this parser you will be able to write articles in foo format. You can use as many parsers as you want at one time, the appropriate parser will be called depending on your article extention:
20090902T18:00:00-this-is-parsed-by-pod-parser.pod
20090902T18:00:00-this-is-parsed-by-foo-parser.foo
