Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/gfldex/perl6-typesafe-html
typesafe baseclass for Typesafe::XHTML::Writer
https://github.com/gfldex/perl6-typesafe-html
Last synced: 13 days ago
JSON representation
typesafe baseclass for Typesafe::XHTML::Writer
- Host: GitHub
- URL: https://github.com/gfldex/perl6-typesafe-html
- Owner: gfldex
- License: artistic-2.0
- Created: 2016-01-12T13:12:03.000Z (almost 9 years ago)
- Default Branch: master
- Last Pushed: 2017-01-21T11:09:42.000Z (almost 8 years ago)
- Last Synced: 2024-11-06T05:44:07.148Z (2 months ago)
- Language: Perl6
- Size: 5.86 KB
- Stars: 0
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Typesafe::HTML
[![Build Status](https://travis-ci.org/gfldex/perl6-typesafe-html.svg?branch=master)](https://travis-ci.org/gfldex/perl6-typesafe-html)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.## Usage:
```
use v6;
use Typesafe::HTML;my $html = HTML.new('
this will not be quoted
');
$html ~= 'this will
';
$html = $html ~ '& this will also be quoted';
$html = '& this prefix too' ~ $html;dd $html;
# OUTPUT: HTML $html = HTML.new('& this prefix too
this will not be quoted
<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
```## License
(c) Wenzel P. P. Peppmeyer, Released under Artistic License 2.0.