asciidoctor-autoterm 1.0.1 → 1.0.2
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/asciidoctor/autoterm/converter.rb +16 -0
- data/lib/asciidoctor/autoterm/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: dcc5c6113c38d85b30990827bb540723c544fca19945081ed308c27ba1a2e7ef
|
|
4
|
+
data.tar.gz: cf29b08297c9ddcfbd6c3bd28513dd9264c6d35671ca032ff9cf9a675a0250a9
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 8808d90bc9f42c396a2d61fb5d0f5c92d48d378f00b304366a20045865f3fd375beb9c43111ed8816bdf670f8ee3a9d74184373284ae22f4d345545b9e341a15
|
|
7
|
+
data.tar.gz: 1f13bed6c62613fc01bc66b9c65f67deea1e72721415eefdee58fa054eec8278f8c1a1afb9f6f121b7397ebebc5dd9fa4ccf5e226f2656a64d29b391b4c49078
|
|
@@ -13,10 +13,26 @@ class TermIndex < Asciidoctor::Converter.for('pdf')
|
|
|
13
13
|
convert_terminology_entries(terms_by_full_name_with_abbr_and_definition) unless terms_by_full_name_with_abbr_and_definition.empty?
|
|
14
14
|
nil
|
|
15
15
|
else
|
|
16
|
+
repair_index_term_parens
|
|
16
17
|
super
|
|
17
18
|
end
|
|
18
19
|
end
|
|
19
20
|
|
|
21
|
+
def repair_index_term_parens
|
|
22
|
+
# AsciiDoc matches the first )) in ((Full Term (Abbr))), so the stored term
|
|
23
|
+
# name loses its closing ). term.name is a FormattedString (String subclass
|
|
24
|
+
# with a fragments array). Append ) to the last fragment's text.
|
|
25
|
+
@index.categories.each do |category|
|
|
26
|
+
category.terms.each do |term_obj|
|
|
27
|
+
if term_obj.name.to_s =~ /\([^)]+$/
|
|
28
|
+
fixed_fragments = term_obj.name.fragments.map(&:dup)
|
|
29
|
+
fixed_fragments.last[:text] = "#{fixed_fragments.last[:text]})"
|
|
30
|
+
term_obj.instance_variable_set(:@name, FormattedString.new(fixed_fragments))
|
|
31
|
+
end
|
|
32
|
+
end
|
|
33
|
+
end
|
|
34
|
+
end
|
|
35
|
+
|
|
20
36
|
def convert_terminology_entries(terms_by_full_name_with_abbr_and_definition)
|
|
21
37
|
sorted_terms = terms_by_full_name_with_abbr_and_definition.sort_by do |full_term, details|
|
|
22
38
|
abbr = details[:abbr]
|