Debian Codegraph @

docs/ref/rst/definitions.rst

raw
1 .. include:: ../../header2.rst
2 .. include:: <html-roles.txt>
3
4 ============================================
5 reStructuredText Standard Definition Files
6 ============================================
7 :Author: David Goodger
8 :Contact: [email protected]
9 :Revision: $Revision: 10285 $
10 :Date: $Date: 2026-01-07 08:52:49 +0100 (Mi, 07. Jan 2026) $
11 :Copyright: This document has been placed in the public domain.
12
13 .. contents::
14
15
16 This document describes standard definition files, such as sets of
17 substitution definitions and interpreted text roles, that can be
18 included in reStructuredText documents. The `"include" directive`__
19 has a special syntax for these standard definition files, angle
20 brackets around the file name::
21
22 .. include:: <filename.txt>
23
24 __ directives.html#include
25
26 The individual data files are stored with the Docutils source code in
27 the "docutils" package, in the ``docutils/parsers/rst/include``
28 directory.
29
30
31 Substitution Definitions
32 ========================
33
34 Many of the standard definition files contain sets of `substitution
35 definitions`__, which can be used in documents via `substitution
36 references`__. For example, the copyright symbol is defined in
37 ``isonum.txt`` as "copy"::
38
39 .. include:: <isonum.txt>
40
41 Copyright |copy| 2003 by John Q. Public, all rights reserved.
42
43 __ restructuredtext.html#substitution-definitions
44 __ restructuredtext.html#substitution-references
45
46 Individual substitution definitions can also be copied from definition
47 files and pasted into documents. This has two advantages: it removes
48 dependencies, and it saves processing of unused definitions. However,
49 multiple substitution definitions add clutter to the document.
50
51 Substitution references require separation from the surrounding text
52 with whitespace or punctuation. To use a substitution without
53 intervening whitespace, you can use the disappearing-whitespace escape
54 sequence, backslash-space::
55
56 .. include:: <isonum.txt>
57
58 Copyright |copy| 2003, BogusMegaCorp\ |trade|.
59
60 Custom substitution definitions may use the `"unicode" directive`__.
61 Whitespace is ignored and removed, effectively sqeezing together the
62 text::
63
64 .. |copy| unicode:: U+000A9 .. COPYRIGHT SIGN
65 .. |BogusMegaCorp (TM)| unicode:: BogusMegaCorp U+2122
66 .. with trademark sign
67
68 Copyright |copy| 2003, |BogusMegaCorp (TM)|.
69
70 __ directives.html#unicode
71
72 In addition, the "ltrim", "rtrim", and "trim" options may be used with
73 the "unicode" directive to automatically trim spaces from the left,
74 right, or both sides (respectively) of substitution references::
75
76 .. |---| unicode:: U+02014 .. em dash
77 :trim:
78
79
80 Character Entity Sets
81 ---------------------
82
83 The following files contain substitution definitions corresponding to
84 XML character entity sets, from the following standards: ISO 8879 &
85 ISO 9573-13 (combined), MathML, and XHTML1. They were generated by
86 the ``tools/dev/unicode2rstsubs.py`` program from the input file
87 unicode.xml__, which is maintained as part of the MathML 2
88 Recommentation XML source.
89
90 __ https://www.w3.org/2003/entities/xml/
91
92 =================== =================================================
93 Entity Set File Description
94 =================== =================================================
95 isoamsa.txt_ Added Mathematical Symbols: Arrows
96 isoamsb.txt_ Added Mathematical Symbols: Binary Operators
97 isoamsc.txt_ Added Mathematical Symbols: Delimiters
98 isoamsn.txt_ Added Mathematical Symbols: Negated Relations
99 isoamso.txt_ Added Mathematical Symbols: Ordinary
100 isoamsr.txt_ Added Mathematical Symbols: Relations
101 isobox.txt_ Box and Line Drawing
102 isocyr1.txt_ Russian Cyrillic
103 isocyr2.txt_ Non-Russian Cyrillic
104 isodia.txt_ Diacritical Marks
105 isogrk1.txt_ Greek Letters
106 isogrk2.txt_ Monotoniko Greek
107 isogrk3.txt_ Greek Symbols
108 isogrk4.txt_ [1]_ Alternative Greek Symbols
109 isolat1.txt_ Added Latin 1
110 isolat2.txt_ Added Latin 2
111 isomfrk.txt_ [1]_ Mathematical Fraktur
112 isomopf.txt_ [1]_ Mathematical Openface (Double-struck)
113 isomscr.txt_ [1]_ Mathematical Script
114 isonum.txt_ Numeric and Special Graphic
115 isopub.txt_ Publishing
116 isotech.txt_ General Technical
117 mmlalias.txt_ MathML aliases for entities from other sets
118 mmlextra.txt_ [1]_ Extra names added by MathML
119 xhtml1-lat1.txt_ XHTML Latin 1
120 xhtml1-special.txt_ XHTML Special Characters
121 xhtml1-symbol.txt_ XHTML Mathematical, Greek and Symbolic Characters
122 =================== =================================================
123
124 .. [1] There are ``*-wide.txt`` variants for each of these character
125 entity set files, containing characters outside of the Unicode
126 basic multilingual plane or BMP (wide-Unicode; code points greater
127 than U+FFFF). Before Python 3.3, some distributions were "narrow"
128 and did not support wide-Unicode characters. This should not be an
129 issue nowadays.
130
131 For example, the copyright symbol is defined as the XML character
132 entity ``&copy;``. The equivalent reStructuredText substitution
133 reference (defined in both ``isonum.txt`` and ``xhtml1-lat1.txt``) is
134 ``|copy|``.
135
136 .. _isoamsa.txt: ../../../docutils/parsers/rst/include/isoamsa.txt
137 .. _isoamsb.txt: ../../../docutils/parsers/rst/include/isoamsb.txt
138 .. _isoamsc.txt: ../../../docutils/parsers/rst/include/isoamsc.txt
139 .. _isoamsn.txt: ../../../docutils/parsers/rst/include/isoamsn.txt
140 .. _isoamso.txt: ../../../docutils/parsers/rst/include/isoamso.txt
141 .. _isoamsr.txt: ../../../docutils/parsers/rst/include/isoamsr.txt
142 .. _isobox.txt: ../../../docutils/parsers/rst/include/isobox.txt
143 .. _isocyr1.txt: ../../../docutils/parsers/rst/include/isocyr1.txt
144 .. _isocyr2.txt: ../../../docutils/parsers/rst/include/isocyr2.txt
145 .. _isodia.txt: ../../../docutils/parsers/rst/include/isodia.txt
146 .. _isogrk1.txt: ../../../docutils/parsers/rst/include/isogrk1.txt
147 .. _isogrk2.txt: ../../../docutils/parsers/rst/include/isogrk2.txt
148 .. _isogrk3.txt: ../../../docutils/parsers/rst/include/isogrk3.txt
149 .. _isogrk4.txt: ../../../docutils/parsers/rst/include/isogrk4.txt
150 .. _isolat1.txt: ../../../docutils/parsers/rst/include/isolat1.txt
151 .. _isolat2.txt: ../../../docutils/parsers/rst/include/isolat2.txt
152 .. _isomfrk.txt: ../../../docutils/parsers/rst/include/isomfrk.txt
153 .. _isomopf.txt: ../../../docutils/parsers/rst/include/isomopf.txt
154 .. _isomscr.txt: ../../../docutils/parsers/rst/include/isomscr.txt
155 .. _isonum.txt: ../../../docutils/parsers/rst/include/isonum.txt
156 .. _isopub.txt: ../../../docutils/parsers/rst/include/isopub.txt
157 .. _isotech.txt: ../../../docutils/parsers/rst/include/isotech.txt
158 .. _mmlalias.txt: ../../../docutils/parsers/rst/include/mmlalias.txt
159 .. _mmlextra.txt: ../../../docutils/parsers/rst/include/mmlextra.txt
160 .. _xhtml1-lat1.txt: ../../../docutils/parsers/rst/include/xhtml1-lat1.txt
161 .. _xhtml1-special.txt: ../../../docutils/parsers/rst/include/xhtml1-special.txt
162 .. _xhtml1-symbol.txt: ../../../docutils/parsers/rst/include/xhtml1-symbol.txt
163
164
165 Role Definitions
166 ================
167
168 Role definitions use the `"role" directive`_ to provide additional
169 `reStructuredText interpreted text roles`_.
170
171 .. _"role" directive: directives.html#role
172 .. _reStructuredText interpreted text roles: roles.html
173
174
175 .. _Additional roles for HTML:
176
177 Semantic Inline Markup Roles
178 ----------------------------
179
180 The "html-roles.txt_" standard definitions file provides role
181 definitions for semantic `HTML inline markup elements`__ and
182 `tags for representation of edits to the document`__ that
183 do not have a corresponding standard rST role
184 (except for elements requiring an additional attribute).
185
186 The additional roles work out of the box with the `"html5" writer`_
187 (selects the corresponding HTML element) and the LaTeX writers.
188
189 .. _html-roles.txt: ../../../docutils/parsers/rst/include/html-roles.txt
190 __ https://html.spec.whatwg.org/multipage/text-level-semantics.html
191 __ https://html.spec.whatwg.org/multipage/edits.html
192
193 .. class:: field-indent-4em
194
195 :b: highlight :b:`key words` without marking them up as important
196 :bdi: text :bdi:`directionality` isolation [#attribute-optional]_
197 :del: :del:`represents` removed content [#attribute-optional]_
198 :dfn: :dfn:`dfn` represents the defining instance of a term
199 [#attribute-optional]_
200 :i: :i:`voix alternative`
201 :ins: :ins:`editional` additions [#attribute-optional]_
202 :kbd: user input like :kbd:`Ctrl X`
203 :mark: :mark:`highlight` a run of text
204 :q: represents :q:`phrasing content quoted from another source`
205 [#attribute-optional]_
206 :s: text that is no longer accurate, :s:`or no longer relevant`
207 :samp: computer output like :samp:`hello world!`
208 :small: side comments :small:`like this`
209 :u: unarticulated annotations of, e.g, :u:`mispellings`
210 :var: variables (or constants like :var:`c`)
211
212 .. [#attribute-optional] Would gain from support for attributes/arguments
213 to inline roles (see TODO_).
214
215 New in Docutils 0.22.
216
217 .. _TODO: https://docutils.sourceforge.io/docs/dev/todo.html
218 #acronym-and-abbreviation
219 .. _"html5" writer: ../../user/html.html#html5
220
221
222 S5/HTML Definitions
223 -------------------
224
225 The "s5defs.txt_" standard definition file contains interpreted text
226 roles (classes) and other definitions for documents destined to become
227 `S5/HTML slide shows`_.
228
229 .. _s5defs.txt: ../../../docutils/parsers/rst/include/s5defs.txt
230 .. _S5/HTML slide shows: ../../user/slide-shows.html
231
232 .. Emacs settings
233
234 Local Variables:
235 mode: indented-text
236 mode: rst
237 indent-tabs-mode: nil
238 sentence-end-double-space: t
239 fill-column: 70
240 End: