bavbavhaus: implement verso and recto iframes

master
urosm 2024-09-01 17:33:38 +02:00
parent d886f42ffc
commit e341eb6bbc
12 changed files with 43 additions and 168 deletions

5
.gitignore vendored
View File

@ -1,4 +1,3 @@
*.bak *.bak
public_html/*.html /public_html/*.html
public_html/*.html.part !/public_html/index.html
public_html/*.d

View File

@ -2,36 +2,21 @@
notes := $(wildcard *.md) notes := $(wildcard *.md)
pages := $(patsubst %.md,public_html/%.html,$(notes)) pages := $(patsubst %.md,public_html/%.html,$(notes))
parts := $(patsubst %.md,public_html/%.html.part,$(notes)) static := public_html/index.html
preqs := $(patsubst %.md,public_html/%.html.d,$(notes))
all: $(pages) all: $(pages)
PANDOCFLAGS := --data-dir pandoc BAVBAVHAUSFLAGS:= --data-dir pandoc -d bavbavhaus.net.yaml
BAVBAVHAUSFLAGS = $(PANDOCFLAGS) -M slug=$*
public_html/%.html: %.md public_html/%.html: %.md
pandoc $(BAVBAVHAUSFLAGS) -d bavbavhaus.net.yaml $< | sed 's/↩︎/[\&#8288;\&lt;\&#8288;-\&#8288;]/g' > $@ pandoc $(BAVBAVHAUSFLAGS) -o $@ $<
$(pages): pandoc/templates/bavbavhaus.net.html5 $(pages): pandoc/templates/bavbavhaus.net.html5
public_html/%.html.part: %.md
pandoc $(BAVBAVHAUSFLAGS) -d bavbavhaus.net.part.yaml --id-prefix $* -o $@ $<
$(parts): pandoc/templates/bavbavhaus.net.part.html5 clean: oldpages := $(filter-out $(static) $(pages),$(wildcard public_html/*.html))
public_html/%.html.d: %.md
pandoc lua dependencies.lua $< > $@
include $(preqs)
clean: oldpages := $(filter-out $(pages),$(wildcard public_html/*.html))
clean: oldparts := $(filter-out $(parts),$(wildcard public_html/*.html.part))
clean: oldpreqs := $(filter-out $(preqs),$(wildcard public_html/*.html.d))
clean: clean:
$(if $(oldpages),$(RM) $(filter-out $(pages),$(wildcard public_html/*.html))) $(if $(oldpages),$(RM) $(oldpages))
$(if $(oldparts),$(RM) $(filter-out $(parts),$(wildcard public_html/*.html.part)))
$(if $(oldpreqs),$(RM) $(filter-out $(preqs),$(wildcard public_html/*.html.d)))
.PHONY: all clean .PHONY: all clean

View File

@ -1,25 +0,0 @@
---
title: "bavbavhaus.net"
index: true
...
> Odkrivanje zatona arhitektov kot aktivnih ideologov, spoznanje o ogromnih tehnoloških zmožnostih racionalizacije mesta in ozemlja skupaj z vsakodnevnimi ugotovitvami o njihovi brezkoristnosti ter zastaranje specifičnih metod projektiranja, še preden so njihove hipoteze lahko preverjene v realnosti, za arhitekte tvorijo tesnobno vzdušje, ki na obzorju ponuja vpogled na zelo konkretno ozadje, zastrašujoče kot največje zlo ... [@tafuri1969peruna, 77]
*bavbavhaus.net* je poskus hekanja prokrastinacije in sploščitve nekaterih idej o ["sanjskem datotečnem formatu"](neusmerjeno_pisanje.md) v enostaven sistem povezanih in vzporednih zapiskov okoli teme [arhitekturnega dela in kapitalističnega razvoja](arhitekturno_delo_in_kapitalisticni_razvoj.md).
---
lang: sl
references:
- type: article-journal
id: tafuri1969peruna
author:
- family: Tafuri
given: Manfredo
title: "Per una critica dell'ideologia archittetonica"
title-short: "Per una critica dell'ideologia archittetonica"
container-title: "Contropiano: materiali marxisti"
issue: 1
issued: 1969
page: 31-79
language: it
...

View File

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

View File

@ -7,7 +7,6 @@ template: bavbavhaus.net.html5
to: html5 to: html5
filters: filters:
- localize_quotes.lua - localize_quotes.lua
- collect_internal_linked.lua
- resolve_internal_links.lua - resolve_internal_links.lua
- link_headings.lua - link_headings.lua
... ...

View File

@ -1,38 +0,0 @@
SCRIPT_NAME = "collect_internal_linked.lua"
os.setlocale("C")
local RawBlock = pandoc.RawBlock
local parts = pandoc.MetaList({})
local visited = {}
return {
{ Link = function(link)
-- early return for external links
if link.target:find("^https?%:%/%/") then return end
if link.target:find("^mailto%:") then return end
local fp, anchor = link.target:match("^(.+%.md)#?(.*)$")
-- early return for non markdown files
if not fp then return end
-- early return for visited
if visited[fp] then return end
visited[fp] = true
local f = io.open(fp)
-- early return for broken internal links
if f == nil then return link.content else f:close() end -- @todo maybe log broken internal links
local part_fp = fp:gsub("^(.+)%.md$", "public_html/%1.html.part")
local f = assert(io.open(part_fp), "\n" ..
"[ERROR] could not open " .. part_fp .. " for reading.")
local rawblock = RawBlock(FORMAT, f:read("a")); f:close()
parts:insert(rawblock)
end },
{ Meta = function (meta)
meta["parts"] = parts
return meta
end }
}

View File

@ -6,7 +6,7 @@ local Inlines = pandoc.Inlines
return { return {
{ Link = function(l) { Link = function(l)
-- early return for external links -- early return for external links
if l.target:find("^https?%:%/%/") then return end if l.target:find("^https?%:%/%/") then return end -- @todo resolve external links
if l.target:find("^mailto%:") then return end if l.target:find("^mailto%:") then return end
local fp, slug, anchor = l.target:match("^((.+)%.md)#?(.*)$") local fp, slug, anchor = l.target:match("^((.+)%.md)#?(.*)$")
@ -17,7 +17,8 @@ return {
-- early return for broken internal links -- early return for broken internal links
if f == nil then return l.content else f:close() end -- @todo maybe log broken internal links if f == nil then return l.content else f:close() end -- @todo maybe log broken internal links
l.target = ("#%s%s"):format(slug, anchor) l.target = ("%s.html#%s"):format(slug, anchor)
l.attributes.target = "internal"
return l return l
end } end }

View File

@ -1,29 +0,0 @@
SCRIPT_NAME = "resolve_internal_links.lua"
os.setlocale("C")
local Inlines = pandoc.Inlines
local page_slug
return {
{ Meta = function(meta)
page_slug = meta["slug"]
end },
{ Link = function(l)
-- early return for external links
if l.target:find("^https?%:%/%/") then return end
if l.target:find("^mailto%:") then return end
local fp, slug, anchor = l.target:match("^((.+)%.md)#?(.*)$")
-- early return for non markdown files
if not fp then return end
local f = io.open(fp)
-- early return for broken internal links
if f == nil then return l.content else f:close() end -- @todo maybe log broken internal links
l.target = ("%s.html#%s%s"):format(page_slug, slug, anchor)
return l
end }
}

View File

@ -15,15 +15,14 @@ $else$
<meta name="description" content="bavbavhaus.net" /> <meta name="description" content="bavbavhaus.net" />
$endif$ $endif$
<title>$pagetitle$, bavbavhaus.net</title> <title>$pagetitle$, bavbavhaus.net</title>
<link rel="icon" href="favicon.svg" />
<link rel="stylesheet" media="screen" href="css/style.css" /> <link rel="stylesheet" media="screen" href="css/style.css" />
<link rel="stylesheet" media="print" href="css/print.css" /> <script src="js/resolve_internal_links.js"></script>
</head> </head>
<body$if(slug)$ id="$slug$"$endif$> <body$if(sourcefile)$ id="$sourcefile$"$endif$>
<main> <main>
<article id="verso" class="post"> <article class="post">
<header> <header>
<h1>$if(index)$$else$<a href="index.html">bavbavhaus.net</a>/$endif$<a href="$slug$.html">$pagetitle$</a></h1> <h1>$pagetitle$</h1>
</header> </header>
<div class="content"> <div class="content">
$if(description)$ $if(description)$
@ -47,12 +46,6 @@ $abstract$
$endif$ $endif$
$body$ $body$
</article> </article>
<article id="recto">
$for(parts)$
$it$
$endfor$
</div>
</article>
</main> </main>
</body> </body>
</html> </html>

View File

@ -1,27 +0,0 @@
<article$if(slug)$ id="$slug$"$endif$ class="post tail">
<header>
<h1><a href="$slug$.html">$pagetitle$</a></h1>
</header>
<div class="content">
$if(description)$
<div class="description">
$description$
</div>
$endif$
$if(toc)$
<nav>
$if(toc-title)$
<h2>$toc-title$</h2>
$endif$
$table-of-contents$
</nav>
$endif$
$if(abstract)$
<div class="abstract">
<h2 class="abstract-title">$abstract-title$</h2>
$abstract$
</div>
$endif$
$body$
</div>
</article>

View File

@ -0,0 +1,23 @@
<!DOCTYPE html>
<html
xmlns="http://www.w3.org/1999/xhtml"
lang="sl"
xml:lang="sl"
>
<head>
<meta charset="utf-8" />
<meta name="viewport"
content="width=device-width, initial-scale=1.0, user-scalable=yes" />
<meta name="description" content="bavbavhaus.net" />
<title>bavbavhaus.net</title>
<link rel="icon" href="favicon.svg" />
<link rel="stylesheet" media="screen" href="css/style.css" />
<link rel="stylesheet" media="screen" href="css/index.css" />
</head>
<body id="index">
<main>
<iframe name="verso" src="intro.html"></iframe>
<iframe name="recto"></iframe>
</main>
</body>
</html>

View File

@ -0,0 +1,6 @@
document.addEventListener("click", e => {
const anchor = e.target.closest("a[target=\"internal\"");
if (anchor && window.name != "") {
anchor.target = window.name === "verso" ? "recto" : "verso";
}
});