Mercurial > hgrepos > Python > libs > pygments-lexer-pseudocode2
diff docs/intro.rst @ 140:e424fcdd472f
REFACTOR: Change the structure of the documentation: make the README the first page.
Make the old "index" an intro.
| author | Franz Glasner <fzglas.hg@dom66.de> |
|---|---|
| date | Thu, 07 May 2026 10:03:32 +0200 |
| parents | docs/index.rst@69283c05ba48 |
| children | acd9073cbbe3 |
line wrap: on
line diff
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/docs/intro.rst Thu May 07 10:03:32 2026 +0200 @@ -0,0 +1,127 @@ +.. -*- coding: utf-8; indent-tabs-mode: nil; -*- + + +Introduction +============ + +The package contains the following lexers: + +.. list-table:: + :align: left + :header-rows: 1 + + * - Language Name + - Description + - Extension(s) + - Aliases / Short Name(s) + - Lexer Class + + * - AlgPseudocode + - Pseudocode lexer heavily inspired by CTAN's "Algpseudocodex" + - \*.algpseudocode, \*.algpseudo + - algpseudocode, algpseudo + - AlgPseudocodeLexer + + * - AlgPseudocodeFR + - AlgPseudocode with french keyword expansion + - \*.algpseudo-fr, \*.algpseudocode-fr + - algpseudocode-fr, algpseudo-fr + - AlgPseudocodeLexer_FR + + * - AlgPseudocodeDE + - AlgPseudocode with german keyword expansion + - \*.algpseudo-de, \*.algpseudocode-de + - algpseudocode-de, algpseudo-de + - AlgPseudocodeLexer_DE + + * - FrPseudocode + - The original lexer (slightly changed) from `pygments-lexer-pseudocode` + - \*.fr-algo, \*.fr-pseudocode + - fr-pseudocode, fr-pseudo, fr-algorithm, fr-algo + - FrPseudocodeLexer + +They may be used in Sphinx by their aliases: + +.. code-block:: none + + .. code-block:: algpseudocode + + \PROGRAM {The Pseudoprogram} \IS + + \END PROGRAM {The Pseudoprogram} + +It will be rendered as: + +.. code-block:: algpseudocode + + \PROGRAM {The Pseudoprogram} \IS + + \END PROGRAM {The Pseudoprogram} + +And the same with the german variant: + +.. code-block:: algpseudocode-de + + \PROGRAM {The Pseudoprogram} \IS + + \END PROGRAM {The Pseudoprogram} + +Expressions: + +- Strings (single-quote, double-quote, triple-single-quote, triple-double-quote) +- Numbers (Python style) +- ``\TEXT{...}`` + + The curly brace can be quoted with ``\}`` to not end the text mode + +- Names (`Name.Entity`) + +.. literalinclude:: example-1.pseudocode + :language: algpseudocode + :lines: 2- + +With a customized `AlgPseudocodeLexer` and its `no_end` +option set to ``True``. + +.. literalinclude:: example-1.pseudocode + :language: NoEndAlgPseudocode + :lines: 2- + +Python: + +.. code-block:: python + + class HUHU: + + # This is a comment + @classmethod + def method1(cls_, aparam1, param2): + return aparam1 + param2 + + +This is Wikipedia's description of *Dinic's Algorithm* +(see https://en.wikipedia.org/wiki/Dinic%27s_algorithm): + +.. literalinclude:: algorithm-dinic.description + :language: algpseudocode + :lines: 2- + +This is Wikipedia's pseudocode of the *Ford–Fulkerson Algorithm* +(see https://en.wikipedia.org/wiki/Ford%E2%80%93Fulkerson_algorithm): + +.. literalinclude:: algorithm-ford-fulkerson.pseudocode + :language: algpseudocode + :lines: 2- + +This is Wikipedia's pseudocode of the *Edmonds–Karp Algorithm* +(see https://en.wikipedia.org/wiki/Edmonds%E2%80%93Karp_algorithm): + +.. literalinclude:: algorithm-edmonds-karp.pseudocode + :language: NoEndAlgPseudocode + :lines: 2- + +And now the *Edmonds–Karp Algorithm* with french keywords: + +.. literalinclude:: algorithm-edmonds-karp.pseudocode + :language: algpseudocode-fr + :lines: 2-
