Perl 6 MyHTML wrapper
Branch: master
Clone or download
MadcapJake Merge pull request #4 from samcv/SPDX-license
Use SPDX identifier in license field of META6.json
Latest commit 38d9f79 Apr 28, 2017
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
eg Add readme example as script Apr 23, 2016
lib/HTML
t
.atom-build.json Modularize project Apr 11, 2016
.gitignore Remove old modularized files Apr 20, 2016
.travis.yml Initial commit Mar 16, 2016
LICENSE
META6.json
README.md

README.md

HTML::MyHTML

A wrapper for MyHTML an HTML parser.

Usage

First you need to install MyHTML. Then install this module via:

panda install HTML::MyHTML
zef install HTML::MyHTML

Example

HTML::MyHTML

use HTML::MyHTML;

my $html = "<div><span>HTML</span></div>";

# init
my HTML::MyHTML $parser .= new;

# parse
$parser.parse($html);

# print tree
$parser.tree.print($parser.tree.document):i;

# print span text
$parser.tree.nodes('span')[0].child.text.say;

# dispose
$parser.dispose;

HTML::MyHTML::Raw

use HTML::MyHTML::Raw;
use HTML::MyHTML::Encoding;

my $html = "<div><span>HTML</span></div>".encode;

# basic init
my $myhtml = myhtml_create();
myhtml_init($myhtml, 0, 1, 0);

# first tree init
my $tree = myhtml_tree_create();
myhtml_tree_init($tree, $myhtml);

# parse html
myhtml_parse($tree, Enc<utf-8>, $html, $html.bytes);

# release resources
myhtml_tree_destroy($tree);
myhtml_destroy($myhtml);