Skip to content

Commit 7f0100d

Browse files
authored
Merge pull request #8 from sphinx-notes/tmpl
docs: Add tmpl.rst
2 parents e03b2e2 + 786ab5f commit 7f0100d

9 files changed

Lines changed: 446 additions & 7 deletions

File tree

docs/api.rst

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,13 +16,16 @@ rendered as part of the document.
1616
- :ref:`context`, the dynamic content of a Jinja template
1717

1818
- :py:class:`~sphinxnotes.render.Template`,
19-
the Jinja template for rendering context to markup text
20-
(reStructuredText or Markdown)
19+
the Jinja template for rendering context to markup text
20+
(reStructuredText or Markdown)
2121

2222
2. Render: the ``pending_node`` node will be rendered at the appropriate
2323
:py:class:`~sphinxnotes.render.Phase`, depending on
2424
:py:attr:`~sphinxnotes.render.pending_node.template.phase`.
2525

26+
For a task-oriented explanation of template variables, extra context, and phase
27+
selection, see :doc:`tmpl`.
28+
2629
Node
2730
-----
2831

@@ -64,6 +67,8 @@ Context refers to the dynamic content of a Jinja template. It can be:
6467
Template
6568
--------
6669

70+
See :doc:`tmpl` for the higher-level guide.
71+
6772
.. autoclass:: sphinxnotes.render.Template
6873
:members:
6974

@@ -73,6 +78,9 @@ Template
7378
Extra Context
7479
-------------
7580

81+
See :doc:`tmpl` for built-in extra-context names such as ``_doc`` and
82+
``_sphinx``, plus usage examples.
83+
7684
.. autoclass:: sphinxnotes.render.GlobalExtraContxt
7785

7886
.. autoclass:: sphinxnotes.render.ParsePhaseExtraContext
@@ -86,6 +94,8 @@ Extra Context
8694
Base Roles and Directives
8795
-------------------------
8896

97+
For a minimal end-to-end example of a custom directive, start with :doc:`usage`.
98+
8999
Base Role Classes
90100
~~~~~~~~~~~~~~~~~
91101

docs/conf.py

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -122,6 +122,8 @@
122122
sys.path.insert(0, os.path.abspath('../src/'))
123123
extensions.append('sphinxnotes.render')
124124

125+
extensions.append('sphinxnotes.data')
126+
125127
# CUSTOM CONFIGURATION
126128

127129
autodoc_default_options = {
@@ -130,6 +132,11 @@
130132

131133
intersphinx_mapping['python'] = ('https://docs.python.org/3', None)
132134
intersphinx_mapping['sphinx'] = ('https://www.sphinx-doc.org/en/master', None)
135+
intersphinx_mapping['data'] = ('https://sphinx.silverrainz.me/data', None)
133136

134137
def setup(app):
135138
app.add_object_type('event', 'event') # for intersphinx
139+
140+
sys.path.insert(0, os.path.abspath('../tests/roots/test-ctxdir-usage'))
141+
from conf import setup as setup_ctxdir_usage_example
142+
setup_ctxdir_usage_example(app)

docs/index.rst

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -39,8 +39,16 @@ Getting Started
3939
4040
.. note::
4141

42-
This extension is not intended to be used directly by Sphinx users.
43-
It is for Sphinx extension developers.
42+
This extension is **aimed at advanced Sphinx users or extension developers**.
43+
44+
If you are new to Sphinx, you may instersting with
45+
:parsed_literal:`sphinxnotes.data__` or :parsed_literal:`sphinxnotes.any__`.
46+
47+
__ https://sphinx.silverrainz.me/data
48+
__ https://sphinx.silverrainz.me/any
49+
50+
We cannot get you started with this short section; please refer to the
51+
:doc:`usage` for more detailed information.
4452

4553
.. ADDITIONAL CONTENT END
4654
@@ -49,8 +57,10 @@ Contents
4957

5058
.. toctree::
5159
:caption: Contents
60+
:maxdepth: 2
5261

5362
usage
63+
tmpl
5464
dsl
5565
api
5666
changelog

0 commit comments

Comments
 (0)