#352 _OLIST_BULLET is potentially too-general a bullet-list regex

open
Edward Loper
epytext (18)
5
2012-03-13
2012-03-13
Anonymous
No

We have some epytext markup in Twisted that has a multiline parameter description which ends with "10.2.0." on a line by itself. "10.2.0." matches the _OLIST_BULLET regex in markup/epytext.py and gets converted to a bullet.

I've attached a minimal reproducer. The output of this reproducer is:

"""
default Do not use this parameter. It is deprecated since Twisted
0.
"""

We can see the erroneous bulleting in the output of parse_docstring for the reproducer:

"""
<epytext><para>Return the service corresponding to a description.</para><fieldlist><field><tag>param</tag><arg>default</arg><para inline=True>Do not use this parameter. It is deprecated since Twisted</para><olist start='0'><li bullet='10.2.0.'></li></olist></field></fieldlist></epytext>
"""

The current regex is:

_OLIST_BULLET = '(\d+[.])+( +|$)'

An easy fix, if we don't care about nested numbers like "10.2.0." is to reduce the regex to '(\d+[.])( +|$)'. If we do care about nested numbers, perhaps the number needs to be followed by some text to be considered a bullet, e.g. "10.2.0. Foo" indicates a bullet, but "10.2.0." doesn't.

I'm using epydoc version 3.0.1 with Python 2.7.1 on OS X 10.6.

Discussion


  • Anonymous
    2012-03-13

     
    Attachments