memory-leaks

Still reachable: lots of words in many pages.
git clone https://git.kevinlegouguec.net/memory-leaks
Log | Files | Refs | README | LICENSE

commit b6cb7d009364ab63e09fe6febc15330edae0644a
parent 63a248e3dd9fc6857098c75ffbd49f72cf362c13
Author: Kévin Le Gouguec <kevin.legouguec@gmail.com>
Date:   Fri, 28 Aug 2020 22:21:11 +0200

Move site title after page title

Plenty of websites do this; on GNU/Linux most applications do this; I
guess the goal is to make the most specific information go first, so
that tabs remain identifiable as they become narrower.

Diffstat:
Mrepo/www/TODO | 1-
Mrepo/www/generate-index.py | 6++++--
Mrepo/www/generate-page.py | 4++--
Mrepo/www/helpers.py | 6++----
Mrepo/www/template.html | 2+-
5 files changed, 9 insertions(+), 10 deletions(-)

diff --git a/repo/www/TODO b/repo/www/TODO @@ -1,5 +1,4 @@ - compute "leak count" on toplevel index -- use "{pagetitle} - {sitetitle})" for <title> - get stylin' - pandoc template - tufte css? at least sidenotes rather than footnotes diff --git a/repo/www/generate-index.py b/repo/www/generate-index.py @@ -100,6 +100,8 @@ def main(arguments): variables = {'crumbs': generate_crumbs(Path(target)/'index')} metadata = {} + if arguments.site_title is not None: + metadata['sitetitle'] = arguments.site_title if readme is not None: repo_top = Repo(search_parent_directories=True).working_dir @@ -118,7 +120,7 @@ def main(arguments): pandoc( readme_path, arguments.output, arguments.template, arguments.filters, stylesheets, - site_title=arguments.site_title, include_after=(toc.name,), + include_after=(toc.name,), variables=variables, metadata=metadata ) return @@ -134,7 +136,7 @@ def main(arguments): pandoc( dummy_readme.name, arguments.output, arguments.template, arguments.filters, stylesheets, - site_title=arguments.site_title, include_after=(toc.name,), + include_after=(toc.name,), variables=variables, metadata=metadata ) diff --git a/repo/www/generate-page.py b/repo/www/generate-page.py @@ -50,9 +50,9 @@ def main(arguments): arguments.template, arguments.filters, stylesheets, - site_title=arguments.site_title, variables={'crumbs': generate_crumbs(page_path)}, - metadata={'pagetitle':arguments.title} + metadata={'pagetitle': arguments.title, + 'sitetitle': arguments.site_title} ) diff --git 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, site_title=None, - include_after=(), variables=None, metadata=None): +def pandoc(page, output, template, filters, stylesheets, include_after=(), + variables=None, metadata=None): cmd = ( 'pandoc', '-s', page, '-o', output, '--template', template, *chain(*(('--lua-filter', f) for f in filters)), @@ -65,8 +65,6 @@ def pandoc(page, output, template, filters, stylesheets, site_title=None, *chain(*(('--include-after-body', f) for f in include_after)) ) - 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()) diff --git a/repo/www/template.html b/repo/www/template.html @@ -13,7 +13,7 @@ $endif$ $if(keywords)$ <meta name="keywords" content="$for(keywords)$$keywords$$sep$, $endfor$" /> $endif$ - <title>$if(title-prefix)$$title-prefix$ – $endif$$pagetitle$</title> + <title>$pagetitle$$if(sitetitle)$ – $sitetitle$$endif$</title> <style> $styles.html()$ </style>