|
saidone.org -
Save water -- drink beer! |
|
Main menu
Development
Mailing lists Swamp
Links
ush.itaghers.org saidone@ush gameknot |
BBCode-like parser work in progress - posted by saidone on Fri, 08 Aug 2008 10:13:17 GMT
This page is a test for the new In the beginning I was thinking to implement some sort of MediaWiki syntax, but I found that is more prone to ambiguity and a parser would become too bloated (maybe I'm wrong eh?). I don't like these things, here's an example: ' stands for apostrophe '' for italics ''' for bold Now the string ''' can be interpreted in various modes... an italicized apostrophe waiting for the italic end tag, an apostrophe followed by the italic start tag, the bold tag itself, or a sequence of three apostrophes. Yes, we can match and replace something with regular expressions, and maybe obtain a somewhat good result, but the code rapidly become a mess and adding further tags is far from trivial then. So, at the moment, I choose BBCode as a lightweight markup language for the posts. Here's some tests: italic bold italic + bold
This is an url: http://www.ush.it and another: ush.it - a beautiful place 10 REM YOU WILL HARDLY NOTICE THE "CODE" TAG *colored text* (only hex encoded colors at the moment) ...and yes, there's also the img tag: (actually, my car ;-))Here's the grammar source code (to be polished): KBbCodeParser.jj REFERENCES JavaCC home: https://javacc.dev.java.net/ An excellent FAQ maintained by Theodore S. Norvell: http://www.engr.mun.ca/~theo/JavaCC-FAQ/javacc-faq-moz.htm No comments yet. Post a new comment back to home |
[[[[[[[ served by kugelmass ]]]]]]]
I don't have a drinking problem except when I can't get a drink. - Tom Waits
|
|