update `pandoc` data dir

master
urosm 2024-05-04 18:56:17 +02:00
parent e67c7c96aa
commit abde069d29
10 changed files with 79 additions and 101 deletions

View File

@ -0,0 +1,11 @@
---
from: markdown
toc: true
citeproc: true
csl: chicago-fullnote-sl
filters:
- localize_quotes.lua
- update_internal_targets.lua
template: bavbavhaus.net.part.html5
to: html
...

View File

@ -1,11 +1,8 @@
--- ---
from: markdown from: markdown
toc: true
citeproc: true
csl: chicago-fullnote-sl
filters: filters:
- localize-quotes.lua - insert_bodypart.lua
- update_internal_targets.lua - insert_linkparts.lua
- insert_links.lua template: bavbavhaus.net.html5
to: html to: html
... ...

View File

@ -0,0 +1,16 @@
local RawBlock = pandoc.RawBlock
SCRIPT_NAME = "insert_bodypart.lua"
os.setlocale("C")
return {
{ Meta = function (meta)
if not meta["bodypart"] then return end
local fp = meta["bodypart"]
local f = assert(io.open(fp), "\n" ..
"[ERROR] could not open " .. fp .. " for reading.")
meta["bodypart"] = RawBlock("html5", f:read("a"))
f:close()
return meta
end }
}

View File

@ -2,23 +2,23 @@
local MetaList = pandoc.MetaList local MetaList = pandoc.MetaList
local RawBlock = pandoc.RawBlock local RawBlock = pandoc.RawBlock
SCRIPT_NAME = "insert_links.lua" SCRIPT_NAME = "insert_linkparts.lua"
os.setlocale("C") os.setlocale("C")
return { return {
{ Meta = function (meta) { Meta = function (meta)
if not meta["links"] then return end if not meta["linkparts"] then return end
if type(meta["links"]) == "string" then if type(meta["linkparts"]) == "string" then
meta["links"] = { meta["links"] } meta["linkparts"] = { meta["linkparts"] }
end end
local links = MetaList({}) local links = MetaList({})
for _,fp in ipairs(meta["links"]) do for _,fp in ipairs(meta["linkparts"]) do
local f = assert(io.open(fp), "\n" .. local f = assert(io.open(fp), "\n" ..
"[ERROR] could not open " .. fp .. " for reading.") "[ERROR] could not open " .. fp .. " for reading.")
links:insert(RawBlock("html5", f:read("a"))) links:insert(RawBlock("html5", f:read("a")))
f:close() f:close()
end end
meta["links"] = links meta["linkparts"] = links
return meta return meta
end } end }
} }

View File

@ -1,22 +0,0 @@
-- local l = require("pandoc.logging")
local json = pandoc.json
local Link = pandoc.Link
SCRIPT_NAME = "insert_sitemap.lua"
os.setlocale("C")
return {
{ Meta = function (meta)
local sitemap_filepath = meta["sitemap-file"] or "sitemap.json"
local f = assert(io.open(sitemap_filepath), "\n" ..
"[ERROR] could not open " .. sitemap_filepath)
local sitemap = json.decode(f:read("a"))
f:close()
local sitemap_meta = pandoc.MetaList({})
sitemap:map(function (item)
sitemap_meta:insert(Link(item, item))
end)
meta["sitemap"] = sitemap_meta
return meta
end }
}

View File

@ -1,15 +0,0 @@
-- local l = require("pandoc.logging")
local stringify = pandoc.utils.stringify
local Link = pandoc.Link
SCRIPT_NAME = "insert_url.lua"
os.setlocale("C")
return {
{ Meta = function (meta)
local target = PANDOC_STATE["input_files"][1]
local title = stringify(meta["title"] or target)
meta["url"] = Link(title, target)
return meta
end }
}

View File

@ -1,49 +1,40 @@
<!DOCTYPE html> <!DOCTYPE html>
<html <html
xmlns="http://www.w3.org/1999/xhtml" xmlns="http://www.w3.org/1999/xhtml"
lang="$if(lang)$$lang$$else$sl$endif$" lang="$if(lang)$$lang$$else$sl$endif$"
xml:lang="$if(lang)$$lang$$else$sl$endif$" xml:lang="$if(lang)$$lang$$else$sl$endif$"
$if(dir)$dir="$dir$"$endif$> $if(dir)$dir="$dir$"$endif$>
<head> <head>
<meta charset="utf-8" /> <meta charset="utf-8" />
<meta name="generator" content="pandoc" /> <meta name="generator" content="pandoc" />
<meta name="viewport" content="width=device-width, initial-scale=1.0, user-scalable=yes" /> <meta name="viewport"
content="width=device-width, initial-scale=1.0, user-scalable=yes" />
$if(description-meta)$ $if(description-meta)$
<meta name="description" content="$description-meta$" /> <meta name="description" content="$description-meta$" />
$else$ $else$
<meta name="description" content="bavbavhaus.net" /> <meta name="description" content="bavbavhaus.net" />
$endif$ $endif$
<title>bavbavhaus.net/$pagetitle$</title> <title>$pagetitle$, bavbavhaus.net</title>
<link rel="icon" href="favicon.svg" /> <link rel="icon" href="favicon.svg" />
<link rel="stylesheet" href="css/style.css" /> <link rel="stylesheet" href="css/style.css" />
</head> </head>
<body> <body>
<main> <main>
<article class="post"> <nav>
<header> <a href="index.html">&lt;</a>
<h1> </nav>
<a href="index.html">bavbavhaus.net</a> <div id="posts">
/ <article class="post">
<a href="$url$">$if(title)$$title$$else$$pagetitle$$endif$</a></h1> $if(bodypart)$
$if(abstract)$ $bodypart$
$abstract$ $endif$
$endif$ </article>
</header> $for(linkparts)$
$if(toc)$ <article class="post link">
<nav> $it$
$if(toc-title)$ </article>
<h2>$toc-title$</h2> $endfor$
$endif$ </div>
$table-of-contents$
</nav>
$endif$
$body$
</article>
$for(links)$
<article class="post link">
$it$
</article>
$endfor$
</main> </main>
</body> </body>
</html> </html>

View File

@ -1,15 +0,0 @@
<header>
<h1><a href="$url$">$if(title)$$title$$else$$pagetitle$$endif$</a></h1>
$if(abstract)$
$abstract$
$endif$
</header>
$if(toc)$
<nav>
$if(toc-title)$
<h2>$toc-title$</h2>
$endif$
$table-of-contents$
</nav>
$endif$
$body$

View File

@ -0,0 +1,15 @@
<header>
<h1><a href="$url$">$pagetitle$</a></h1>
$if(abstract)$
$abstract$
$endif$
</header>
$if(toc)$
<nav>
$if(toc-title)$
<h2>$toc-title$</h2>
$endif$
$table-of-contents$
</nav>
$endif$
$body$