Hello everybody. I'm kind of new to Python. I'm working on a simple
text parser that will allow me to transform a certain syntax into a
certain output. I find wikis interesting, so wiki to HTML parsing is
one of the things that I want to accomplish (I'm not actually writing
a whole wiki, that's complex, but I'm only trying to get basic text
conversion going on).

Presently, I'm thinking of putting the (simple, regexp-driven)
filters in a module called "parsers", and then make a "handlers"
module that allows for the actual transformation. So, for example,
one parser would be a separate class (WikiParser) which would have an
attribute called "emph" (emphasis) which is a string '\*\*(.+?)\*\*'.
Then a handler class (HTMLHandler) would have an attribute called
"emph" which is a string '<em>\\1</em>'. Then the regular expressions
would be generated via a chosen parser/handler combination. This to
make it easy to change things around later.

My question to you: is this the right way to go about it? My parser
doesn't really need to do all that much, but I would like for it to
be easily changeable by editing a single file.

Thanks for any help!


Search Discussions

Related Discussions

Discussion Navigation
viewthread | post
Discussion Overview
grouppython-list @
postedMay 19, '07 at 4:50p
activeMay 19, '07 at 4:50p

1 user in discussion

Michiel Sikma: 1 post



site design / logo © 2022 Grokbase