Permalink
Browse files

if xmlns:xi is already there, dont add it.

  • Loading branch information...
1 parent cc97f9e commit e66087893fbb62a0af51e81fe47049fc457d7871 @chergert committed Jan 1, 2013
Showing with 6 additions and 3 deletions.
  1. +6 −3 gtkdoc2man.py
View
@@ -111,9 +111,10 @@ def gtkdoc2man(path, output_directory=None, prefix=None, section=3, book=None):
# Inject xmlns:xi="" so that the XML parser can follow xinclude
# paths. Pretty annoying that this isn't done by default.
- idx = data.index('<book')
- assert idx, 'Cannot find <book> in XML document.'
- data = data[:idx + 5] + ' xmlns:xi="http://www.w3.org/2001/XInclude" ' + data[idx+5:]
+ if 'xmlns:xi' not in data:
+ idx = data.index('<book')
+ assert idx, 'Cannot find <book> in XML document.'
+ data = data[:idx + 5] + ' xmlns:xi="http://www.w3.org/2001/XInclude" ' + data[idx+5:]
data = StringIO(data)
# Generate the links to the generated manpage.
@@ -186,6 +187,8 @@ def usage(stream=sys.stdout):
elif o in ('-b', '--book'):
book = a
+ assert prefix
+
for path in args:
if os.path.exists(path):
gtkdoc2man(path,

0 comments on commit e660878

Please sign in to comment.