HTML::Element::Convert - Monkeypatch content conversion methods into HTML::Element
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
langattribute. If it recognizes
lang, it will convert and replace the div's content.
Currently, only markdown is supported.
- $content = $element->extract_content([TYPE])
Extract and parse the content of $element. If
TYPEis given, then this method will assume the content is of the given type, and try to parse it accordingly. Otherwise it will use the
langattribute of $element to detemine the type.
- $content = $element->pull_content([TYPE])
extract_content, extract and parse the content of $element. It will also delete $element from the tree.
<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.
You can find documentation for this module with the perldoc command.
You can also look for information at:
AnnoCPAN: Annotated CPAN documentation
RT: CPAN's request tracker
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.