Mercurial > hgrepos > Python > libs > pygments-lexer-pseudocode2
comparison docs/index.rst @ 125:3629bf09b30d
Much more documentation including most details of the AlgPseudocodeLexer
| author | Franz Glasner <fzglas.hg@dom66.de> |
|---|---|
| date | Wed, 06 May 2026 16:59:44 +0200 |
| parents | 1c1985532139 |
| children | e91c9dcbeb77 |
comparison
equal
deleted
inserted
replaced
| 124:f916251d5647 | 125:3629bf09b30d |
|---|---|
| 6 | 6 |
| 7 .. toctree:: | 7 .. toctree:: |
| 8 :maxdepth: 2 | 8 :maxdepth: 2 |
| 9 :caption: Contents: | 9 :caption: Contents: |
| 10 | 10 |
| 11 readme | |
| 11 details | 12 details |
| 12 | 13 |
| 14 | |
| 15 .. list-table:: | |
| 16 :align: left | |
| 17 :header-rows: 1 | |
| 18 | |
| 19 * - Language Name | |
| 20 - Description | |
| 21 - Extension(s) | |
| 22 - Aliases / Short Name(s) | |
| 23 - Lexer Class | |
| 24 | |
| 25 * - AlgPseudocode | |
| 26 - Pseudocode with inspirations from CTAN's "Algpseudocodex" | |
| 27 - \*.algpseudocode, \*.algpseudo | |
| 28 - algpseudocode, algpseudo | |
| 29 - AlgPseudocodeLexer | |
| 30 | |
| 31 * - AlgPseudocodeFR | |
| 32 - AlgPseudocode with french keyword expansion | |
| 33 - \*.algpseudo-fr, \*.algpseudocode-fr | |
| 34 - algpseudocode-fr, algpseudo-fr | |
| 35 - AlgPseudocodeLexer_FR | |
| 36 | |
| 37 * - AlgPseudocodeDE | |
| 38 - AlgPseudocode with german keyword expansion | |
| 39 - \*.algpseudo-de, \*.algpseudocode-de | |
| 40 - algpseudocode-de, algpseudo-de | |
| 41 - AlgPseudocodeLexer_DE | |
| 42 | |
| 43 * - FrPseudocode | |
| 44 - The original lexer (slightly changed) from `pygments-lexer-pseudocode` | |
| 45 - \*.fr-algo, \*.fr-pseudocode | |
| 46 - fr-pseudocode, fr-pseudo, fr-algorithm, fr-algo | |
| 47 - FrPseudocodeLexer | |
| 48 | |
| 49 To be used in Sphinx like this: | |
| 50 | |
| 51 .. code-block:: none | |
| 52 | |
| 53 .. code-block:: algpseudocode | |
| 54 | |
| 55 \PROGRAM {The Pseudoprogram} \IS | |
| 56 | |
| 57 \END PROGRAM {The Pseudoprogram} | |
| 58 | |
| 59 would be rendered as: | |
| 60 | |
| 61 .. code-block:: algpseudocode | |
| 62 | |
| 63 \PROGRAM {The Pseudoprogram} \IS | |
| 64 | |
| 65 \END PROGRAM {The Pseudoprogram} | |
| 66 | |
| 67 And the same with the german variant: | |
| 68 | |
| 69 .. code-block:: algpseudocode-de | |
| 70 | |
| 71 \PROGRAM {The Pseudoprogram} \IS | |
| 72 | |
| 73 \END PROGRAM {The Pseudoprogram} | |
| 13 | 74 |
| 14 Expressions: | 75 Expressions: |
| 15 | 76 |
| 16 - Strings (single-quote, double-quote, triple-single-quote, triple-double-quote) | 77 - Strings (single-quote, double-quote, triple-single-quote, triple-double-quote) |
| 17 - Numbers (Python style) | 78 - Numbers (Python style) |
| 20 The curly brace can be quoted with ``\}`` to not end the text mode | 81 The curly brace can be quoted with ``\}`` to not end the text mode |
| 21 | 82 |
| 22 - Names (`Name.Entity`) | 83 - Names (`Name.Entity`) |
| 23 | 84 |
| 24 .. literalinclude:: example-1.pseudocode | 85 .. literalinclude:: example-1.pseudocode |
| 25 :language: AlgPseudocode | 86 :language: algpseudocode |
| 26 :lines: 2- | 87 :lines: 2- |
| 27 | 88 |
| 28 With a customized `AlgPseudocodeLexer` and its `no_end` | 89 With a customized `AlgPseudocodeLexer` and its `no_end` |
| 29 option set to ``True``. | 90 option set to ``True``. |
| 30 | 91 |
| 46 | 107 |
| 47 This is Wikipedia's description of *Dinic's Algorithm* | 108 This is Wikipedia's description of *Dinic's Algorithm* |
| 48 (see https://en.wikipedia.org/wiki/Dinic%27s_algorithm): | 109 (see https://en.wikipedia.org/wiki/Dinic%27s_algorithm): |
| 49 | 110 |
| 50 .. literalinclude:: algorithm-dinic.description | 111 .. literalinclude:: algorithm-dinic.description |
| 51 :language: AlgPseudocode | 112 :language: algpseudocode |
| 52 :lines: 2- | 113 :lines: 2- |
| 53 | 114 |
| 54 This is Wikipedia's pseudocode of the *Ford–Fulkerson Algorithm* | 115 This is Wikipedia's pseudocode of the *Ford–Fulkerson Algorithm* |
| 55 (see https://en.wikipedia.org/wiki/Ford%E2%80%93Fulkerson_algorithm): | 116 (see https://en.wikipedia.org/wiki/Ford%E2%80%93Fulkerson_algorithm): |
| 56 | 117 |
| 57 .. literalinclude:: algorithm-ford-fulkerson.pseudocode | 118 .. literalinclude:: algorithm-ford-fulkerson.pseudocode |
| 58 :language: AlgPseudocode | 119 :language: algpseudocode |
| 59 :lines: 2- | 120 :lines: 2- |
| 60 | 121 |
| 61 This is Wikipedia's pseudocode of the *Edmonds–Karp Algorithm* | 122 This is Wikipedia's pseudocode of the *Edmonds–Karp Algorithm* |
| 62 (see https://en.wikipedia.org/wiki/Edmonds%E2%80%93Karp_algorithm): | 123 (see https://en.wikipedia.org/wiki/Edmonds%E2%80%93Karp_algorithm): |
| 63 | 124 |
| 64 .. literalinclude:: algorithm-edmonds-karp.pseudocode | 125 .. literalinclude:: algorithm-edmonds-karp.pseudocode |
| 65 :language: NoEndAlgPseudocode | 126 :language: NoEndAlgPseudocode |
| 66 :lines: 2- | 127 :lines: 2- |
| 67 | 128 |
| 68 .. todo:: | 129 And now the *Edmonds–Karp Algorithm* with french keywords: |
| 69 | 130 |
| 70 Note how | 131 .. literalinclude:: algorithm-edmonds-karp.pseudocode |
| 71 https://stackoverflow.com/questions/11413203/sphinx-pygments-lexer-filter-extension | 132 :language: algpseudocode-fr |
| 72 documents dynamic lexer and style creation for Pygments within Sphinx. | 133 :lines: 2- |
| 73 | |
| 74 Examples: | |
| 75 | |
| 76 - Load lexers with some custom (init) options | |
| 77 - Dynamically create new lexers, styles, formatters or filters | |
| 78 | |
| 79 .. todolist:: | |
| 80 | 134 |
| 81 | 135 |
| 82 Indices and tables | 136 Indices and tables |
| 83 ================== | 137 ================== |
| 84 | 138 |
