HTML::WikiConverter dialects convert HTML into wiki markup. Most
(if not all) know nothing about CSS, nor do they take it into
consideration when performing html-to-wiki conversion. But there is no
good reason for, say, <font
style="font-weight:bold">text</font> not to be converted
into text in the MediaWiki dialect. The same is true of other
dialects, all of which should be able to use CSS information to
produce wiki markup.
The issue becomes especially problematic when considering that several
WYSIWYG HTML editors (e.g. Mozillas) produce this sort of CSS-heavy
HTML. Prior to HTML::WikiConverter::Normalizer, this HTML would
have been essentially converted to text, the CSS information having
been ignored by HTML::WikiConverter.
HTML::WikiConverter::Normalizer avoids this with a few simple
transformations that convert CSS styles into HTML tags.
my $handlers = $self->handlers;
Class method returning reference to an array of handlers used to
convert CSS to HTML. Each handler is a hashref that specifies the CSS
properties and values to match, and the HTML tags and attributes the
matched properties will be converted to.
The type, name, value, and tag keys may be used to match
an elements property or attribute. type may be either "css" if
matching a CSS property (in which case name must contain the name
of the property, and value must contain the property value to
match) or "attr" if matching an HTML tag attribute (in which case
name must contain the name of the attribute, and value must
contain the attribute value to match).
value may be a string (for an exact match), regex (which will be
used to match against the elements property or attribute value),
coderef (which will be passed the property or attribute value and is
expected to return true on match, false otherwise), or "*" (which
matches any property or attribute value). A tag or list of tags can
also be matched with the tag key, which takes either a string or an
To specify what actions the handler will take, the new_tag,
new_attr, and normalizer keys are used. new_tag is required
and indicates the name of the tag that will be created. attribute
is optional and indicates the name of the attribute in the new tag
that will take the value of the original CSS property. If a coderef is
given as the normalizer, it will be passed the value of the
property/attribute and should return one suitable to be assigned to
the new tag attribute.