view docs/index.rst @ 121:a3ed7d8231d7

Comment
author Franz Glasner <fzglas.hg@dom66.de>
date Wed, 06 May 2026 15:39:03 +0200
parents 1c1985532139
children 3629bf09b30d
line wrap: on
line source

.. -*- coding: utf-8; indent-tabs-mode: nil; -*-


The Pygments Pseudocode Lexer
=============================

.. toctree::
   :maxdepth: 2
   :caption: Contents:

   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::


Indices and tables
==================

.. * :ref:`genindex`
.. * :ref:`modindex`

* :ref:`search`