updating docstring for add_js_file for body element

This commit is contained in:
Chris Holdgraf 2020-01-03 14:54:26 -08:00 committed by GitHub
parent 0319faf8f1
commit 01ffa6cf04
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -861,8 +861,10 @@ class Sphinx:
Add *filename* to the list of JavaScript files that the default HTML Add *filename* to the list of JavaScript files that the default HTML
template will include. The filename must be relative to the HTML template will include. The filename must be relative to the HTML
static path , or a full URI with scheme. The keyword arguments are static path , or a full URI with scheme. If the keyword argument
also accepted for attributes of ``<script>`` tag. ``body`` is given, its value will be added between the
``<script>`` tags. Extra keyword arguments are included as
attributes of the ``<script>`` tag.
Example:: Example::
@ -872,6 +874,9 @@ class Sphinx:
app.add_js_file('example.js', async="async") app.add_js_file('example.js', async="async")
# => <script src="_static/example.js" async="async"></script> # => <script src="_static/example.js" async="async"></script>
app.add_js_file(None, body="var myVariable = 'foo';")
# => <script>var myVariable = 'foo';</script>
.. versionadded:: 0.5 .. versionadded:: 0.5
.. versionchanged:: 1.8 .. versionchanged:: 1.8