[GRASS-SVN] r40150 - grass/trunk/tools/g.html2man

svn_grass at osgeo.org svn_grass at osgeo.org
Sun Dec 27 01:10:08 EST 2009


Author: glynn
Date: 2009-12-27 01:10:08 -0500 (Sun, 27 Dec 2009)
New Revision: 40150

Modified:
   grass/trunk/tools/g.html2man/g.html2man.py
Log:
Generalise handling of omitted start tags (replace <table> -> <tr> hack)


Modified: grass/trunk/tools/g.html2man/g.html2man.py
===================================================================
--- grass/trunk/tools/g.html2man/g.html2man.py	2009-12-27 04:51:17 UTC (rev 40149)
+++ grass/trunk/tools/g.html2man/g.html2man.py	2009-12-27 06:10:08 UTC (rev 40150)
@@ -23,6 +23,8 @@
     'bull': "*"
     }
 
+omit_start = ["body", "tbody", "head", "html"]
+
 single = ["area", "base", "basefont", "br", "col", "frame",
 	  "hr", "img", "input", "isindex", "link", "meta", "param"]
 single = frozenset(single)
@@ -49,6 +51,15 @@
 def setify(d):
     return dict([(key, frozenset(val)) for key, val in d.iteritems()])
 
+def omit(allowed, tags):
+    result = {}
+    for k, v in allowed.iteritems():
+	for t in tags:
+	    if t in v:
+		v = v.union(allowed[t])
+	result[k] = v
+    return result
+
 allowed = {
     "a": inline,
     "abbr": inline,
@@ -115,8 +126,7 @@
     "style": [],
     "sub": inline,
     "sup": inline,
-    "table": ["caption", "col", "colgroup", "thead", "tfoot", "tbody",
-	      "tr"], # to allow for <table>[implied <tbody>]<tr>
+    "table": ["caption", "col", "colgroup", "thead", "tfoot", "tbody"],
     "tbody": ["tr"],
     "td": flow,
     "textarea": [],
@@ -132,6 +142,7 @@
     }
 
 allowed = setify(allowed)
+allowed = omit(allowed, omit_start)
 
 excluded = {
     "a": ["a"],



More information about the grass-commit mailing list