Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
32 commits
Select commit Hold shift + click to select a range
00400d1
Add share button (#21)
Mar 17, 2025
b993fcb
Add share dialogue and scrolling to main section (#21)
Mar 31, 2025
dadb9c7
Add TEI download draft (#23)
Apr 16, 2025
23b3c83
Add xml template (#23)
Apr 29, 2025
f14b249
Update template, add random longest/shortest play generation (#23)
Jun 23, 2025
3aa0d0b
Update template, add same-pip-plays
Aug 19, 2025
00f2e43
Use timestamp as filename (#23)
Sep 3, 2025
28e21d9
Generate corpus with 100 random plays
Sep 3, 2025
da9844c
Correct ESLint flat config rules placement
v-ji Sep 9, 2025
eceda46
Add download and generation functionality to +page.svelte
v-ji Sep 9, 2025
e2b66f1
Add menu
markschwindt Sep 10, 2025
dffa970
Refactor button click handlers to remove menu closure
markschwindt Sep 10, 2025
a55fe92
Add English source localisation
v-ji Sep 12, 2025
b7737f1
Update English source: 265/1200
v-ji Sep 15, 2025
bf9c064
Let locale buttons show current state
v-ji Sep 15, 2025
24cc2be
Localise title
v-ji Sep 15, 2025
7c68e98
Fix Locale type
v-ji Sep 15, 2025
fbb2cd0
Adjust tab title based on source language
v-ji Sep 15, 2025
b32c22c
Update English source: 456/1200
v-ji Sep 17, 2025
9523db6
Update English source: complete
v-ji Jan 27, 2026
e9d0f4f
Resolve merge conflict: Keep TEI download in share button, remove fro…
v-ji Jan 27, 2026
37dd3ed
Adjust spacing
v-ji Jan 27, 2026
81b3329
Pass sourceLanguage to downloadTEIDoc
v-ji Jan 27, 2026
799227e
Update English source: wording
v-ji Feb 11, 2026
954fd7e
add missing scenes; fix OCR error
lehkost Sep 23, 2025
db6b446
Add about page scaffold
v-ji Feb 22, 2026
001f9b2
Add about page
v-ji Feb 22, 2026
8afa134
Add icons
markschwindt Feb 26, 2026
f01d3c3
Update icon sizes for consistency in about page and SVG assets
markschwindt Feb 26, 2026
2acfd1f
Add HamburgerMenu component to about page and main page
markschwindt Feb 26, 2026
5a1d539
update Credits page
lehkost Feb 28, 2026
076a538
Format with prettier
v-ji Mar 14, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
295 changes: 63 additions & 232 deletions package-lock.json

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,8 @@
"@eslint/eslintrc": "^3.2.0",
"@eslint/js": "^9.19.0",
"@sveltejs/adapter-static": "^3.0.1",
"@sveltejs/kit": "^2.5.27",
"@sveltejs/vite-plugin-svelte": "^4.0.0",
"@sveltejs/kit": "^2.53.0",
"@sveltejs/vite-plugin-svelte": "^4.0.4",
"@tailwindcss/vite": "^4.0.0",
"@types/eslint": "^9.6.1",
"@types/node": "^24.0.1",
Expand Down
32 changes: 18 additions & 14 deletions src/lib/almanac.ts
Original file line number Diff line number Diff line change
@@ -1,27 +1,31 @@
import { browser } from "$app/environment"
import diceChart from "$lib/assets/dice_chart.json"
import almanacText from "$lib/assets/neunhundert-neun-und-neunzig-und-noch-etliche-almanachs-lustspiele.xml?raw"
import germanAlmanacText from "$lib/assets/neunhundert-neun-und-neunzig-und-noch-etliche-almanachs-lustspiele.xml?raw"
import englishAlmanacText from "$lib/assets/rolling-the-dice-for-999-and-many-more-almanac-comedies.xml?raw"
import xslStyle from "$lib/assets/transform.xsl?raw"
import { validateDiceChart, validateSegments } from "$lib/validate"
import { xsltTransform } from "$lib/xslt"

type Locale = "de" | "en"

export class Almanac {
static segmentsCache: Record<string, string> | null = null
static segmentsPromise: Promise<Record<string, string>> | null = null
static segmentsCache: Partial<Record<Locale, Record<string, string>>> = {}
static segmentsPromise: Partial<Record<Locale, Promise<Record<string, string>>>> = {}

static getDom() {
static getDom(locale: Locale = "de") {
if (!browser) {
throw new Error("getDom is only available in the browser")
}
return new window.DOMParser().parseFromString(almanacText, "text/xml")
const text = locale === "de" ? germanAlmanacText : englishAlmanacText
return new window.DOMParser().parseFromString(text, "text/xml")
}

static async getSegments(): Promise<Record<string, string>> {
if (this.segmentsCache) return this.segmentsCache
if (this.segmentsPromise) return this.segmentsPromise
static async getSegments(locale: Locale = "de"): Promise<Record<string, string>> {
if (this.segmentsCache[locale]) return this.segmentsCache[locale]!
if (this.segmentsPromise[locale]) return this.segmentsPromise[locale]!

this.segmentsPromise = (async () => {
const dom = this.getDom()
this.segmentsPromise[locale] = (async () => {
const dom = this.getDom(locale)
const segments: Record<string, string> = {}
const segmentDivs = dom.querySelectorAll('div[type="segment"]')

Expand All @@ -33,11 +37,11 @@ export class Almanac {
await Promise.all(promises)

validateSegments(segments, 200 * 6)
this.segmentsCache = segments
this.segmentsCache[locale] = segments
return segments
})()

return this.segmentsPromise
return this.segmentsPromise[locale]!
}

static getDiceChart() {
Expand All @@ -52,9 +56,9 @@ export class Almanac {
return diceChart[roll - 1][pips - 1]
}

static async getSegment(roll: number, pips: number): Promise<Segment> {
static async getSegment(roll: number, pips: number, locale: Locale = "de"): Promise<Segment> {
const id = this.getSegmentId(roll, pips)
return { id, html: (await this.getSegments())[id] }
return { id, html: (await this.getSegments(locale))[id] }
}
}

Expand Down
5 changes: 5 additions & 0 deletions src/lib/assets/cross-circled.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
5 changes: 5 additions & 0 deletions src/lib/assets/info-circled.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,7 @@
<change when="2024-02-22">initial conversion from source</change>
<change when="2024-06-26">minor corrections</change>
<change when="2025-02-05">minor corrections</change>
<change when="2025-09-23">add scene titles missing in original</change>
</listChange>
</revisionDesc>
</teiHeader>
Expand Down Expand Up @@ -2507,7 +2508,7 @@
<sp who="#zofe">
<speaker>Das Kammerm.</speaker>
<p>Richtig. Und das Stück könnte heißen. U. A. z. n., oder: <emph>Der geprellte
Akte</emph>.</p>
Alte</emph>.</p>
</sp>
<sp who="#liebhaberin">
<speaker>Die Nichte.</speaker>
Expand Down Expand Up @@ -3531,6 +3532,8 @@
</div>
<pb n="95"/>
<div n="418" type="segment">
<head><supplied>Dritter Auftritt.</supplied></head>
<stage><supplied>Die Vorigen. Der Liebhaber.</supplied></stage>
<sp who="#liebhaber">
<speaker>Der Liebh.</speaker>
<stage>(sie umfassend)</stage>
Expand Down Expand Up @@ -5996,6 +5999,7 @@
</sp>
</div>
<div n="725" subtype="manicule-left" type="segment">
<head><supplied>Vierzehnter Auftritt.</supplied></head>
<stage>Der Oheim. Das Kammermädchen.</stage>
<pb n="160"/>
<sp who="#diener">
Expand Down Expand Up @@ -8718,6 +8722,7 @@
</sp>
</div>
<div n="1047" type="segment">
<head><supplied>Vierzehnter Auftritt.</supplied></head>
<stage>Der Oheim. Das Kammermädchen. Der Diener.</stage>
<stage>(Der Letztere ist auffallend als Stutzer gekleidet. Er spricht <pb n="235"/> im
Berlinischen, sächsischen, pommerschen oder im Mecklenburger-Bauern-Dialekt; wie es dem
Expand Down
Loading
Loading