update `pandoc` data dir

master
urosm 2024-04-22 14:52:02 +02:00
parent cba1b32d2c
commit 08cfba2c7d
4 changed files with 17 additions and 33 deletions

View File

@ -1,6 +1,5 @@
local l = require("pandoc.logging")
local json = pandoc.json
local MetaMap = pandoc.MetaMap
local MetaList = pandoc.MetaList
local RawBlock = pandoc.RawBlock
@ -17,22 +16,15 @@ return {
local links = json.decode(f:read("a"))
f:close()
if not links[input_filepath] then return end
local prevlinks_meta = MetaList({})
local nextlinks_meta = MetaList({})
local links_meta = prevlinks_meta
local nextlinks = MetaList({})
for _,filepath in ipairs(links[input_filepath]) do
if filepath == json.null then
links_meta = nextlinks_meta
goto continue
end
local partial_filepath = filepath:gsub("^(.+)%.md$", partials_dirpath .. "/%1.html")
local f = assert(io.open(partial_filepath), "\n" ..
"[ERROR] could not open " .. partial_filepath)
links_meta:insert(RawBlock("html5", f:read("a")))
nextlinks:insert(RawBlock("html5", f:read("a")))
::continue::
end
meta["prevlinks"] = prevlinks_meta
meta["nextlinks"] = nextlinks_meta
meta["nextlinks"] = nextlinks
return meta
end }
}

View File

@ -4,7 +4,7 @@ local json = pandoc.json
SCRIPT_NAME = "update_internal_targets.lua"
os.setlocale("C")
TARGET_PATTERN = { "^(.+)%.md$", "%1.html#start" }
TARGET_PATTERN = { "^(.+)%.md", "%1.html" }
local function file_exists(filepath)
local f = io.open(filepath)

View File

@ -11,7 +11,7 @@ for _, option in ipairs(arg) do
destination_filepath = option
else
table.insert(input_filepaths, option)
input_filepaths_keys[option] = { json.null }
input_filepaths_keys[option] = {}
end
end
@ -26,7 +26,6 @@ for _,filepath in ipairs(input_filepaths) do
if not input_filepaths_keys[link.target] then return end
if visited_map[link.target] then return end
table.insert(input_filepaths_keys[filepath], link.target)
table.insert(input_filepaths_keys[link.target], 1, filepath)
visited_map[link.target] = true
end
})

View File

@ -17,24 +17,9 @@ $endif$
<link rel="icon" href="favicon.svg" />
<link rel="stylesheet" href="css/style.css" />
</head>
<body onload="start.scrollIntoView()"><!-- HACK -->
<body>
<main>
$if(sitemap)$
<nav class="sitemap">
<h1><a href="/">bavbavhaus.net</a></h1>
<ul>
$for(sitemap)$
<li>$it$</li>
$endfor$
</ul>
</nav>
$endif$
$for(prevlinks)$
<article class="prevlink">
$it$
</article>
$endfor$
<article id="start">
<article>
${ bavbavhaus.net.inline.html5() }
</article>
$for(nextlinks)$
@ -42,8 +27,16 @@ $endif$
$it$
</article>
$endfor$
<div class="dummy"><!-- HACK -->
</div>
$if(sitemap)$
<nav class="sitemap">
<h1><a href="/">bavbavhaus.net/sitemap</a></h1>
<ul>
$for(sitemap)$
<li>$it$</li>
$endfor$
</ul>
</nav>
$endif$
</main>
</body>
</html>