NAME
Mediawiki::POD - convert POD to HTML suitable for a MediaWiki wiki
SYNOPSIS
use Mediawiki::POD;
my $converter = Mediawiki::POD->new();
my $html = $converter->as_thml($POD);
DESCRIPTION
Turns a given POD (Plain Old Documentation) into HTML code.
This subclass of Pod::Simple::HTML catches =head
directives, and then allows you to assemble a TOC (table of contents) from the captured headlines.
In addition, it supports graph-common
and graph
subsections, these will be turned into HTML graphs.
GRAPH SUPPORT
Mediawiki::POD
allows you to write graphs (nodes connected with edges) in Graph::Easy or http://www.graphviz.org|Graphviz format inside the POD itself, and turns these portions into HTML "graphics".
The following represents two graphs:
=for graph [ Single ] --> [ Line ] --> [ Definition ]
=begin graph
node { fill: silver; }
[ Mutli ] --> [ Line ]
=end graph
In addition, a graph-common
section can be used to set a common text for all following graphs. Each graph-common
section resets the common text section:
=for graph-common node { fill: red; }
=for graph [ Red ]
=for graph [ Red too ]
=for graph-common node { fill: blue; }
=for graph [ Blue ]
=for graph [ Blue too ]
The attribute output
for graphs is not yet used, eventually it should result in different output formats like SVG, or PNG rendered via dot.
VERSIONS
Please see the CHANGES file for a complete version history.
METHODS
new()
my $converter = Mediawiki::POD->new();
Create a new converter object.
as_html()
my $html = $converter->as_html( $pod_text);
Take the given POD text and return HTML suitable for embedding into an Mediawiki page.
The returned HTML contains no newlines (as these would confuse the Mdiawiki parser) and a table of contents.
remove_newlines()
$self->remove_newlines(0); # output contains \n
Set/get the flag that indicates that newlines should be removed from the output. For Mediawiki integration, the output must be stripped of newlines completely. Otherwise you might want to leave them in to generated more readable HTML.
Default is true.
body_only()
$self->body_only(0); # output contains <head> etc.
Set/get the flag that indicates that only the body part should be returned by as_html(). The default means that the head section as well as the body tags are removed from the output.
Default is true.
LICENSE
This library is free software; you can redistribute it and/or modify it under the same terms of the GPL.
See the LICENSE file for information.
AUTHOR
(c) Copyright by Tels http://bloodgate.com/wiki 2007