Add support for different sections for term content

This commit is contained in:
toasted-nutbread 2020-03-01 14:04:54 -05:00
parent 168bd72d0a
commit 9e8a22b08a
5 changed files with 28 additions and 3 deletions

View File

@ -19,6 +19,8 @@
body { background-color: #1e1e1e; color: #d4d4d4; } body { background-color: #1e1e1e; color: #d4d4d4; }
h2 { border-bottom-color: #2f2f2f; }
.navigation-header { .navigation-header {
background-color: #1e1e1e; background-color: #1e1e1e;
border-bottom-color: #2f2f2f; border-bottom-color: #2f2f2f;

View File

@ -19,6 +19,8 @@
body { background-color: #ffffff; color: #333333; } body { background-color: #ffffff; color: #333333; }
h2 { border-bottom-color: #eeeeee; }
.navigation-header { .navigation-header {
background-color: #ffffff; background-color: #ffffff;
border-bottom-color: #eeeeee; border-bottom-color: #eeeeee;

View File

@ -65,6 +65,14 @@ ol, ul {
height: 2.28571428em; /* 14px => 32px */ height: 2.28571428em; /* 14px => 32px */
} }
h2 {
font-size: 1.25em;
font-weight: normal;
margin: 0.25em 0 0;
border-bottom-width: 0.05714285714285714em; /* 14px * 1.25em => 1px */
border-bottom-style: solid;
}
/* /*
* Navigation * Navigation
*/ */
@ -422,6 +430,11 @@ button.action-button {
display: inline; display: inline;
} }
.term-entry-body[data-section-count="0"] .term-entry-body-section-header,
.term-entry-body[data-section-count="1"] .term-entry-body-section-header {
display: none;
}
/* /*
* Kanji * Kanji

View File

@ -17,7 +17,9 @@
</div> </div>
<div class="term-special-tags"><div class="frequencies tag-list"></div></div> <div class="term-special-tags"><div class="frequencies tag-list"></div></div>
</div> </div>
<div class="term-definition-container"><ol class="term-definition-list"></ol></div> <div class="term-entry-body">
<div class="term-entry-body-section term-pitch-accent-container"><h2 class="term-entry-body-section-header term-pitch-accent-header">Pitch Accents</h2><ol class="term-entry-body-section-content term-pitch-accent-group-list"></ol></div>
</div>
<pre class="debug-info"></pre> <pre class="debug-info"></pre>
</div></template> </div></template>
<template id="term-expression-template"><div class="term-expression"><span class="term-expression-text source-text"></span><div class="term-expression-details"> <template id="term-expression-template"><div class="term-expression"><span class="term-expression-text source-text"></span><div class="term-expression-details">

View File

@ -43,11 +43,17 @@ class DisplayGenerator {
const expressionMulti = Array.isArray(details.expressions); const expressionMulti = Array.isArray(details.expressions);
const definitionMulti = Array.isArray(details.definitions); const definitionMulti = Array.isArray(details.definitions);
const expressionCount = expressionMulti ? details.expressions.length : 1;
const definitionCount = definitionMulti ? details.definitions.length : 1;
node.dataset.expressionMulti = `${expressionMulti}`; node.dataset.expressionMulti = `${expressionMulti}`;
node.dataset.definitionMulti = `${definitionMulti}`; node.dataset.definitionMulti = `${definitionMulti}`;
node.dataset.expressionCount = `${expressionMulti ? details.expressions.length : 1}`; node.dataset.expressionCount = `${expressionCount}`;
node.dataset.definitionCount = `${definitionMulti ? details.definitions.length : 1}`; node.dataset.definitionCount = `${definitionCount}`;
bodyContainer.dataset.sectionCount = `${
(definitionCount > 0 ? 1 : 0)
}`;
const termTags = details.termTags; const termTags = details.termTags;
let expressions = details.expressions; let expressions = details.expressions;