1Mojo::DOM58::Entities(3U)ser Contributed Perl DocumentatiMoonjo::DOM58::Entities(3)
2
3
4

NAME

6       Mojo::DOM58::Entities - Escape or unescape HTML entities in strings
7

SYNOPSIS

9         use Mojo::DOM58::Entities qw(html_escape html_unescape);
10
11         my $str = 'foo & bar';
12         $str = html_unescape $str; # "foo & bar"
13         $str = html_escape $str; # "foo & bar"
14

DESCRIPTION

16       Mojo::DOM58::Entities contains functions for escaping and unescaping
17       HTML entities for Mojo::DOM58, based on functions from Mojo::Util. All
18       functions are exported on demand.
19

FUNCTIONS

21   html_attr_unescape
22         my $str = html_attr_unescape $escaped;
23
24       Same as "html_unescape", but handles special rules from the HTML Living
25       Standard <https://html.spec.whatwg.org> for HTML attributes.
26
27         # "foo=bar&ltest=baz"
28         html_attr_unescape 'foo=bar&ltest=baz';
29
30         # "foo=bar<est=baz"
31         html_attr_unescape 'foo=bar&lt;est=baz';
32
33   html_escape
34        my $escaped = html_escape $str;
35
36       Escape unsafe characters "&", "<", ">", """, and "'" in string.
37
38        html_escape '<div>'; # "&lt;div&gt;"
39
40   html_unescape
41        my $str = html_unescape $escaped;
42
43       Unescape all HTML entities in string, according to the HTML Living
44       Standard <https://html.spec.whatwg.org/#named-character-references-
45       table>.
46
47        html_unescape '&lt;div&gt'; # "<div>"
48

BUGS

50       Report issues related to the format of this distribution or Perl 5.8
51       support to the public bugtracker. Any other issues should be reported
52       directly to the upstream Mojolicious issue tracker.
53

AUTHOR

55       Dan Book <dbook@cpan.org>
56
57       Code and tests adapted from Mojo::Util, a set of utilities by the
58       Mojolicious team.
59
61       Copyright (c) 2008-2016 Sebastian Riedel and others.
62
63       Copyright (c) 2016 Dan Book for adaptation to standalone format.
64
65       This is free software, licensed under:
66
67         The Artistic License 2.0 (GPL Compatible)
68

SEE ALSO

70       HTML::Entities
71
72
73
74perl v5.38.0                      2023-07-20          Mojo::DOM58::Entities(3)
Impressum