]> git.proxmox.com Git - mirror_ovs.git/blobdiff - build-aux/dist-docs
dist-docs: Fix bugs in text to HTML conversion.
[mirror_ovs.git] / build-aux / dist-docs
index 9f6ca7b2cbfc17ead16a90d1614a974ec2b9c81e..f6b88ca2d04b075117a8dfce82119e7713c693a0 100755 (executable)
@@ -69,11 +69,29 @@ EOF
      GROFF_NO_SGR=1 man -l -Tutf8 $manpage | sed 's/.\b//g' > $manpage.txt
      (echo '<html><head><meta charset="UTF-8"></head><body><pre>'
       GROFF_NO_SGR=1 man -l -Tutf8 $manpage | sed '
-s/&/&amp;/g
-s/</&lt;/g
-s/>/&gt;/g
-s,\(.\)\b\1,<b>\1</b>,g
-s,_\b\(.\),<u>\1</u>,g'
+# Change bold and underline via backspacing into bracketing with control
+# characters.  We cannot directly translate them to HTML because <> need
+# to be escaped later.  (We cannot escape <> first because bold or
+# underlined escaped characters would be mis-processed.)
+s,\(.\)\b\1,\ 1\1\ 2,g
+s,_\b\(.\),\ 3\1\ 4,g
+
+# Drop redundant font changes, to keep from having every character have
+# a separate tag pair.
+s,\ 2\ 1,,g
+s,\ 4\ 3,,g
+
+# Escape special characters.
+s,&,\&amp;,g
+s,<,\&lt;,g
+s,>,\&gt;,g
+
+# Translate control characters to HTML.
+s,\ 1,<b>,g
+s,\ 2,</b>,g
+s,\ 3,<u>,g
+s,\ 4,</u>,g
+'
       echo '</pre></body></html>'
      ) > $manpage.html