return s
-def docsToNroff(schemaFile, xmlFile, erFile, title=None, version=None):
+def docsToNroff(schemaFile, xmlFile, erFile, version=None):
schema = ovs.db.schema.DbSchema.from_json(ovs.json.from_file(schemaFile))
doc = xml.dom.minidom.parse(xmlFile).documentElement
xmlDate = os.stat(xmlFile).st_mtime
d = date.fromtimestamp(max(schemaDate, xmlDate))
- if title == None:
- title = schema.name
+ if doc.hasAttribute('name'):
+ manpage = doc.attributes['name'].nodeValue
+ else:
+ manpage = schema.name
if version == None:
version = "UNKNOWN"
.SH NAME
%s \- %s database schema
.PP
-''' % (title, schema.version, version, textToNroff(schema.name), schema.name)
+''' % (manpage, schema.version, version, textToNroff(manpage), schema.name)
tables = ""
introNodes = []
The following options are also available:
--er-diagram=DIAGRAM.PIC include E-R diagram from DIAGRAM.PIC
- --title=TITLE use TITLE as title instead of schema name
--version=VERSION use VERSION to display on document footer
-h, --help display this help message\
""" % {'argv0': argv0}
try:
try:
options, args = getopt.gnu_getopt(sys.argv[1:], 'hV',
- ['er-diagram=', 'title=',
+ ['er-diagram=',
'version=', 'help'])
except getopt.GetoptError, geo:
sys.stderr.write("%s: %s\n" % (argv0, geo.msg))
sys.exit(1)
er_diagram = None
- title = None
version = None
for key, value in options:
if key == '--er-diagram':
er_diagram = value
- elif key == '--title':
- title = value
elif key == '--version':
version = value
elif key in ['-h', '--help']:
sys.exit(1)
# XXX we should warn about undocumented tables or columns
- s = docsToNroff(args[0], args[1], er_diagram, title, version)
+ s = docsToNroff(args[0], args[1], er_diagram, version)
for line in s.split("\n"):
line = line.strip()
if len(line):