Skip to content

Commit

Permalink
Add chapter property first for superhead population, improve head p…
Browse files Browse the repository at this point in the history
…opulation, and fix emphasize parse overreach
  • Loading branch information
CurbaiCode committed Sep 17, 2024
1 parent d156516 commit 3699c9a
Show file tree
Hide file tree
Showing 5 changed files with 12 additions and 8 deletions.
2 changes: 1 addition & 1 deletion index.html
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ <h4 id="subheading"></h4>
<p id="intro"></p>
</div>
<h3 id="chapter"></h3>
<p><em id="summary"></em></p>
<p id="summary"><em id="summary-text"></em></p>
</div>
<article id="article"></article>
</section>
Expand Down
Binary file modified library/en/nt.spr/book.stc
Binary file not shown.
Binary file modified library/en/nt.spr/mark/1.snn
Binary file not shown.
10 changes: 7 additions & 3 deletions scripts/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -149,7 +149,7 @@ function parse(el, type, text) {
t = newSubline.split("~")[1];
var translationLen = t.split("\n").length;
}
while (emMatch = /`([^\|]+?)`/g.exec(t)) { // Emphasize ` `, but not `| `
while (emMatch = /`([^\|]+?)`[^\|]/g.exec(t)) { // Emphasize ` `, but not `| `
t = t.replace(emMatch[0], '<em class="jst">' + emMatch[1] + "</em>");
}
var first = true;
Expand Down Expand Up @@ -674,6 +674,8 @@ function chapterCatalog(id) { // Get article
});
})();
} else if (curPart.id == "SKIP") {
document.getElementById("chapter").style.display = "none";
document.getElementById("summary").style.display = "none";
document.getElementById("head").style.display = "";
document.getElementById("heading").textContent = curChapter.title || curChapter.name;
document.getElementById("subheading").textContent = curChapter.subtitle || "";
Expand All @@ -695,16 +697,18 @@ function chapterCatalog(id) { // Get article
document.getElementById("head").style.display = "";
for (var chapter of partCache) { // Search for selected chapter
if (chapter.id == curChapter.id) {
if (chapter == partCache[0]) { // Populate heading above first chapter
if (chapter.first == true) { // Populate heading above first chapter
document.getElementById("heading").textContent = curPart.title || "";
document.getElementById("subheading").textContent = curPart.subtitle || "";
document.getElementById("intro").textContent = curPart.intro || "";
document.getElementById("superhead").style.display = "";
} else {
document.getElementById("superhead").style.display = "none";
}
document.getElementById("chapter").style.display = "";
document.getElementById("summary").style.display = "";
document.getElementById("chapter").textContent = chapter.title || chapter.name;
document.getElementById("summary").textContent = chapter.summary || "";
document.getElementById("summary-text").textContent = chapter.summary || "";
(function () {
var c = chapter;
readFile("library/" + lang + "/" + curBook.id + ".spr/" + curPart.id + "/" + curChapter.id + ".sch", function (success, contents) {
Expand Down
Loading

0 comments on commit 3699c9a

Please sign in to comment.