diff options
| author | Kévin Le Gouguec <kevin.legouguec@gmail.com> | 2020-04-20 00:03:16 +0200 |
|---|---|---|
| committer | Kévin Le Gouguec <kevin.legouguec@gmail.com> | 2020-04-20 00:03:16 +0200 |
| commit | 8692dba921531783b9204a9323db2aba640fe978 (patch) | |
| tree | 57f9f2f5bb1d72f050a2a89234db762aa4cba733 /repo/www/print-title.lua | |
| parent | 3a18562cad4b0fb144b637037ee676bafaaa3632 (diff) | |
| download | memory-leaks-8692dba921531783b9204a9323db2aba640fe978.tar.xz | |
Parse site title from top-level README
Maybe not the best idea, since the dependency chain will trigger a
site-wide rebuild everytime the README is edited. Ah well.
Diffstat (limited to 'repo/www/print-title.lua')
| -rw-r--r-- | repo/www/print-title.lua | 26 |
1 files changed, 26 insertions, 0 deletions
diff --git a/repo/www/print-title.lua b/repo/www/print-title.lua new file mode 100644 index 0000000..c2c90fb --- /dev/null +++ b/repo/www/print-title.lua @@ -0,0 +1,26 @@ +title = '' + +titlefilter = { + Str = function (element) + title = title .. element.text + end, + + Code = function (element) + title = title .. element.text + end, + + Space = function (element) + title = title .. ' ' + end, +} + +function Pandoc(doc) + pandoc.List.map( + doc.meta.title, + function (inline) + pandoc.walk_inline(pandoc.Span(inline), titlefilter) + end + ) + print(title) + os.exit(0) +end |
