NAME
HTML::WikiConverter - An HTML-to-wiki markup converter
SYNOPSIS
my $wc = new HTML::WikiConverter(
html => $html
);
print $wc->output, "\n";
DESCRIPTION
There are lots of programs out there that convert wiki markup into HTML, but relatively few that convert HTML into wiki markup. HTML::WikiConverter falls into the latter category, converting HTML source into wiki markup.
HTML to wiki conversion may be used in conjunction with in-browser WYSIWYG text editors to provide a WYSIWYG wiki interface. For example, a wiki edit page could allow users to modify text using a WYSIWYG editor such as HTMLArea (see http://dynarch.com/mishoo/htmlarea.epl). When the page is saved, HTML is submitted to the server, which can then use HTML::WikiConverter to translate the HTML back to its wikitext equivalent. Some alternative solutions are enumerated at http://meta.wikipedia.org/wiki/WYSIWYG_editor.
METHODS
- new
-
$wc = new HTML::WikiConverter( %attribs )Accepts a list of attribute name/value pairs and returns a new HTML::WikiConverter object. Allowed attribute names:
file - (scalar) name of HTML file to convert to wikitext html - (scalar) HTML source to convert base_url - (scalar) base URL used to make absolute URLs dialect - (scalar) wiki engine target (default is 'MediaWiki') benchmark - (scalar) true value indicates that benchmarks should be recordedSupported wiki dialects are in the HTML::WikiConverter::Dialect namespace. The default installation of HTML::WikiConverter includes HTML::WikiConverter::Dialect::MediaWiki.
If both the 'file' and 'html' attributes are specified, only the 'file' attribute will be used. The HTML source (from the 'html' or 'file' attribute) is parsed immediately in the constructor.
All attributes (including those not listed above) will be passed to the dialect class when creating a tag handler instance.
- file
-
$file = $wc->fileReturns the value of the 'file' property passed to the
newconstructor. - html
-
$html = $wc->htmlReturns the value of the 'html' property passed to the
newconstructor. - root
-
$root = $wc->rootReturns the root HTML::Element of the HTML tree
- dialect
- tag_handler
- tag_handler_class
-
$dialect = $wc->dialect $handler = $wc->tag_handler $handler_class = $wc->tag_handler_classRelated methods that return information about the current dialect being used to process incoming HTML. The
dialectmethod returns whatever value was passed as thedialectproperty in thenewconstructor.The
tag_handler_classmethod returns the name of the dialect class, such as "HTML::WikiConverter::Dialect::MediaWiki".The
tag_handlerreturns the instance of the tag handler class that is being used for HTML conversion. - output
-
$output = $wc->outputConverts HTML input to wiki markup.
- log
-
$log_output = $wc->logReturns log information accumulated during conversion.
- rendered_html
-
$html = $wc->rendered_htmlReturns a pretty-printed version of the HTML that WikiConverter used to produce wikitext markup. This will almost certainly differ from the HTML input provided to
newbecause of internal processing done by HTML::TreeBuilder, namely that all start tags are closed, HTML, BODY, and HEAD tags are automatically wrapped around the provided HTML source (if not already present), tags are converted to lowercase, tag attributes are quoted, etc.This method is useful for debugging.
COPYRIGHT
Copyright (c) 2004 David J. Iberri
This library is free software; you may redistribute it and/or modify it under the same terms as Perl itself.
AUTHOR
David J. Iberri <diberri@yahoo.com>
1 POD Error
The following errors were encountered while parsing the POD:
- Around line 341:
You forgot a '=back' before '=head1'