Do you know where your variables are? | |
PerlMonks |
Re^2: Text to HTML convert.by muntfish (Chaplain) |
on Oct 07, 2004 at 15:07 UTC ( [id://397327]=note: print w/replies, xml ) | Need Help?? |
You also need to escape the & (ampersand) character, as this is also a reserved char in HTML. I dug this code out of one of my old scripts. I'm not saying it's perfect, by any means. In particular it can treat things as URLs when they are not well formed.
But I hope it helps you get started. Other monks are (as always) welcome to suggest improvements or point out flaws! Update: The above assumes the whole output is wrapped in <pre> tags, otherwise original paragraph/line formatting won't be preserved. Update 2: Actually, the CPAN module HTML::FromText as suggested by jeffa looks like a better idea. I'll have to look into it myself... s^^unp(;75N=&9I<V@`ack(u,^;s|\(.+\`|"$`$'\"$&\"\)"|ee;/m.+h/&&print$&
In Section
Seekers of Perl Wisdom
|
|