]> granicus.if.org Git - zziplib/commitdiff
print mails correctly in dbk2htm
authorGuido Draheim <guidod@gmx.de>
Sun, 25 Mar 2018 23:35:36 +0000 (01:35 +0200)
committerGuido Draheim <guidod@gmx.de>
Sun, 25 Mar 2018 23:35:36 +0000 (01:35 +0200)
docs/dbk2man.py

index 8a2879c1094f73e0c810fc5ff76bf9f184cd7da6..c5176b7b61550e27e2997326a26380b721034eb3 100755 (executable)
@@ -35,6 +35,10 @@ def htm(text):
     text = text.replace('>', '&gt;')
     text = text.replace('"', '&quot;')
     return text
+def mailhref(text):
+    return re.sub("<([^<>]*@[^<>]*)>", 
+        lambda x: '<a href="mailto:%s">%s</a>' % (x.group(1), x.group(1)), 
+        text)
 
 OverviewEntry = collections.namedtuple("OverviewEntry", ["manpage", "manvolnum", "refpurpose"])
 
@@ -282,7 +286,7 @@ def refsect2htm(refsect, title = ""):
         if para.tag == 'itemizedlist':
             text += "<ul>" + "\n"
             for item in list(para):
-                text + "<li><p>" + para2htm(item)
+                text += "<li><p>" + para2htm(item)
                 text += "</p></li>" + "\n"
             text += "</ul>" + "\n"
             continue
@@ -323,7 +327,7 @@ def para2htm(para):
    item = item.replace("</function>", "</code></em>")
    item = item.replace("<literal>", "<code>")
    item = item.replace("</literal>", "</code>")
-   return item
+   return mailhref(item)
 
 def styleinfo2(man):
     if man: