Fix blank URL_ROOT

pathto doesn't expand in non-HTML templates so the workaround involves
expanding it in the HTML file and passing it as a data attribute to
the script.
This commit is contained in:
Tommy Nguyen 2018-04-29 22:07:07 -04:00
parent 6ad0ad6f17
commit a7c6cb0180
No known key found for this signature in database
GPG Key ID: BE22B2891C045E30
2 changed files with 2 additions and 2 deletions

View File

@ -87,7 +87,7 @@
{%- endmacro %}
{%- macro script() %}
<script type="text/javascript" src="{{ pathto('_static/documentation_options.js', 1) }}"></script>
<script type="text/javascript" id="documentation_options" data-url_root="{{ pathto('', 1) }}" src="{{ pathto('_static/documentation_options.js', 1) }}"></script>
{%- for scriptfile in script_files %}
<script type="text/javascript" src="{{ pathto(scriptfile, 1) }}"></script>
{%- endfor %}

View File

@ -1,5 +1,5 @@
var DOCUMENTATION_OPTIONS = {
URL_ROOT: '{{ url_root }}',
URL_ROOT: document.getElementById("documentation_options").getAttribute('data-url_root'),
VERSION: '{{ release|e }}',
LANGUAGE: '{{ language }}',
COLLAPSE_INDEX: false,