]> git.ipfire.org Git - thirdparty/rsync.git/commitdiff
Improve interior dashes in long options.
authorWayne Davison <wayne@opencoder.net>
Thu, 16 Jan 2025 06:19:33 +0000 (22:19 -0800)
committerWayne Davison <wayne@opencoder.net>
Thu, 16 Jan 2025 06:23:30 +0000 (22:23 -0800)
Improve the backslash-adding code in md-convert to affect dashes in the
interior of long options.  Perhaps fixes #686.

md-convert

index 5fd63a76d494eec72dca9f79a0bebc70a8fcf7b0..fb2bc993f981116edd51c519c8e54657fd941201 100755 (executable)
@@ -120,6 +120,7 @@ TZ_RE = re.compile(r'^#define\s+MAINTAINER_TZ_OFFSET\s+(-?\d+(\.\d+)?)', re.M)
 VAR_REF_RE = re.compile(r'\$\{(\w+)\}')
 VERSION_RE = re.compile(r' (\d[.\d]+)[, ]')
 BIN_CHARS_RE = re.compile(r'[\1-\7]+')
+LONG_OPT_DASH_RE = re.compile(r'(--\w[-\w]+)')
 SPACE_DOUBLE_DASH_RE = re.compile(r'\s--(\s)')
 NON_SPACE_SINGLE_DASH_RE = re.compile(r'(^|\W)-')
 WHITESPACE_RE = re.compile(r'\s')
@@ -540,6 +541,7 @@ class TransformHtml(HTMLParser):
         if st.in_pre:
             html = htmlify(txt)
         else:
+            txt = LONG_OPT_DASH_RE.sub(lambda x: x.group(1).replace('-', NBR_DASH[0]), txt)
             txt = SPACE_DOUBLE_DASH_RE.sub(NBR_SPACE[0] + r'--\1', txt).replace('--', NBR_DASH[0]*2)
             txt = NON_SPACE_SINGLE_DASH_RE.sub(r'\1' + NBR_DASH[0], txt)
             html = htmlify(txt)