Glossar-Review: CO2-Eintrag ganze Sätze + Tabelle, Geviertstrich→Gedankenstrich, Weltküche-Onboarding
- Glossar-Renderer: Markdown-Tabellen (|…|) + .gl-table CSS - co2-fussabdruck-lebensmittel: telegrafische Liste → ganze Sätze + saubere Portions-Tabelle, Avocado-Vergleich, Malpunkt statt × - Programmweit „—" (Geviertstrich) → „–" (Gedankenstrich): Glossar-DB, glossar_examples, module_info, alle 13 Buch-Kapitel - Weltküche-Onboarding: Blatt 2 umformuliert (zweites Land nacheinander), Blatt 3 Lehrplan-Satz entfernt, Blatt 4 fehlendes markt.webp generiert Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
+19
-2
@@ -353,6 +353,10 @@ foreach (array_keys($moduleMeta) as $mid) {
|
||||
}
|
||||
@keyframes gl-fade-in { from { opacity: 0 } to { opacity: 1 } }
|
||||
.gl-detail-text { font-size: .95rem; line-height: 1.7; color: var(--ggs-text); margin-bottom: 1rem; }
|
||||
.gl-table { border-collapse: collapse; width: 100%; margin: .8rem 0; font-size: .9rem; }
|
||||
.gl-table th, .gl-table td { border: 1px solid var(--ggs-border); padding: .35rem .6rem; text-align: left; }
|
||||
.gl-table th { background: var(--ggs-fjord-light, #eef2ea); font-weight: 700; }
|
||||
.gl-table td:last-child, .gl-table th:last-child { text-align: right; white-space: nowrap; }
|
||||
.gl-detail-text p { margin-bottom: .9rem; }
|
||||
.gl-detail-text p:last-child { margin-bottom: 0; }
|
||||
.gl-inline-link {
|
||||
@@ -738,9 +742,22 @@ function renderArticle(text) {
|
||||
// Einfache Textauszeichnung
|
||||
h = h.replace(/\*\*([^*]+)\*\*/g, '<strong>$1</strong>');
|
||||
h = h.replace(/(?<!\*)\*([^*\n]+)\*(?!\*)/g, '<em>$1</em>');
|
||||
// Absätze
|
||||
// Absätze — ein Block aus lauter |…|-Zeilen wird zur Tabelle (Markdown-Stil)
|
||||
const paras = h.split(/\n\s*\n/).map(p => p.trim()).filter(Boolean);
|
||||
return paras.map(p => '<p>' + p.replace(/\n/g, '<br>') + '</p>').join('');
|
||||
return paras.map(p => {
|
||||
const lines = p.split('\n').map(l => l.trim());
|
||||
if (lines.length >= 2 && lines.every(l => l.startsWith('|'))) {
|
||||
const body = lines.filter(l => !/^\|[\s:|-]+\|?$/.test(l)); // Trennzeile |---|---| entfernen
|
||||
let t = '<table class="gl-table">';
|
||||
body.forEach((line, i) => {
|
||||
const cells = line.replace(/^\||\|$/g, '').split('|').map(c => c.trim());
|
||||
const tag = i === 0 ? 'th' : 'td';
|
||||
t += '<tr>' + cells.map(c => '<' + tag + '>' + c + '</' + tag + '>').join('') + '</tr>';
|
||||
});
|
||||
return t + '</table>';
|
||||
}
|
||||
return '<p>' + p.replace(/\n/g, '<br>') + '</p>';
|
||||
}).join('');
|
||||
}
|
||||
|
||||
/** Datum yyyy-mm-dd → Abgerufen am D.M.YYYY */
|
||||
|
||||
Reference in New Issue
Block a user