mirror of
https://github.com/ClickHouse/ClickHouse.git
synced 2024-12-18 12:22:12 +00:00
Put single-page content into a separate js file (#10160)
This commit is contained in:
parent
2b51b5ee5f
commit
9326016e5f
@ -220,6 +220,19 @@ def build_single_page_version(lang, args, nav, cfg):
|
|||||||
single_page_output_path
|
single_page_output_path
|
||||||
)
|
)
|
||||||
|
|
||||||
|
single_page_index_html = os.path.join(single_page_output_path, 'index.html')
|
||||||
|
single_page_content_js = os.path.join(single_page_output_path, 'content.js')
|
||||||
|
with open(single_page_index_html, 'r') as f:
|
||||||
|
sp_prefix, sp_js, sp_suffix = f.read().split('<!-- BREAK -->')
|
||||||
|
with open(single_page_index_html, 'w') as f:
|
||||||
|
f.write(sp_prefix)
|
||||||
|
f.write(sp_suffix)
|
||||||
|
with open(single_page_content_js, 'w') as f:
|
||||||
|
if args.minify:
|
||||||
|
import jsmin
|
||||||
|
sp_js = jsmin.jsmin(sp_js)
|
||||||
|
f.write(sp_js)
|
||||||
|
|
||||||
logging.info(f'Re-building single page for {lang} pdf/test')
|
logging.info(f'Re-building single page for {lang} pdf/test')
|
||||||
with util.temp_dir() as test_dir:
|
with util.temp_dir() as test_dir:
|
||||||
extra['single_page'] = False
|
extra['single_page'] = False
|
||||||
|
@ -17,11 +17,7 @@
|
|||||||
{% endif %}
|
{% endif %}
|
||||||
|
|
||||||
{% if single_page and page.content %}
|
{% if single_page and page.content %}
|
||||||
<script async type="text/javascript">
|
<script type="text/javascript" src="content.js?{{ config.extra.rev_short }}"></script>
|
||||||
{% for chunk in page.content|chunks %}
|
|
||||||
document.write({{ chunk|tojson|safe }});
|
|
||||||
{% endfor %}
|
|
||||||
</script>
|
|
||||||
{% endif %}
|
{% endif %}
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
@ -32,3 +28,12 @@
|
|||||||
</div>
|
</div>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
</div>
|
</div>
|
||||||
|
{% if single_page and page.content %}
|
||||||
|
<!-- BREAK -->
|
||||||
|
(function() {
|
||||||
|
{% for chunk in page.content|chunks %}
|
||||||
|
document.write({{ chunk|tojson|safe }});
|
||||||
|
{% endfor %}
|
||||||
|
})();
|
||||||
|
<!-- BREAK -->
|
||||||
|
{% endif %}
|
||||||
|
Loading…
Reference in New Issue
Block a user