[library-web] mallard: copy files from C locales before processing, for XInclude
- From: Frederic Peters <fpeters src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [library-web] mallard: copy files from C locales before processing, for XInclude
- Date: Mon, 13 Aug 2012 06:08:12 +0000 (UTC)
commit 7d47053afefc7176b1efeb6093b5d0a7e2871727
Author: FrÃdÃric PÃters <fpeters 0d be>
Date: Mon Aug 13 08:07:15 2012 +0200
mallard: copy files from C locales before processing, for XInclude
src/modtypes/mallard.py | 25 +++++++++++++++++++++++++
1 files changed, 25 insertions(+), 0 deletions(-)
---
diff --git a/src/modtypes/mallard.py b/src/modtypes/mallard.py
index abef55b..5a3b953 100644
--- a/src/modtypes/mallard.py
+++ b/src/modtypes/mallard.py
@@ -328,6 +328,27 @@ class MallardModule(DocModule):
if mtime > max(self.mtime_tarball, self.mtime_xslt_files):
continue
+ # make sure there's a copy of figures (and other "static" elements)
+ # in the language subdirectory, as they may be used by XInclude and
+ # therefore be required already during the XSLT step.
+ copied_files = []
+ for doc_figure in doc_figures:
+ src = os.path.join(lang_dirname, doc_figure)
+ if os.path.exists(src):
+ # file already exists, keep it
+ continue
+ # fallback to file from C locale.
+ src = os.path.join(ext_dirname, self.dirname, 'C', doc_figure)
+ if not os.path.exists(src):
+ # fallback file doesn't even exist, ignore
+ continue
+
+ dst = os.path.join(lang_dirname, doc_figure)
+ if not os.path.exists(os.path.split(dst)[0]):
+ os.makedirs(os.path.split(dst)[0])
+ open(dst, 'w').write(open(src, 'r').read())
+ copied_files.append(dst)
+
for doc_page in doc_pages:
xml_file = os.path.join(lang_dirname, doc_page)
filename = os.path.splitext(doc_page)[0] + '.html.' + lang
@@ -356,6 +377,10 @@ class MallardModule(DocModule):
if rc != 0:
logging.warn('%s failed with error %d' % (' '.join(cmd), rc))
+ # remove static files that were copied to the lang directory
+ for filename in copied_files:
+ os.unlink(filename)
+
if doc_figures:
# and copy images/
logging.debug('copying figures')
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]