Skip to content

Commit 353506b

Browse files
committed
Improve interior dashes in long options.
Improve the backslash-adding code in md-convert to affect dashes in the interior of long options. Perhaps fixes RsyncProject#686.
1 parent 7cff121 commit 353506b

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

md-convert

+2
Original file line numberDiff line numberDiff line change
@@ -120,6 +120,7 @@ TZ_RE = re.compile(r'^#define\s+MAINTAINER_TZ_OFFSET\s+(-?\d+(\.\d+)?)', re.M)
120120
VAR_REF_RE = re.compile(r'\$\{(\w+)\}')
121121
VERSION_RE = re.compile(r' (\d[.\d]+)[, ]')
122122
BIN_CHARS_RE = re.compile(r'[\1-\7]+')
123+
LONG_OPT_DASH_RE = re.compile(r'(--\w[-\w]+)')
123124
SPACE_DOUBLE_DASH_RE = re.compile(r'\s--(\s)')
124125
NON_SPACE_SINGLE_DASH_RE = re.compile(r'(^|\W)-')
125126
WHITESPACE_RE = re.compile(r'\s')
@@ -540,6 +541,7 @@ class TransformHtml(HTMLParser):
540541
if st.in_pre:
541542
html = htmlify(txt)
542543
else:
544+
txt = LONG_OPT_DASH_RE.sub(lambda x: x.group(1).replace('-', NBR_DASH[0]), txt)
543545
txt = SPACE_DOUBLE_DASH_RE.sub(NBR_SPACE[0] + r'--\1', txt).replace('--', NBR_DASH[0]*2)
544546
txt = NON_SPACE_SINGLE_DASH_RE.sub(r'\1' + NBR_DASH[0], txt)
545547
html = htmlify(txt)

0 commit comments

Comments
 (0)