typesafe baseclass for Typesafe::XHTML::Writer
Latest commit 2a0933e Jan 21, 2017 @gfldex META* -> META6.json
Failed to load latest commit information.
lib/Typesafe help with overloading class HTML Jan 19, 2016
t add all the files Jan 12, 2016
.travis.yml add travis Jan 12, 2016
LICENSE add all the files Jan 12, 2016
META.info add all the files Jan 12, 2016
META6.json META* -> META6.json Jan 21, 2017
README.md clarify what we talk about Jan 19, 2016



Build Status

Baseclass to be used with Typesafe::XHTML::Writer. It overloads infix:<~> to 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 < and &. 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('&amp; this prefix too<p>this will not be quoted</p>&lt;p>this will&lt;/p>&amp; this will also be quoted');

$html = HTML.new ~ '& more quoting';

dd $html;

# OUTPUT: HTML $html = HTML.new('&amp; more quoting');

put $html.Str;

# OUTPUT: &amp; more quoting


(c) Wenzel P. P. Peppmeyer, Released under Artistic License 2.0.