Mercurial > hgrepos > Python > libs > pygments-lexer-pseudocode2
annotate docs/conf.py @ 119:9be446a43b81
Wording in comment
| author | Franz Glasner <fzglas.hg@dom66.de> |
|---|---|
| date | Wed, 06 May 2026 15:16:48 +0200 |
| parents | a861ac4d11fc |
| children | a3ed7d8231d7 |
| rev | line source |
|---|---|
|
45
6ac1ea5d2d4a
Begin documentation: add the Sphinx generated configuration as-is
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff
changeset
|
1 # Configuration file for the Sphinx documentation builder. |
|
6ac1ea5d2d4a
Begin documentation: add the Sphinx generated configuration as-is
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff
changeset
|
2 # |
|
6ac1ea5d2d4a
Begin documentation: add the Sphinx generated configuration as-is
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff
changeset
|
3 # For the full list of built-in configuration values, see the documentation: |
|
6ac1ea5d2d4a
Begin documentation: add the Sphinx generated configuration as-is
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff
changeset
|
4 # https://www.sphinx-doc.org/en/master/usage/configuration.html |
|
6ac1ea5d2d4a
Begin documentation: add the Sphinx generated configuration as-is
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff
changeset
|
5 |
|
49
5c0f26a21e81
Determine "release" dynamically from the package's "__version__"
Franz Glasner <fzglas.hg@dom66.de>
parents:
48
diff
changeset
|
6 import ast |
|
63
414bf3cbb152
Add a custom lexer to the Sphinx application dynamically with "no_end" set to True
Franz Glasner <fzglas.hg@dom66.de>
parents:
60
diff
changeset
|
7 import functools |
|
49
5c0f26a21e81
Determine "release" dynamically from the package's "__version__"
Franz Glasner <fzglas.hg@dom66.de>
parents:
48
diff
changeset
|
8 import io |
|
63
414bf3cbb152
Add a custom lexer to the Sphinx application dynamically with "no_end" set to True
Franz Glasner <fzglas.hg@dom66.de>
parents:
60
diff
changeset
|
9 import os |
|
414bf3cbb152
Add a custom lexer to the Sphinx application dynamically with "no_end" set to True
Franz Glasner <fzglas.hg@dom66.de>
parents:
60
diff
changeset
|
10 import sys |
|
49
5c0f26a21e81
Determine "release" dynamically from the package's "__version__"
Franz Glasner <fzglas.hg@dom66.de>
parents:
48
diff
changeset
|
11 import re |
|
5c0f26a21e81
Determine "release" dynamically from the package's "__version__"
Franz Glasner <fzglas.hg@dom66.de>
parents:
48
diff
changeset
|
12 |
|
63
414bf3cbb152
Add a custom lexer to the Sphinx application dynamically with "no_end" set to True
Franz Glasner <fzglas.hg@dom66.de>
parents:
60
diff
changeset
|
13 sys.path.insert(0, os.path.dirname(os.path.abspath('.'))) |
|
414bf3cbb152
Add a custom lexer to the Sphinx application dynamically with "no_end" set to True
Franz Glasner <fzglas.hg@dom66.de>
parents:
60
diff
changeset
|
14 |
|
68
93ade4c595b7
Reorg conf.py: import globally
Franz Glasner <fzglas.hg@dom66.de>
parents:
63
diff
changeset
|
15 from pygments_lexer_pseudocode2.algpseudocode import AlgPseudocodeLexer |
|
93ade4c595b7
Reorg conf.py: import globally
Franz Glasner <fzglas.hg@dom66.de>
parents:
63
diff
changeset
|
16 |
|
93ade4c595b7
Reorg conf.py: import globally
Franz Glasner <fzglas.hg@dom66.de>
parents:
63
diff
changeset
|
17 |
|
45
6ac1ea5d2d4a
Begin documentation: add the Sphinx generated configuration as-is
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff
changeset
|
18 # -- Project information ----------------------------------------------------- |
|
6ac1ea5d2d4a
Begin documentation: add the Sphinx generated configuration as-is
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff
changeset
|
19 # https://www.sphinx-doc.org/en/master/usage/configuration.html#project-information |
|
6ac1ea5d2d4a
Begin documentation: add the Sphinx generated configuration as-is
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff
changeset
|
20 |
|
6ac1ea5d2d4a
Begin documentation: add the Sphinx generated configuration as-is
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff
changeset
|
21 project = 'Pygments Pseudocode Lexer' |
|
118
a861ac4d11fc
Extend the copyright to Simon Wachter in the docs
Franz Glasner <fzglas.hg@dom66.de>
parents:
68
diff
changeset
|
22 copyright = '2026 Franz Glasner. © Copyright 2015 Simon Wachter' |
|
45
6ac1ea5d2d4a
Begin documentation: add the Sphinx generated configuration as-is
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff
changeset
|
23 author = 'Franz Glasner' |
|
49
5c0f26a21e81
Determine "release" dynamically from the package's "__version__"
Franz Glasner <fzglas.hg@dom66.de>
parents:
48
diff
changeset
|
24 # Determine "release" dynamically from the package's "__version__" |
|
5c0f26a21e81
Determine "release" dynamically from the package's "__version__"
Franz Glasner <fzglas.hg@dom66.de>
parents:
48
diff
changeset
|
25 with io.open("../pygments_lexer_pseudocode2/__init__.py", |
|
5c0f26a21e81
Determine "release" dynamically from the package's "__version__"
Franz Glasner <fzglas.hg@dom66.de>
parents:
48
diff
changeset
|
26 "rt", |
|
5c0f26a21e81
Determine "release" dynamically from the package's "__version__"
Franz Glasner <fzglas.hg@dom66.de>
parents:
48
diff
changeset
|
27 encoding="utf-8") as relfp: |
|
5c0f26a21e81
Determine "release" dynamically from the package's "__version__"
Franz Glasner <fzglas.hg@dom66.de>
parents:
48
diff
changeset
|
28 release = ast.literal_eval( |
|
5c0f26a21e81
Determine "release" dynamically from the package's "__version__"
Franz Glasner <fzglas.hg@dom66.de>
parents:
48
diff
changeset
|
29 re.search(r"""^\s*__version__\s*=\s*(("|')[^"']*\2)""", |
|
5c0f26a21e81
Determine "release" dynamically from the package's "__version__"
Franz Glasner <fzglas.hg@dom66.de>
parents:
48
diff
changeset
|
30 relfp.read(), |
|
5c0f26a21e81
Determine "release" dynamically from the package's "__version__"
Franz Glasner <fzglas.hg@dom66.de>
parents:
48
diff
changeset
|
31 re.MULTILINE) |
|
5c0f26a21e81
Determine "release" dynamically from the package's "__version__"
Franz Glasner <fzglas.hg@dom66.de>
parents:
48
diff
changeset
|
32 .group(1) |
|
5c0f26a21e81
Determine "release" dynamically from the package's "__version__"
Franz Glasner <fzglas.hg@dom66.de>
parents:
48
diff
changeset
|
33 ) |
|
51
b4c255f8bdc4
Also define "version" (identical to "release" yet)
Franz Glasner <fzglas.hg@dom66.de>
parents:
50
diff
changeset
|
34 version = release |
|
b4c255f8bdc4
Also define "version" (identical to "release" yet)
Franz Glasner <fzglas.hg@dom66.de>
parents:
50
diff
changeset
|
35 del relfp |
|
45
6ac1ea5d2d4a
Begin documentation: add the Sphinx generated configuration as-is
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff
changeset
|
36 |
|
60
0ff291eac663
Minimal Sphinx configuration for the first tests
Franz Glasner <fzglas.hg@dom66.de>
parents:
51
diff
changeset
|
37 |
|
45
6ac1ea5d2d4a
Begin documentation: add the Sphinx generated configuration as-is
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff
changeset
|
38 # -- General configuration --------------------------------------------------- |
|
6ac1ea5d2d4a
Begin documentation: add the Sphinx generated configuration as-is
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff
changeset
|
39 # https://www.sphinx-doc.org/en/master/usage/configuration.html#general-configuration |
|
6ac1ea5d2d4a
Begin documentation: add the Sphinx generated configuration as-is
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff
changeset
|
40 |
|
60
0ff291eac663
Minimal Sphinx configuration for the first tests
Franz Glasner <fzglas.hg@dom66.de>
parents:
51
diff
changeset
|
41 extensions = [ |
|
0ff291eac663
Minimal Sphinx configuration for the first tests
Franz Glasner <fzglas.hg@dom66.de>
parents:
51
diff
changeset
|
42 "sphinx.ext.todo", |
|
0ff291eac663
Minimal Sphinx configuration for the first tests
Franz Glasner <fzglas.hg@dom66.de>
parents:
51
diff
changeset
|
43 ] |
|
45
6ac1ea5d2d4a
Begin documentation: add the Sphinx generated configuration as-is
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff
changeset
|
44 |
|
6ac1ea5d2d4a
Begin documentation: add the Sphinx generated configuration as-is
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff
changeset
|
45 templates_path = ['_templates'] |
|
6ac1ea5d2d4a
Begin documentation: add the Sphinx generated configuration as-is
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff
changeset
|
46 exclude_patterns = ['_build', 'Thumbs.db', '.DS_Store'] |
|
6ac1ea5d2d4a
Begin documentation: add the Sphinx generated configuration as-is
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff
changeset
|
47 |
|
60
0ff291eac663
Minimal Sphinx configuration for the first tests
Franz Glasner <fzglas.hg@dom66.de>
parents:
51
diff
changeset
|
48 |
|
0ff291eac663
Minimal Sphinx configuration for the first tests
Franz Glasner <fzglas.hg@dom66.de>
parents:
51
diff
changeset
|
49 # --- Options for todo extension --------------------------------------------- |
|
0ff291eac663
Minimal Sphinx configuration for the first tests
Franz Glasner <fzglas.hg@dom66.de>
parents:
51
diff
changeset
|
50 todo_include_todos = True |
|
45
6ac1ea5d2d4a
Begin documentation: add the Sphinx generated configuration as-is
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff
changeset
|
51 |
|
6ac1ea5d2d4a
Begin documentation: add the Sphinx generated configuration as-is
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff
changeset
|
52 |
|
6ac1ea5d2d4a
Begin documentation: add the Sphinx generated configuration as-is
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff
changeset
|
53 # -- Options for HTML output ------------------------------------------------- |
|
6ac1ea5d2d4a
Begin documentation: add the Sphinx generated configuration as-is
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff
changeset
|
54 # https://www.sphinx-doc.org/en/master/usage/configuration.html#options-for-html-output |
|
6ac1ea5d2d4a
Begin documentation: add the Sphinx generated configuration as-is
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff
changeset
|
55 |
|
6ac1ea5d2d4a
Begin documentation: add the Sphinx generated configuration as-is
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff
changeset
|
56 html_theme = 'alabaster' |
|
60
0ff291eac663
Minimal Sphinx configuration for the first tests
Franz Glasner <fzglas.hg@dom66.de>
parents:
51
diff
changeset
|
57 html_theme = 'haiku' |
|
45
6ac1ea5d2d4a
Begin documentation: add the Sphinx generated configuration as-is
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff
changeset
|
58 html_static_path = ['_static'] |
|
60
0ff291eac663
Minimal Sphinx configuration for the first tests
Franz Glasner <fzglas.hg@dom66.de>
parents:
51
diff
changeset
|
59 #pygments_style = "sphinx" |
|
0ff291eac663
Minimal Sphinx configuration for the first tests
Franz Glasner <fzglas.hg@dom66.de>
parents:
51
diff
changeset
|
60 pygments_style = "default" |
|
63
414bf3cbb152
Add a custom lexer to the Sphinx application dynamically with "no_end" set to True
Franz Glasner <fzglas.hg@dom66.de>
parents:
60
diff
changeset
|
61 |
|
414bf3cbb152
Add a custom lexer to the Sphinx application dynamically with "no_end" set to True
Franz Glasner <fzglas.hg@dom66.de>
parents:
60
diff
changeset
|
62 |
|
414bf3cbb152
Add a custom lexer to the Sphinx application dynamically with "no_end" set to True
Franz Glasner <fzglas.hg@dom66.de>
parents:
60
diff
changeset
|
63 def setup(app): |
|
68
93ade4c595b7
Reorg conf.py: import globally
Franz Glasner <fzglas.hg@dom66.de>
parents:
63
diff
changeset
|
64 # |
|
63
414bf3cbb152
Add a custom lexer to the Sphinx application dynamically with "no_end" set to True
Franz Glasner <fzglas.hg@dom66.de>
parents:
60
diff
changeset
|
65 # Add a custom lexer: AlgPseudocodeLexer with custom init option "no_end" |
| 119 | 66 # Given lexer must be callable: so use an indirection with "partial" |
|
68
93ade4c595b7
Reorg conf.py: import globally
Franz Glasner <fzglas.hg@dom66.de>
parents:
63
diff
changeset
|
67 # |
|
63
414bf3cbb152
Add a custom lexer to the Sphinx application dynamically with "no_end" set to True
Franz Glasner <fzglas.hg@dom66.de>
parents:
60
diff
changeset
|
68 app.add_lexer("NoEndAlgPseudocode", |
|
414bf3cbb152
Add a custom lexer to the Sphinx application dynamically with "no_end" set to True
Franz Glasner <fzglas.hg@dom66.de>
parents:
60
diff
changeset
|
69 functools.partial(AlgPseudocodeLexer, no_end=True)) |
