Mercurial > hgrepos > Python > libs > pygments-lexer-pseudocode2
comparison docs/index.rst @ 107:1c1985532139
A couple of real pseudocode examples.
Examples are from the Wikipedia.
| author | Franz Glasner <fzglas.hg@dom66.de> |
|---|---|
| date | Mon, 04 May 2026 16:57:17 +0200 |
| parents | 0c05dc09c9e2 |
| children | 3629bf09b30d |
comparison
equal
deleted
inserted
replaced
| 106:f6b46a379aba | 107:1c1985532139 |
|---|---|
| 6 | 6 |
| 7 .. toctree:: | 7 .. toctree:: |
| 8 :maxdepth: 2 | 8 :maxdepth: 2 |
| 9 :caption: Contents: | 9 :caption: Contents: |
| 10 | 10 |
| 11 details | 11 details |
| 12 | 12 |
| 13 | |
| 14 Expressions: | |
| 15 | |
| 16 - Strings (single-quote, double-quote, triple-single-quote, triple-double-quote) | |
| 17 - Numbers (Python style) | |
| 18 - ``\TEXT{...}`` | |
| 19 | |
| 20 The curly brace can be quoted with ``\}`` to not end the text mode | |
| 21 | |
| 22 - Names (`Name.Entity`) | |
| 23 | |
| 24 .. literalinclude:: example-1.pseudocode | |
| 25 :language: AlgPseudocode | |
| 26 :lines: 2- | |
| 27 | |
| 28 With a customized `AlgPseudocodeLexer` and its `no_end` | |
| 29 option set to ``True``. | |
| 30 | |
| 31 .. literalinclude:: example-1.pseudocode | |
| 32 :language: NoEndAlgPseudocode | |
| 33 :lines: 2- | |
| 34 | |
| 35 Python: | |
| 36 | |
| 37 .. code-block:: python | |
| 38 | |
| 39 class HUHU: | |
| 40 | |
| 41 # This is a comment | |
| 42 @classmethod | |
| 43 def method1(cls_, aparam1, param2): | |
| 44 return aparam1 + param2 | |
| 45 | |
| 46 | |
| 47 This is Wikipedia's description of *Dinic's Algorithm* | |
| 48 (see https://en.wikipedia.org/wiki/Dinic%27s_algorithm): | |
| 49 | |
| 50 .. literalinclude:: algorithm-dinic.description | |
| 51 :language: AlgPseudocode | |
| 52 :lines: 2- | |
| 53 | |
| 54 This is Wikipedia's pseudocode of the *Ford–Fulkerson Algorithm* | |
| 55 (see https://en.wikipedia.org/wiki/Ford%E2%80%93Fulkerson_algorithm): | |
| 56 | |
| 57 .. literalinclude:: algorithm-ford-fulkerson.pseudocode | |
| 58 :language: AlgPseudocode | |
| 59 :lines: 2- | |
| 60 | |
| 61 This is Wikipedia's pseudocode of the *Edmonds–Karp Algorithm* | |
| 62 (see https://en.wikipedia.org/wiki/Edmonds%E2%80%93Karp_algorithm): | |
| 63 | |
| 64 .. literalinclude:: algorithm-edmonds-karp.pseudocode | |
| 65 :language: NoEndAlgPseudocode | |
| 66 :lines: 2- | |
| 67 | |
| 68 .. todo:: | |
| 69 | |
| 70 Note how | |
| 71 https://stackoverflow.com/questions/11413203/sphinx-pygments-lexer-filter-extension | |
| 72 documents dynamic lexer and style creation for Pygments within Sphinx. | |
| 73 | |
| 74 Examples: | |
| 75 | |
| 76 - Load lexers with some custom (init) options | |
| 77 - Dynamically create new lexers, styles, formatters or filters | |
| 13 | 78 |
| 14 .. todolist:: | 79 .. todolist:: |
| 15 | 80 |
| 16 | 81 |
| 17 Indices and tables | 82 Indices and tables |
