From 1ce8d29c91b53922b6e1714c1dd074ed15c74f99 Mon Sep 17 00:00:00 2001 From: Chris Johns Date: Wed, 11 Jan 2017 17:04:02 +1100 Subject: html: Embed the catalogue XML in JS. The is to work around a security issue with Chrome on Windows. This patches let the cover page load on Chrome and Edge on Windows 10. --- wscript | 27 ++++++++++++++++++++++++--- 1 file changed, 24 insertions(+), 3 deletions(-) (limited to 'wscript') diff --git a/wscript b/wscript index 96a8574..955e68f 100644 --- a/wscript +++ b/wscript @@ -9,7 +9,7 @@ path.append(abspath('common')) import waflib import waf as docs_waf -version = '4.11 (4.11.2)' +version = 'Master (4.11.99)' build_all = ['user', 'rsb', @@ -36,18 +36,39 @@ def configure(conf): def catalogue(ctx): docs_waf.xml_catalogue(ctx, building, version) +def coverpage_js(ctx): + js = None + xml = None + for f in ctx.inputs: + if f.abspath().endswith('.js'): + with open(f.abspath()) as i: + js = i.read() + elif f.abspath().endswith('.xml'): + with open(f.abspath()) as i: + xml = i.read() + xml = xml.replace('\n', ' \\\n'); + with open(ctx.outputs[0].abspath(), 'w') as o: + o.write(js.replace('@CATALOGUE', xml)) + def build(ctx): for b in building: ctx.recurse(b) # - # Build the catalogue and install with the coverpage and static content. + # Build the catalogue, coverpage.js and install. # ctx(rule = catalogue, target = 'catalogue.xml', source = ['wscript', 'common/waf.py']) ctx.install_files('${PREFIX}', 'catalogue.xml') - ctx.install_files('${PREFIX}', 'common/html-coverpage/index.html') + ctx(rule = coverpage_js, + target = 'coverpage.js', + source = ['wscript', 'catalogue.xml', 'common/html-coverpage/coverpage.js']) + ctx.install_as('${PREFIX}/coverpage.js', 'coverpage.js') + # + # Install the static content. + # + ctx.install_as('${PREFIX}/index.html', 'common/html-coverpage/coverpage.html') static_dir = ctx.path.find_dir('common/html-coverpage/static') ctx.install_files('${PREFIX}/static', static_dir.ant_glob('**'), -- cgit v1.2.3