From 63a248e3dd9fc6857098c75ffbd49f72cf362c13 Mon Sep 17 00:00:00 2001 From: Kévin Le Gouguec Date: Fri, 28 Aug 2020 19:06:45 +0200 Subject: Make sure titles are not redundant with breadcrumbs MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The logic for the various titles on any given page is: ∃README ∃title block ⇒ 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> ⇒ ∅ --- repo/www/helpers.py | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) (limited to 'repo/www/helpers.py') 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) -- cgit v1.2.3