copy custom css and js in documentation directories
This commit is contained in:
parent
23a5278e98
commit
d92e30a1e1
|
@ -0,0 +1,7 @@
|
|||
<?xml version='1.0' encoding='UTF-8'?>
|
||||
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0">
|
||||
<xsl:template name="html.head.custom">
|
||||
<link rel="stylesheet" type="text/css" href="brainstew.css"/>
|
||||
<script type="text/javascript" src="brainstew.js"></script>
|
||||
</xsl:template>
|
||||
</xsl:stylesheet>
|
|
@ -0,0 +1,5 @@
|
|||
<?xml version='1.0' encoding='UTF-8'?>
|
||||
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0">
|
||||
<xsl:import href="mallard_extra.xsl"/>
|
||||
<xsl:param name="mal2html.editor_mode" select="true()"/>
|
||||
</xsl:stylesheet>
|
26
publish.py
26
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)
|
||||
|
|
Loading…
Reference in New Issue