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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 3bb4285b630df041e24ddd4866844a4199a3acaebeca0ea63655a4b6a5379d99
4
- data.tar.gz: a97025d3d2e623ee29b1996ec7172df1d0b66fb6e33f4fcedb65b5bfd00e9026
3
+ metadata.gz: dcc5c6113c38d85b30990827bb540723c544fca19945081ed308c27ba1a2e7ef
4
+ data.tar.gz: cf29b08297c9ddcfbd6c3bd28513dd9264c6d35671ca032ff9cf9a675a0250a9
5
5
  SHA512:
6
- metadata.gz: 334b47ea0b94a2a101811f42f73a9d0395f6bc41ee9d5be626a0b6422b391344321d5de7b969de0f111f31986b13ea090f9f914d78ceb7be085019a590527e92
7
- data.tar.gz: 8e1f2512d127207c1a79b28f75279e0f9b992c999761d63a738b187c8f33d77a2e13c52e94b52b09176c587b3ecce29f85e20a10e1717b2f9c607e7584e62559
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]
@@ -1,5 +1,5 @@
1
1
  module Asciidoctor
2
2
  module Autoterm
3
- VERSION = '1.0.1'
3
+ VERSION = '1.0.2'
4
4
  end
5
5
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: asciidoctor-autoterm
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.1
4
+ version: 1.0.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - baiyibai