From f56d7a4c570b47c6e7c7409bfe4621af026a9358 Mon Sep 17 00:00:00 2001 From: Matthias Jung Date: Sun, 29 Mar 2026 22:19:28 +0200 Subject: [PATCH 1/6] feature: index --- README-FORMAT.md | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/README-FORMAT.md b/README-FORMAT.md index c19ca20..df663f5 100644 --- a/README-FORMAT.md +++ b/README-FORMAT.md @@ -133,3 +133,7 @@ Kommentare gehen weiterhin per %-Zeichen, aber nur am Anfang der Zeile! TODO als ## Links Hyperlinks sollten immer über den 50ohm.de-URL-Shortener abgebildet werden. + +## Index + +Indexeinträge werden mit `[index:Begriff]` bzw. `[index:Hauptbegriff:Unterbegriff]` gesetzt. Ein optionales Leerzeichen vor dem Befehl wird beim Konvertieren entfernt. From 6f1ae857058ad38a7a0a80a428931e954cc12dd3 Mon Sep 17 00:00:00 2001 From: Matthias Jung Date: Mon, 30 Mar 2026 12:41:54 +0200 Subject: [PATCH 2/6] refactor: improved with example --- README-FORMAT.md | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/README-FORMAT.md b/README-FORMAT.md index df663f5..3ec10d0 100644 --- a/README-FORMAT.md +++ b/README-FORMAT.md @@ -137,3 +137,9 @@ Hyperlinks sollten immer über den 50ohm.de-URL-Shortener abgebildet werden. ## Index Indexeinträge werden mit `[index:Begriff]` bzw. `[index:Hauptbegriff:Unterbegriff]` gesetzt. Ein optionales Leerzeichen vor dem Befehl wird beim Konvertieren entfernt. + +Beispiel: + +``` +Im Betrieb werden Yagi-Antennen [index:Antenne:Yagi-Antenne] oft ... +``` From 5dd4b81e8ae337db4a1999b9d7066253385955b1 Mon Sep 17 00:00:00 2001 From: Matthias Jung Date: Sun, 5 Apr 2026 16:39:03 +0200 Subject: [PATCH 3/6] feature: add question index search --- contents/static/suche.html | 209 +++++++++++++++++++++++++++++++++++++ 1 file changed, 209 insertions(+) create mode 100644 contents/static/suche.html diff --git a/contents/static/suche.html b/contents/static/suche.html new file mode 100644 index 0000000..85cee20 --- /dev/null +++ b/contents/static/suche.html @@ -0,0 +1,209 @@ +

Fragensuche

+ +
+
+
+
+ + +
+
+ +
+
+ +
+ + \ No newline at end of file From bdedf0d16ab986d565488177e36f439366c45350 Mon Sep 17 00:00:00 2001 From: Matthias Jung Date: Sun, 5 Apr 2026 23:10:04 +0200 Subject: [PATCH 4/6] refactor: improved search --- contents/static/suche.html | 98 ++++++++++++++++++++++---------------- 1 file changed, 57 insertions(+), 41 deletions(-) diff --git a/contents/static/suche.html b/contents/static/suche.html index 85cee20..e79531e 100644 --- a/contents/static/suche.html +++ b/contents/static/suche.html @@ -1,5 +1,13 @@

Fragensuche

+ +
@@ -104,7 +112,7 @@ if (query.length === 0) { resultsBox.innerHTML = - '
Bitte gib eine Frage-ID ein, z. B. AB123.
'; + '
Bitte gib eine Frage-ID ein, z. B. VD102.
'; return; } @@ -114,7 +122,7 @@ (questionId) => questionId.includes(query) && !questionId.startsWith(query) ); - const matches = [...exactMatches, ...startsWithMatches, ...includesMatches].slice(0, 50); + const matches = [...exactMatches, ...startsWithMatches, ...includesMatches]; if (matches.length === 0) { resultsBox.innerHTML = @@ -122,44 +130,52 @@ return; } - const cards = matches.flatMap((questionId) => { - const entries = Array.isArray(questionIndex[questionId]) ? questionIndex[questionId] : []; - return entries - .map((entry) => { - const sectionIdentRaw = entry.section || ""; - const chapterTitle = escapeHtml(entry.chapter_title || "Unbekanntes Kapitel"); - const sectionTitle = escapeHtml(entry.section_title || entry.section || "Unbekannte Sektion"); - const editions = sortEditions(Array.isArray(entry.editions) ? entry.editions : []); - const editionLinks = editions - .map((edition) => { - const editionSafe = escapeHtml(edition); - const editionLabel = escapeHtml(getEditionLabel(edition)); - const targetClass = getTargetClass(edition); - const targetColor = targetColorByClass[targetClass] || "#6c757d"; - const targetTitle = targetClass ? `Zielklasse ${targetClass}` : "Zielklasse unbekannt"; - const href = `${encodeURIComponent(edition)}_${encodeURIComponent(sectionIdentRaw)}.html#${encodeURIComponent(questionId)}`; - return `${editionLabel}`; - }) - .join(""); - return ` -
-
- -
-
-
${editionLinks || '-'}
-
+ const cards = matches.map((questionId) => { + const entry = questionIndex[questionId] || {}; + const sectionIdentRaw = entry.section || ""; + const chapterTitle = escapeHtml(entry.chapter_title || "Unbekanntes Kapitel"); + const sectionTitle = escapeHtml(entry.section_title || entry.section || "Unbekannte Sektion"); + const hasSolution = Boolean(entry.has_solution); + const editions = sortEditions(Array.isArray(entry.editions) ? entry.editions : []); + const editionLinks = editions + .map((edition) => { + const editionSafe = escapeHtml(edition); + const editionLabel = escapeHtml(getEditionLabel(edition)); + const targetClass = getTargetClass(edition); + const targetColor = targetColorByClass[targetClass] || "#6c757d"; + const targetTitle = targetClass ? `Zielklasse ${targetClass}` : "Zielklasse unbekannt"; + const href = `${encodeURIComponent(edition)}_${encodeURIComponent(sectionIdentRaw)}.html#${encodeURIComponent(questionId)}`; + return `${editionLabel}`; + }) + .join(""); + const solutionLink = hasSolution + ? ` + + Lösungsweg + ` + : ""; + + return ` +
+
+
${escapeHtml(questionId)}
+ +
+
+
+ ${editionLinks || '-'} + ${solutionLink}
- `; - }); +
+
+ `; }); resultsBox.innerHTML = ` @@ -170,7 +186,7 @@ async function loadQuestionIndex() { try { - const response = await fetch("/question_index.json", { + const response = await fetch("/assets/question_index.json", { cache: "no-cache", headers: { Accept: "application/json", @@ -200,7 +216,7 @@ errorBox.classList.remove("d-none"); errorBox.textContent = "Suchindex konnte nicht geladen werden: " + error.message; - console.error("Failed to load /question_index.json", error); + console.error("Failed to load question_index.json", error); } } From 69302bbf6d9dfbe4a7af2125d585a91fa049fdef Mon Sep 17 00:00:00 2001 From: Matthias Jung Date: Mon, 6 Apr 2026 22:03:19 +0200 Subject: [PATCH 5/6] feature: index search --- contents/static/suche.html | 429 +++++++++++++++++++++---------------- 1 file changed, 242 insertions(+), 187 deletions(-) diff --git a/contents/static/suche.html b/contents/static/suche.html index e79531e..5728785 100644 --- a/contents/static/suche.html +++ b/contents/static/suche.html @@ -1,225 +1,280 @@ -

Fragensuche

+

Suche

-
-
-
- - -
-
- -
+
+
+
+ + +
+
+ +
\ No newline at end of file + resultsBox.innerHTML = ` +

${total} Treffer (${questionCards.length} Fragen, ${indexCards.length} Begriffe)

+ ${questionCards.join("")} + ${indexCards.join("")} + `; + } + + async function loadSearchIndices() { + try { + const [questionResponse, indexResponse] = await Promise.all([ + fetch("/assets/question_index.json", { + cache: "no-cache", + headers: { Accept: "application/json" }, + }), + fetch("/assets/index.json", { + cache: "no-cache", + headers: { Accept: "application/json" }, + }), + ]); + + if (!questionResponse.ok) throw new Error("question_index.json: HTTP " + questionResponse.status); + if (!indexResponse.ok) throw new Error("index.json: HTTP " + indexResponse.status); + + const questionData = await questionResponse.json(); + const indexData = await indexResponse.json(); + + questionIndex = questionData || {}; + indexEntries = Array.isArray(indexData) ? indexData : []; + + searchInput.disabled = false; + searchInput.addEventListener("input", renderSearchResults); + searchInput.addEventListener("keydown", (event) => { + if (event.key === "Enter") { + event.preventDefault(); + renderSearchResults(); + } + }); + + renderSearchResults(); + } catch (error) { + errorBox.classList.remove("d-none"); + errorBox.textContent = "Suchindex konnte nicht geladen werden: " + error.message; + console.error("Failed to load search indices", error); + } + } + + loadSearchIndices(); +})(); + From 7d63969c51265f7deeb2842a9f8a25dac6810011 Mon Sep 17 00:00:00 2001 From: Matthias Jung Date: Mon, 6 Apr 2026 22:21:17 +0200 Subject: [PATCH 6/6] feature: index search --- contents/static/suche.html | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/contents/static/suche.html b/contents/static/suche.html index 5728785..f4e07aa 100644 --- a/contents/static/suche.html +++ b/contents/static/suche.html @@ -113,7 +113,7 @@ const hasSolution = Boolean(entry.has_solution); const editionLinks = renderEditionButtons(entry.editions, sectionIdentRaw, questionId); const solutionLink = hasSolution - ? `Loesungsweg` + ? `Lösungsweg` : ""; return ` @@ -151,7 +151,7 @@ return `
-
Index: ${term}${subterm ? ` / ${subterm}` : ""}
+
${term}${subterm ? ` / ${subterm}` : ""}