Restart repo
This commit is contained in:
214
sphinx/syntax.rst
Normal file
214
sphinx/syntax.rst
Normal file
@@ -0,0 +1,214 @@
|
||||
..
|
||||
Copyright (C) 2023 Jeremie Salvi.
|
||||
Permission is granted to copy, distribute and/or modify this document
|
||||
under the terms of the GNU Free Documentation License, Version 1.3
|
||||
or any later version published by the Free Software Foundation;
|
||||
with no Invariant Sections, no Front-Cover Texts, and no Back-Cover Texts.
|
||||
A copy of the license is included in the section entitled "GNU
|
||||
Free Documentation License".
|
||||
|
||||
La syntaxe reStructuredText
|
||||
===========================
|
||||
|
||||
Les titres
|
||||
----------
|
||||
|
||||
Les liens
|
||||
---------
|
||||
|
||||
.. code-block:: rst
|
||||
|
||||
`ReSrtucturedText <https://docutils.sourceforge.io/rst.html>`_
|
||||
|
||||
Resultat :
|
||||
|
||||
`ReSrtucturedText <https://docutils.sourceforge.io/rst.html>`_
|
||||
|
||||
Les listes
|
||||
----------
|
||||
|
||||
.. code-block:: rst
|
||||
|
||||
Bullet lists:
|
||||
|
||||
- This is item 1
|
||||
- This is item 2
|
||||
|
||||
Resultat :
|
||||
|
||||
Bullet lists:
|
||||
|
||||
- This is item 1
|
||||
- This is item 2
|
||||
|
||||
.. code-block:: rst
|
||||
|
||||
Enumerated lists:
|
||||
|
||||
3. This is the first item
|
||||
4. This is the second item
|
||||
#. Auto ennumerated item
|
||||
|
||||
Resultat :
|
||||
|
||||
Enumerated lists:
|
||||
|
||||
3. This is the first item
|
||||
4. This is the second item
|
||||
#. Auto ennumerated item
|
||||
|
||||
Plus d'infos `ici <https://docutils.sourceforge.io/docs/user/rst/quickref.html#bullet-lists>`_.
|
||||
|
||||
Les blocs
|
||||
---------
|
||||
|
||||
.. code-block:: rst
|
||||
|
||||
.. error:: text
|
||||
|
||||
Resultat :
|
||||
|
||||
.. error:: text
|
||||
|
||||
.. code-block:: rst
|
||||
|
||||
.. warning:: text
|
||||
|
||||
Resultat :
|
||||
|
||||
.. warning:: text
|
||||
|
||||
.. code-block:: rst
|
||||
|
||||
.. note:: text
|
||||
|
||||
Resultat :
|
||||
|
||||
.. note:: text
|
||||
|
||||
.. code-block:: rst
|
||||
|
||||
.. tip:: text
|
||||
|
||||
Resultat :
|
||||
|
||||
.. tip:: text
|
||||
|
||||
.. code-block:: rst
|
||||
|
||||
.. important:: text
|
||||
|
||||
Resultat :
|
||||
|
||||
.. important:: text
|
||||
|
||||
Les Maths
|
||||
---------
|
||||
|
||||
.. code-block:: rst
|
||||
|
||||
.. math::
|
||||
(a + b)^2 = a^2 + 2ab + b^2 \\
|
||||
= a^2 - 2ab + b^2
|
||||
|
||||
Resultat :
|
||||
|
||||
.. math::
|
||||
(a + b)^2 = a^2 + 2ab + b^2 \\
|
||||
= a^2 - 2ab + b^2
|
||||
|
||||
Plus d'infos sur ce bloc `ici <https://www.sphinx-doc.org/en/master/usage/restructuredtext/directives.html#math>`_.
|
||||
|
||||
Le code
|
||||
-------
|
||||
|
||||
analysé avec la librairie `Pygments <https://pygments.org/>`_. Pour en
|
||||
savoir plus sur son utilisation et les langages supportés, c'est `ici <https://pygments.org/languages/>`_
|
||||
|
||||
Code "inline"
|
||||
~~~~~~~~~~~~~
|
||||
|
||||
Le code "inline" est un génère un objet html <inline> qui s'intègre dans le texte comme ``ceci``
|
||||
|
||||
.. code-block:: rst
|
||||
|
||||
``code``
|
||||
|
||||
Resultat :
|
||||
|
||||
``code``
|
||||
|
||||
Code "block"
|
||||
~~~~~~~~~~~~
|
||||
|
||||
Le code "block" génère un bojet html <block>. La syntaxe rst est la suivante :
|
||||
|
||||
.. code-block:: rst
|
||||
|
||||
.. code-block:: bash
|
||||
:linenos:
|
||||
:lineno-start: 5
|
||||
:caption: caption
|
||||
:name: a label
|
||||
:emphasize-lines: 2,6
|
||||
|
||||
#!/bin/bash
|
||||
function start() {
|
||||
while :
|
||||
do
|
||||
discord --no-sandbox $1
|
||||
done
|
||||
}
|
||||
|
||||
.. code-block:: bash
|
||||
:linenos:
|
||||
:lineno-start: 5
|
||||
:caption: a caption
|
||||
:name: a label
|
||||
:emphasize-lines: 2,6
|
||||
|
||||
#!/bin/bash
|
||||
function start() {
|
||||
while :
|
||||
do
|
||||
discord --no-sandbox $1
|
||||
done
|
||||
}
|
||||
|
||||
| Les paramètres ne sont pas très compliqués :
|
||||
| ``:lineos:`` : affiche les numéros de ligne
|
||||
| ``:linestart: number`` : affiche les numéros de ligne
|
||||
| ``:caption: string`` : affiche un titre au bloc de code
|
||||
| ``:name: string`` : ???
|
||||
| ``:emphasize-lines: number list coma separated`` : met en surbrillance les lignes renseignées par cette option
|
||||
|
||||
Inclure un fichier de Code
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
|
||||
On peut avec Sphinx inclure un fichier de code dans in bloc.
|
||||
Ici, j'inclus le code de cette page dans un bloc de code rst
|
||||
|
||||
.. code-block:: rst
|
||||
|
||||
.. literalinclude:: syntax.rst
|
||||
:language: rst
|
||||
|
||||
Resultat :
|
||||
|
||||
.. literalinclude:: syntax.rst
|
||||
:language: rst
|
||||
|
||||
Les images
|
||||
----------
|
||||
|
||||
.. code-block:: rst
|
||||
|
||||
.. image:: ../images/example_image.png
|
||||
:width: 400
|
||||
:alt: Alternative text
|
||||
|
||||
Resultat :
|
||||
|
||||
.. image:: ../images/example_image.png
|
||||
:width: 400
|
||||
:alt: Alternative text
|
||||
Reference in New Issue
Block a user