the proper way is using a parer but the shortcut (used in markmin) is
using regular expressions

def process(text):
   import re
   text = re.compile('\[(?P<key>.+?)\]).sub('<img src="static/images/
\g<key>.gif">',text)
   # ... more for other rules
   return text

but you have to make sure rules do not conflict with each other
(nested matches).


On Dec 8, 10:01 pm, lyn2py <lyn...@gmail.com> wrote:
> Hi guys,
>
> I have no idea where to start on this, I am grateful for any help.
>
> Like MARKMIN has
> **bold** --> <b>bold</b>
> ''italics'' --> <i>italics</i>
>
> I would like to add to (or create) a set of "vocabulary" like MARKMIN,
> using square brackets like
> [smiley] --> <img src="static/images/smiley.gif">
>
> Mostly they are image files.
>
> How can I do that in web2py?

Reply via email to