(no subject)
Jun. 26th, 2008 01:14 pmInsane? why yes, yes I am.
All so that things like
can become
And I refuse to implement Markdown or anything like that for this. And because XML::Simple is too dumb to let me say "never parse the contents of tags named <text>".
edit: also, one of these days I might actually remember how to write zero-width negative look-behinds, so I don't have to keep looking it up. But not yet.
$text =~ s!^\s*\*\s*(.+)$!<li>$1</li>!gm;
$text =~ s!<li>!<ul>\n<li>!s;
$text =~ s!(.*</li>)!$1\n</ul>!s;
$text =~ s!(?<=\s)\*(\S[^\*]+?\S)\*(?=\s)!<b>$1</b>!gs;
$text =~ s!(?<=\s)/(\S[^\*]+?\S)/(?=\s)!<i>$1</i>!gs;
$text =~ s^(?<!>)(\r\n|\n|\r)^<br />$1^gs;
All so that things like
la la la /but/ la la *then* la la
* foo
*foo
can become
la la la but la la then la la
- foo
- foo
And I refuse to implement Markdown or anything like that for this. And because XML::Simple is too dumb to let me say "never parse the contents of tags named <text>".
edit: also, one of these days I might actually remember how to write zero-width negative look-behinds, so I don't have to keep looking it up. But not yet.
no subject
Date: 2008-06-26 09:22 pm (UTC)no subject
Date: 2008-06-27 05:09 am (UTC)no subject
Date: 2008-06-27 11:42 am (UTC)no subject
Date: 2008-06-27 04:10 pm (UTC)no subject
Date: 2008-06-27 06:11 pm (UTC)m#\*\b(.*?)\b\*# ..