coradoc-html 1.1.19 → 1.1.20
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.
- checksums.yaml +4 -4
- data/lib/coradoc/html/converters.rb +1 -1
- data/lib/coradoc/html/drop/definition_item_drop.rb +17 -0
- data/lib/coradoc/html/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 7b80c7ecc059a1f17523119dae3e89844ba8dd3fd1b3c81a75b285b71ae7a025
|
|
4
|
+
data.tar.gz: 74c971f574f006af62d33ad0a7b7e6efea25ed133d0b8fe43ff8596f66adb844
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 28fb0309d4a60f6023299020928ca3fa91b0cb8b760f8ea60910423521331e6d8f7fe4edfe5621513f4bd9070e7f66bc0450948e3b8638fe717cad6118293a66
|
|
7
|
+
data.tar.gz: 27ec60dbeab0d9bf586e51919d8de05ff560cfb5abc3e210e04c392f2640ca17873f64ff2fc68f6abb3b74a1d3ece0531966b6b1a700fea452ce7eb378bf08a8
|
|
@@ -8,6 +8,17 @@ module Coradoc
|
|
|
8
8
|
Escape.escape_html(stripped_term)
|
|
9
9
|
end
|
|
10
10
|
|
|
11
|
+
# All terms on this `<dt>`, escaped and id-stripped. Multi-term
|
|
12
|
+
# `<dt>`'s (AsciiDoc `term1::\nterm2::`) carry multiple entries;
|
|
13
|
+
# templates iterate this collection to emit one `<dt>` per term.
|
|
14
|
+
# Falls back to `[term]` for legacy callers that only set the
|
|
15
|
+
# singular `term` accessor.
|
|
16
|
+
def terms
|
|
17
|
+
raw = @model.terms
|
|
18
|
+
collection = raw.nil? || raw.empty? ? [@model.term.to_s] : raw.map(&:to_s)
|
|
19
|
+
collection.map { |t| Escape.escape_html(strip_term_id(t)) }
|
|
20
|
+
end
|
|
21
|
+
|
|
11
22
|
def term_id
|
|
12
23
|
match = term_text.match(/\A\[\[([^\]]+)\]\]/)
|
|
13
24
|
match&.[](1)
|
|
@@ -36,6 +47,12 @@ module Coradoc
|
|
|
36
47
|
def stripped_term
|
|
37
48
|
term_text.sub(/\A\[\[[^\]]+\]\]/, '')
|
|
38
49
|
end
|
|
50
|
+
|
|
51
|
+
# Strip a leading `[[id]]` anchor from a term string. Shared by
|
|
52
|
+
# `terms` (per-entry) and `stripped_term` (primary term).
|
|
53
|
+
def strip_term_id(text)
|
|
54
|
+
text.to_s.sub(/\A\[\[[^\]]+\]\]/, '')
|
|
55
|
+
end
|
|
39
56
|
end
|
|
40
57
|
|
|
41
58
|
DropFactory.register(CoreModel::DefinitionItem, DefinitionItemDrop)
|
data/lib/coradoc/html/version.rb
CHANGED