isodoc 3.4.4 → 3.4.5

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: 640ee57a7cd7a28d8cb4c7c071fe5e84972145276996061e509c67d91b5cd151
4
- data.tar.gz: 64296e42e9a5c6228b2fd0b66ef277e884647f6a1fb323d01f097388d31ada91
3
+ metadata.gz: a8b88a6aed03f811db7d034a9eac97cbce2110e5efb1ba78d70c6c8666af1b66
4
+ data.tar.gz: 814cbba6debefab5d23c5beb9764438160aeee1937c18279a53bde60bd49c5bf
5
5
  SHA512:
6
- metadata.gz: 9a4e5052eade557aaea4684cb222adc48357d00bbcbbf70d05e9d89adc54853aad657d75b63bcb36cab9594c1520aeb7e41eddf0c9228001c01849517c6cbbb1
7
- data.tar.gz: '01519d2826ab2d80b0f76b89c1cceccbbc7750138e311a4f00480794748c8aeb3e7a3557f892a85065a973ff619002f185e10cd4f9599a3247c484ca9147a440'
6
+ metadata.gz: de5040ab72de3052667440ac395eabc311621f0361979d9a5d637091e8e263547bf7723e3b7d19c995985252f14db4a9123eec1d0315a8f0fca0c062e0c79d3d
7
+ data.tar.gz: 53d2892698b75cfc7a8a40f7c921e810830b177f450b9187aa273e8479ecdaa937b0b58b9469bd616a3f7c8841d8c7ec0794a9e75185aada63c6a87580590edb
@@ -32,7 +32,7 @@
32
32
  }
33
33
 
34
34
  @mixin figureBlock() {
35
- .FigureTitle, .figure-title {
35
+ figcaption {
36
36
  @include blockTitle();
37
37
  }
38
38
 
@@ -5,8 +5,8 @@ module IsoDoc
5
5
  module Blocks
6
6
  def figure_name_parse(_node, div, name)
7
7
  name.nil? and return
8
- div.p class: "FigureTitle", style: "text-align:center;" do |p|
9
- name.children.each { |n| parse(n, p) }
8
+ div.figcaption do |p|
9
+ children_parse(name, p)
10
10
  end
11
11
  end
12
12
 
@@ -23,7 +23,7 @@ module IsoDoc
23
23
  end
24
24
 
25
25
  def figure_parse1(node, out)
26
- out.div **figure_attrs(node) do |div|
26
+ out.figure **figure_attrs(node) do |div|
27
27
  node.children.each do |n|
28
28
  parse(n, div) unless n.name == "fmt-name"
29
29
  end
@@ -65,8 +65,9 @@ module IsoDoc
65
65
 
66
66
  def starts_with_para?(node)
67
67
  elem = block_body_first_elem(node) or return
68
- elem.name == "p" || elem.elements.first&.name == "p" ||
69
- block_body_first_elem(elem)&.name == "p"
68
+ elem.name == "p" || block_body_first_elem(elem)&.name == "p" ||
69
+ elem.elements.first&.name == "semx" &&
70
+ block_body_first_elem(elem.elements.first)&.name == "p"
70
71
  end
71
72
 
72
73
  def note_p_class
@@ -127,22 +127,13 @@ module IsoDoc
127
127
  [HTMLEntities.new.encode(a), /^[[0-9,.+-]]*$/.match?(a)]
128
128
  end
129
129
 
130
- def image_title_parse(out, caption)
131
- unless caption.nil?
132
- out.p class: "FigureTitle", style: "text-align:center;" do |p|
133
- p.b { |b| b << caption.to_s }
134
- end
135
- end
136
- end
137
-
138
- def image_parse(node, out, caption)
130
+ def image_parse(node, out)
139
131
  attrs = { src: node["src"],
140
132
  height: node["height"] || "auto",
141
133
  width: node["width"] || "auto",
142
134
  title: node["title"],
143
135
  alt: node["alt"] }
144
136
  image_body_parse(node, attrs, out)
145
- image_title_parse(out, caption)
146
137
  end
147
138
 
148
139
  def image_body_parse(_node, attrs, out)
@@ -2,9 +2,15 @@ module IsoDoc
2
2
  module Function
3
3
  module Table
4
4
  def table_title_parse(node, out)
5
- name = node.at(ns("./fmt-name")) or return
6
- out.p class: "TableTitle", style: "text-align:center;" do |p|
7
- name&.children&.each { |n| parse(n, p) }
5
+ name = node.at(ns("./fmt-name"))
6
+ summ = node["summary"]
7
+ name || summ or return
8
+ # out.p class: "TableTitle", style: "text-align:center;" do |p|
9
+ out.caption do |p|
10
+ children_parse(name, p)
11
+ summ and p.span style: "display:none" do |s|
12
+ s << summ
13
+ end
8
14
  end
9
15
  end
10
16
 
@@ -64,15 +70,6 @@ module IsoDoc
64
70
  style
65
71
  end
66
72
 
67
- def tcaption(node, table)
68
- node["summary"] or return
69
- table.caption do |c|
70
- c.span style: "display:none" do |s|
71
- s << node["summary"]
72
- end
73
- end
74
- end
75
-
76
73
  def colgroup(node, table)
77
74
  colgroup = node.at(ns("./colgroup")) or return
78
75
  table.colgroup do |cg|
@@ -84,8 +81,8 @@ module IsoDoc
84
81
 
85
82
  def table_parse(node, out)
86
83
  @in_table = true
87
- table_title_parse(node, out)
88
84
  out.table **table_attrs(node) do |t|
85
+ table_title_parse(node, t)
89
86
  table_parse_core(node, t)
90
87
  table_parse_tail(node, t)
91
88
  end
@@ -101,7 +98,6 @@ module IsoDoc
101
98
  end
102
99
 
103
100
  def table_parse_core(node, out)
104
- tcaption(node, out)
105
101
  colgroup(node, out)
106
102
  thead_parse(node, out)
107
103
  tbody_parse(node, out)
@@ -163,7 +163,7 @@ module IsoDoc
163
163
  when "table" then table_parse(node, out)
164
164
  when "figure" then figure_parse(node, out)
165
165
  when "example", "termexample" then example_parse(node, out)
166
- when "image" then image_parse(node, out, nil)
166
+ when "image" then image_parse(node, out)
167
167
  when "sourcecode" then sourcecode_parse(node, out)
168
168
  when "pre" then pre_parse(node, out)
169
169
  when "callout-annotation" then annotation_parse(node, out)
@@ -106,8 +106,8 @@ module IsoDoc
106
106
  def svg_supply_viewbox(svg)
107
107
  svg["viewbox"] and return
108
108
  svg["height"] && svg["width"] or return
109
- h = svg["height"].sub(/[^0-9]+$/, "")
110
- w = svg["width"].sub(/[^0-9]+$/, "")
109
+ h = svg["height"].to_s[/\d+/].to_s
110
+ w = svg["width"].to_s[/\d+/].to_s
111
111
  h.to_i.positive? && w.to_i.positive? or return
112
112
  svg["viewbox"] = "0 0 #{w} #{h}"
113
113
  end
@@ -114,9 +114,9 @@ module IsoDoc
114
114
  def prefix_container_fmt_xref_label(container, xref)
115
115
  container or return xref
116
116
  container_container = prefix_container_container(container)
117
+ container_xref = @xrefs.anchor(container, :xref, false)
117
118
  container_label =
118
- prefix_container_fmt_xref_label(container_container,
119
- @xrefs.anchor(container, :xref, false))
119
+ prefix_container_fmt_xref_label(container_container, container_xref)
120
120
  l10n(connectives_spans(@i18n.nested_xref
121
121
  .sub("%1", "<span class='fmt-xref-container'>#{esc container_label}</span>")
122
122
  .sub("%2", xref || "[Unknown]")))
@@ -124,6 +124,7 @@ module IsoDoc
124
124
 
125
125
  def prefix_container_container(container)
126
126
  container_container = @xrefs.anchor(container, :container, false)
127
+ container_container == container and return nil
127
128
  if @xrefs.anchor(container, :type) == "bibitem"
128
129
  p = @bibitem_lookup[container].parent
129
130
  p and container_container ||= p["id"]
@@ -61,6 +61,7 @@ module IsoDoc
61
61
  @bibitem_lookup ||= docxml.xpath(ns("//references/bibitem"))
62
62
  .each_with_object({}) do |b, m|
63
63
  m[b["id"]] = b
64
+ m[b["anchor"]] = b
64
65
  end
65
66
  end
66
67
 
@@ -1,3 +1,3 @@
1
1
  module IsoDoc
2
- VERSION = "3.4.4".freeze
2
+ VERSION = "3.4.5".freeze
3
3
  end
@@ -160,6 +160,23 @@ module IsoDoc
160
160
  end
161
161
  end
162
162
  end
163
+
164
+ def figure_parse1(node, out)
165
+ out.div **figure_attrs(node) do |div|
166
+ node.children.each do |n|
167
+ parse(n, div) unless n.name == "fmt-name"
168
+ end
169
+ figure_name_parse(node, div, node.at(ns("./fmt-name")))
170
+ end
171
+ end
172
+
173
+ def figure_name_parse(_node, div, name)
174
+ name.nil? and return
175
+ div.p class: "FigureTitle",
176
+ style: "text-align:center;" do |p|
177
+ name.children.each { |n| parse(n, p) }
178
+ end
179
+ end
163
180
  end
164
181
  end
165
182
  end
@@ -41,13 +41,12 @@ module IsoDoc
41
41
  save_dataimage(node["src"])
42
42
  end
43
43
 
44
- def image_parse(node, out, caption)
44
+ def image_parse(node, out)
45
45
  emf_attributes(node)
46
46
  attrs = { src: imgsrc(node),
47
47
  height: node["height"], alt: node["alt"],
48
48
  title: node["title"], width: node["width"] }
49
49
  out.img **attr_code(attrs)
50
- image_title_parse(out, caption)
51
50
  end
52
51
 
53
52
  def emf_attributes(node)
@@ -104,6 +104,13 @@ module IsoDoc
104
104
  end
105
105
  end
106
106
 
107
+ def table_title_parse(node, out)
108
+ name = node.at(ns("./fmt-name")) or return
109
+ out.p class: "TableTitle", style: "text-align:center;" do |p|
110
+ name&.children&.each { |n| parse(n, p) }
111
+ end
112
+ end
113
+
107
114
  def table_parse(node, out)
108
115
  @in_table = true
109
116
  table_title_parse(node, out)
@@ -115,13 +122,6 @@ module IsoDoc
115
122
  end
116
123
  @in_table = false
117
124
  end
118
-
119
- def table_parse_core(node, out)
120
- colgroup(node, out)
121
- thead_parse(node, out)
122
- tbody_parse(node, out)
123
- tfoot_parse(node, out)
124
- end
125
125
  end
126
126
  end
127
127
  end
@@ -174,6 +174,24 @@ module IsoDoc
174
174
  end
175
175
  end
176
176
 
177
+ def para_anchor_names(sections)
178
+ sections.each do |s|
179
+ notes = s.xpath(ns("./p"))
180
+ para_anchor_names1(notes, Counter.new)
181
+ para_anchor_names(s.xpath(ns(child_sections)))
182
+ end
183
+ end
184
+
185
+ def para_anchor_names1(notes, counter)
186
+ notes.noblank.each do |n|
187
+ counter.increment(n)
188
+ @anchors[n["id"]] =
189
+ anchor_struct(counter.print, n,
190
+ @labels["para_xref"], "paragraph",
191
+ { container: true, unnumb: false })
192
+ end
193
+ end
194
+
177
195
  def id_ancestor(node)
178
196
  parent = nil
179
197
  node.ancestors.each do |a|
@@ -21,10 +21,10 @@ module IsoDoc
21
21
  j = 0
22
22
  clause.xpath(ns(self.class::FIGURE_NO_CLASS)).noblank
23
23
  .each_with_object(Counter.new) do |t, c|
24
- # labelled_ancestor(t, %w(figure)) and next # disable nested figure labelling
25
- j = subfigure_increment(j, c, t)
26
- sublabel = subfigure_label(j)
27
- figure_anchor(t, sublabel, c.print, "figure", container: container)
24
+ # labelled_ancestor(t, %w(figure)) and next # disable nested figure labelling
25
+ j = subfigure_increment(j, c, t)
26
+ sublabel = subfigure_label(j)
27
+ figure_anchor(t, sublabel, c.print, "figure", container: container)
28
28
  end
29
29
  sequential_figure_class_names(clause, container:)
30
30
  end
@@ -33,11 +33,11 @@ module IsoDoc
33
33
  j = 0
34
34
  clause.xpath(ns(".//figure[@class][not(@class = 'pseudocode')]"))
35
35
  .each_with_object({}) do |t, c|
36
- c[t["class"]] ||= Counter.new
37
- j = subfigure_increment(j, c[t["class"]], t)
38
- sublabel = subfigure_label(j)
39
- figure_anchor(t, sublabel, c[t["class"]].print, t["class"],
40
- container: container)
36
+ c[t["class"]] ||= Counter.new
37
+ j = subfigure_increment(j, c[t["class"]], t)
38
+ sublabel = subfigure_label(j)
39
+ figure_anchor(t, sublabel, c[t["class"]].print, t["class"],
40
+ container: container)
41
41
  end
42
42
  end
43
43
 
@@ -84,48 +84,48 @@ module IsoDoc
84
84
  def sequential_table_names(clause, container: false)
85
85
  clause.xpath(ns(".//table")).noblank
86
86
  .each_with_object(Counter.new) do |t, c|
87
- @anchors[t["id"]] = anchor_struct(
88
- c.increment(t).print, t, @labels["table"], "table",
89
- { unnumb: t["unnumbered"], container: container }
90
- )
91
- nested_notes(t)
87
+ @anchors[t["id"]] = anchor_struct(
88
+ c.increment(t).print, t, @labels["table"], "table",
89
+ { unnumb: t["unnumbered"], container: container }
90
+ )
91
+ nested_notes(t)
92
92
  end
93
93
  end
94
94
 
95
95
  def sequential_formula_names(clause, container: false)
96
96
  clause.xpath(ns(".//formula")).noblank
97
97
  .each_with_object(Counter.new) do |t, c|
98
- @anchors[t["id"]] = anchor_struct(
99
- c.increment(t).print, t,
100
- t["inequality"] ? @labels["inequality"] : @labels["formula"],
101
- "formula", { unnumb: t["unnumbered"], container: true }
102
- )
103
- @anchors[t["id"]][:bare_xref] = @anchors[t["id"]][:label]
98
+ @anchors[t["id"]] = anchor_struct(
99
+ c.increment(t).print, t,
100
+ t["inequality"] ? @labels["inequality"] : @labels["formula"],
101
+ "formula", { unnumb: t["unnumbered"], container: true }
102
+ )
103
+ @anchors[t["id"]][:bare_xref] = @anchors[t["id"]][:label]
104
104
  end
105
105
  end
106
106
 
107
107
  def sequential_permission_names(clause, container: true)
108
108
  clause.xpath(ns(first_lvl_req)).noblank
109
109
  .each_with_object(ReqCounter.new) do |t, c|
110
- m = @reqt_models.model(t["model"])
111
- klass, label = reqt2class_label(t, m)
112
- id = c.increment(label, t).print
113
- sequential_permission_body(id, nil, t, label, klass, m,
114
- container:)
115
- sequential_permission_children(t, id, klass, container:)
110
+ m = @reqt_models.model(t["model"])
111
+ klass, label = reqt2class_label(t, m)
112
+ id = c.increment(label, t).print
113
+ sequential_permission_body(id, nil, t, label, klass, m,
114
+ container:)
115
+ sequential_permission_children(t, id, klass, container:)
116
116
  end
117
117
  end
118
118
 
119
119
  def sequential_permission_children(elem, lbl, klass, container: false)
120
120
  elem.xpath(ns(req_children)).noblank
121
121
  .each_with_object(ReqCounter.new) do |t, c|
122
- m = @reqt_models.model(t["model"])
123
- klass, label = reqt2class_nested_label(t, m)
124
- ctr = c.increment(label, t).print
125
- id = "#{lbl}#{subreqt_separator}#{ctr}"
126
- sequential_permission_body(ctr, lbl, t, label, klass, m,
127
- container:)
128
- sequential_permission_children(t, id, klass, container:)
122
+ m = @reqt_models.model(t["model"])
123
+ klass, label = reqt2class_nested_label(t, m)
124
+ ctr = c.increment(label, t).print
125
+ id = "#{lbl}#{subreqt_separator}#{ctr}"
126
+ sequential_permission_body(ctr, lbl, t, label, klass, m,
127
+ container:)
128
+ sequential_permission_children(t, id, klass, container:)
129
129
  end
130
130
  end
131
131
 
@@ -11,6 +11,7 @@ module IsoDoc
11
11
  note_anchor_names(sections)
12
12
  admonition_anchor_names(sections)
13
13
  example_anchor_names(sections)
14
+ para_anchor_names(sections)
14
15
  list_anchor_names(sections)
15
16
  deflist_anchor_names(sections)
16
17
  bookmark_anchor_names(doc)
@@ -55,6 +55,7 @@ OrdinalRules: digits-ordinal
55
55
  note: ملاحظة
56
56
  note_xref: ملاحظة
57
57
  termnote: ملاحظة % للقيد
58
+ para_xref: فقرة
58
59
  list: قائمة
59
60
  deflist: قائمة تعريف
60
61
  figure: شكل
@@ -67,6 +67,7 @@ OrdinalRules:
67
67
  note: HINWEIS
68
68
  note_xref: Hinweis
69
69
  termnote: Hinweis % zum Eintrag
70
+ para_xref: Absatz
70
71
  list: Liste
71
72
  deflist: Definitionsliste
72
73
  figure: Abbildung
@@ -58,6 +58,7 @@ OrdinalRules: digits-ordinal
58
58
  note: NOTE
59
59
  note_xref: Note
60
60
  termnote: Note % to entry
61
+ para_xref: Paragraph
61
62
  list: List
62
63
  deflist: Definition List
63
64
  figure: Figure
@@ -65,6 +65,7 @@ OrdinalRules:
65
65
  note: NOTA
66
66
  note_xref: Nota
67
67
  termnote: Nota % a la entrada
68
+ para_xref: Párrafo
68
69
  list: Lista
69
70
  deflist: Lista de definiciones
70
71
  figure: Figura
@@ -62,6 +62,7 @@ OrdinalRules:
62
62
  note: NOTE
63
63
  note_xref: Note
64
64
  termnote: Note % à l’article
65
+ para_xref: Alinéa
65
66
  figure: Figure
66
67
  diagram: Diagramme
67
68
  formula: Formule
@@ -55,6 +55,7 @@ OrdinalRules: digits-ordinal
55
55
  note: 注記
56
56
  note_xref: 注記
57
57
  termnote: 注釈%
58
+ para_xref: 段落
58
59
  list: リスト
59
60
  deflist: 定義リスト
60
61
  figure: 図
@@ -129,6 +129,7 @@ OrdinalRules:
129
129
  note: ПРИМЕЧАНИЕ
130
130
  note_xref: Примечание
131
131
  termnote: Примечание % к определению
132
+ para_xref: Абзац
132
133
  list: Список
133
134
  deflist: Список определений
134
135
  figure: Рисунок
@@ -56,6 +56,7 @@ OrdinalRules: digits-ordinal
56
56
  note: 注
57
57
  note_xref: 注
58
58
  termnote: 注%
59
+ para_xref: 段
59
60
  figure: 图
60
61
  diagram: 图表
61
62
  formula: 公式
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: isodoc
3
3
  version: !ruby/object:Gem::Version
4
- version: 3.4.4
4
+ version: 3.4.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ribose Inc.
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2026-02-16 00:00:00.000000000 Z
11
+ date: 2026-03-02 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: base64