Hello,
I have the following code:
[% truncate_txt = String.new(dailynews).truncate(500, '...') %]
[% trunc_txt = trunc_synopsis.replace("<div>","<p>"); %]
[% trunc_txt = trunc_synopsis.replace("</div>","</p>"); %]
[% trunc_txt %]
This isnt' working well. Basically, users will sometimes put div tags IN the
stories and I can't have that because when I truncate, I potentially cut off
closing div tags.
I was thinking I would just replace the div tags with paragraph tags. BUT what
I have doesn't seem to work either. I mean, P gets put in, but its not clean.
Alot of closing P's get put in even when I don't close the DIVS
Is there a robust solution that IF there are any DIV, irregardless of
captilization etc.. a corresponding P tag will be used.. for example.
When I find a <div> or a <DIV> or <DIv> it will be replaced with a <p>. Same
with a closing div???
Please advise.
Bill
_______________________________________________
templates mailing list
[email protected]
http://mail.template-toolkit.org/mailman/listinfo/templates