Skip to content

Commit

Permalink
Use non-greedy matching when looking for pairs of <nowiki> tags
Browse files Browse the repository at this point in the history
  • Loading branch information
projectgus committed Mar 20, 2015
1 parent 8158a51 commit baadbf7
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion wikicontent.py
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ def convert_pagecontent(title, content):
# wrap the "magic" marker tag <__mw_nowiki> around <nowiki>, as
# as mwlib just discards it otherwise and we can't detect it within the parser.
# We keep the inner <nowiki> so the mwlib parser still skips that content
content = re.sub(r"<nowiki>.+</nowiki>", lambda e: "<__mw_nowiki>"+e.group(0)+"</__mw_nowiki>", content)
content = re.sub(r"<nowiki>.+?</nowiki>", lambda e: "<__mw_nowiki>"+e.group(0)+"</__mw_nowiki>", content)

root = uparser.parseString(title, content) # create parse tree
return convert(root, False)
Expand Down

0 comments on commit baadbf7

Please sign in to comment.