NAME
HTML::Element::Convert - Monkeypatch content conversion methods into HTML::Element
VERSION
Version 0.10
SYNOPSIS
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;
- $element->convert_content
-
Look for every div below $element containing a
lang
attribute. If it recognizeslang
, 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
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 thelang
attribute of $element to detemine the type. - $content = $element->pull_content([TYPE])
-
Like
extract_content
, extract and parse the content of $element. It will also delete $element from the tree.
AUTHOR
Robert Krimen, <rkrimen at cpan.org>
BUGS
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.
SUPPORT
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
CPAN Ratings
RT: CPAN's request tracker
http://rt.cpan.org/NoAuth/Bugs.html?Dist=HTML-Element-Convert
Search CPAN
ACKNOWLEDGEMENTS
COPYRIGHT & LICENSE
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.