| Rubric documentation | Contained in the Rubric distribution. |
Rubric::Entry::Formatter::HTMLEscape - format into HTML by escaping entities
version 0.147
This formatter only handles formatting to HTML, and outputs the original content with HTML-unsafe characters escaped and paragraphs broken.
This is equivalent to filtering with Template::Filters' html and
html_para filters.
Ricardo SIGNES, <rjbs@cpan.org>
Please report any bugs or feature requests to bug-rubric@rt.cpan.org, or
through the web interface at http://rt.cpan.org. I will be notified, and
then you'll automatically be notified of progress on your bug as I make
changes.
Copyright 2005 Ricardo SIGNES. This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself.
| Rubric documentation | Contained in the Rubric distribution. |
use strict; use warnings; package Rubric::Entry::Formatter::HTMLEscape; our $VERSION = '0.147';
use Template::Filters;
my ($filter, $html, $para); { my $filters = Template::Filters->new; $html = $filters->fetch('html'); $para = $filters->fetch('html_para'); $filter = sub { $para->( $html->($_[0]) ); } } sub as_html { my ($class, $arg) = @_; return '' unless $arg->{text}; return $filter->($arg->{text}); } sub as_text { my ($class, $arg) = @_; return '' unless $arg->{text}; return $html->($arg->{text}); }
1;