Hi !
I started using the creoleparser for a project of mine. I was
wondering wether it's possible to handle line-breaks more like a blog
editor would do, instead of having to specifically write the '\\' at
the end of line.
The discussion about creole for newlines handling is here:
http://www.wikicreole.org/wiki/Creole1.0#section-Creole1.0-LineBreaks
and here:
http://www.wikicreole.org/wiki/Talk.ChangeLinebreakMarkupProposal
What I did as a first attempt is the following:
class MyDialect(Creole10)
def __init__(self, *args, **kwargs):
super(MyDialect, self).__init__(self, *args, **kwargs)
# Auto-convert newlines to <br> tags
br =
self.br
br.regexp = re.compile(esc_neg_look + "(\n|\\\\\\\\)",
re.DOTALL)
In other words add the \n as valid linebreak separator for the
self.br
element defined in Creole10.
It seems to be working for all my tests, however i don't know if it
could have any side-effects i'm not aware of. Anyway, I thought I
might just share the tip, and if anyone sees a major problem with this
please let me know !
(This might also be an option for Creole10 dialect,
use_blog_like_newlines=False)
Raf