On Thursday 11 January 2007 18:24, Matt S Trout wrote:
> On 9 Jan 2007, at 17:10, Xavier Robin wrote:
> > I also tried HTML::Scrubber as proposed by Carl Franks, but
> > basically it keeps
> > some tags we chose to allow.
>
> Have a look at the scrubber docs, there are options to select exactly
> which tags to allow.
>
> Personally I think I'd use XML::LibXML's HTML parsing functionality
> (which is fairly generous about common validation errors) and a quick
> XSLT sheet, but this only works if you're somebody who can stand to
> use XSLT :)
That's also an idea !
But finally I found HTML::FormatText::WithLinks.
It is simple, fast enough, and it does exactly what I want in 8 lines of code,
so I think I'll be keeping it.
> use HTML::FormatText::WithLinks;
> my $formatter = HTML::FormatText::WithLinks->new(
> before_link => '',
> after_link => "\nLink: %l",
> footnote => '',
> leftmargin => 0
> );
> $c->stash->{'text'} = $formatter->parse($c->stash->{'html'});
Thanks,
Xavier
--
Some people says that if you play a Windows XP install CD backwards you will
hear demon voices commanding you to worship Satan. But that's nothing. If you
play it forward it will install Windows XP.
_______________________________________________
List: [email protected]
Listinfo: http://lists.rawmode.org/mailman/listinfo/catalyst
Searchable archive: http://www.mail-archive.com/[email protected]/
Dev site: http://dev.catalyst.perl.org/