diff --git a/brainstew.css b/brainstew.css new file mode 100644 index 0000000..e69de29 diff --git a/brainstew.js b/brainstew.js new file mode 100644 index 0000000..e69de29 diff --git a/mallard_extra.xsl b/mallard_extra.xsl new file mode 100644 index 0000000..6fb0124 --- /dev/null +++ b/mallard_extra.xsl @@ -0,0 +1,7 @@ + + + + + + + diff --git a/mallard_extra_dev.xsl b/mallard_extra_dev.xsl new file mode 100644 index 0000000..3f4292c --- /dev/null +++ b/mallard_extra_dev.xsl @@ -0,0 +1,5 @@ + + + + + diff --git a/publish.py b/publish.py index 6287f44..1d5313e 100755 --- a/publish.py +++ b/publish.py @@ -49,7 +49,8 @@ def download(url): def publish_mallard(module, branch, directory): - checkout_dir = os.path.join(checkouts_directory, module) + module_name = module.get('name') + checkout_dir = os.path.join(checkouts_directory, module_name) kws = {} kws['stdout'] = subprocess.PIPE @@ -60,16 +61,23 @@ def publish_mallard(module, branch, directory): help_dir = os.path.join(checkout_dir, 'help', 'fr') if not os.path.exists(help_dir): return - output_dir = os.path.join(web_directory, module, directory) + output_dir = os.path.join(web_directory, module_name, directory) if not os.path.exists(output_dir): os.makedirs(output_dir) index_html = os.path.join(output_dir, 'index.html') if os.path.islink(index_html): os.unlink(index_html) - cmd = ['jhbuild', '-f', jhbuildrc, 'run', 'yelp-build', 'html', '-o', output_dir] + cmd = ['jhbuild', '-f', jhbuildrc, 'run', 'yelp-build', 'html', + '-o', output_dir, '-x'] + if module.get('branch') == 'dev': + cmd.append('mallard_extra_dev.xsl') + else: + cmd.append('mallard_extra.xsl') cmd.extend([os.path.join(help_dir, x) for x in os.listdir(help_dir) if x.endswith('.page')]) subprocess.call(cmd, **kws) + for static in ('brainstew.js', 'brainstew.css'): + shutil.copy(static, output_dir) if not os.path.exists(index_html): html_files = [x for x in os.listdir(output_dir) if x.endswith('.html')] @@ -80,13 +88,13 @@ def publish_mallard(module, branch, directory): return temp_dir = tempfile.mkdtemp() - cache_file = os.path.join(temp_dir, '%s.cache' % module) + cache_file = os.path.join(temp_dir, '%s.cache' % module_name) cmd = ['jhbuild', '-f', jhbuildrc, 'run', 'yelp-build', 'cache', '-o', cache_file] cmd.extend([os.path.join(help_dir, x) for x in os.listdir(help_dir) if x.endswith('.page')]) subprocess.call(cmd, **kws) if os.path.exists(cache_file): - latex_file = os.path.join(temp_dir, 'doc-%s.tex' % module) + latex_file = os.path.join(temp_dir, 'doc-%s.tex' % module_name) cmd = ['xsltproc', '-o', latex_file, '../mal2latex/mal2latex.xsl', cache_file] subprocess.call(cmd, **kws) @@ -103,11 +111,11 @@ def publish_mallard(module, branch, directory): cmd = ['pdflatex', '--interaction=nonstopmode', '-output-directory', temp_dir, latex_file] subprocess.call(cmd, cwd=temp_dir, **kws) - if not os.path.exists(os.path.join(temp_dir, 'doc-%s.pdf' % module)): + if not os.path.exists(os.path.join(temp_dir, 'doc-%s.pdf' % module_name)): break else: - fd = file(os.path.join(output_dir, 'doc-%s.pdf' % module), 'w') - fd.write(file(os.path.join(temp_dir, 'doc-%s.pdf' % module)).read()) + fd = file(os.path.join(output_dir, 'doc-%s.pdf' % module_name), 'w') + fd.write(file(os.path.join(temp_dir, 'doc-%s.pdf' % module_name)).read()) fd.close() shutil.rmtree(temp_dir) @@ -152,6 +160,6 @@ for module in modules: publish_tarball(module) else: module['branch'] = 'dev' - publish_mallard(module.get('name'), 'master', 'dev') + publish_mallard(module, 'master', 'dev') create_index(modules)