Re: [q-lang-users] silly regex wonderings
Brought to you by:
agraef
From: Tim H. <q...@st...> - 2004-11-22 08:07:09
|
"David vGB" <da...@pu...> writes: > OK, you've got me playing with these regexes now. [snip] > Slightly more usable: > tagify Delim Tag = snr "g" (Delim++"([^"++Delim++"]*)"++Delim) > '(tag Tag (reg 1)); > embolden3 = tagify "\\*" "bold"; > underline = tagify "_" "underline"; Oooh! Thanks a lot for all those. I'm going straight with embolden3 now. > Then we can write: > ==> underline (embolden3 "This has *bold _underlining_*!") > "This has <bold>bold <underline>underlining</underline></bold>!" > > The problem is > ==> underline (embolden3 "This has *bold _underlining*_ !") > "This has <bold>bold <underline>underlining</bold></underline> !" > > And this is malformed html. Well, it's ugly input as well, so it's not that surprising. For my purposes, I can declare this to be erroneous :) > I'm torn between two instincts here: > - A clean way to do it would be to process your wikitext, build a full > parse tree and transform this to html, but > - this doesn't seem in the wiki spirit, where I suspect the ideal would > be to capture the entire conversion to html in a single regex. Well, I've worked with TWiki including some dabblings in the source, and definitely don't want to reproduce something quite like that again. Hence, what I'm actually doing with these tags is to build docbook, which I can XSLT using these new-fangled libxml bindings. :) (And it might not be for an actual wiki, either; I have other web-based document-management ideas in mind that require a markup format for all the content; I'll see how that evolves, although it's been a year or more cooking in my head so far...) Thanks greatly for fixing the regex stuff, though :) ~Tim -- <http://spodzone.org.uk/> |