summaryrefslogtreecommitdiff
path: root/repo/www/convert-internal-links.lua
diff options
context:
space:
mode:
authorKévin Le Gouguec <kevin.legouguec@gmail.com>2020-08-19 00:10:08 +0200
committerKévin Le Gouguec <kevin.legouguec@gmail.com>2020-08-19 00:10:08 +0200
commit30e831c9602ea5d4d0603f5ad03baff481771b4b (patch)
tree7548cd29ed5ecf3e975df5a2e6ae130ae488f36f /repo/www/convert-internal-links.lua
parent338f941477ef6815bd4638bf166f1fddb5a4b3d3 (diff)
downloadmemory-leaks-30e831c9602ea5d4d0603f5ad03baff481771b4b.tar.xz
Put extensions in Lua module instead of sneaking them in environment
Note that neither .cache/config.lua nor .cache/site-tree.json get updated when EXTENSIONS changes. This could be hacked as follows: config = EXTENSIONS="$(EXTENSIONS)" ifneq "$(shell test -f $(config_token) && cat $(config_token))" \ "$(shell ./generate-config-token.py $(config))" .PHONY: $(lua_config) $(site_tree) $(config_token) endif Plus a recipe for config_token, and some dependencies on it.
Diffstat (limited to 'repo/www/convert-internal-links.lua')
-rw-r--r--repo/www/convert-internal-links.lua10
1 files changed, 2 insertions, 8 deletions
diff --git a/repo/www/convert-internal-links.lua b/repo/www/convert-internal-links.lua
index e50352a..21054d1 100644
--- a/repo/www/convert-internal-links.lua
+++ b/repo/www/convert-internal-links.lua
@@ -1,10 +1,4 @@
-EXTENSIONS = {}
-
-string.gsub(
- os.getenv("EXTENSIONS"),
- "[^%s]+",
- function (ext) EXTENSIONS[#EXTENSIONS+1] = ext end
-)
+local config = require 'config'
function Link(link)
if link.target:match("^[%w]+://")
@@ -12,7 +6,7 @@ function Link(link)
return link
end
- for _, ext in pairs(EXTENSIONS)
+ for _, ext in pairs(config.EXTENSIONS)
do
link.target = link.target:gsub("%."..ext.."$", ".html")
end