changeset 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 18553f595b34
children ad57aaf87799
files docs/_latex/my-doc-style.sty docs/conf.py docs/lexer-algpseudocode.rst
diffstat 3 files changed, 35 insertions(+), 6 deletions(-) [+]
line wrap: on
line diff
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/docs/_latex/my-doc-style.sty	Fri May 15 05:15:59 2026 +0200
@@ -0,0 +1,24 @@
+% -*- coding: utf-8 -*-
+%
+% Some font hacks for my Sphinx PDF documents
+%
+\NeedsTeXFormat{LaTeX2e}
+\ProvidesPackage{my-doc-style}[%
+  2026/05/14 v0.1 (Franz Glasner) Some style customizations]
+
+%
+% For the title page: "Last updated on ..."
+%
+\DeclareRobustCommand*\vcsrevision[1]{\gdef\mds@vcs@revision{#1}}
+\DeclareRobustCommand*\builddate[1]{\gdef\mds@builddate{#1}}
+\vcsrevision{}
+\builddate{}
+% \sphinxmaketitle references \@thanks: abuse this
+\gdef\@thanks{%
+  \ifx\mds@builddate\@empty\relax%
+  \else%
+    \hfill\normalsize\textsf{Last updated on \mds@builddate%
+    \ifx\mds@vcs@revision\@empty\relax\else\enspace(rv:\mds@vcs@revision )\fi}
+  \fi
+}
+\endinput
--- a/docs/conf.py	Thu May 14 07:30:38 2026 +0200
+++ b/docs/conf.py	Fri May 15 05:15:59 2026 +0200
@@ -33,7 +33,7 @@
 
 """
 
-today = datetime.date.today().isoformat()
+current_date = datetime.date.today().isoformat()
 
 master_doc = "index"
 
@@ -55,19 +55,19 @@
         re.search(r"""^\s*__version__\s*=\s*(("|')[^"']*\2)""",
                   verfiledata,
                   re.MULTILINE).group(1))
-    release_date = (
+    release_date = today = (
         ast.literal_eval(
             re.search(r"""^\s*__date__\s*=\s*(("|')[^"']*\2)""",
                       verfiledata,
                       re.MULTILINE).group(1))
-        or "dev:%s" % (today,)
+        or "dev:%s" % (current_date,)
     )
     release_rev = ast.literal_eval(
         re.search(r"""^\s*__revision__\s*=\s*(("|')[^"']*\2)""",
                   verfiledata,
                   re.MULTILINE).group(1))
     if release_rev.startswith("|") or release_rev.endswith("|"):
-        # Assume that make export (hg kwarchive) is not called.
+        # Assume that make export (hg kwarchive) may not has been called.
         import subprocess
         try:
             release_rev = subprocess.check_output(
@@ -136,7 +136,7 @@
 html_css_files = ["custom-haiku.css"]
 html_title = 'The %s v%s' % (project, release)
 html_short_title = html_title
-html_last_updated_fmt = "%s (rv:%s)" % (today, release_rev)
+html_last_updated_fmt = "%s (rv:%s)" % (current_date, release_rev)
 #pygments_style = "sphinx"
 pygments_style = "default"
 
@@ -152,6 +152,10 @@
 #   "fontpkg": r"\usepackage[charter]{my-doc-fonts}",
     "releasename": "Version",
     "fncychap": r"\usepackage[Sonny]{fncychap}",
+    "preamble": r"""
+\usepackage{my-doc-style}
+\builddate{%s}\vcsrevision{%s}
+""" % (current_date, release_rev),
 }
 latex_theme = "manual"
 latex_show_urls = "footnote"
@@ -162,6 +166,7 @@
 ]
 latex_additional_files = [
     "_latex/my-doc-fonts.sty",
+    "_latex/my-doc-style.sty",
     "examples/example-1.pseudocode",         # linked via \url{}
     "examples/algorithm-dinic.pseudocode",
     "examples/algorithm-ford-fulkerson.pseudocode",
--- a/docs/lexer-algpseudocode.rst	Thu May 14 07:30:38 2026 +0200
+++ b/docs/lexer-algpseudocode.rst	Fri May 15 05:15:59 2026 +0200
@@ -168,7 +168,7 @@
 
    # A single-line comment
 
-   \REM A remark has a leading symbol
+   \REM A remark is a single-line comment with a leading symbol
 
 
 Literals