|
31 | 31 | */ |
32 | 32 | function nullIfDivEmpty(div) { |
33 | 33 | // Example |
34 | | - // {id: 'commentary', html: '<h2>commentary</h2> <p> </p> '} => null |
| 34 | + // {id: 'commentary', html: '<h2>commentary</h2> <p> </p> '} => null |
35 | 35 | let ret = null; |
36 | 36 | if (div && div.html) { |
37 | 37 | let html = div.html.trim(); |
38 | 38 | // removes heading from start |
39 | 39 | html = html.replace(/^<(h[1-6])>.*?<\/\1>/, ''); |
40 | 40 | // removes empty <p> |
41 | 41 | html = html.replace(/<p(\s[^>]*)?>\s*(?: |\s)*<\/p>/gi, ''); |
42 | | - html = html.trim() |
| 42 | + html = html.trim(); |
43 | 43 | if (html.length) { |
44 | 44 | ret = div; |
45 | 45 | } |
|
49 | 49 |
|
50 | 50 | const attribution = $derived(html?.editions?.[0]?.html); |
51 | 51 | const editions = $derived(html?.divs?.find((div) => div.id === 'editions')); |
52 | | - const apparatus = $derived( |
53 | | - nullIfDivEmpty( |
54 | | - html?.divs?.find((div) => div.id === 'apparatus') |
55 | | - ) |
56 | | - ); |
| 52 | + const apparatus = $derived(nullIfDivEmpty(html?.divs?.find((div) => div.id === 'apparatus'))); |
57 | 53 | const translations = $derived(html?.divs?.filter((div) => div.id === 'translation') || []); |
58 | 54 |
|
59 | 55 | /** |
@@ -609,6 +605,42 @@ ${changeDate ? `Last revised: ${changeDate}.` : ''} |
609 | 605 | padding-block: var(--size-2); |
610 | 606 | } |
611 | 607 |
|
| 608 | + /* ZL: consistent spacing between section headings and their content */ |
| 609 | + #text-type h2 { |
| 610 | + margin-bottom: var(--size-3); |
| 611 | + } |
| 612 | +
|
| 613 | + #commentary :global(h2) { |
| 614 | + padding-bottom: var(--size-3); |
| 615 | + } |
| 616 | +
|
| 617 | + #physical-description h3 { |
| 618 | + margin-top: var(--size-6); |
| 619 | + margin-bottom: var(--size-2); |
| 620 | + } |
| 621 | +
|
| 622 | + /* ZL: improve spacing and hierarchy in Physical description */ |
| 623 | + #physical-description dl { |
| 624 | + display: flex; |
| 625 | + flex-direction: column; |
| 626 | + gap: 0; |
| 627 | + margin-block: var(--size-2) var(--size-6); |
| 628 | + } |
| 629 | +
|
| 630 | + #physical-description dt { |
| 631 | + font-weight: bold; |
| 632 | + margin-top: var(--size-4); |
| 633 | + } |
| 634 | +
|
| 635 | + #physical-description dt:first-child { |
| 636 | + margin-top: 0; |
| 637 | + } |
| 638 | +
|
| 639 | + #physical-description dd { |
| 640 | + margin-inline-start: 0; |
| 641 | + margin-top: var(--size-1); |
| 642 | + } |
| 643 | +
|
612 | 644 | #content > section { |
613 | 645 | border-bottom: var(--border-size-1) solid var(--border-color); |
614 | 646 | padding-bottom: var(--size-8); |
|
0 commit comments