Merge upstream & local

This commit is contained in:
Simon Martens
2025-05-13 20:39:03 +02:00
9 changed files with 78 additions and 35 deletions

View File

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

File diff suppressed because one or more lines are too long

View File

@@ -1,5 +1,5 @@
{{- $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>
<i class="ri-creative-commons-line"></i>

View File

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

View File

@@ -1,8 +1,11 @@
{{ $model := . }}
<div class="flex flex-row w-full border-b pb-2 mb-3">
{{- 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 }}
<a href="/brief/{{ .prev.Letter }}" class="stdlink"
><i class="ri-arrow-left-long-line"></i
@@ -20,3 +23,7 @@
<div class="text">
{{- Safe (ParseGeneric .text.Content) -}}
</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 := . }}
<nav>
<nav class="print:hidden">
{{- range $y := .years -}}
<a
class="inline-block stdlink px-0.5"
@@ -22,7 +22,7 @@
{{- if .year -}}
{{- $letters := index $model.yearmap $model.year -}}
<div class="flex flex-row gap-x-1">
<div>{{- .year }}</div>
<div>Briefe für das Jahr {{- .year }}</div>
<div>({{- len $letters }})</div>
</div>
{{ 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;
}
.text {
@apply font-serif max-w-[80ch] relative;
@apply font-serif max-w-[80ch] print:max-w-[60ch] relative;
}
.text .page,
@@ -92,6 +92,7 @@
.text .pe,
.text .gr,
.text .hb,
.text .ru,
.text .nr,
.text .align,
.text .b,
@@ -175,6 +176,13 @@
@apply italic;
}
.traditions,
.tradition,
.text,
.text * {
clear: both;
}
.text .align.pos-right {
@apply text-right;
float: right;
@@ -225,10 +233,8 @@
.text .note,
.text .hand-person,
.text .sidenote-note,
.text .sidenote-page,
.text .sidenote-pos {
@apply inline px-2 mr-2 w-full bg-gray-100 font-bold text-gray-700;
.text .sidenote-meta {
@apply absolute right-[-45ch] w-[40ch] px-2 mr-2 bg-gray-100 italic text-sm text-gray-700 font-sans;
}
.text .sidenote-page::before {

View File

@@ -315,11 +315,25 @@ func (l *Library) Person(id int) (ret *PersonDef) {
return
}
func (l *Library) App(id int) (ret *AppDef) {
ret = l.AppDefs.Item(id)
return
}
func (l *Library) Place(id int) (ret *LocationDef) {
ret = l.Places.Item(id)
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) {
for _, i := range id {
ret = append(ret, l.Person(i))
@@ -336,9 +350,11 @@ func (l *Library) GetPlaces(id []int) (ret []*LocationDef) {
func (l *Library) FuncMap() template.FuncMap {
return template.FuncMap{
"Person": l.Person,
"Place": l.Place,
"Persons": l.GetPersons,
"Places": l.GetPlaces,
"Person": l.Person,
"Place": l.Place,
"Persons": l.GetPersons,
"Places": l.GetPlaces,
"App": l.App,
"Tradition": l.Tradition,
}
}