| 1 |
:tocdepth: 2 |
| 2 |
|
| 3 |
.. title:: set by title directive |
| 4 |
.. _1024: |
| 5 |
|
| 6 |
Testing various markup |
| 7 |
====================== |
| 8 |
|
| 9 |
Meta markup |
| 10 |
----------- |
| 11 |
|
| 12 |
.. sectionauthor:: Georg Brandl |
| 13 |
.. moduleauthor:: Georg Brandl |
| 14 |
|
| 15 |
.. contents:: TOC |
| 16 |
|
| 17 |
.. meta:: |
| 18 |
:author: Me |
| 19 |
:keywords: docs, sphinx |
| 20 |
|
| 21 |
|
| 22 |
Generic reST |
| 23 |
------------ |
| 24 |
|
| 25 |
A |subst|! |
| 26 |
|
| 27 |
.. |subst| replace:: global substitution |
| 28 |
|
| 29 |
.. highlight:: none |
| 30 |
|
| 31 |
.. _label: |
| 32 |
|
| 33 |
:: |
| 34 |
|
| 35 |
some code |
| 36 |
|
| 37 |
Option list: |
| 38 |
|
| 39 |
-h help |
| 40 |
--help also help |
| 41 |
|
| 42 |
Line block: |
| 43 |
|
| 44 |
| line1 |
| 45 |
| line2 |
| 46 |
| line3 |
| 47 |
| line4 |
| 48 |
| line5 |
| 49 |
| line6 |
| 50 |
| line7 |
| 51 |
|
| 52 |
|
| 53 |
Body directives |
| 54 |
^^^^^^^^^^^^^^^ |
| 55 |
|
| 56 |
.. topic:: Title |
| 57 |
|
| 58 |
Topic body. |
| 59 |
|
| 60 |
.. sidebar:: Sidebar |
| 61 |
:subtitle: Sidebar subtitle |
| 62 |
|
| 63 |
Sidebar body. |
| 64 |
|
| 65 |
.. rubric:: Test rubric |
| 66 |
|
| 67 |
.. epigraph:: Epigraph title |
| 68 |
|
| 69 |
Epigraph body. |
| 70 |
|
| 71 |
-- Author |
| 72 |
|
| 73 |
.. highlights:: Highlights |
| 74 |
|
| 75 |
Highlights body. |
| 76 |
|
| 77 |
.. pull-quote:: Pull-quote |
| 78 |
|
| 79 |
Pull quote body. |
| 80 |
|
| 81 |
.. compound:: |
| 82 |
|
| 83 |
a |
| 84 |
|
| 85 |
b |
| 86 |
|
| 87 |
.. parsed-literal:: |
| 88 |
|
| 89 |
with some *markup* inside |
| 90 |
|
| 91 |
|
| 92 |
.. _admonition-section: |
| 93 |
|
| 94 |
Admonitions |
| 95 |
^^^^^^^^^^^ |
| 96 |
|
| 97 |
.. admonition:: My Admonition |
| 98 |
|
| 99 |
Admonition text. |
| 100 |
|
| 101 |
.. note:: |
| 102 |
Note text. |
| 103 |
|
| 104 |
.. warning:: |
| 105 |
|
| 106 |
Warning text. |
| 107 |
|
| 108 |
.. _some-label: |
| 109 |
|
| 110 |
.. tip:: |
| 111 |
Tip text. |
| 112 |
|
| 113 |
Indirect hyperlink targets |
| 114 |
|
| 115 |
.. _other-label: some-label_ |
| 116 |
|
| 117 |
Inline markup |
| 118 |
------------- |
| 119 |
|
| 120 |
*Generic inline markup* |
| 121 |
|
| 122 |
Adding \n to test unescaping. |
| 123 |
|
| 124 |
* :command:`command\\n` |
| 125 |
* :dfn:`dfn\\n` |
| 126 |
* :guilabel:`guilabel with &accelerator and \\n` |
| 127 |
* :kbd:`kbd\\n` |
| 128 |
* :mailheader:`mailheader\\n` |
| 129 |
* :makevar:`makevar\\n` |
| 130 |
* :manpage:`manpage\\n` |
| 131 |
* :mimetype:`mimetype\\n` |
| 132 |
* :newsgroup:`newsgroup\\n` |
| 133 |
* :program:`program\\n` |
| 134 |
* :regexp:`regexp\\n` |
| 135 |
* :menuselection:`File --> Close\\n` |
| 136 |
* :menuselection:`&File --> &Print` |
| 137 |
* :file:`a/{varpart}/b\\n` |
| 138 |
* :samp:`print {i}\\n` |
| 139 |
|
| 140 |
*Linking inline markup* |
| 141 |
|
| 142 |
* :pep:`8` |
| 143 |
* :pep:`Python Enhancement Proposal #8 <8>` |
| 144 |
* :rfc:`1` |
| 145 |
* :rfc:`Request for Comments #1 <1>` |
| 146 |
* :envvar:`HOME` |
| 147 |
* :keyword:`with` |
| 148 |
* :token:`try statement <try_stmt>` |
| 149 |
* :ref:`admonition-section` |
| 150 |
* :ref:`here <some-label>` |
| 151 |
* :ref:`there <other-label>` |
| 152 |
* :ref:`my-figure` |
| 153 |
* :ref:`my-figure-name` |
| 154 |
* :ref:`my-table` |
| 155 |
* :ref:`my-table-name` |
| 156 |
* :ref:`my-code-block` |
| 157 |
* :ref:`my-code-block-name` |
| 158 |
* :ref:`1024` |
| 159 |
* :numref:`my-figure` |
| 160 |
* :numref:`my-figure-name` |
| 161 |
* :numref:`my-table` |
| 162 |
* :numref:`my-table-name` |
| 163 |
* :numref:`my-code-block` |
| 164 |
* :numref:`my-code-block-name` |
| 165 |
* :doc:`subdir/includes` |
| 166 |
* ``:download:`` is tested in includes.txt |
| 167 |
* :option:`Python -c option <python -c>` |
| 168 |
|
| 169 |
Test :abbr:`abbr (abbreviation)` and another :abbr:`abbr (abbreviation)`. |
| 170 |
|
| 171 |
Testing the :index:`index` role, also available with |
| 172 |
:index:`explicit <pair: title; explicit>` title. |
| 173 |
|
| 174 |
.. _with: |
| 175 |
|
| 176 |
With |
| 177 |
---- |
| 178 |
|
| 179 |
(Empty section.) |
| 180 |
|
| 181 |
|
| 182 |
Tables |
| 183 |
------ |
| 184 |
|
| 185 |
.. tabularcolumns:: |*{1}{L|}p{5cm}|*{1}{R}| |
| 186 |
|
| 187 |
.. _my-table: |
| 188 |
|
| 189 |
.. table:: my table |
| 190 |
:name: my-table-name |
| 191 |
|
| 192 |
+----+----------------+----+ |
| 193 |
| 1 | * Block elems | x | |
| 194 |
| | * In table | | |
| 195 |
+----+----------------+----+ |
| 196 |
| 2 | Empty cells: | | |
| 197 |
+----+----------------+----+ |
| 198 |
|
| 199 |
.. table:: empty cell in table header |
| 200 |
|
| 201 |
===== ====== |
| 202 |
\ |
| 203 |
===== ====== |
| 204 |
1 2 |
| 205 |
3 4 |
| 206 |
===== ====== |
| 207 |
|
| 208 |
Tables with multirow and multicol: |
| 209 |
|
| 210 |
.. only:: latex |
| 211 |
|
| 212 |
+----+----------------+---------+ |
| 213 |
| 1 | test! | c | |
| 214 |
+----+---------+------+ | |
| 215 |
| 2 | col | col | | |
| 216 |
| y +---------+------+----+----+ |
| 217 |
| x | multi-column cell | x | |
| 218 |
+----+---------------------+----+ |
| 219 |
|
| 220 |
+----+ |
| 221 |
| 1 | |
| 222 |
+ + |
| 223 |
| | |
| 224 |
+----+ |
| 225 |
|
| 226 |
+---+---+ |
| 227 |
| +---+ | |
| 228 |
| | h | | |
| 229 |
| +---+ | |
| 230 |
+---+---+ |
| 231 |
|
| 232 |
.. rst-class:: longtable |
| 233 |
|
| 234 |
+---+---+ |
| 235 |
| +---+ | |
| 236 |
| | h | | |
| 237 |
| +---+ | |
| 238 |
+---+---+ |
| 239 |
|
| 240 |
.. list-table:: |
| 241 |
:header-rows: 0 |
| 242 |
|
| 243 |
* - .. figure:: img.png |
| 244 |
|
| 245 |
figure in table |
| 246 |
|
| 247 |
* - .. warning:: |
| 248 |
|
| 249 |
warning in table |
| 250 |
|
| 251 |
* - .. seealso:: |
| 252 |
|
| 253 |
figure in a seealso in a table |
| 254 |
|
| 255 |
.. figure:: img.png |
| 256 |
|
| 257 |
with a caption |
| 258 |
|
| 259 |
and a legend |
| 260 |
|
| 261 |
Figures |
| 262 |
------- |
| 263 |
|
| 264 |
.. _my-figure: |
| 265 |
|
| 266 |
.. figure:: img.png |
| 267 |
:name: my-figure-name |
| 268 |
|
| 269 |
My caption of the figure |
| 270 |
|
| 271 |
My description paragraph of the figure. |
| 272 |
|
| 273 |
Description paragraph is wrapped with legend node. |
| 274 |
|
| 275 |
.. figure:: rimg.png |
| 276 |
:align: right |
| 277 |
|
| 278 |
figure with align option |
| 279 |
|
| 280 |
.. figure:: rimg.png |
| 281 |
:align: right |
| 282 |
:figwidth: 50% |
| 283 |
|
| 284 |
figure with align & figwidth option |
| 285 |
|
| 286 |
.. figure:: rimg.png |
| 287 |
:align: right |
| 288 |
:width: 3cm |
| 289 |
|
| 290 |
figure with align & width option |
| 291 |
|
| 292 |
Version markup |
| 293 |
-------------- |
| 294 |
|
| 295 |
.. version-added:: 0.6 |
| 296 |
Some funny **stuff**. |
| 297 |
|
| 298 |
.. version-changed:: 0.6 |
| 299 |
Even more funny stuff. |
| 300 |
|
| 301 |
.. version-deprecated:: 0.6 |
| 302 |
Boring stuff. |
| 303 |
|
| 304 |
.. version-removed:: 0.6 |
| 305 |
Goodbye boring stuff. |
| 306 |
|
| 307 |
.. version-added:: 1.2 |
| 308 |
|
| 309 |
First paragraph of version-added. |
| 310 |
|
| 311 |
.. version-changed:: 1.2 |
| 312 |
First paragraph of version-changed. |
| 313 |
|
| 314 |
Second paragraph of version-changed. |
| 315 |
|
| 316 |
.. version-added:: 0.6 |
| 317 |
Deprecated alias for version-added. |
| 318 |
|
| 319 |
.. version-changed:: 0.6 |
| 320 |
Deprecated alias for version-changed. |
| 321 |
|
| 322 |
.. deprecated:: 0.6 |
| 323 |
Deprecated alias for version-deprecated. |
| 324 |
|
| 325 |
.. versionremoved:: 0.6 |
| 326 |
Deprecated alias for version-removed. |
| 327 |
|
| 328 |
Code blocks |
| 329 |
----------- |
| 330 |
|
| 331 |
.. _my-code-block: |
| 332 |
|
| 333 |
.. code-block:: ruby |
| 334 |
:linenos: |
| 335 |
:caption: my ruby code |
| 336 |
:name: my-code-block-name |
| 337 |
|
| 338 |
def ruby? |
| 339 |
false |
| 340 |
end |
| 341 |
|
| 342 |
Misc stuff |
| 343 |
---------- |
| 344 |
|
| 345 |
Stuff [#]_ |
| 346 |
|
| 347 |
Reference lookup: [Ref1]_ (defined in another file). |
| 348 |
Reference lookup underscore: [Ref_1]_ |
| 349 |
|
| 350 |
.. seealso:: something, something else, something more |
| 351 |
|
| 352 |
`Google <https://www.google.com>`_ |
| 353 |
For everything. |
| 354 |
|
| 355 |
.. hlist:: |
| 356 |
:columns: 4 |
| 357 |
|
| 358 |
* This |
| 359 |
* is |
| 360 |
* a horizontal |
| 361 |
* list |
| 362 |
* with several |
| 363 |
* items |
| 364 |
|
| 365 |
.. rubric:: Side note |
| 366 |
|
| 367 |
This is a side note. |
| 368 |
|
| 369 |
This tests :CLASS:`role names in uppercase`. |
| 370 |
|
| 371 |
.. centered:: LICENSE AGREEMENT |
| 372 |
|
| 373 |
.. acks:: |
| 374 |
|
| 375 |
* Terry Pratchett |
| 376 |
* J. R. R. Tolkien |
| 377 |
* Monty Python |
| 378 |
|
| 379 |
.. glossary:: |
| 380 |
:sorted: |
| 381 |
|
| 382 |
boson |
| 383 |
Particle with integer spin. |
| 384 |
|
| 385 |
*fermion* |
| 386 |
Particle with half-integer spin. |
| 387 |
|
| 388 |
tauon |
| 389 |
myon |
| 390 |
electron |
| 391 |
Examples for fermions. |
| 392 |
|
| 393 |
über |
| 394 |
Gewisse |
| 395 |
|
| 396 |
ähnlich |
| 397 |
Dinge |
| 398 |
|
| 399 |
.. productionlist:: |
| 400 |
try_stmt: `try1_stmt` | `try2_stmt` |
| 401 |
try1_stmt: "try" ":" `suite` |
| 402 |
: ("except" [`expression` ["," `target`]] ":" `suite`)+ |
| 403 |
: ["else" ":" `suite`] |
| 404 |
: ["finally" ":" `suite`] |
| 405 |
try2_stmt: "try" ":" `suite` |
| 406 |
: "finally" ":" `suite` |
| 407 |
|
| 408 |
|
| 409 |
Index markup |
| 410 |
------------ |
| 411 |
|
| 412 |
.. index:: |
| 413 |
single: entry |
| 414 |
pair: entry; pair |
| 415 |
double: entry; double |
| 416 |
triple: index; entry; triple |
| 417 |
see: from; to |
| 418 |
seealso: fromalso; toalso |
| 419 |
|
| 420 |
.. index:: |
| 421 |
!Main, !Other |
| 422 |
!single: entry; pair |
| 423 |
|
| 424 |
:index:`!Main` |
| 425 |
|
| 426 |
.. _ölabel: |
| 427 |
|
| 428 |
Ö... Some strange characters |
| 429 |
---------------------------- |
| 430 |
|
| 431 |
Testing öäü... |
| 432 |
|
| 433 |
|
| 434 |
Only directive |
| 435 |
-------------- |
| 436 |
|
| 437 |
.. only:: html |
| 438 |
|
| 439 |
In HTML. |
| 440 |
|
| 441 |
.. only:: latex |
| 442 |
|
| 443 |
In LaTeX. |
| 444 |
|
| 445 |
.. only:: html or latex |
| 446 |
|
| 447 |
In both. |
| 448 |
|
| 449 |
.. only:: confpytag and (testtag or nonexisting_tag) |
| 450 |
|
| 451 |
Always present, because set through conf.py/command line. |
| 452 |
|
| 453 |
|
| 454 |
Any role |
| 455 |
-------- |
| 456 |
|
| 457 |
.. default-role:: any |
| 458 |
|
| 459 |
Test referencing to `headings <with>` and `objects <func_without_body>`. |
| 460 |
Also `modules <mod>` and `classes <Time>`. |
| 461 |
|
| 462 |
More domains: |
| 463 |
|
| 464 |
* `JS <bar.baz>` |
| 465 |
* `C <SphinxType>` |
| 466 |
* `myobj` (user markup) |
| 467 |
* `n::Array` |
| 468 |
* `perl -c` |
| 469 |
|
| 470 |
.. default-role:: |
| 471 |
|
| 472 |
|
| 473 |
Smart quotes |
| 474 |
------------ |
| 475 |
|
| 476 |
* Smart "quotes" in English 'text'. |
| 477 |
* Smart --- long and -- short dashes. |
| 478 |
* Ellipsis... |
| 479 |
* No smartypants in literal blocks: ``foo--"bar"...``. |
| 480 |
|
| 481 |
.. only:: html |
| 482 |
|
| 483 |
.. LaTeX does not like Cyrillic letters in this test, so it is HTML only. |
| 484 |
|
| 485 |
.. rst-class:: language-ru |
| 486 |
|
| 487 |
Этот "абзац" должен использовать 'русские' кавычки. |
| 488 |
|
| 489 |
.. rst-class:: language-fr |
| 490 |
|
| 491 |
Il dit : "C'est 'super' !" |
| 492 |
|
| 493 |
.. rubric:: Footnotes |
| 494 |
|
| 495 |
.. [#] Like footnotes. |
| 496 |
|
| 497 |
|
| 498 |
Link in a title: `Field lists <https://www.sphinx-doc.org/en/master/usage/restructuredtext/basics.html#field-lists>`_ |
| 499 |
--------------------------------------------------------------------------------------------------------------------- |
| 500 |
|
| 501 |
Again: https://www.sphinx-doc.org/en/master/usage/restructuredtext/basics.html#field-lists |
| 502 |
------------------------------------------------------------------------------------------ |