rstfinder icon indicating copy to clipboard operation
rstfinder copied to clipboard

collapse_rst_labels.py could be cleaned up a bit

Open mheilman opened this issue 11 years ago • 1 comments

Some of the regular expressions are a bit unnecessarily complicated (e.g., including extraneous instances of .*), and in some cases, perhaps str.startswith could be used instead of re.search.

mheilman avatar Oct 31 '14 18:10 mheilman

Note that there is some inconsistency with escaping - in the regular expressions, but python deals with this fine.

e.g.,

elif re.search(r'^(topic-.*)', relation_lc):

vs.

elif re.search(r'^(temporal\-.*|sequence|inverted\-sequence)',

mheilman avatar Oct 31 '14 18:10 mheilman