[Israel.pm] Editing an HTML fragment

Shmuel Fomberg shmuelfomberg at gmail.com
Sun Aug 26 07:16:24 PDT 2012


On Sun, Aug 26, 2012 at 8:57 PM, Natty wrote:

> probably will be an overkill,  have u considered a templating engine???
> e.g Template::Toolkit? or even a simplier one
>
My situation is that I get a part of HTML, that contains unwanted part.
It is not HTML sanitizing, or composing.

I'm playing around in our product (Movable Type) with the concepts of
templates and plugins, and how to make them composable.
So I'm letting plugins write their data inside an entry text, (which is an
HTML part, will be included later inside a full HTML page) but this data
contains edit-time data and publish-time data. before the entry is ready to
be published, I need to throw the edit-time data, and leave only the
publish-time data.
(the idea is that edit-time data and controls can be re-created later from
the publish-time data)
So I can't use a templating engine, as the html part is already complete. I
need to break it up, edit, and close again.

Shmuel.



> On Aug 26, 2012 2:52 PM, "Shmuel Fomberg"  wrote:
>
>> Hi all.
>>
>> I have an part of HTML that I need to edit.
>> Currently, I'm wrapping it in
>> '<html><head></head><body>'.$str.'</body></html>',
>> and the use HTML::TreeBuilder to parse, modify, and dump it back to text.
>> and then I remove the enclosing tags.
>>
>> It works pretty well so far, but is there a better way?
>>
>> Shmuel.
>>
>> _______________________________________________
>> Perl mailing list
>> Perl at perl.org.il
>> http://mail.perl.org.il/mailman/listinfo/perl
>>
>
> _______________________________________________
> Perl mailing list
> Perl at perl.org.il
> http://mail.perl.org.il/mailman/listinfo/perl
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mail.perl.org.il/pipermail/perl/attachments/20120826/2844b9a3/attachment.htm 


More information about the Perl mailing list