Some small stuff; überlieferungen; erster entfurf für randnotizen

This commit is contained in:
Simon Martens
2025-05-13 18:29:56 +02:00
parent b6e2d6d84c
commit cf683c43ab
10 changed files with 87 additions and 44 deletions

View File

@@ -10,6 +10,11 @@ import (
type outType int type outType int
var endDivToken = outToken{
Type: EndElement,
Name: "div",
}
const ( const (
NA outType = iota NA outType = iota
Text Text
@@ -132,6 +137,12 @@ func Parse(lib *xmlmodels.Library) func(s string) string {
Classes: []string{"sidenote"}, Classes: []string{"sidenote"},
} }
ps.Out = append(ps.Out, nt) ps.Out = append(ps.Out, nt)
metatoken := outToken{
Type: Element,
Name: "div",
Classes: []string{"sidenote-meta"},
}
ps.Out = append(ps.Out, metatoken)
if elem.Token.Attributes["annotation"] != "" { if elem.Token.Attributes["annotation"] != "" {
note := outToken{ note := outToken{
Type: Element, Type: Element,
@@ -142,11 +153,7 @@ func Parse(lib *xmlmodels.Library) func(s string) string {
Type: Text, Type: Text,
Value: elem.Token.Attributes["annotation"], Value: elem.Token.Attributes["annotation"],
} }
noteend := outToken{ ps.Out = append(ps.Out, note, notecontent, endDivToken)
Type: EndElement,
Name: "div",
}
ps.Out = append(ps.Out, note, notecontent, noteend)
} }
if elem.Token.Attributes["page"] != "" { if elem.Token.Attributes["page"] != "" {
note := outToken{ note := outToken{
@@ -158,11 +165,7 @@ func Parse(lib *xmlmodels.Library) func(s string) string {
Type: Text, Type: Text,
Value: elem.Token.Attributes["page"], Value: elem.Token.Attributes["page"],
} }
noteend := outToken{ ps.Out = append(ps.Out, note, notecontent, endDivToken)
Type: EndElement,
Name: "div",
}
ps.Out = append(ps.Out, note, notecontent, noteend)
} }
if elem.Token.Attributes["pos"] != "" { if elem.Token.Attributes["pos"] != "" {
note := outToken{ note := outToken{
@@ -174,12 +177,16 @@ func Parse(lib *xmlmodels.Library) func(s string) string {
Type: Text, Type: Text,
Value: elem.Token.Attributes["pos"], Value: elem.Token.Attributes["pos"],
} }
noteend := outToken{ ps.Out = append(ps.Out, note, notecontent, endDivToken)
Type: EndElement,
Name: "div",
}
ps.Out = append(ps.Out, note, notecontent, noteend)
} }
ps.Out = append(ps.Out, endDivToken)
case "note":
nt := outToken{
Type: Element,
Name: "div",
Classes: []string{"note-anchor"},
}
ps.Out = append(ps.Out, nt, endDivToken)
case "hand": case "hand":
nt := outToken{ nt := outToken{
Type: Element, Type: Element,
@@ -205,11 +212,7 @@ func Parse(lib *xmlmodels.Library) func(s string) string {
if person != nil { if person != nil {
defhand.Value = person.Name defhand.Value = person.Name
} }
handend := outToken{ ps.Out = append(ps.Out, handtok, defhand, endDivToken)
Type: EndElement,
Name: "div",
}
ps.Out = append(ps.Out, handtok, defhand, handend)
case "line": case "line":
nt := outToken{ nt := outToken{
Type: EmptyElement, Type: EmptyElement,

File diff suppressed because one or more lines are too long

View File

@@ -4,15 +4,15 @@
"": { "": {
"name": "caveman_views", "name": "caveman_views",
"devDependencies": { "devDependencies": {
"@laynezh/vite-plugin-lib-assets": "latest", "@laynezh/vite-plugin-lib-assets": "^1.1.0",
"@tailwindcss/postcss": "latest", "@tailwindcss/postcss": "^4.1.4",
"daisyui": "latest", "daisyui": "^5.0.28",
"postcss": "latest", "postcss": "^8.5.3",
"postcss-cli": "latest", "postcss-cli": "^11.0.1",
"prettier": "latest", "prettier": "^3.5.3",
"prettier-plugin-go-template": "latest", "prettier-plugin-go-template": "^0.0.15",
"tailwindcss": "latest", "tailwindcss": "^4.1.4",
"vite": "latest", "vite": "^6.3.3",
}, },
}, },
}, },

View File

@@ -1,5 +1,5 @@
{{- $date := Today -}} {{- $date := Today -}}
<footer class="container-normal pb-1.5 text-base text-gray-800 justify-self-end"> <footer class="print:hidden container-normal pb-1.5 text-base text-gray-800 justify-self-end">
<div class="mt-12 pt-3 flex flex-row justify-between"> <div class="mt-12 pt-3 flex flex-row justify-between">
<div> <div>
<i class="ri-creative-commons-line"></i> <i class="ri-creative-commons-line"></i>

View File

@@ -1,6 +1,6 @@
{{ $model := . }} {{ $model := . }}
<nav class="flex flex-row gap-x-1 justify-between"> <nav class="flex flex-row gap-x-1 justify-between print:hidden">
<div> <div>
<a class="inline-block px-0.5" href="/"> J.M.R. Lenz: Kritische Briefausgabe </a> <a class="inline-block px-0.5" href="/"> J.M.R. Lenz: Kritische Briefausgabe </a>
</div> </div>

View File

@@ -1,8 +1,11 @@
{{ $model := . }}
<div class="flex flex-row w-full border-b pb-2 mb-3"> <div class="flex flex-row w-full border-b pb-2 mb-3">
{{- template "_letterhead" .meta -}} {{- template "_letterhead" .meta -}}
<div class="self-end justify-self-end grow-0 "> <div class="self-end justify-self-end grow-0 print:hidden">
{{ if .prev }} {{ if .prev }}
<a href="/brief/{{ .prev.Letter }}" class="stdlink" <a href="/brief/{{ .prev.Letter }}" class="stdlink"
><i class="ri-arrow-left-long-line"></i ><i class="ri-arrow-left-long-line"></i
@@ -20,3 +23,7 @@
<div class="text"> <div class="text">
{{- Safe (ParseGeneric .text.Content) -}} {{- Safe (ParseGeneric .text.Content) -}}
</div> </div>
<div class="traditions mt-12 pt-3 border-t-gray-200 border-t-1 max-w-[90ch] print:border-none">
{{ template "_lettertrad" $model.meta -}}
</div>

View File

@@ -1,7 +1,7 @@
{{ $model := . }} {{ $model := . }}
<nav> <nav class="print:hidden">
{{- range $y := .years -}} {{- range $y := .years -}}
<a <a
class="inline-block stdlink px-0.5" class="inline-block stdlink px-0.5"
@@ -22,7 +22,7 @@
{{- if .year -}} {{- if .year -}}
{{- $letters := index $model.yearmap $model.year -}} {{- $letters := index $model.yearmap $model.year -}}
<div class="flex flex-row gap-x-1"> <div class="flex flex-row gap-x-1">
<div>{{- .year }}</div> <div>Briefe für das Jahr {{- .year }}</div>
<div>({{- len $letters }})</div> <div>({{- len $letters }})</div>
</div> </div>
{{ template "_letterlist" $letters -}} {{ template "_letterlist" $letters -}}

View File

@@ -0,0 +1,11 @@
{{ $model := . }}
{{- range $i, $trad := (Tradition $model.Letter) -}}
<div class="traditioncategory mb-6">
<div class="tradition-header font-bold">
{{- (App $trad.Reference).Name -}}
</div>
<div class="tradition-text">
{{- Safe (ParseGeneric $trad.Content) -}}
</div>
</div>
{{- end -}}

View File

@@ -80,7 +80,7 @@
@apply font-bold text-red-500; @apply font-bold text-red-500;
} }
.text { .text {
@apply font-serif max-w-[80ch] relative; @apply font-serif max-w-[80ch] print:max-w-[60ch] relative;
} }
.text .page, .text .page,
@@ -92,6 +92,7 @@
.text .pe, .text .pe,
.text .gr, .text .gr,
.text .hb, .text .hb,
.text .ru,
.text .nr, .text .nr,
.text .align, .text .align,
.text .b, .text .b,
@@ -175,6 +176,13 @@
@apply italic; @apply italic;
} }
.traditions,
.tradition,
.text,
.text * {
clear: both;
}
.text .align.pos-right { .text .align.pos-right {
@apply text-right; @apply text-right;
float: right; float: right;
@@ -225,10 +233,8 @@
.text .note, .text .note,
.text .hand-person, .text .hand-person,
.text .sidenote-note, .text .sidenote-meta {
.text .sidenote-page, @apply absolute right-[-45ch] w-[40ch] px-2 mr-2 bg-gray-100 italic text-sm text-gray-700 font-sans;
.text .sidenote-pos {
@apply inline px-2 mr-2 w-full bg-gray-100 font-bold text-gray-700;
} }
.text .sidenote-page::before { .text .sidenote-page::before {

View File

@@ -315,11 +315,25 @@ func (l *Library) Person(id int) (ret *PersonDef) {
return return
} }
func (l *Library) App(id int) (ret *AppDef) {
ret = l.AppDefs.Item(id)
return
}
func (l *Library) Place(id int) (ret *LocationDef) { func (l *Library) Place(id int) (ret *LocationDef) {
ret = l.Places.Item(id) ret = l.Places.Item(id)
return return
} }
func (l *Library) Tradition(letter int) (ret []App) {
item := l.Traditions.Item(letter)
if item == nil {
return []App{}
}
return item.Apps
}
func (l *Library) GetPersons(id []int) (ret []*PersonDef) { func (l *Library) GetPersons(id []int) (ret []*PersonDef) {
for _, i := range id { for _, i := range id {
ret = append(ret, l.Person(i)) ret = append(ret, l.Person(i))
@@ -336,9 +350,11 @@ func (l *Library) GetPlaces(id []int) (ret []*LocationDef) {
func (l *Library) FuncMap() template.FuncMap { func (l *Library) FuncMap() template.FuncMap {
return template.FuncMap{ return template.FuncMap{
"Person": l.Person, "Person": l.Person,
"Place": l.Place, "Place": l.Place,
"Persons": l.GetPersons, "Persons": l.GetPersons,
"Places": l.GetPlaces, "Places": l.GetPlaces,
"App": l.App,
"Tradition": l.Tradition,
} }
} }