isodoc 2.12.0 → 2.12.2

Sign up to get free protection for your applications and to get access to all the features.
Files changed (63) hide show
  1. checksums.yaml +4 -4
  2. data/isodoc.gemspec +2 -2
  3. data/lib/isodoc/convert.rb +0 -21
  4. data/lib/isodoc/function/blocks.rb +19 -48
  5. data/lib/isodoc/function/blocks_example_note.rb +75 -29
  6. data/lib/isodoc/function/cleanup.rb +3 -40
  7. data/lib/isodoc/function/inline.rb +39 -9
  8. data/lib/isodoc/function/lists.rb +5 -5
  9. data/lib/isodoc/function/references.rb +9 -133
  10. data/lib/isodoc/function/reqt.rb +2 -2
  11. data/lib/isodoc/function/section.rb +25 -28
  12. data/lib/isodoc/function/section_titles.rb +16 -13
  13. data/lib/isodoc/function/table.rb +3 -3
  14. data/lib/isodoc/function/terms.rb +21 -20
  15. data/lib/isodoc/function/to_word_html.rb +8 -5
  16. data/lib/isodoc/function/utils.rb +1 -1
  17. data/lib/isodoc/html_function/footnotes.rb +2 -1
  18. data/lib/isodoc/html_function/html.rb +1 -5
  19. data/lib/isodoc/init.rb +31 -0
  20. data/lib/isodoc/metadata.rb +9 -0
  21. data/lib/isodoc/metadata_contributor.rb +1 -1
  22. data/lib/isodoc/metadata_date.rb +1 -1
  23. data/lib/isodoc/presentation_function/autonum.rb +139 -0
  24. data/lib/isodoc/presentation_function/block.rb +95 -36
  25. data/lib/isodoc/presentation_function/docid.rb +78 -0
  26. data/lib/isodoc/presentation_function/erefs.rb +6 -4
  27. data/lib/isodoc/presentation_function/image.rb +52 -13
  28. data/lib/isodoc/presentation_function/inline.rb +6 -6
  29. data/lib/isodoc/presentation_function/math.rb +0 -14
  30. data/lib/isodoc/presentation_function/metadata.rb +0 -62
  31. data/lib/isodoc/presentation_function/refs.rb +44 -14
  32. data/lib/isodoc/presentation_function/reqt.rb +1 -1
  33. data/lib/isodoc/presentation_function/section.rb +46 -121
  34. data/lib/isodoc/presentation_function/sourcecode.rb +7 -4
  35. data/lib/isodoc/presentation_function/terms.rb +27 -2
  36. data/lib/isodoc/presentation_function/title.rb +107 -0
  37. data/lib/isodoc/presentation_function/xrefs.rb +17 -10
  38. data/lib/isodoc/presentation_xml_convert.rb +6 -2
  39. data/lib/isodoc/version.rb +1 -1
  40. data/lib/isodoc/word_function/body.rb +8 -36
  41. data/lib/isodoc/word_function/footnotes.rb +1 -1
  42. data/lib/isodoc/word_function/lists.rb +12 -10
  43. data/lib/isodoc/word_function/postprocess_cover.rb +0 -2
  44. data/lib/isodoc/word_function/postprocess_table.rb +1 -1
  45. data/lib/isodoc/word_function/table.rb +2 -2
  46. data/lib/isodoc/xref/clause_order.rb +2 -2
  47. data/lib/isodoc/xref/xref_anchor.rb +31 -16
  48. data/lib/isodoc/xref/xref_counter_types.rb +3 -2
  49. data/lib/isodoc/xref/xref_gen.rb +57 -33
  50. data/lib/isodoc/xref/xref_gen_seq.rb +145 -56
  51. data/lib/isodoc/xref/xref_sect_gen.rb +64 -47
  52. data/lib/isodoc/xref/xref_util.rb +49 -1
  53. data/lib/isodoc/xref.rb +3 -0
  54. data/lib/isodoc-yaml/i18n-ar.yaml +9 -9
  55. data/lib/isodoc-yaml/i18n-de.yaml +9 -9
  56. data/lib/isodoc-yaml/i18n-en.yaml +9 -9
  57. data/lib/isodoc-yaml/i18n-es.yaml +9 -9
  58. data/lib/isodoc-yaml/i18n-fr.yaml +9 -9
  59. data/lib/isodoc-yaml/i18n-ja.yaml +10 -10
  60. data/lib/isodoc-yaml/i18n-ru.yaml +9 -9
  61. data/lib/isodoc-yaml/i18n-zh-Hans.yaml +9 -9
  62. data/lib/nokogiri/xml/node.rb +1 -0
  63. metadata +9 -6
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: f7b57ce9e119a72a5611931503d20a6a6eb525b9f07cbc06b0e8794a80db8da2
4
- data.tar.gz: 51a4d399f9ab8b7730a08d15deaa52b0526efbbe27cea41e355fca92ce0768ba
3
+ metadata.gz: 4eb3b494f63d18c01a41db1113867423729b62912dc89c002bccf7bd5b5e10e9
4
+ data.tar.gz: 665fa84ece67866381fa3c71c41a04e57f231de95143fee235f157ffbe61daf8
5
5
  SHA512:
6
- metadata.gz: 280cf748d5411c671d3e9f7d6e4b949611f1567766bddcdea160b5eff1bf49d6b61df5b706092f0775812515fb78ccf4812edfb79a98f47d0bcfef9e6215fe70
7
- data.tar.gz: 3af9ba5dec2db7b37542f8dab65bc90cdf19f1298110fc230aac03187814c88bffeed194d3d9de7a2e1892f82767d24cab970f780a3655985dfa7f0482d851d1
6
+ metadata.gz: f1837352724ea2d81646db5a1f499f19ec1f6c84eace5906cd7ae795e6be9fa156e6de43bfa7ecef4ecc4149e7ec4c30c052e64687b1d5f3d8b2ef1b0dfa292e
7
+ data.tar.gz: 5996acc46b47b24285d1d696d203a16255a69e67a8c25690213afa41d7fe65b02464e26e4db6516b5b3edf020a5222fc342691f0c13b1861d4a436390ea93655
data/isodoc.gemspec CHANGED
@@ -34,10 +34,10 @@ Gem::Specification.new do |spec|
34
34
  # spec.add_dependency "isodoc-i18n", "~> 1.1.0" # already in relaton-render and mn-requirements
35
35
  # spec.add_dependency "relaton-cli"
36
36
  # spec.add_dependency "metanorma-utils", "~> 1.5.0" # already in isodoc-i18n
37
- spec.add_dependency "mn2pdf"
37
+ spec.add_dependency "mn2pdf", ">= 2.08"
38
38
  spec.add_dependency "mn-requirements", "~> 0.4.0"
39
39
 
40
- spec.add_dependency "relaton-render", "~> 0.7.1"
40
+ spec.add_dependency "relaton-render", "~> 0.8.0"
41
41
  spec.add_dependency "roman-numerals"
42
42
  spec.add_dependency "rouge", "~> 4.0"
43
43
  spec.add_dependency "thread_safe"
@@ -115,31 +115,10 @@ module IsoDoc
115
115
  metadata_init(@lang, @script, @locale, @i18n)
116
116
  xref_init(@lang, @script, self, @i18n,
117
117
  { locale: @locale, bibrender: @bibrender })
118
- docxml = preprocess_xslt(docxml)
119
118
  toc_init(docxml)
120
119
  [docxml, filename, dir]
121
120
  end
122
121
 
123
- def preprocess_xslt(docxml)
124
- sheets = extract_preprocess_xslt(docxml)
125
- sheets.each do |x|
126
- docxml = Nokogiri::XSLT(x).transform(docxml)
127
- end
128
- docxml
129
- rescue ::Error => e
130
- require "debug"
131
- binding.b
132
- end
133
-
134
- def extract_preprocess_xslt(docxml)
135
- docxml.xpath(ns("//metanorma-extension/render/preprocess-xslt"))
136
- .each_with_object([]) do |x, m|
137
- formats = x["format"]&.split(",") || []
138
- !formats.empty? && !formats.include?(@format.to_s) and next
139
- m << x.children.to_xml
140
- end
141
- end
142
-
143
122
  def convert_i18n_init(docxml)
144
123
  convert_i18n_init1(docxml)
145
124
  i18n_init(@lang, @script, @locale)
@@ -3,8 +3,6 @@ require_relative "blocks_example_note"
3
3
  module IsoDoc
4
4
  module Function
5
5
  module Blocks
6
- @annotation = false
7
-
8
6
  def figure_name_parse(_node, div, name)
9
7
  name.nil? and return
10
8
  div.p class: "FigureTitle", style: "text-align:center;" do |p|
@@ -12,20 +10,13 @@ module IsoDoc
12
10
  end
13
11
  end
14
12
 
15
- def figure_key(out)
16
- out.p style: "page-break-after:avoid;" do |p|
17
- p.b { |b| b << @i18n.key }
18
- end
19
- end
20
-
21
13
  def figure_attrs(node)
22
14
  attr_code(id: node["id"], class: "figure", style: keep_style(node))
23
15
  end
24
16
 
25
17
  def figure_parse(node, out)
26
- return pseudocode_parse(node, out) if node["class"] == "pseudocode" ||
27
- node["type"] == "pseudocode"
28
-
18
+ node["class"] == "pseudocode" || node["type"] == "pseudocode" and
19
+ return pseudocode_parse(node, out)
29
20
  @in_figure = true
30
21
  figure_parse1(node, out)
31
22
  @in_figure = false
@@ -34,10 +25,9 @@ module IsoDoc
34
25
  def figure_parse1(node, out)
35
26
  out.div **figure_attrs(node) do |div|
36
27
  node.children.each do |n|
37
- figure_key(out) if n.name == "dl"
38
- parse(n, div) unless n.name == "name"
28
+ parse(n, div) unless n.name == "fmt-name"
39
29
  end
40
- figure_name_parse(node, div, node.at(ns("./name")))
30
+ figure_name_parse(node, div, node.at(ns("./fmt-name")))
41
31
  end
42
32
  end
43
33
 
@@ -47,17 +37,16 @@ module IsoDoc
47
37
 
48
38
  def pseudocode_parse(node, out)
49
39
  @in_figure = true
50
- name = node.at(ns("./name"))
40
+ name = node.at(ns("./fmt-name"))
51
41
  out.div **pseudocode_attrs(node) do |div|
52
- node.children.each { |n| parse(n, div) unless n.name == "name" }
42
+ node.children.each { |n| parse(n, div) unless n.name == "fmt-name" }
53
43
  sourcecode_name_parse(node, div, name)
54
44
  end
55
45
  @in_figure = false
56
46
  end
57
47
 
58
48
  def sourcecode_name_parse(_node, div, name)
59
- return if name.nil?
60
-
49
+ name.nil? and return
61
50
  div.p class: "SourceTitle", style: "text-align:center;" do |p|
62
51
  name.children.each { |n| parse(n, p) }
63
52
  end
@@ -68,7 +57,7 @@ module IsoDoc
68
57
  end
69
58
 
70
59
  def sourcecode_parse(node, out)
71
- name = node.at(ns("./name"))
60
+ name = node.at(ns("./fmt-name"))
72
61
  out.p **sourcecode_attrs(node) do |div|
73
62
  sourcecode_parse1(node, div)
74
63
  end
@@ -82,7 +71,7 @@ module IsoDoc
82
71
  node.at("./ancestor::xmlns:table[@class = 'rouge-line-table']") and
83
72
  @sourcecode = "table"
84
73
  node.children.each do |n|
85
- %w(name dl).include?(n.name) and next
74
+ %w(fmt-name dl).include?(n.name) and next
86
75
  parse(n, div)
87
76
  end
88
77
  @sourcecode = false
@@ -95,10 +84,8 @@ module IsoDoc
95
84
  def annotation_parse(node, out)
96
85
  dl = node.at(ns("./dl")) or return
97
86
  @sourcecode = false
98
- # @annotation = true
99
87
  out.div class: "annotation" do |div|
100
88
  parse(dl, div)
101
- # @annotation = false
102
89
  end
103
90
  end
104
91
 
@@ -106,9 +93,9 @@ module IsoDoc
106
93
  out.div **attr_code(class: "formula") do |div|
107
94
  div.p do |_p|
108
95
  parse(node.at(ns("./stem")), div)
109
- if lbl = node&.at(ns("./name"))&.text
96
+ if lbl = node&.at(ns("./fmt-name"))&.text
110
97
  insert_tab(div, 1)
111
- div << "(#{lbl})"
98
+ div << lbl
112
99
  end
113
100
  end
114
101
  end
@@ -122,8 +109,7 @@ module IsoDoc
122
109
  out.div **formula_attrs(node) do |div|
123
110
  formula_parse1(node, div)
124
111
  node.children.each do |n|
125
- next if %w(stem name).include? n.name
126
-
112
+ %w(stem fmt-name).include? n.name and next
127
113
  parse(n, div)
128
114
  end
129
115
  end
@@ -132,10 +118,8 @@ module IsoDoc
132
118
  def para_class(node)
133
119
  classtype = nil
134
120
  classtype = "MsoCommentText" if in_comment
135
- classtype = "Sourcecode" if @annotation
136
- if node["type"] == "floating-title"
121
+ node["type"] == "floating-title" and
137
122
  classtype = "h#{node['depth']}"
138
- end
139
123
  classtype ||= node["class"]
140
124
  classtype
141
125
  end
@@ -150,22 +134,13 @@ module IsoDoc
150
134
 
151
135
  def para_parse(node, out)
152
136
  out.p **attr_code(para_attrs(node)) do |p|
153
- unless @termdomain.empty?
154
- p << "&lt;#{@termdomain}&gt; "
155
- @termdomain = ""
156
- end
157
137
  node.children.each { |n| parse(n, p) }
158
138
  end
159
139
  end
160
140
 
161
- def quote_attribution(node, out)
162
- author = node.at(ns("./author"))
163
- source = node.at(ns("./source"))
164
- author.nil? && source.nil? and return
165
- out.p class: "QuoteAttribution" do |p|
166
- p << "&#x2014; #{author.text}" if author
167
- p << ", " if author && source
168
- eref_parse(source, p) if source
141
+ def attribution_parse(node, out)
142
+ out.div class: "QuoteAttribution" do |d|
143
+ node.children.each { |n| parse(n, d) }
169
144
  end
170
145
  end
171
146
 
@@ -173,17 +148,13 @@ module IsoDoc
173
148
  attrs = para_attrs(node)
174
149
  attrs[:class] = "Quote"
175
150
  out.div **attr_code(attrs) do |p|
176
- node.children.each do |n|
177
- parse(n, p) unless %w(author source).include? n.name
178
- end
179
- quote_attribution(node, out)
151
+ node.children.each { |n| parse(n, p) }
180
152
  end
181
153
  end
182
154
 
183
155
  def passthrough_parse(node, out)
184
- return if node["format"] &&
185
- !(node["format"].split(",").include? @format.to_s)
186
-
156
+ node["formats"] &&
157
+ !(node["formats"].split(" ").include? @format.to_s) and return
187
158
  out.passthrough node.text
188
159
  end
189
160
 
@@ -2,8 +2,7 @@ module IsoDoc
2
2
  module Function
3
3
  module Blocks
4
4
  def example_label(_node, div, name)
5
- return if name.nil?
6
-
5
+ name.nil? and return
7
6
  div.p class: "example-title" do |_p|
8
7
  name.children.each { |n| parse(n, div) }
9
8
  end
@@ -20,9 +19,9 @@ module IsoDoc
20
19
  # used if we are boxing examples
21
20
  def example_div_parse(node, out)
22
21
  out.div **example_div_attr(node) do |div|
23
- example_label(node, div, node.at(ns("./name")))
22
+ example_label(node, div, node.at(ns("./fmt-name")))
24
23
  node.children.each do |n|
25
- parse(n, div) unless n.name == "name"
24
+ parse(n, div) unless n.name == "fmt-name"
26
25
  end
27
26
  end
28
27
  end
@@ -40,10 +39,12 @@ module IsoDoc
40
39
  out.table **example_table_attr(node) do |t|
41
40
  t.tr do |tr|
42
41
  tr.td **EXAMPLE_TBL_ATTR do |td|
43
- example_label(node, td, node.at(ns("./name")))
42
+ example_label(node, td, node.at(ns("./fmt-name")))
44
43
  end
45
44
  tr.td **EXAMPLE_TD_ATTR do |td|
46
- node.children.each { |n| parse(n, td) unless n.name == "name" }
45
+ node.children.each do |n|
46
+ parse(n, td) unless n.name == "fmt-name"
47
+ end
47
48
  end
48
49
  end
49
50
  end
@@ -53,32 +54,45 @@ module IsoDoc
53
54
  example_div_parse(node, out)
54
55
  end
55
56
 
56
- def note_delim
57
- ""
57
+ def block_body_first_elem(node)
58
+ node.elements.each do |n|
59
+ %w(title fmt-title fmt-xref-label fmt-name name)
60
+ .include?(n.name) and next
61
+ return n
62
+ end
63
+ nil
64
+ end
65
+
66
+ def starts_with_para?(node)
67
+ block_body_first_elem(node)&.name == "p"
68
+ end
69
+
70
+ def note_p_class
71
+ nil
58
72
  end
59
73
 
60
74
  def note_p_parse(node, div)
61
- name = node.at(ns("./name"))&.remove
62
- div.p do |p|
75
+ name = node.at(ns("./fmt-name"))
76
+ para = node.at(ns("./p"))
77
+ div.p **attr_code(class: note_p_class) do |p|
63
78
  name and p.span class: "note_label" do |s|
64
79
  name.children.each { |n| parse(n, s) }
65
- s << note_delim
66
80
  end
67
- insert_tab(p, 1)
68
- node.first_element_child.children.each { |n| parse(n, p) }
81
+ #insert_tab(p, 1) # TODO to Presentation XML
82
+ children_parse(para, p)
69
83
  end
70
- node.element_children[1..-1].each { |n| parse(n, div) }
84
+ para.xpath("./following-sibling::*").each { |n| parse(n, div) }
71
85
  end
72
86
 
73
87
  def note_parse1(node, div)
74
- name = node.at(ns("./name")) and div.p do |p|
75
- p.span class: "note_label" do |s|
76
- name.remove.children.each { |n| parse(n, s) }
77
- s << note_delim
88
+ name = node.at(ns("./fmt-name")) and
89
+ div.p **attr_code(class: note_p_class) do |p|
90
+ p.span class: "note_label" do |s|
91
+ name.remove.children.each { |n| parse(n, s) }
92
+ end
93
+ #insert_tab(p, 1) # TODO to Presentation XML
78
94
  end
79
- insert_tab(p, 1)
80
- end
81
- node.children.each { |n| parse(n, div) }
95
+ children_parse(node, div)
82
96
  end
83
97
 
84
98
  def keep_style(node)
@@ -101,7 +115,7 @@ module IsoDoc
101
115
  def note_parse(node, out)
102
116
  @note = true
103
117
  out.div **note_attrs(node) do |div|
104
- if node&.at(ns("./*[local-name() != 'name'][1]"))&.name == "p"
118
+ if starts_with_para?(node)
105
119
  note_p_parse(node, div)
106
120
  else
107
121
  note_parse1(node, div)
@@ -112,7 +126,7 @@ module IsoDoc
112
126
 
113
127
  def admonition_name_parse(_node, div, name)
114
128
  div.p class: "AdmonitionTitle", style: "text-align:center;" do |p|
115
- name.children.each { |n| parse(n, p) }
129
+ children_parse(name, p)
116
130
  end
117
131
  end
118
132
 
@@ -121,7 +135,7 @@ module IsoDoc
121
135
  end
122
136
 
123
137
  def admonition_name(node, _type)
124
- node&.at(ns("./name"))
138
+ node&.at(ns("./fmt-name"))
125
139
  end
126
140
 
127
141
  def admonition_attrs(node)
@@ -130,12 +144,44 @@ module IsoDoc
130
144
  end
131
145
 
132
146
  def admonition_parse(node, out)
133
- type = node["type"]
134
- name = admonition_name(node, type)
135
- out.div **admonition_attrs(node) do |t|
136
- admonition_name_parse(node, t, name) if name
137
- node.children.each { |n| parse(n, t) unless n.name == "name" }
147
+ out.div **admonition_attrs(node) do |div|
148
+ if starts_with_para?(node)
149
+ admonition_p_parse(node, div)
150
+ else
151
+ admonition_parse1(node, div)
152
+ end
153
+ end
154
+ end
155
+
156
+ # code to allow name and first paragraph to be rendered in same block
157
+ def admonition_p_parse(node, div)
158
+ admonition_parse1(node, div)
159
+ end
160
+
161
+ # code to allow name and first paragraph to be rendered in same block
162
+ def admonition_name_in_first_para(node, div)
163
+ name = node.at(ns("./fmt-name"))
164
+ para = node.at(ns("./p"))
165
+ div.p do |p|
166
+ if name = admonition_name(node, node["type"])&.remove
167
+ name.children.each { |n| parse(n, p) }
168
+ admonition_name_para_delim(p) # TODO to Presentation XML
169
+ end
170
+ para.children.each { |n| parse(n, p) }
171
+ end
172
+ para.xpath("./following-sibling::*").each { |n| parse(n, div) }
173
+ end
174
+
175
+ def admonition_name_para_delim(para)
176
+ insert_tab(para, 1)
177
+ end
178
+
179
+ def admonition_parse1(node, div)
180
+ name = admonition_name(node, node["type"])
181
+ if name
182
+ admonition_name_parse(node, div, name)
138
183
  end
184
+ node.children.each { |n| parse(n, div) unless n.name == "fmt-name" }
139
185
  end
140
186
  end
141
187
  end
@@ -25,6 +25,7 @@ module IsoDoc
25
25
  admonition_cleanup(docxml)
26
26
  end
27
27
 
28
+ # todo PRESENTATION XML
28
29
  def admonition_cleanup(docxml)
29
30
  docxml.xpath("//div[@class = 'Admonition'][title]").each do |d|
30
31
  title = d.at("./title")
@@ -42,45 +43,7 @@ module IsoDoc
42
43
  docxml
43
44
  end
44
45
 
45
- def figure_get_or_make_dl(elem)
46
- dl = elem.at(".//dl")
47
- if dl.nil?
48
- elem.add_child("<p><b>#{@i18n.key}</b></p><dl></dl>")
49
- dl = elem.at(".//dl")
50
- end
51
- dl
52
- end
53
-
54
- FIGURE_WITH_FOOTNOTES =
55
- "//div[@class = 'figure'][descendant::aside]" \
56
- "[not(descendant::div[@class = 'figure'])]".freeze
57
-
58
- def figure_aside_process(elem, aside, key)
59
- # get rid of footnote link, it is in diagram
60
- elem&.at("./a[@class='TableFootnoteRef']")&.remove
61
- fnref = elem.at(".//span[@class='TableFootnoteRef']/..")
62
- dt = key.add_child("<dt></dt>").first
63
- dd = key.add_child("<dd></dd>").first
64
- fnref.parent = dt
65
- aside.xpath(".//p").each do |a|
66
- a.delete("class")
67
- a.parent = dd
68
- end
69
- end
70
-
71
- # move footnotes into key, and get rid of footnote reference
72
- # since it is in diagram
73
- def figure_cleanup(docxml)
74
- docxml.xpath(FIGURE_WITH_FOOTNOTES).each do |f|
75
- next unless f.at(".//aside[not(ancestor::p[@class = 'FigureTitle'])]")
76
-
77
- key = figure_get_or_make_dl(f)
78
- f.xpath(".//aside").each do |aside|
79
- figure_aside_process(f, aside, key)
80
- end
81
- end
82
- docxml
83
- end
46
+ def figure_cleanup(docxml); end
84
47
 
85
48
  def inline_header_cleanup(docxml)
86
49
  docxml.xpath('//span[@class="zzMoveToFollowing"]').each do |x|
@@ -89,13 +52,13 @@ module IsoDoc
89
52
  if n.nil?
90
53
  x.name = "p"
91
54
  else
92
- #n.children.first.previous = x.remove
93
55
  n.add_first_child(x.remove)
94
56
  end
95
57
  end
96
58
  docxml
97
59
  end
98
60
 
61
+ # todo PRESENTATION XML
99
62
  def footnote_cleanup(docxml)
100
63
  docxml.xpath('//a[@class = "FootnoteRef"]/sup')
101
64
  .each_with_index do |x, i|
@@ -8,7 +8,8 @@ module IsoDoc
8
8
  node["update-type"] == "true" and url = suffix_url(url)
9
9
  out.a **attr_code(href: url, title: node["alt"]) do |l|
10
10
  if node.elements.empty? && node.text.strip.empty?
11
- l << @c.encode(node["target"].sub(/^mailto:/, ""), :basic, :hexadecimal)
11
+ l << @c.encode(node["target"].sub(/^mailto:/, ""), :basic,
12
+ :hexadecimal)
12
13
  else node.children.each { |n| parse(n, l) }
13
14
  end
14
15
  end
@@ -16,16 +17,24 @@ module IsoDoc
16
17
 
17
18
  def location_parse(node, out); end
18
19
 
20
+ # Presentation XML classes which we need not pass on to HTML or DOC
21
+ SPAN_UNWRAP_CLASSES =
22
+ %w[fmt-caption-label fmt-label-delim fmt-caption-delim fmt-autonum-delim
23
+ fmt-element-name fmt-conn fmt-comma fmt-enum-comma fmt-obligation
24
+ fmt-xref-container].freeze
25
+
19
26
  def span_parse(node, out)
20
- if node["style"] || node["class"]
27
+ klass = node["style"] || node["class"]
28
+ if klass && !SPAN_UNWRAP_CLASSES.include?(klass)
21
29
  out.span **attr_code(style: node["style"],
22
30
  class: node["class"]) do |s|
23
- node.children.each { |n| parse(n, s) }
31
+ children_parse(node, s)
24
32
  end
25
- else node.children.each { |n| parse(n, out) }
33
+ else children_parse(node, out)
26
34
  end
27
35
  end
28
36
 
37
+ # todo PRESENTATION XML
29
38
  def callout_parse(node, out)
30
39
  out << " &lt;#{node.text}&gt;"
31
40
  end
@@ -46,9 +55,8 @@ module IsoDoc
46
55
  end
47
56
 
48
57
  def suffix_url(url)
49
- return url if url.nil? || %r{^https?://|^#}.match?(url)
50
- return url unless File.extname(url).empty?
51
-
58
+ url.nil? || %r{^https?://|^#}.match?(url) and return url
59
+ File.extname(url).empty? or return url
52
60
  url.sub(/#{File.extname(url)}$/, ".html")
53
61
  end
54
62
 
@@ -64,6 +72,7 @@ module IsoDoc
64
72
  end
65
73
  end
66
74
 
75
+ # todo PRESENTATION XML
67
76
  def termrefelem_parse(node, out)
68
77
  if node.text.strip.empty?
69
78
  out << "Termbase #{node['base']}, term ID #{node['target']}"
@@ -133,8 +142,7 @@ module IsoDoc
133
142
  end
134
143
 
135
144
  def text_parse(node, out)
136
- return if node.nil? || node.text.nil?
137
-
145
+ node.nil? || node.text.nil? and return
138
146
  text = node.to_s
139
147
  @sourcecode == "pre" and
140
148
  text = text.gsub("\n", "<br/>").gsub("<br/> ", "<br/>&#xa0;")
@@ -179,6 +187,28 @@ module IsoDoc
179
187
  node.children.each { |n| parse(n, e) }
180
188
  end
181
189
  end
190
+
191
+ def author_parse(node, out)
192
+ children_parse(node, out)
193
+ end
194
+
195
+ def semx_parse(node, out)
196
+ children_parse(node, out)
197
+ end
198
+
199
+ def children_parse(node, out)
200
+ node.children.each { |n| parse(n, out) }
201
+ end
202
+
203
+ def xref_label_parse(node, out); end
204
+
205
+ def name_parse(node, out); end
206
+
207
+ def floating_title_parse(node, out); end
208
+
209
+ def fmt_name_parse(node, out)
210
+ children_parse(node, out)
211
+ end
182
212
  end
183
213
  end
184
214
  end
@@ -2,9 +2,9 @@ module IsoDoc
2
2
  module Function
3
3
  module Lists
4
4
  def list_title_parse(node, out)
5
- name = node.at(ns("./name")) or return
5
+ name = node.at(ns("./fmt-name")) or return
6
6
  out.p class: "ListTitle" do |p|
7
- name&.children&.each { |n| parse(n, p) }
7
+ name.children&.each { |n| parse(n, p) }
8
8
  end
9
9
  end
10
10
 
@@ -16,7 +16,7 @@ module IsoDoc
16
16
  out.div **attr_code(class: "ul_wrap") do |div|
17
17
  list_title_parse(node, div)
18
18
  div.ul **attr_code(ul_attrs(node)) do |ul|
19
- node.children.each { |n| n.name == "name" or parse(n, ul) }
19
+ node.children.each { |n| n.name == "fmt-name" or parse(n, ul) }
20
20
  end
21
21
  end
22
22
  end
@@ -57,7 +57,7 @@ module IsoDoc
57
57
  out.div **attr_code(class: "ol_wrap") do |div|
58
58
  list_title_parse(node, div)
59
59
  div.ol **attr_code(ol_attrs(node)) do |ol|
60
- node.children.each { |n| n.name == "name" or parse(n, ol) }
60
+ node.children.each { |n| n.name == "fmt-name" or parse(n, ol) }
61
61
  end
62
62
  end
63
63
  end
@@ -106,7 +106,7 @@ module IsoDoc
106
106
  end
107
107
 
108
108
  def dl_parse_notes(node, out)
109
- node.elements.reject { |n| dt_dd?(n) || n.name == "name" }
109
+ node.elements.reject { |n| dt_dd?(n) || n.name == "fmt-name" }
110
110
  .each { |n| parse(n, out) }
111
111
  end
112
112