File: entities.pl

package info (click to toggle)
libmojolicious-perl 7.21%2Bdfsg-1
  • links: PTS, VCS
  • area: main
  • in suites: stretch
  • size: 3,432 kB
  • ctags: 1,253
  • sloc: perl: 11,603; makefile: 10
file content (13 lines) | stat: -rw-r--r-- 416 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
use Mojo::Base -strict;
use Mojo::UserAgent;

# Extract named character references from HTML Living Standard
my $tx   = Mojo::UserAgent->new->get('https://html.spec.whatwg.org');
my $rows = $tx->res->dom('#named-character-references-table tbody > tr');
for my $row ($rows->each) {
  my $entity     = $row->at('td > code')->text;
  my $codepoints = $row->children('td')->[1]->text;
  say "$entity $codepoints";
}

1;