summaryrefslogtreecommitdiff
path: root/repo/www/print-title.lua
diff options
context:
space:
mode:
authorKévin Le Gouguec <kevin.legouguec@gmail.com>2020-04-20 00:03:16 +0200
committerKévin Le Gouguec <kevin.legouguec@gmail.com>2020-04-20 00:03:16 +0200
commit8692dba921531783b9204a9323db2aba640fe978 (patch)
tree57f9f2f5bb1d72f050a2a89234db762aa4cba733 /repo/www/print-title.lua
parent3a18562cad4b0fb144b637037ee676bafaaa3632 (diff)
downloadmemory-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.lua26
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