Baseclass to be used with Typesafe::XHTML::Writer. It overloads
guard against omision of HTML-element quotation. This is not a DOM
implementation, it's merely a secure way to concatanate HTML and non-HTML
strings. It's lightweight by design, resulting in fairly good speed.
The only characters that are turned into HTML-Entities are
&. If you
need more use a modules that does not focus on speed.
use v6; use Typesafe::HTML; my $html = HTML.new('<p>this will not be quoted</p>'); $html ~= '<p>this will</p>'; $html = $html ~ '& this will also be quoted'; $html = '& this prefix too' ~ $html; dd $html; # OUTPUT: HTML $html = HTML.new('& this prefix too<p>this will not be quoted</p><p>this will</p>& this will also be quoted'); $html = HTML.new ~ '& more quoting'; dd $html; # OUTPUT: HTML $html = HTML.new('& more quoting'); put $html.Str; # OUTPUT: & more quoting
(c) Wenzel P. P. Peppmeyer, Released under Artistic License 2.0.