metanorma-bipm 2.1.13 → 2.2.1

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.
@@ -550,8 +550,11 @@ a:hover {
550
550
  background: #6C734A;
551
551
  box-shadow: 3px 0 0 #6C734A, -3px 0 0 #6C734A; }
552
552
 
553
- ::selection,
554
- ::-moz-selection {
553
+ *::selection {
554
+ background: #6C734A;
555
+ color: white; }
556
+
557
+ *::-moz-selection {
555
558
  background: #6C734A;
556
559
  color: white; }
557
560
 
@@ -14,12 +14,12 @@ module IsoDoc
14
14
  return
15
15
  end
16
16
  i = docxml.at(ns("//indexsect")) ||
17
- docxml.root.add_child("<indexsect #{add_id}><title>#{@i18n.index}"\
17
+ docxml.root.add_child("<indexsect #{add_id}><title>#{@i18n.index}" \
18
18
  "</title></indexsect>").first
19
19
  index = sort_indexterms(
20
20
  docxml.xpath(ns("//index")),
21
21
  docxml.xpath(ns("//index-xref[@also = 'false']")),
22
- docxml.xpath(ns("//index-xref[@also = 'true']"))
22
+ docxml.xpath(ns("//index-xref[@also = 'true']")),
23
23
  )
24
24
  index1(docxml, i, index)
25
25
  end
@@ -27,7 +27,9 @@ module IsoDoc
27
27
  def index1(docxml, i, index)
28
28
  index.keys.sort.each do |k|
29
29
  c = i.add_child "<clause #{add_id}><title>#{k}</title><ul></ul></clause>"
30
- words = index[k].keys.each_with_object({}) { |w, v| v[sortable(w).downcase] = w }
30
+ words = index[k].keys.each_with_object({}) do |w, v|
31
+ v[sortable(w).downcase] = w
32
+ end
31
33
  words.keys.localize(@lang.to_sym).sort.to_a.each do |w|
32
34
  c.first.at(ns("./ul")).add_child index_entries(words, index[k], w)
33
35
  end
@@ -64,12 +66,13 @@ module IsoDoc
64
66
  ret = index_entries_head(words[secondary],
65
67
  index.dig(words[secondary], nil),
66
68
  index_entries_opt)
67
- words3 = index[words[secondary]]&.keys&.reject { |k| k.nil? }
69
+ words3 = index[words[secondary]]&.keys&.reject(&:nil?)
68
70
  &.each_with_object({}) { |w, v| v[w.downcase] = w }
69
71
  unless words3.empty?
70
72
  ret += "<ul>"
71
73
  words3.keys.localize(@lang.to_sym).sort.to_a.each do |w|
72
- ret += (index_entries_head(words3[w], index[words[secondary]][words3[w]], index_entries_opt) + "</li>")
74
+ ret += (index_entries_head(words3[w],
75
+ index[words[secondary]][words3[w]], index_entries_opt) + "</li>")
73
76
  end
74
77
  ret += "</ul>"
75
78
  end
@@ -79,10 +82,18 @@ module IsoDoc
79
82
  def index_entries_head(head, entries, opt)
80
83
  ret = "<li>#{head}"
81
84
  xref = entries&.dig(:xref)&.join(", ")
82
- see_sort = entries&.dig(:see)&.each_with_object({}) { |w, v| v[sortable(w).downcase] = w }
83
- see = see_sort&.keys&.localize(@lang.to_sym)&.sort&.to_a&.map { |k| see_sort[k] }&.join(", ")
84
- also_sort = entries&.dig(:also)&.each_with_object({}) { |w, v| v[sortable(w).downcase] = w }
85
- also = also_sort&.keys&.localize(@lang.to_sym)&.sort&.to_a&.map { |k| also_sort[k] }&.join(", ")
85
+ see_sort = entries&.dig(:see)&.each_with_object({}) do |w, v|
86
+ v[sortable(w).downcase] = w
87
+ end
88
+ see = see_sort&.keys&.localize(@lang.to_sym)&.sort&.to_a&.map do |k|
89
+ see_sort[k]
90
+ end&.join(", ")
91
+ also_sort = entries&.dig(:also)&.each_with_object({}) do |w, v|
92
+ v[sortable(w).downcase] = w
93
+ end
94
+ also = also_sort&.keys&.localize(@lang.to_sym)&.sort&.to_a&.map do |k|
95
+ also_sort[k]
96
+ end&.join(", ")
86
97
  ret += "#{opt[:xref_lbl]} #{xref}" if xref
87
98
  ret += "#{opt[:see_lbl]} #{see}" if see
88
99
  ret += "#{opt[:also_lbl]} #{also}" if also
@@ -107,16 +118,16 @@ module IsoDoc
107
118
  end
108
119
  end
109
120
 
110
- def extract_indexsee(v, terms, label)
111
- terms.each_with_object(v) do |t, v|
112
- term = t&.at(ns("./primary"))&.children&.to_xml
113
- term2 = t&.at(ns("./secondary"))&.children&.to_xml
114
- term3 = t&.at(ns("./tertiary"))&.children&.to_xml
121
+ def extract_indexsee(idx, terms, label)
122
+ terms.each_with_object(idx) do |t, v|
123
+ term = to_xml(t.at(ns("./primary"))&.children)
124
+ term2 = to_xml(t.at(ns("./secondary"))&.children)
125
+ term3 = to_xml(t.at(ns("./tertiary"))&.children)
115
126
  v[term] ||= {}
116
127
  v[term][term2] ||= {}
117
128
  v[term][term2][term3] ||= {}
118
129
  v[term][term2][term3][label] ||= []
119
- v[term][term2][term3][label] << t&.at(ns("./target"))&.children&.to_xml
130
+ v[term][term2][term3][label] << to_xml(t.at(ns("./target"))&.children)
120
131
  t.remove
121
132
  end
122
133
  end
@@ -129,9 +140,9 @@ module IsoDoc
129
140
  # attributes are decoded into UTF-8, elements in extract_indexsee are still in entities
130
141
  def extract_indexterms(terms)
131
142
  terms.each_with_object({}) do |t, v|
132
- term = t&.at(ns("./primary"))&.children&.to_xml
133
- term2 = t&.at(ns("./secondary"))&.children&.to_xml
134
- term3 = t&.at(ns("./tertiary"))&.children&.to_xml
143
+ term = to_xml(t.at(ns("./primary"))&.children)
144
+ term2 = to_xml(t.at(ns("./secondary"))&.children)
145
+ term3 = to_xml(t.at(ns("./tertiary"))&.children)
135
146
  index2bookmark(t)
136
147
  v[term] ||= {}
137
148
  v[term][term2] ||= {}