Help language development. Donate to The Perl Foundation
XML::Entity::HTML - Extension of XML::Entity for (X)HTML 5 entities.
use XML::Entity::HTML; my $xeh = XML::Entity::HTML.new; say $xeh.decode: 'Text with <entities> & «more»'; # Text with <entities> & «more» say $xeh.encode: 'Text with <entities> & «more»'; # Text with <entities> & «more» say decode-html-entities 'Text with <entities> & «more»'; # Text with <entities> & «more» say encode-html-entities 'Text with <entities> & «more»'; # Text with <entities> & «more»
It's simply an extension class of XML::Entity, but with a lot more entities taken from the official JSON list.
Any entities that wouldn't compile properly have been blacklisted and aren't supported. See the build.raku
script in the build
directory on how this module is built.
Overrides the XML::Entity.decode
method. Expects a string and an optional named argument :numeric
.
Overrides the XML::Entity.encode
method. Expects a string and an optional named argument :hex
.
Provides procedural access to the decode
method on a singleton XML::Entity::HTML
object. Takes the same parameters.
Provides procedural access to the encode
method on a singleton XML::Entity::HTML
object. Takes the same parameters.
Timothy Totten
Copyright 2019 Timothy Totten
Copyright 2020 - 2022 Raku Community
This library is free software; you can redistribute it and/or modify it under the Artistic License 2.0.