X-Git-Url: https://pintos-os.org/cgi-bin/gitweb.cgi?a=blobdiff_plain;f=ovsdb%2Fovsdb-doc.in;h=7b783e1a0414c9e29b329c3b30ec44133b844ae8;hb=7792bfe075f1284e4927eef4cef6e36d26776e37;hp=90de4521adebec88feb4d37d3ec9c6cc3db9ed7f;hpb=991559357f6a03c3a5b70c053c8c2554aa8d5ee4;p=openvswitch diff --git a/ovsdb/ovsdb-doc.in b/ovsdb/ovsdb-doc.in index 90de4521..7b783e1a 100755 --- a/ovsdb/ovsdb-doc.in +++ b/ovsdb/ovsdb-doc.in @@ -16,9 +16,9 @@ argv0 = sys.argv[0] def textToNroff(s, font=r'\fR'): def escape(match): c = match.group(0) - if c == '-': - if font == r'\fB': - return r'\-' + if c.startswith('-'): + if c != '-' or font == r'\fB': + return '\\' + c else: return '-' if c == '\\': @@ -31,7 +31,7 @@ def textToNroff(s, font=r'\fR'): raise error.Error("bad escape") # Escape - \ " ' as needed by nroff. - s = re.sub('([-"\'\\\\])', escape, s) + s = re.sub('(-[0-9]|[-"\'\\\\])', escape, s) if s.startswith('.'): s = '\\' + s return s @@ -43,7 +43,7 @@ def inlineXmlToNroff(node, font): if node.nodeType == node.TEXT_NODE: return textToNroff(node.data, font) elif node.nodeType == node.ELEMENT_NODE: - if node.tagName == 'code' or node.tagName == 'em': + if node.tagName in ['code', 'em', 'option']: s = r'\fB' for child in node.childNodes: s += inlineXmlToNroff(child, r'\fB') @@ -52,12 +52,14 @@ def inlineXmlToNroff(node, font): s = r'\fB' if node.hasAttribute('column'): s += node.attributes['column'].nodeValue + if node.hasAttribute('key'): + s += ':' + node.attributes['key'].nodeValue elif node.hasAttribute('table'): s += node.attributes['table'].nodeValue elif node.hasAttribute('group'): s += node.attributes['group'].nodeValue else: - raise error.Error("'ref' lacks column and table attributes") + raise error.Error("'ref' lacks required attributes: %s" % node.attributes.keys()) return s + font elif node.tagName == 'var': s = r'\fI' @@ -76,17 +78,23 @@ def blockXmlToNroff(nodes, para='.PP'): s += textToNroff(node.data) s = s.lstrip() elif node.nodeType == node.ELEMENT_NODE: - if node.tagName == 'ul': + if node.tagName in ['ul', 'ol']: if s != "": s += "\n" s += ".RS\n" + i = 0 for liNode in node.childNodes: if (liNode.nodeType == node.ELEMENT_NODE and liNode.tagName == 'li'): - s += ".IP \\(bu\n" + blockXmlToNroff(liNode.childNodes, ".IP") + i += 1 + if node.tagName == 'ul': + s += ".IP \\(bu\n" + else: + s += ".IP %d. .25in\n" % i + s += blockXmlToNroff(liNode.childNodes, ".IP") elif (liNode.nodeType != node.TEXT_NODE or not liNode.data.isspace()): - raise error.Error("