From 84f7dffd995fa36f5380e4b79a681c62fd3a0296 Mon Sep 17 00:00:00 2001 From: Chris Holdgraf Date: Thu, 23 Jul 2020 17:39:20 -0700 Subject: [PATCH] comments --- doc/development/theming.rst | 20 ++++++++++++++++++++ doc/usage/restructuredtext/field-lists.rst | 7 ++----- 2 files changed, 22 insertions(+), 5 deletions(-) diff --git a/doc/development/theming.rst b/doc/development/theming.rst index ea993e679..5de10158a 100644 --- a/doc/development/theming.rst +++ b/doc/development/theming.rst @@ -245,6 +245,26 @@ Now, you will have access to this function in jinja like so: +Add your own static files to the build assets +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +If you are packaging your own build assets with an extension +(e.g., a CSS or JavaScript file), you need to ensure that they are placed +in the ``_static/`` folder of HTML outputs. To do so, you may copy them directly +into a build's ``_static/`` folder at build time, generally via an event hook. +Here is some sample code to accomplish this: + +.. code-block:: python + + def copy_custom_files(app, exc): + if app.builder.format == 'html' and not exc: + staticdir = path.join(app.builder.outdir, '_static') + copy_asset_file('path/to/myextension/_static/myjsfile.js', staticdir) + + def setup(app): + app.connect('builder-inited', copy_custom_files) + + Inject JavaScript based on user configuration ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ diff --git a/doc/usage/restructuredtext/field-lists.rst b/doc/usage/restructuredtext/field-lists.rst index d6d90caf7..5fc897d62 100644 --- a/doc/usage/restructuredtext/field-lists.rst +++ b/doc/usage/restructuredtext/field-lists.rst @@ -9,17 +9,14 @@ fields marked up like this:: :fieldname: Field content -Field lists are :duref:`originally defined in docutils ` -to show information about a page (such as the document author or date of -publication). +Sphinx extends standard docutils behavior for field lists and adds some extra +functionality that is covered in this section. .. note:: The values of field lists will be parsed as strings. You cannot use Python collections such as lists or dictionaries. -Sphinx treats field lists slightly differently, as explained -below. .. _metadata: