.\" Automatically generated by Pod::Man 4.14 (Pod::Simple 3.42) .\" .\" Standard preamble: .\" ======================================================================== .de Sp \" Vertical space (when we can't use .PP) .if t .sp .5v .if n .sp .. .de Vb \" Begin verbatim text .ft CW .nf .ne \\$1 .. .de Ve \" End verbatim text .ft R .fi .. .\" Set up some character translations and predefined strings. \*(-- will .\" give an unbreakable dash, \*(PI will give pi, \*(L" will give a left .\" double quote, and \*(R" will give a right double quote. \*(C+ will .\" give a nicer C++. Capital omega is used to do unbreakable dashes and .\" therefore won't be available. \*(C` and \*(C' expand to `' in nroff, .\" nothing in troff, for use with C<>. .tr \(*W- .ds C+ C\v'-.1v'\h'-1p'\s-2+\h'-1p'+\s0\v'.1v'\h'-1p' .ie n \{\ . ds -- \(*W- . ds PI pi . if (\n(.H=4u)&(1m=24u) .ds -- \(*W\h'-12u'\(*W\h'-12u'-\" diablo 10 pitch . if (\n(.H=4u)&(1m=20u) .ds -- \(*W\h'-12u'\(*W\h'-8u'-\" diablo 12 pitch . ds L" "" . ds R" "" . ds C` "" . ds C' "" 'br\} .el\{\ . ds -- \|\(em\| . ds PI \(*p . ds L" `` . ds R" '' . ds C` . ds C' 'br\} .\" .\" Escape single quotes in literal strings from groff's Unicode transform. .ie \n(.g .ds Aq \(aq .el .ds Aq ' .\" .\" If the F register is >0, we'll generate index entries on stderr for .\" titles (.TH), headers (.SH), subsections (.SS), items (.Ip), and index .\" entries marked with X<> in POD. Of course, you'll have to process the .\" output yourself in some meaningful fashion. .\" .\" Avoid warning from groff about undefined register 'F'. .de IX .. .nr rF 0 .if \n(.g .if rF .nr rF 1 .if (\n(rF:(\n(.g==0)) \{\ . if \nF \{\ . de IX . tm Index:\\$1\t\\n%\t"\\$2" .. . if !\nF==2 \{\ . nr % 0 . nr F 2 . \} . \} .\} .rr rF .\" ======================================================================== .\" .IX Title "HTML::WikiConverter::Normalizer 3pm" .TH HTML::WikiConverter::Normalizer 3pm "2022-06-14" "perl v5.34.0" "User Contributed Perl Documentation" .\" For nroff, turn off justification. Always turn off hyphenation; it makes .\" way too many mistakes in technical documents. .if n .ad l .nh .SH "NAME" HTML::WikiConverter::Normalizer \- Convert CSS styles to (roughly) corresponding HTML .SH "SYNOPSIS" .IX Header "SYNOPSIS" .Vb 2 \& use HTML::TreeBuilder; \& use HTML::WikiConverter::Normalizer; \& \& my $tree = new HTML::TreeBuilder(); \& $tree\->parse( \*(Aq

text

\*(Aq ); \& \& my $norm = new HTML::WikiConverter::Normalizer(); \& $norm\->normalize($tree); \& \& # Roughly gives "

text

" \& print $tree\->as_HTML(); .Ve .SH "DESCRIPTION" .IX Header "DESCRIPTION" HTML::WikiConverter dialects convert \s-1HTML\s0 into wiki markup. Most (if not all) know nothing about \s-1CSS,\s0 nor do they take it into consideration when performing html-to-wiki conversion. But there is no good reason for, say, \f(CW\*(C`text\*(C'\fR not to be converted into \f(CW\*(Aq\*(Aq\*(Aqtext\*(Aq\*(Aq\*(Aq\fR in the MediaWiki dialect. The same is true of other dialects, all of which should be able to use \s-1CSS\s0 information to produce wiki markup. .PP The issue becomes especially problematic when considering that several \&\s-1WYSIWYG HTML\s0 editors (e.g. Mozilla's) produce this sort of CSS-heavy \&\s-1HTML.\s0 Prior to \f(CW\*(C`HTML::WikiConverter::Normalizer\*(C'\fR, this \s-1HTML\s0 would have been essentially converted to text, the \s-1CSS\s0 information having been ignored by \f(CW\*(C`HTML::WikiConverter\*(C'\fR. .PP \&\f(CW\*(C`HTML::WikiConverter::Normalizer\*(C'\fR avoids this with a few simple transformations that convert \s-1CSS\s0 styles into \s-1HTML\s0 tags. .SH "METHODS" .IX Header "METHODS" .SS "new" .IX Subsection "new" .Vb 1 \& my $norm = new HTML::WikiConverter::Normalizer(); .Ve .PP Constructs a new normalizer .SS "normalize" .IX Subsection "normalize" .Vb 1 \& $norm\->normalize($elem); .Ve .PP Normalizes \f(CW$elem\fR and all its descendents, where \f(CW$elem\fR is an HTML::Element object. .SH "SUBCLASSING" .IX Header "SUBCLASSING" The following methods may be useful to subclasses. .SS "handlers" .IX Subsection "handlers" .Vb 1 \& my $handlers = $self\->handlers; .Ve .PP Class method returning reference to an array of handlers used to convert \s-1CSS\s0 to \s-1HTML.\s0 Each handler is a hashref that specifies the \s-1CSS\s0 properties and values to match, and the \s-1HTML\s0 tags and attributes the matched properties will be converted to. .PP The \f(CW\*(C`type\*(C'\fR, \f(CW\*(C`name\*(C'\fR, \f(CW\*(C`value\*(C'\fR, and \f(CW\*(C`tag\*(C'\fR keys may be used to match an element's property or attribute. \f(CW\*(C`type\*(C'\fR may be either \f(CW"css"\fR if matching a \s-1CSS\s0 property (in which case \f(CW\*(C`name\*(C'\fR must contain the name of the property, and \f(CW\*(C`value\*(C'\fR must contain the property value to match) or \f(CW"attr"\fR if matching an \s-1HTML\s0 tag attribute (in which case \&\f(CW\*(C`name\*(C'\fR must contain the name of the attribute, and \f(CW\*(C`value\*(C'\fR must contain the attribute value to match). .PP \&\f(CW\*(C`value\*(C'\fR may be a string (for an exact match), regex (which will be used to match against the element's 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 \f(CW"*"\fR (which matches any property or attribute value). A tag or list of tags can also be matched with the \f(CW\*(C`tag\*(C'\fR key, which takes either a string or an arrayref. .PP To specify what actions the handler will take, the \f(CW\*(C`new_tag\*(C'\fR, \&\f(CW\*(C`new_attr\*(C'\fR, and \f(CW\*(C`normalizer\*(C'\fR keys are used. \f(CW\*(C`new_tag\*(C'\fR is required and indicates the name of the tag that will be created. \f(CW\*(C`attribute\*(C'\fR is optional and indicates the name of the attribute in the new tag that will take the value of the original \s-1CSS\s0 property. If a coderef is given as the \f(CW\*(C`normalizer\*(C'\fR, it will be passed the value of the property/attribute and should return one suitable to be assigned to the new tag attribute. .SH "SEE ALSO" .IX Header "SEE ALSO" \&\s-1CSS\s0 .SH "AUTHOR" .IX Header "AUTHOR" David J. Iberri, \f(CW\*(C`\*(C'\fR .SH "BUGS" .IX Header "BUGS" Please report any bugs or feature requests to \f(CW\*(C`bug\-html\-wikiconverter at rt.cpan.org\*(C'\fR, or through the web interface at . I will be notified, and then you'll automatically be notified of progress on your bug as I make changes. .SH "COPYRIGHT & LICENSE" .IX Header "COPYRIGHT & LICENSE" Copyright 2006 David J. Iberri, all rights reserved. .PP This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself.