Mercurial > hgrepos > Python > libs > pygments-lexer-pseudocode2
comparison docs/conf.py @ 213:d470250f8451
Title/metadata of PDF documentation builds:
- make the printet "normal" date also a revision date
- print an extra line with creation date and the revision number
| author | Franz Glasner <fzglas.hg@dom66.de> |
|---|---|
| date | Fri, 15 May 2026 05:15:59 +0200 |
| parents | ae0f6dda6e49 |
| children | 8ef73270beae |
comparison
equal
deleted
inserted
replaced
| 212:18553f595b34 | 213:d470250f8451 |
|---|---|
| 31 | 31 |
| 32 Currently really built and tested with Sphinx 7.1.2. | 32 Currently really built and tested with Sphinx 7.1.2. |
| 33 | 33 |
| 34 """ | 34 """ |
| 35 | 35 |
| 36 today = datetime.date.today().isoformat() | 36 current_date = datetime.date.today().isoformat() |
| 37 | 37 |
| 38 master_doc = "index" | 38 master_doc = "index" |
| 39 | 39 |
| 40 # -- Project information ----------------------------------------------------- | 40 # -- Project information ----------------------------------------------------- |
| 41 # https://www.sphinx-doc.org/en/master/usage/configuration.html#project-information | 41 # https://www.sphinx-doc.org/en/master/usage/configuration.html#project-information |
| 53 verfiledata = relfp.read() | 53 verfiledata = relfp.read() |
| 54 release = ast.literal_eval( | 54 release = ast.literal_eval( |
| 55 re.search(r"""^\s*__version__\s*=\s*(("|')[^"']*\2)""", | 55 re.search(r"""^\s*__version__\s*=\s*(("|')[^"']*\2)""", |
| 56 verfiledata, | 56 verfiledata, |
| 57 re.MULTILINE).group(1)) | 57 re.MULTILINE).group(1)) |
| 58 release_date = ( | 58 release_date = today = ( |
| 59 ast.literal_eval( | 59 ast.literal_eval( |
| 60 re.search(r"""^\s*__date__\s*=\s*(("|')[^"']*\2)""", | 60 re.search(r"""^\s*__date__\s*=\s*(("|')[^"']*\2)""", |
| 61 verfiledata, | 61 verfiledata, |
| 62 re.MULTILINE).group(1)) | 62 re.MULTILINE).group(1)) |
| 63 or "dev:%s" % (today,) | 63 or "dev:%s" % (current_date,) |
| 64 ) | 64 ) |
| 65 release_rev = ast.literal_eval( | 65 release_rev = ast.literal_eval( |
| 66 re.search(r"""^\s*__revision__\s*=\s*(("|')[^"']*\2)""", | 66 re.search(r"""^\s*__revision__\s*=\s*(("|')[^"']*\2)""", |
| 67 verfiledata, | 67 verfiledata, |
| 68 re.MULTILINE).group(1)) | 68 re.MULTILINE).group(1)) |
| 69 if release_rev.startswith("|") or release_rev.endswith("|"): | 69 if release_rev.startswith("|") or release_rev.endswith("|"): |
| 70 # Assume that make export (hg kwarchive) is not called. | 70 # Assume that make export (hg kwarchive) may not has been called. |
| 71 import subprocess | 71 import subprocess |
| 72 try: | 72 try: |
| 73 release_rev = subprocess.check_output( | 73 release_rev = subprocess.check_output( |
| 74 ["hg", "id", "-i"], stderr=subprocess.STDOUT) | 74 ["hg", "id", "-i"], stderr=subprocess.STDOUT) |
| 75 except Exception: | 75 except Exception: |
| 134 #html_theme = 'alabaster' | 134 #html_theme = 'alabaster' |
| 135 html_theme = 'haiku' | 135 html_theme = 'haiku' |
| 136 html_css_files = ["custom-haiku.css"] | 136 html_css_files = ["custom-haiku.css"] |
| 137 html_title = 'The %s v%s' % (project, release) | 137 html_title = 'The %s v%s' % (project, release) |
| 138 html_short_title = html_title | 138 html_short_title = html_title |
| 139 html_last_updated_fmt = "%s (rv:%s)" % (today, release_rev) | 139 html_last_updated_fmt = "%s (rv:%s)" % (current_date, release_rev) |
| 140 #pygments_style = "sphinx" | 140 #pygments_style = "sphinx" |
| 141 pygments_style = "default" | 141 pygments_style = "default" |
| 142 | 142 |
| 143 # --- Options for LaTeX output ----------------------------------------------- | 143 # --- Options for LaTeX output ----------------------------------------------- |
| 144 # https://www.sphinx-doc.org/en/master/latex.html | 144 # https://www.sphinx-doc.org/en/master/latex.html |
| 150 # "fontpkg": r"\usepackage[plexmono]{my-doc-fonts}", | 150 # "fontpkg": r"\usepackage[plexmono]{my-doc-fonts}", |
| 151 # "fontpkg": r"\usepackage[spectral]{my-doc-fonts}", | 151 # "fontpkg": r"\usepackage[spectral]{my-doc-fonts}", |
| 152 # "fontpkg": r"\usepackage[charter]{my-doc-fonts}", | 152 # "fontpkg": r"\usepackage[charter]{my-doc-fonts}", |
| 153 "releasename": "Version", | 153 "releasename": "Version", |
| 154 "fncychap": r"\usepackage[Sonny]{fncychap}", | 154 "fncychap": r"\usepackage[Sonny]{fncychap}", |
| 155 "preamble": r""" | |
| 156 \usepackage{my-doc-style} | |
| 157 \builddate{%s}\vcsrevision{%s} | |
| 158 """ % (current_date, release_rev), | |
| 155 } | 159 } |
| 156 latex_theme = "manual" | 160 latex_theme = "manual" |
| 157 latex_show_urls = "footnote" | 161 latex_show_urls = "footnote" |
| 158 latex_show_pagerefs = True | 162 latex_show_pagerefs = True |
| 159 latex_domain_indices = False | 163 latex_domain_indices = False |
| 160 latex_documents = [ | 164 latex_documents = [ |
| 161 ("_latex/index-latex", "PygmentsLexerPseudocode2.tex", "The Pygments Pseudocode Lexer", "Franz Glasner", "manual", True), | 165 ("_latex/index-latex", "PygmentsLexerPseudocode2.tex", "The Pygments Pseudocode Lexer", "Franz Glasner", "manual", True), |
| 162 ] | 166 ] |
| 163 latex_additional_files = [ | 167 latex_additional_files = [ |
| 164 "_latex/my-doc-fonts.sty", | 168 "_latex/my-doc-fonts.sty", |
| 169 "_latex/my-doc-style.sty", | |
| 165 "examples/example-1.pseudocode", # linked via \url{} | 170 "examples/example-1.pseudocode", # linked via \url{} |
| 166 "examples/algorithm-dinic.pseudocode", | 171 "examples/algorithm-dinic.pseudocode", |
| 167 "examples/algorithm-ford-fulkerson.pseudocode", | 172 "examples/algorithm-ford-fulkerson.pseudocode", |
| 168 "examples/algorithm-edmonds-karp.pseudocode", | 173 "examples/algorithm-edmonds-karp.pseudocode", |
| 169 ] | 174 ] |
