Mercurial > hgrepos > Python > libs > pygments-lexer-pseudocode2
diff 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 |
line wrap: on
line diff
--- a/docs/index.rst Mon May 04 16:40:13 2026 +0200 +++ b/docs/index.rst Mon May 04 16:57:17 2026 +0200 @@ -8,8 +8,73 @@ :maxdepth: 2 :caption: Contents: - details + details + + +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- + +.. todo:: + + Note how + https://stackoverflow.com/questions/11413203/sphinx-pygments-lexer-filter-extension + documents dynamic lexer and style creation for Pygments within Sphinx. + + Examples: + + - Load lexers with some custom (init) options + - Dynamically create new lexers, styles, formatters or filters .. todolist::
