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
toc: true
citeproc: true
csl: chicago-fullnote-sl
filters:
- localize-quotes.lua
- update_internal_targets.lua
- insert_links.lua
- insert_bodypart.lua
- insert_linkparts.lua
template: bavbavhaus.net.html5
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 RawBlock = pandoc.RawBlock
SCRIPT_NAME = "insert_links.lua"
SCRIPT_NAME = "insert_linkparts.lua"
os.setlocale("C")
return {
{ Meta = function (meta)
if not meta["links"] then return end
if type(meta["links"]) == "string" then
meta["links"] = { meta["links"] }
if not meta["linkparts"] then return end
if type(meta["linkparts"]) == "string" then
meta["linkparts"] = { meta["linkparts"] }
end
local links = MetaList({})
for _,fp in ipairs(meta["links"]) do
for _,fp in ipairs(meta["linkparts"]) do
local f = assert(io.open(fp), "\n" ..
"[ERROR] could not open " .. fp .. " for reading.")
links:insert(RawBlock("html5", f:read("a")))
f:close()
end
meta["links"] = links
meta["linkparts"] = links
return meta
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>
<html
xmlns="http://www.w3.org/1999/xhtml"
lang="$if(lang)$$lang$$else$sl$endif$"
xml:lang="$if(lang)$$lang$$else$sl$endif$"
$if(dir)$dir="$dir$"$endif$>
xmlns="http://www.w3.org/1999/xhtml"
lang="$if(lang)$$lang$$else$sl$endif$"
xml:lang="$if(lang)$$lang$$else$sl$endif$"
$if(dir)$dir="$dir$"$endif$>
<head>
<meta charset="utf-8" />
<meta name="generator" content="pandoc" />
<meta name="viewport" content="width=device-width, initial-scale=1.0, user-scalable=yes" />
<meta charset="utf-8" />
<meta name="generator" content="pandoc" />
<meta name="viewport"
content="width=device-width, initial-scale=1.0, user-scalable=yes" />
$if(description-meta)$
<meta name="description" content="$description-meta$" />
<meta name="description" content="$description-meta$" />
$else$
<meta name="description" content="bavbavhaus.net" />
<meta name="description" content="bavbavhaus.net" />
$endif$
<title>bavbavhaus.net/$pagetitle$</title>
<link rel="icon" href="favicon.svg" />
<link rel="stylesheet" href="css/style.css" />
<title>$pagetitle$, bavbavhaus.net</title>
<link rel="icon" href="favicon.svg" />
<link rel="stylesheet" href="css/style.css" />
</head>
<body>
<main>
<article class="post">
<header>
<h1>
<a href="index.html">bavbavhaus.net</a>
/
<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$
</article>
$for(links)$
<article class="post link">
$it$
</article>
$endfor$
<nav>
<a href="index.html">&lt;</a>
</nav>
<div id="posts">
<article class="post">
$if(bodypart)$
$bodypart$
$endif$
</article>
$for(linkparts)$
<article class="post link">
$it$
</article>
$endfor$
</div>
</main>
</body>
</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$