diff options
| author | Kévin Le Gouguec <kevin.legouguec@gmail.com> | 2020-04-29 00:40:14 +0200 |
|---|---|---|
| committer | Kévin Le Gouguec <kevin.legouguec@gmail.com> | 2020-04-29 00:40:14 +0200 |
| commit | a4401b352150205d2f6ee7e3dc99c1145e399c60 (patch) | |
| tree | 92829d81f4eda39f02f248c6ac87d0db5f7f76ef /repo/www/convert-internal-links.lua | |
| parent | 23685fe090d986d3322903a003b91f7b1dfd1a3a (diff) | |
| download | memory-leaks-a4401b352150205d2f6ee7e3dc99c1145e399c60.tar.xz | |
Fix links to internal pages
Replace .md/.org extension with .html.
The output of "make" is now ugly as sin.
Diffstat (limited to 'repo/www/convert-internal-links.lua')
| -rw-r--r-- | repo/www/convert-internal-links.lua | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/repo/www/convert-internal-links.lua b/repo/www/convert-internal-links.lua new file mode 100644 index 0000000..b0817dd --- /dev/null +++ b/repo/www/convert-internal-links.lua @@ -0,0 +1,21 @@ +EXTENSIONS = {} + +string.gsub( + os.getenv("TEXT_FILES"), + "[^%s]+", + function (ext) EXTENSIONS[#EXTENSIONS+1] = ext end +) + +function Link(link) + if link.target:match("^[%w]+://") + then + return link + end + + for _, ext in pairs(EXTENSIONS) + do + link.target = link.target:gsub("%."..ext.."$", ".html") + end + + return link +end |
