diff options
| author | Kévin Le Gouguec <kevin.legouguec@gmail.com> | 2020-08-28 19:06:45 +0200 |
|---|---|---|
| committer | Kévin Le Gouguec <kevin.legouguec@gmail.com> | 2020-08-28 22:25:00 +0200 |
| commit | 63a248e3dd9fc6857098c75ffbd49f72cf362c13 (patch) | |
| tree | 40f67826a7d4f955136e8f8bc01121513139d8a5 /repo/www/helpers.py | |
| parent | d0d869e06b30a1f8b7b539978caa0ed6123f9864 (diff) | |
| download | memory-leaks-63a248e3dd9fc6857098c75ffbd49f72cf362c13.tar.xz | |
Make sure titles are not redundant with breadcrumbs
The logic for the various titles on any given page is:
∃README
∃title block
<title> ⇒ title block
<header> <h1> ⇒ title block
TOC <h1> ⇒ "Index for {target}"
∄title block
<title> ⇒ "{target}" or "README"
<header> <h1> ⇒ ∅
TOC <h1> ⇒ "Index for {target}"
∄README
<title> ⇒ "Index for {target}"
<header> <h1> ⇒ "Index"
TOC <h1> ⇒ ∅
Diffstat (limited to 'repo/www/helpers.py')
| -rw-r--r-- | repo/www/helpers.py | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/repo/www/helpers.py b/repo/www/helpers.py index 80b8857..3d412b4 100644 --- a/repo/www/helpers.py +++ b/repo/www/helpers.py @@ -56,8 +56,8 @@ def deserialize_directories(directories): } -def pandoc(page, output, template, filters, stylesheets, title=None, - site_title=None, include_after=(), variables=None): +def pandoc(page, output, template, filters, stylesheets, site_title=None, + include_after=(), variables=None, metadata=None): cmd = ( 'pandoc', '-s', page, '-o', output, '--template', template, *chain(*(('--lua-filter', f) for f in filters)), @@ -65,14 +65,16 @@ def pandoc(page, output, template, filters, stylesheets, title=None, *chain(*(('--include-after-body', f) for f in include_after)) ) - if title is not None: - cmd += ('-M', f'title={title}') if site_title is not None: cmd += ('-T', site_title) if variables is not None: cmd += tuple(chain( *(('-V', f'{k}={v}') for k, v in variables.items()) )) + if metadata is not None: + cmd += tuple(chain( + *(('-M', f'{k}={v}') for k, v in metadata.items()) + )) environ['LUA_PATH'] = '.cache/?.lua;;' run(cmd, check=True) |
