Mercurial > hgrepos > Python > libs > pygments-lexer-pseudocode2
comparison docs/intro.rst @ 166:6a7dace0141e
Also implement filters to replace tokens in a token stream: TokenReplaceFilter and ErrorToGenericErrorTokenFilter
| author | Franz Glasner <fzglas.hg@dom66.de> |
|---|---|
| date | Fri, 08 May 2026 23:54:06 +0200 |
| parents | a4317957148b |
| children |
comparison
equal
deleted
inserted
replaced
| 165:88f872c50aae | 166:6a7dace0141e |
|---|---|
| 1 .. -*- coding: utf-8; indent-tabs-mode: nil; -*- | 1 .. -*- coding: utf-8; indent-tabs-mode: nil; -*- |
| 2 | 2 |
| 3 | 3 |
| 4 ************** | 4 ************** |
| 5 Introduction | 5 Introduction |
| 6 ************** | 6 ************** |
| 7 | |
| 8 Lexer | |
| 9 ===== | |
| 7 | 10 |
| 8 The package contains the following lexers: | 11 The package contains the following lexers: |
| 9 | 12 |
| 10 .. include:: lexerlist.rst | 13 .. include:: lexerlist.rst |
| 11 | 14 |
| 127 | 130 |
| 128 And again the *Edmonds–Karp Algorithm* with german keywords: | 131 And again the *Edmonds–Karp Algorithm* with german keywords: |
| 129 | 132 |
| 130 .. literalinclude:: examples/algorithm-edmonds-karp.pseudocode | 133 .. literalinclude:: examples/algorithm-edmonds-karp.pseudocode |
| 131 :language: algpseudocode-de | 134 :language: algpseudocode-de |
| 132 :lines: 2- | 135 :lines: 2- |
| 133 | 136 |
| 134 More details you will find :ref:`here <details-algpseudocode>`. | 137 More details you will find :ref:`here <details-algpseudocode>`. |
| 138 | |
| 139 | |
| 140 Filter | |
| 141 ====== | |
| 142 | |
| 143 The package contains the following filters: | |
| 144 | |
| 145 .. include:: filterlist.rst | |
| 146 | |
| 147 The AlgPseudocode lexer yields an error token for the following code block. | |
| 148 `Sphinx`_ therefore suppresses highlighting completely: | |
| 149 | |
| 150 .. code-block:: none | |
| 151 | |
| 152 \EXPR{TEST} | |
| 153 | |
| 154 With a custom AlgPseudocode lexer that has ``prohibit_raiseonerror_filter`` | |
| 155 activated the output in `Sphinx`_ is as: | |
| 156 | |
| 157 .. code-block:: no-raiseonerror-algpseudocode | |
| 158 | |
| 159 \EXPR{TEST} | |
| 160 | |
| 161 | |
| 162 With the "errortogenericerror" filter the very same block is highlighted | |
| 163 as: | |
| 164 | |
| 165 .. code-block:: genericerror-algpseudocode | |
| 166 | |
| 167 \EXPR{TEST} |
