@rse/specbook 1.2.14 → 1.2.15
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -50,34 +50,37 @@
|
|
|
50
50
|
let indexed = false
|
|
51
51
|
|
|
52
52
|
/* fill the unit and vocabulary indices once on first use: a unit
|
|
53
|
-
is an outermost paragraph-level element within an article
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
searched text */
|
|
53
|
+
is an outermost paragraph-level element within an article or
|
|
54
|
+
the title page abstract (a lone paragraph being the unit itself),
|
|
55
|
+
i.e. one not nested inside another unit (like a paragraph in a
|
|
56
|
+
table cell, covered by its table row), where a diagram is
|
|
57
|
+
searched by its space-joined SVG text labels (its raw text
|
|
58
|
+
content runs them together), and where the explicit anchor id
|
|
59
|
+
of an object heading or table row joins the searched text */
|
|
60
60
|
const index = () => {
|
|
61
61
|
if (indexed)
|
|
62
62
|
return
|
|
63
63
|
indexed = true
|
|
64
|
-
document.querySelectorAll("article").forEach((
|
|
65
|
-
|
|
66
|
-
.
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
})
|
|
64
|
+
document.querySelectorAll("article, div.titlepage > .description").forEach((root) => {
|
|
65
|
+
const els = Array.from(root.querySelectorAll(
|
|
66
|
+
"p, li, tr, pre, blockquote, h1, h2, h3, h4, h5, h6, div.diagram"))
|
|
67
|
+
if (root.tagName === "P")
|
|
68
|
+
els.unshift(root)
|
|
69
|
+
els.forEach((el) => {
|
|
70
|
+
let parent = el.parentElement
|
|
71
|
+
while (parent !== null && parent !== root) {
|
|
72
|
+
if (/^(TR|TD|TH|LI|P|BLOCKQUOTE)$/.test(parent.tagName))
|
|
73
|
+
return
|
|
74
|
+
parent = parent.parentElement
|
|
75
|
+
}
|
|
76
|
+
const id = (el.dataset.id ?? "").toLowerCase()
|
|
77
|
+
const text = ((el.classList.contains("diagram") ?
|
|
78
|
+
Array.from(el.querySelectorAll("text")).map((t) => t.textContent ?? "").join(" ") :
|
|
79
|
+
(el.textContent ?? "")) + " " + id).toLowerCase()
|
|
80
|
+
const words = new Set(text.split(/[^\p{L}\p{N}]+/u).filter((w) => w !== ""))
|
|
81
|
+
words.forEach((w) => { vocab.add(w) })
|
|
82
|
+
units.push({ el, id, text, words, keep: false })
|
|
83
|
+
})
|
|
81
84
|
})
|
|
82
85
|
|
|
83
86
|
/* let a hyperlink whose target the filtering hid leave the
|
|
@@ -38,9 +38,9 @@ const templates = {
|
|
|
38
38
|
<div class="theme-switch" onclick="themeSwitch()" title="switch color theme"><svg class="theme-icon" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2.5" stroke-linecap="round"><circle cx="12" cy="12" r="8.5"/><path d="M12 3.5 A 8.5 8.5 0 0 0 12 20.5 Z" fill="currentColor" stroke="none"/></svg></div>
|
|
39
39
|
{% if Document.info %}<div class="info-switch" title="toggle description popups"><svg class="info-icon" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2.5" stroke-linecap="round"><circle cx="12" cy="12" r="8.5"/><line x1="12" y1="11" x2="12" y2="16"/><line x1="12" y1="7.75" x2="12.01" y2="7.75"/></svg></div>{% endif %}
|
|
40
40
|
<div class="search" id="search">
|
|
41
|
-
<div class="search-toggle" id="search-toggle" title="toggle search field"><svg class="search-icon" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2.5" stroke-linecap="round"
|
|
41
|
+
<div class="search-toggle" id="search-toggle" title="toggle search field"><svg class="search-icon" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2.5" stroke-linecap="round" stroke-linejoin="round"><polygon points="3.5,4.5 20.5,4.5 14,12.5 14,20 10,17.5 10,12.5"/></svg></div>
|
|
42
42
|
<div class="search-field">
|
|
43
|
-
<input type="text" id="search-input" placeholder="
|
|
43
|
+
<input type="text" id="search-input" placeholder="Filter… (fuzzy matched keywords)" autocomplete="off" spellcheck="false"/>
|
|
44
44
|
<span class="search-clear" id="search-clear" title="clear search">×</span>
|
|
45
45
|
</div>
|
|
46
46
|
</div>
|