summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorVincent Untz <vuntz@gnome.org>2012-01-26 11:00:10 +0100
committerVincent Untz <vuntz@gnome.org>2012-01-26 11:00:10 +0100
commitc8bbc33a08c28a0580e7fc61fe31ce6af6f7c059 (patch)
treed487d07f0cab3ced26325f8144a4b044ed685bf6
parent9f7664fc3a6e0f55ee2eb49d14874ec9f0603d7e (diff)
downloadxdg-specs-c8bbc33a08c28a0580e7fc61fe31ce6af6f7c059.tar.xz
web-export: Support converting old specs from SGML DocBook
-rw-r--r--web-export/specs.idx11
-rwxr-xr-xweb-export/update.py37
2 files changed, 28 insertions, 20 deletions
diff --git a/web-export/specs.idx b/web-export/specs.idx
index 5d300cf..4d0dde1 100644
--- a/web-export/specs.idx
+++ b/web-export/specs.idx
@@ -19,9 +19,8 @@ git:xdg/xdg-specs:desktop-entry/desktop-entry-spec.xml af1b346daa90b9cb
git:xdg/xdg-specs:desktop-entry/desktop-entry-spec.xml 6855384d021d88557f80674798c584c15b547f36 0.9.5 desktop-entry-spec
# Invalid docbook:
#git:xdg/xdg-specs:desktop-entry/desktop-entry-spec.xml b818b36ff0ee3c7f35df7b38db15a18b434f6375 0.9.4 desktop-entry-spec
-# SGML format...
-#git:xdg/xdg-specs:desktop-entry/desktop-entry-spec.sgml e7d2b4770815f8d8dcca934d3520d3fe55f86b09 0.9.3 desktop-entry-spec
-#git:xdg/xdg-specs:desktop-entry/desktop-entry-spec.sgml 9c493d5fca5fcceca4e1bc0b2b2ba8a13c5eb12e 0.9.2 desktop-entry-spec
+git:xdg/xdg-specs:desktop-entry/desktop-entry-spec.sgml e7d2b4770815f8d8dcca934d3520d3fe55f86b09 0.9.3 desktop-entry-spec
+git:xdg/xdg-specs:desktop-entry/desktop-entry-spec.sgml 9c493d5fca5fcceca4e1bc0b2b2ba8a13c5eb12e 0.9.2 desktop-entry-spec
git:xdg/default-icon-theme:spec/icon-naming-spec.xml master 0.8.90 icon-naming-spec
git:xdg/default-icon-theme:spec/icon-naming-spec.xml 77bc8ba641ca24bf2e55292f7d31926d60295e5c 0.8 icon-naming-spec
@@ -84,9 +83,9 @@ git:xdg/xdg-specs:systemtray/systemtray-spec.xml c8475bef1d1f84afcc89c710b6b5b
git:xdg/xdg-specs:wm-spec/wm-spec.xml master 1.5 wm-spec
git:xdg/xdg-specs:wm-spec/wm-spec.xml a95af55a102b0814e81095bda46a691068009c3c 1.4 wm-spec
git:xdg/xdg-specs:wm-spec/wm-spec.xml 2eafacb23421d25147533a66a9eb8f0f4650a5e4 1.3 wm-spec
-# SGML format...
-#git:xdg/xdg-specs:wm-spec/wm-spec.sgml d10d819f39c4c7e878288192f14248536d9d4b96 1.2 wm-spec
-#git:xdg/xdg-specs:wm-spec/wm-spec.sgml a6e9a0a88112e5f6ac7099530e5c732c7ec6fb7f 1.1 wm-spec
+git:xdg/xdg-specs:wm-spec/wm-spec.sgml d10d819f39c4c7e878288192f14248536d9d4b96 1.2 wm-spec
+git:xdg/xdg-specs:wm-spec/wm-spec.sgml a6e9a0a88112e5f6ac7099530e5c732c7ec6fb7f 1.1 wm-spec
+# Invalid docbook:
#git:xdg/xdg-specs:wm-spec/wm-spec.sgml b58352845cebc1d3b5754215a03ed047d1b28b11 1.0 wm-spec
xembed/xembed/spec/xembed-spec.xml 1.2 0.5 xembed-spec
diff --git a/web-export/update.py b/web-export/update.py
index a84cffc..cd54f28 100755
--- a/web-export/update.py
+++ b/web-export/update.py
@@ -164,26 +164,35 @@ class SpecObject():
path = os.path.join(self.spec_dir, self.filename)
(path_no_ext, ext) = os.path.splitext(path)
- if self.ext == '.xml':
- # One-chunk HTML
- html_path = '%s%s' % (path_no_ext, '.html')
- if os.path.exists(html_path):
- os.unlink(html_path)
+ # One-chunk HTML
+ html_path = '%s%s' % (path_no_ext, '.html')
+ if os.path.exists(html_path):
+ os.unlink(html_path)
- retcode = subprocess.call(['xmlto', '-o', self.spec_dir, 'html-nochunks', path])
+ # Multiple chunks
+ html_dir = os.path.join(self.spec_dir, self.version)
+ if os.path.exists(html_dir):
+ shutil.rmtree(html_dir)
+ one_chunk_command = None
+ multiple_chunks_command = None
+
+ if self.ext == '.xml':
+ one_chunk_command = ['xmlto', '-o', self.spec_dir, 'html-nochunks', path]
+ multiple_chunks_command = ['xmlto', '-o', html_dir, 'html', path]
+ elif self.ext == '.sgml':
+ one_chunk_command = ['docbook2html', '-o', self.spec_dir, '--nochunks', path]
+ multiple_chunks_command = ['docbook2html', '-o', html_dir, path]
+
+ if one_chunk_command:
+ retcode = subprocess.call(one_chunk_command)
if retcode != 0:
raise Exception('Cannot convert \'%s\' to HTML.' % path)
self.one_chunk = True
- # Multiple chunks
- html_dir = os.path.join(self.spec_dir, self.version)
- if os.path.exists(html_dir):
- shutil.rmtree(html_dir)
+ if multiple_chunks_command:
safe_mkdir(html_dir)
-
- retcode = subprocess.call(['xmlto', '-o', html_dir, 'html', path])
-
+ retcode = subprocess.call(multiple_chunks_command)
if retcode != 0:
raise Exception('Cannot convert \'%s\' to multiple-chunks HTML.' % path)
self.multiple_chunks = True
@@ -196,7 +205,7 @@ class SpecObject():
os.unlink(path_latest)
os.symlink(self.filename, path_latest)
- if self.ext == '.xml':
+ if self.ext in ['.xml', '.sgml']:
# One-chunk HTML
html_path_latest = os.path.join(self.spec_dir, '%s-latest%s' % (self.basename_no_ext, '.html'))
if os.path.exists(html_path_latest):