NAME
App::Followme::ConvertPage - Convert Markdown files to html
SYNOPSIS
use App::Followme::ConvertPage;
my $converter = App::Followme::ConvertPage->new($configuration);
$converter->run($directory);
DESCRIPTION
If there are any markdown files in the directory, they are converted into html files by substituting the content into a template. After the conversion the original file is deleted. Markdown files are identified by their extension, which by default is 'md'.
Along with the content, other variables are calculated from the file name and modification date. Variables in the template are preceded by a sigil, most usually a dollar sign. Thus a link would look like:
<li><a href="$url">$title</a></li>
The variables that are calculated for each markdown file are:
- body
-
All the contents of the file, minus the title if there is one. Markdown is called on the file's content to generate html before being stored in the body variable.
- title
-
The title of the page is derived from the header, if one is at the front of the file content, or the filename, if it is not.
- time fields
-
The variables calculated from the modification time are:
weekday, month,
monthnum, day, year, hour24, hour, ampm, minute,
andsecond.
- url
-
The url of the html file built from the Markdown file.
CONFIGURATION
The following parameters are used from the configuration:
- page_template
-
The name of the template file. The template file is either in the same directory as the configuration file used to invoke this method, or if not there, in the templates subdirectory.
- text_extension
-
The extension of files that are converted to web pages. The default value is md.
The remaining parameters are passed unchanged to Text::Markdown. You should not need to change them.
LICENSE
Copyright (C) Bernie Simon.
This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself.
AUTHOR
Bernie Simon <bernie.simon@gmail.com>