2
2
Source Constants
3
3
================
4
4
5
- The `substitutions <http://docutils.sourceforge.net/docs/ref/rst/restructuredtext.html#substitution-definitions>`__
6
- built into restructuredText have a number of limitations and quirks. For
7
- example, they cannot be used to substitute content inside of code blocks,
8
- and cannot contain links.
5
+ The `substitutions
6
+ <http://docutils.sourceforge.net/docs/ref/rst/restructuredtext.html#substitution-definitions>`__
7
+ built into restructuredText have a number of limitations and quirks.
8
+ For example, they cannot be used to substitute content inside of code
9
+ blocks, and cannot contain links.
9
10
10
- The MongoDB Documentation Project has an extension called ``source_constants``
11
- which allows you to substitute constants anywhere in a page *before*
12
- docutils begins its parse stage.
11
+ The MongoDB Documentation Project has an extension called
12
+ ``source_constants`` which allows you to substitute constants anywhere
13
+ in a page *before* docutils begins its parse stage.
13
14
14
15
Example
15
16
-------
@@ -18,6 +19,7 @@ In your ``conf.py``, add ``'source_constants'`` to the ``extensions``
18
19
list, and define a ``source_constants`` dict:
19
20
20
21
.. code-block:: python
22
+ :linenos:
21
23
22
24
source_constants = {
23
25
'package-branch': 'testing',
@@ -29,13 +31,15 @@ You may then use these constants in your restructuredText files:
29
31
30
32
.. code-block:: rst
31
33
32
- Create the ``/etc/apt/sources.list.d/mongodb-org-{+package-version+}.list`` list file using
33
- the command appropriate for your version of Ubuntu:
34
+ Create the
35
+ ``/etc/apt/sources.list.d/mongodb-org-{+package-version+}.list``
36
+ list file using the command appropriate for your version of Ubuntu:
34
37
35
- Ubuntu 14.04
36
- .. code-block:: sh
38
+ .. code-block:: sh
37
39
38
- echo "deb [ arch=amd64 ] https://repo.mongodb.org/apt/ubuntu trusty/mongodb-org/{+package-branch+} multiverse" | sudo tee /etc/apt/sources.list.d/mongodb-org-{+version+}.list
40
+ echo "deb [ arch=amd64 ] https://repo.mongodb.org/apt/ubuntu \
41
+ trusty/mongodb-org/{+package-branch+} multiverse" \
42
+ | sudo tee /etc/apt/sources.list.d/mongodb-org-{+version+}.list
39
43
40
44
Comparison with Other Variable Syntaxes
41
45
---------------------------------------
@@ -62,7 +66,8 @@ Comparison with Other Variable Syntaxes
62
66
* - Valid Content
63
67
- Anything
64
68
- Anything
65
- - May not be used to inject links or other non-trivial types of content
69
+ - May not be used to inject links or other non-trivial types of
70
+ content
66
71
67
72
* - Mutable
68
73
- Can currently only be defined in ``conf.py``
0 commit comments