HTML::Element::Convert - Monkeypatch content conversion methods into HTML::Element
Version 0.10
use HTML::TreeBulder; use HTML::Element::Convert; my $tree = HTML::TreeBuilder->new_from_content($html); # Search for some JSON-encoded meta-data embedded in the document and extract it: my $element = $tree->look_down(...); my $hash = $element->extract_content; # This time extract the YAML data and delete the containing element from the tree: $element = $tree->look_down(...); $hash = $element->pull_content; # Convert the content of any <div> with a 'lang="markdown"' attribute into HTML: $tree->convert_content;
Look for every div below $element containing a lang attribute. If it recognizes lang, it will convert and replace the div's content.
lang
Currently, only markdown is supported.
Extract and parse the content of $element. If TYPE is given, then this method will assume the content is of the given type, and try to parse it accordingly. Otherwise it will use the lang attribute of $element to detemine the type.
TYPE
Like extract_content, extract and parse the content of $element. It will also delete $element from the tree.
extract_content
Robert Krimen, <rkrimen at cpan.org>
<rkrimen at cpan.org>
Please report any bugs or feature requests to bug-html-element-convert at rt.cpan.org, or through the web interface at http://rt.cpan.org/NoAuth/ReportBug.html?Queue=HTML-Element-Convert. I will be notified, and then you'll automatically be notified of progress on your bug as I make changes.
bug-html-element-convert at rt.cpan.org
You can find documentation for this module with the perldoc command.
perldoc HTML::Element::Convert
You can also look for information at:
AnnoCPAN: Annotated CPAN documentation
http://annocpan.org/dist/HTML-Element-Convert
CPAN Ratings
http://cpanratings.perl.org/d/HTML-Element-Convert
RT: CPAN's request tracker
http://rt.cpan.org/NoAuth/Bugs.html?Dist=HTML-Element-Convert
Search CPAN
http://search.cpan.org/dist/HTML-Element-Convert
Copyright 2007 Robert Krimen, all rights reserved.
This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself.
To install HTML::Element, copy and paste the appropriate command in to your terminal.
cpanm
cpanm HTML::Element
CPAN shell
perl -MCPAN -e shell install HTML::Element
For more information on module installation, please visit the detailed CPAN module installation guide.