nricciar/wikicloth — pull request #39 by adiel-mittmann (2012-04-05 17:42:48+00:00)
Title: Better handling for bold and italic

The current rendering of bold and italic only works for simple cases. For example, this doesn't work:

''Mars goes around the Sun once in a Martian '''year''', or 1.88 Earth '''years'''.''

Wikicloth renders it as:

Mars goes around the Sun once in a Martian 'year, or 1.88 Earth years'.

My fix works for this and other, much more complicated cases, including the following:

''aaaaaa''''bbbbbbbb''''ccccc''ddddd
'''aaaaaa''''bbbbbbb''''cccccc'''dddddd
''''aaaaa''''bbbbb
'''aaaaaa''bbbbbbbbb'''cccccccc
'''''aaaaaaaa''bbbbb''cccccccc''dddd'''eeeee
'''''aaaaaaaaaa''bbbbb'''''cccccc''ddddddddd
'''aaaa''bbbbbbbbbbbb'''''cccccc
'''aaaaaa''bbbbbbbb'''cccccc''ddddd
''aaaaa'''bbbb''ccccc'''ddddd
''aaaaaaaa'''''bbbbbbbbbb'''''cccccccc''dddddddd
'''aaaaaa'''''bbbbb'''''cccccc'''dddddd

I compared the run time of the old and the new code, and the difference in performance seems to be around 1%.