isodoc 1.6.7.1 → 1.7.3

Sign up to get free protection for your applications and to get access to all the features.
Files changed (45) hide show
  1. checksums.yaml +4 -4
  2. data/isodoc.gemspec +1 -1
  3. data/lib/isodoc-yaml/i18n-ar.yaml +19 -25
  4. data/lib/isodoc-yaml/i18n-de.yaml +1 -0
  5. data/lib/isodoc-yaml/i18n-en.yaml +1 -0
  6. data/lib/isodoc-yaml/i18n-es.yaml +1 -0
  7. data/lib/isodoc-yaml/i18n-fr.yaml +1 -0
  8. data/lib/isodoc-yaml/i18n-ru.yaml +1 -0
  9. data/lib/isodoc-yaml/i18n-zh-Hans.yaml +1 -0
  10. data/lib/isodoc.rb +1 -0
  11. data/lib/isodoc/convert.rb +1 -1
  12. data/lib/isodoc/css.rb +3 -3
  13. data/lib/isodoc/function/blocks.rb +180 -168
  14. data/lib/isodoc/function/form.rb +39 -36
  15. data/lib/isodoc/function/inline.rb +5 -1
  16. data/lib/isodoc/function/reqt.rb +91 -85
  17. data/lib/isodoc/function/to_word_html.rb +207 -204
  18. data/lib/isodoc/html_convert.rb +0 -4
  19. data/lib/isodoc/html_function/form.rb +48 -45
  20. data/lib/isodoc/html_function/html.rb +2 -0
  21. data/lib/isodoc/html_function/postprocess.rb +9 -4
  22. data/lib/isodoc/presentation_function/block.rb +7 -4
  23. data/lib/isodoc/presentation_function/inline.rb +29 -12
  24. data/lib/isodoc/presentation_function/section.rb +1 -2
  25. data/lib/isodoc/presentation_xml_convert.rb +2 -2
  26. data/lib/isodoc/version.rb +1 -1
  27. data/lib/isodoc/xref.rb +8 -7
  28. data/lib/isodoc/xref/xref_anchor.rb +45 -44
  29. data/lib/isodoc/xref/xref_counter.rb +113 -103
  30. data/lib/isodoc/xref/xref_gen.rb +39 -11
  31. data/lib/metanorma/output.rb +7 -0
  32. data/lib/metanorma/output/base.rb +13 -0
  33. data/lib/metanorma/output/utils.rb +17 -0
  34. data/lib/metanorma/output/xslfo.rb +21 -0
  35. data/spec/assets/outputtest/a.xml +66 -0
  36. data/spec/assets/outputtest/iso.international-standard.xsl +3011 -0
  37. data/spec/isodoc/blocks_spec.rb +358 -243
  38. data/spec/isodoc/form_spec.rb +94 -90
  39. data/spec/isodoc/inline_spec.rb +413 -234
  40. data/spec/isodoc/postproc_spec.rb +70 -27
  41. data/spec/isodoc/terms_spec.rb +2 -2
  42. data/spec/isodoc/xref_spec.rb +274 -652
  43. metadata +8 -18
  44. data/lib/isodoc/html_function/sectionsplit.rb +0 -230
  45. data/spec/isodoc/sectionsplit_spec.rb +0 -190
@@ -1,48 +1,51 @@
1
- module IsoDoc::Function
2
- module Form
3
- def form_parse(node, out)
4
- node.children.each do |n|
5
- parse(n, out)
1
+ module IsoDoc
2
+ module Function
3
+ module Form
4
+ def form_parse(node, out)
5
+ out.div **attr_code(class: node["class"],
6
+ id: node["id"]) do |div|
7
+ node.children.each do |n|
8
+ parse(n, div)
9
+ end
10
+ end
6
11
  end
7
- end
8
12
 
9
- def input_parse(node, out)
10
- case node["type"]
11
- when "button" then out << "[#{node['value'] || 'BUTTON'}]"
12
- when "checkbox" then out << "&#x2610; "
13
- when "date" then text_input(out)
14
- when "file" then text_input(out)
15
- when "password" then text_input(out)
16
- when "radio" then out << "&#x25CE; "
17
- when "submit" # nop
18
- when "text" then text_input(out, node["maxlength"])
13
+ def input_parse(node, out)
14
+ case node["type"]
15
+ when "button" then out << "[#{node['value'] || 'BUTTON'}]"
16
+ when "checkbox" then out << "&#x2610; "
17
+ when "date", "file", "password" then text_input(out)
18
+ when "radio" then out << "&#x25CE; "
19
+ when "submit" # nop
20
+ when "text" then text_input(out, node["maxlength"])
21
+ end
19
22
  end
20
- end
21
23
 
22
- def text_input(out, length = 10)
23
- length ||= 10
24
- length = length.to_i
25
- length.zero? and length = 10
26
- out << "_" * length
27
- out << " "
28
- end
24
+ def text_input(out, length = 10)
25
+ length ||= 10
26
+ length = length.to_i
27
+ length.zero? and length = 10
28
+ out << "_" * length
29
+ out << " "
30
+ end
29
31
 
30
- def select_parse(node, out)
31
- text_input(out, node["size"] || 10)
32
- end
32
+ def select_parse(node, out)
33
+ text_input(out, node["size"] || 10)
34
+ end
33
35
 
34
- def label_parse(node, out)
35
- node.children.each do |n|
36
- parse(n, out)
36
+ def label_parse(node, out)
37
+ node.children.each do |n|
38
+ parse(n, out)
39
+ end
37
40
  end
38
- end
39
41
 
40
- def option_parse(node, out); end
42
+ def option_parse(node, out); end
41
43
 
42
- def textarea_parse(_node, out)
43
- out.table **{ border: 1, width: "50%" } do |t|
44
- t.tr do |tr|
45
- tr.td do |td|
44
+ def textarea_parse(_node, out)
45
+ out.table **{ border: 1, width: "50%" } do |t|
46
+ t.tr do |tr|
47
+ tr.td do |td|
48
+ end
46
49
  end
47
50
  end
48
51
  end
@@ -71,7 +71,11 @@ module IsoDoc::Function
71
71
  end
72
72
 
73
73
  def termrefelem_parse(node, out)
74
- out << "Termbase #{node['base']}, term ID #{node['target']}"
74
+ if node.text.strip.empty?
75
+ out << "Termbase #{node['base']}, term ID #{node['target']}"
76
+ else
77
+ node.children.each { |n| parse(n, out) }
78
+ end
75
79
  end
76
80
 
77
81
  def stem_parse(node, out)
@@ -1,115 +1,121 @@
1
- module IsoDoc::Function
2
- module Blocks
3
- def recommendation_labels(node)
4
- [node.at(ns("./label")), node.at(ns("./title")), node.at(ns("./name"))]
5
- end
1
+ module IsoDoc
2
+ module Function
3
+ module Blocks
4
+ def recommendation_labels(node)
5
+ [node.at(ns("./label")), node.at(ns("./title")), node.at(ns("./name"))]
6
+ end
6
7
 
7
- def recommendation_name(node, out, _type)
8
- label, title, lbl = recommendation_labels(node)
9
- out.p **{ class: "RecommendationTitle" } do |b|
10
- lbl and lbl.children.each { |n| parse(n, b) }
11
- b << l10n(":")
12
- if label || title
13
- b.br
14
- label and label.children.each { |n| parse(n,b) }
15
- b << "#{clausedelim} " if label && title
16
- title and title.children.each { |n| parse(n,b) }
8
+ def recommendation_name(node, out, _type)
9
+ label, title, lbl = recommendation_labels(node)
10
+ out.p **{ class: "RecommendationTitle" } do |b|
11
+ lbl&.children&.each { |n| parse(n, b) }
12
+ b << l10n(":")
13
+ if label || title
14
+ b.br
15
+ label&.children&.each { |n| parse(n, b) }
16
+ b << "#{clausedelim} " if label && title
17
+ title&.children&.each { |n| parse(n, b) }
18
+ end
17
19
  end
18
20
  end
19
- end
20
21
 
21
- def recommendation_attributes1(node)
22
- out = []
23
- oblig = node["obligation"] and
24
- out << l10n("#{@i18n.obligation}: #{oblig}")
25
- subj = node&.at(ns("./subject"))&.text and
26
- out << l10n("#{@i18n.subject}: #{subj}")
27
- node.xpath(ns("./inherit")).each do |i|
28
- out << recommendation_attr_parse(i, @i18n.inherits)
22
+ def recommendation_attributes1(node)
23
+ out = []
24
+ oblig = node["obligation"] and
25
+ out << l10n("#{@i18n.obligation}: #{oblig}")
26
+ node.xpath(ns("./subject")).each do |subj|
27
+ out << l10n("#{@i18n.subject}: #{subj.text}")
28
+ end
29
+ node.xpath(ns("./inherit")).each do |i|
30
+ out << recommendation_attr_parse(i, @i18n.inherits)
31
+ end
32
+ node.xpath(ns("./classification")).each do |c|
33
+ line = recommendation_attr_keyvalue(c, "tag", "value") and out << line
34
+ end
35
+ out
29
36
  end
30
- node.xpath(ns("./classification")).each do |c|
31
- line = recommendation_attr_keyvalue(c, "tag", "value") and out << line
37
+
38
+ def recommendation_attr_parse(node, label)
39
+ noko do |xml|
40
+ xml << "#{label}: "
41
+ node.children.each { |n| parse(n, xml) }
42
+ end.join
32
43
  end
33
- out
34
- end
35
44
 
36
- def recommendation_attr_parse(node, label)
37
- noko do |xml|
38
- xml << "#{label}: "
39
- node.children.each { |n| parse(n, xml) }
40
- end.join
41
- end
45
+ def recommendation_attr_keyvalue(node, key, value)
46
+ tag = node.at(ns("./#{key}")) or return nil
47
+ value = node.at(ns("./#{value}")) or return nil
48
+ "#{tag.text.capitalize}: #{value.text}"
49
+ end
42
50
 
43
- def recommendation_attr_keyvalue(node, key, value)
44
- tag = node.at(ns("./#{key}")) or return nil
45
- value = node.at(ns("./#{value}")) or return nil
46
- "#{tag.text.capitalize}: #{value.text}"
47
- end
51
+ def recommendation_attributes(node, out)
52
+ ret = recommendation_attributes1(node)
53
+ return if ret.empty?
48
54
 
49
- def recommendation_attributes(node, out)
50
- ret = recommendation_attributes1(node)
51
- return if ret.empty?
52
- out.p do |p|
53
- p.i do |i|
54
- i << ret.join("<br/>")
55
+ out.p do |p|
56
+ p.i do |i|
57
+ i << ret.join("<br/>")
58
+ end
55
59
  end
56
60
  end
57
- end
58
61
 
59
- def reqt_metadata_node(n)
60
- %w(label title subject classification tag value
61
- inherit name).include? n.name
62
- end
62
+ def reqt_metadata_node(node)
63
+ %w(label title subject classification tag value
64
+ inherit name).include? node.name
65
+ end
63
66
 
64
- def reqt_attrs(node, klass)
65
- attr_code(class: klass, id: node["id"], style: keep_style(node))
66
- end
67
+ def reqt_attrs(node, klass)
68
+ attr_code(class: klass, id: node["id"], style: keep_style(node))
69
+ end
67
70
 
68
- def recommendation_parse(node, out)
69
- out.div **reqt_attrs(node, "recommend") do |t|
70
- recommendation_name(node, t, @i18n.recommendation)
71
- recommendation_attributes(node, out)
72
- node.children.each do |n|
73
- parse(n, t) unless reqt_metadata_node(n)
71
+ def recommendation_parse(node, out)
72
+ out.div **reqt_attrs(node, "recommend") do |t|
73
+ recommendation_name(node, t, @i18n.recommendation)
74
+ recommendation_attributes(node, out)
75
+ node.children.each do |n|
76
+ parse(n, t) unless reqt_metadata_node(n)
77
+ end
74
78
  end
75
79
  end
76
- end
77
80
 
78
- def requirement_parse(node, out)
79
- out.div **reqt_attrs(node, "require") do |t|
80
- recommendation_name(node, t, @i18n.requirement)
81
- recommendation_attributes(node, out)
82
- node.children.each do |n|
83
- parse(n, t) unless reqt_metadata_node(n)
81
+ def requirement_parse(node, out)
82
+ out.div **reqt_attrs(node, "require") do |t|
83
+ recommendation_name(node, t, @i18n.requirement)
84
+ recommendation_attributes(node, out)
85
+ node.children.each do |n|
86
+ parse(n, t) unless reqt_metadata_node(n)
87
+ end
84
88
  end
85
89
  end
86
- end
87
90
 
88
- def permission_parse(node, out)
89
- out.div **reqt_attrs(node, "permission") do |t|
90
- recommendation_name(node, t, @i18n.permission)
91
- recommendation_attributes(node, out)
92
- node.children.each do |n|
93
- parse(n, t) unless reqt_metadata_node(n)
91
+ def permission_parse(node, out)
92
+ out.div **reqt_attrs(node, "permission") do |t|
93
+ recommendation_name(node, t, @i18n.permission)
94
+ recommendation_attributes(node, out)
95
+ node.children.each do |n|
96
+ parse(n, t) unless reqt_metadata_node(n)
97
+ end
94
98
  end
95
99
  end
96
- end
97
100
 
98
- def reqt_component_attrs(node)
99
- attr_code(class: "requirement-" + node.name,
100
- style: keep_style(node))
101
- end
101
+ def reqt_component_attrs(node)
102
+ klass = node.name
103
+ klass == "component" and klass = node["class"]
104
+ attr_code(class: "requirement-#{klass}",
105
+ style: keep_style(node))
106
+ end
102
107
 
103
- def requirement_component_parse(node, out)
104
- return if node["exclude"] == "true"
105
- out.div **reqt_component_attrs(node) do |div|
106
- node.children.each do |n|
107
- parse(n, div)
108
+ def requirement_component_parse(node, out)
109
+ return if node["exclude"] == "true"
110
+
111
+ out.div **reqt_component_attrs(node) do |div|
112
+ node.children.each do |n|
113
+ parse(n, div)
114
+ end
108
115
  end
109
116
  end
110
- end
111
117
 
112
- def requirement_skip_parse(node, out)
118
+ def requirement_skip_parse(node, out); end
113
119
  end
114
120
  end
115
121
  end
@@ -1,237 +1,240 @@
1
1
  require "fileutils"
2
2
  require "pathname"
3
3
 
4
- module IsoDoc::Function
5
- module ToWordHtml
6
-
7
- def set_termdomain(termdomain)
8
- @termdomain = termdomain
9
- end
4
+ module IsoDoc
5
+ module Function
6
+ module ToWordHtml
7
+ def set_termdomain(termdomain)
8
+ @termdomain = termdomain
9
+ end
10
10
 
11
- def in_sourcecode
12
- @sourcecode
13
- end
11
+ def in_sourcecode
12
+ @sourcecode
13
+ end
14
14
 
15
- def note?
16
- @note
17
- end
15
+ def note?
16
+ @note
17
+ end
18
18
 
19
- def init_file(filename, debug)
20
- filepath = Pathname.new(filename)
21
- filename = filepath.sub_ext("").sub(/\.presentation$/, "").to_s
22
- dir = init_dir(filename, debug)
23
- @filename = filename
24
- @localdir = "#{filepath.parent}/"
25
- @sourcedir = @localdir
26
- @sourcefilename and
27
- @sourcedir = "#{Pathname.new(@sourcefilename).parent}/"
28
- [filename, dir]
29
- end
19
+ def init_file(filename, debug)
20
+ filepath = Pathname.new(filename)
21
+ filename = filepath.sub_ext("").sub(/\.presentation$/, "").to_s
22
+ dir = init_dir(filename, debug)
23
+ @filename = filename
24
+ @localdir = "#{filepath.parent}/"
25
+ @sourcedir = @localdir
26
+ @sourcefilename and
27
+ @sourcedir = "#{Pathname.new(@sourcefilename).parent}/"
28
+ [filename, dir]
29
+ end
30
30
 
31
- def init_dir(filename, debug)
32
- dir = "#{filename}_files"
33
- unless debug
34
- Dir.mkdir(dir, 0o777) unless File.exists?(dir)
35
- FileUtils.rm_rf "#{dir}/*"
31
+ def init_dir(filename, debug)
32
+ dir = "#{filename}_files"
33
+ unless debug
34
+ Dir.mkdir(dir, 0o777) unless File.exists?(dir)
35
+ FileUtils.rm_rf "#{dir}/*"
36
+ end
37
+ dir
36
38
  end
37
- dir
38
- end
39
39
 
40
- # tmp image dir is same directory as @filename
41
- def tmpimagedir
42
- @filename + tmpimagedir_suffix
43
- end
40
+ # tmp image dir is same directory as @filename
41
+ def tmpimagedir
42
+ @filename + tmpimagedir_suffix
43
+ end
44
44
 
45
- def rel_tmpimagedir
46
- Pathname.new(@filename).basename.to_s + tmpimagedir_suffix
47
- end
45
+ def rel_tmpimagedir
46
+ Pathname.new(@filename).basename.to_s + tmpimagedir_suffix
47
+ end
48
48
 
49
- # isodoc.css overrides any CSS injected by Html2Doc, which
50
- # is inserted before this CSS.
51
- def define_head(head, _filename, _dir)
52
- if @standardstylesheet
53
- head.style do |style|
54
- @standardstylesheet.open
55
- stylesheet = @standardstylesheet.read
56
- style.comment "\n#{stylesheet}\n"
49
+ # isodoc.css overrides any CSS injected by Html2Doc, which
50
+ # is inserted before this CSS.
51
+ def define_head(head, _filename, _dir)
52
+ if @standardstylesheet
53
+ head.style do |style|
54
+ @standardstylesheet.open
55
+ stylesheet = @standardstylesheet.read
56
+ style.comment "\n#{stylesheet}\n"
57
+ end
57
58
  end
58
59
  end
59
- end
60
60
 
61
- def body_attr
62
- { lang: @lang.to_s }
63
- end
64
-
65
- def make_body(xml, docxml)
66
- xml.body **body_attr do |body|
67
- make_body1(body, docxml)
68
- make_body2(body, docxml)
69
- make_body3(body, docxml)
61
+ def body_attr
62
+ { lang: @lang.to_s }
70
63
  end
71
- end
72
64
 
73
- def make_body1(body, _docxml)
74
- body.div **{ class: "title-section" } do |div1|
75
- div1.p { |p| p << "&nbsp;" } # placeholder
65
+ def make_body(xml, docxml)
66
+ xml.body **body_attr do |body|
67
+ make_body1(body, docxml)
68
+ make_body2(body, docxml)
69
+ make_body3(body, docxml)
70
+ end
76
71
  end
77
- section_break(body)
78
- end
79
72
 
80
- def make_body2(body, _docxml)
81
- body.div **{ class: "prefatory-section" } do |div2|
82
- div2.p { |p| p << "&nbsp;" } # placeholder
73
+ def make_body1(body, _docxml)
74
+ body.div **{ class: "title-section" } do |div1|
75
+ div1.p { |p| p << "&nbsp;" } # placeholder
76
+ end
77
+ section_break(body)
83
78
  end
84
- section_break(body)
85
- end
86
79
 
87
- def make_body3(body, docxml)
88
- body.div **{ class: "main-section" } do |div3|
89
- boilerplate docxml, div3
90
- preface_block docxml, div3
91
- abstract docxml, div3
92
- foreword docxml, div3
93
- introduction docxml, div3
94
- acknowledgements docxml, div3
95
- middle docxml, div3
96
- footnotes div3
97
- comments div3
80
+ def make_body2(body, _docxml)
81
+ body.div **{ class: "prefatory-section" } do |div2|
82
+ div2.p { |p| p << "&nbsp;" } # placeholder
83
+ end
84
+ section_break(body)
98
85
  end
99
- end
100
86
 
101
- def info(isoxml, out)
102
- @meta.title isoxml, out
103
- @meta.subtitle isoxml, out
104
- @meta.docstatus isoxml, out
105
- @meta.docid isoxml, out
106
- @meta.otherid isoxml, out
107
- @meta.docnumeric isoxml, out
108
- @meta.doctype isoxml, out
109
- @meta.author isoxml, out
110
- @meta.bibdate isoxml, out
111
- @meta.relations isoxml, out
112
- @meta.version isoxml, out
113
- @meta.url isoxml, out
114
- @meta.keywords isoxml, out
115
- @meta.note isoxml, out
116
- @meta.get
117
- end
87
+ def make_body3(body, docxml)
88
+ body.div **{ class: "main-section" } do |div3|
89
+ boilerplate docxml, div3
90
+ preface_block docxml, div3
91
+ abstract docxml, div3
92
+ foreword docxml, div3
93
+ introduction docxml, div3
94
+ acknowledgements docxml, div3
95
+ middle docxml, div3
96
+ footnotes div3
97
+ comments div3
98
+ end
99
+ end
118
100
 
119
- def middle(isoxml, out)
120
- middle_title(isoxml, out)
121
- middle_admonitions(isoxml, out)
122
- i = scope isoxml, out, 0
123
- i = norm_ref isoxml, out, i
124
- i = terms_defs isoxml, out, i
125
- symbols_abbrevs isoxml, out, i
126
- clause isoxml, out
127
- annex isoxml, out
128
- bibliography isoxml, out
129
- end
101
+ def info(isoxml, out)
102
+ @meta.title isoxml, out
103
+ @meta.subtitle isoxml, out
104
+ @meta.docstatus isoxml, out
105
+ @meta.docid isoxml, out
106
+ @meta.otherid isoxml, out
107
+ @meta.docnumeric isoxml, out
108
+ @meta.doctype isoxml, out
109
+ @meta.author isoxml, out
110
+ @meta.bibdate isoxml, out
111
+ @meta.relations isoxml, out
112
+ @meta.version isoxml, out
113
+ @meta.url isoxml, out
114
+ @meta.keywords isoxml, out
115
+ @meta.note isoxml, out
116
+ @meta.get
117
+ end
130
118
 
131
- def boilerplate(node, out)
132
- return if @bare
119
+ def middle(isoxml, out)
120
+ middle_title(isoxml, out)
121
+ middle_admonitions(isoxml, out)
122
+ i = scope isoxml, out, 0
123
+ i = norm_ref isoxml, out, i
124
+ i = terms_defs isoxml, out, i
125
+ symbols_abbrevs isoxml, out, i
126
+ clause isoxml, out
127
+ annex isoxml, out
128
+ bibliography isoxml, out
129
+ end
133
130
 
134
- boilerplate = node.at(ns("//boilerplate")) or return
135
- out.div **{ class: "authority" } do |s|
136
- boilerplate.children.each do |n|
137
- if n.name == "title"
138
- s.h1 do |h|
139
- n.children.each { |nn| parse(nn, h) }
131
+ def boilerplate(node, out)
132
+ return if @bare
133
+
134
+ boilerplate = node.at(ns("//boilerplate")) or return
135
+ out.div **{ class: "authority" } do |s|
136
+ boilerplate.children.each do |n|
137
+ if n.name == "title"
138
+ s.h1 do |h|
139
+ n.children.each { |nn| parse(nn, h) }
140
+ end
141
+ else parse(n, s)
140
142
  end
141
- else parse(n, s)
142
143
  end
143
144
  end
144
145
  end
145
- end
146
146
 
147
- def parse(node, out)
148
- if node.text? then text_parse(node, out)
149
- else
150
- case node.name
151
- when "em" then em_parse(node, out)
152
- when "strong" then strong_parse(node, out)
153
- when "sup" then sup_parse(node, out)
154
- when "sub" then sub_parse(node, out)
155
- when "tt" then tt_parse(node, out)
156
- when "strike" then strike_parse(node, out)
157
- when "underline" then underline_parse(node, out)
158
- when "keyword" then keyword_parse(node, out)
159
- when "smallcap" then smallcap_parse(node, out)
160
- when "br" then br_parse(node, out)
161
- when "hr" then hr_parse(node, out)
162
- when "bookmark" then bookmark_parse(node, out)
163
- when "pagebreak" then pagebreak_parse(node, out)
164
- when "callout" then callout_parse(node, out)
165
- when "stem" then stem_parse(node, out)
166
- when "clause" then clause_parse(node, out)
167
- when "xref" then xref_parse(node, out)
168
- when "eref" then eref_parse(node, out)
169
- when "origin" then origin_parse(node, out)
170
- when "link" then link_parse(node, out)
171
- when "ul" then ul_parse(node, out)
172
- when "ol" then ol_parse(node, out)
173
- when "li" then li_parse(node, out)
174
- when "dl" then dl_parse(node, out)
175
- when "fn" then footnote_parse(node, out)
176
- when "p" then para_parse(node, out)
177
- when "quote" then quote_parse(node, out)
178
- when "tr" then tr_parse(node, out)
179
- when "note" then note_parse(node, out)
180
- when "review" then review_note_parse(node, out)
181
- when "admonition" then admonition_parse(node, out)
182
- when "formula" then formula_parse(node, out)
183
- when "table" then table_parse(node, out)
184
- when "figure" then figure_parse(node, out)
185
- when "example" then example_parse(node, out)
186
- when "image" then image_parse(node, out, nil)
187
- when "sourcecode" then sourcecode_parse(node, out)
188
- when "pre" then pre_parse(node, out)
189
- when "annotation" then annotation_parse(node, out)
190
- when "term" then termdef_parse(node, out)
191
- when "preferred" then term_parse(node, out)
192
- when "admitted" then admitted_term_parse(node, out)
193
- when "deprecates" then deprecated_term_parse(node, out)
194
- when "domain" then set_termdomain(node.text)
195
- when "definition" then definition_parse(node, out)
196
- when "termsource" then termref_parse(node, out)
197
- when "modification" then modification_parse(node, out)
198
- when "termnote" then termnote_parse(node, out)
199
- when "termexample" then example_parse(node, out)
200
- when "terms" then terms_parse(node, out)
201
- when "definitions" then symbols_parse(node, out)
202
- when "references" then bibliography_parse(node, out)
203
- when "termdocsource" then termdocsource_parse(node, out)
204
- when "requirement" then requirement_parse(node, out)
205
- when "recommendation" then recommendation_parse(node, out)
206
- when "permission" then permission_parse(node, out)
207
- when "subject" then requirement_skip_parse(node, out)
208
- when "classification" then requirement_skip_parse(node, out)
209
- when "inherit" then requirement_component_parse(node, out)
210
- when "description" then requirement_component_parse(node, out)
211
- when "specification" then requirement_component_parse(node, out)
212
- when "measurement-target" then requirement_component_parse(node, out)
213
- when "verification" then requirement_component_parse(node, out)
214
- when "import" then requirement_component_parse(node, out)
215
- when "index" then index_parse(node, out)
216
- when "index-xref" then index_xref_parse(node, out)
217
- when "termref" then termrefelem_parse(node, out)
218
- when "copyright-statement" then copyright_parse(node, out)
219
- when "license-statement" then license_parse(node, out)
220
- when "legal-statement" then legal_parse(node, out)
221
- when "feedback-statement" then feedback_parse(node, out)
222
- when "passthrough" then passthrough_parse(node, out)
223
- when "amend" then amend_parse(node, out)
224
- when "tab" then clausedelimspace(out) # in Presentation XML only
225
- when "svg" then svg_parse(node, out) # in Presentation XML only
226
- when "add" then add_parse(node, out)
227
- when "del" then del_parse(node, out)
228
- when "form" then form_parse(node, out)
229
- when "input" then input_parse(node, out)
230
- when "select" then select_parse(node, out)
231
- when "label" then label_parse(node, out)
232
- when "option" then option_parse(node, out)
233
- when "textarea" then textarea_parse(node, out)
234
- else error_parse(node, out)
147
+ def parse(node, out)
148
+ if node.text? then text_parse(node, out)
149
+ else
150
+ case node.name
151
+ when "em" then em_parse(node, out)
152
+ when "strong" then strong_parse(node, out)
153
+ when "sup" then sup_parse(node, out)
154
+ when "sub" then sub_parse(node, out)
155
+ when "tt" then tt_parse(node, out)
156
+ when "strike" then strike_parse(node, out)
157
+ when "underline" then underline_parse(node, out)
158
+ when "keyword" then keyword_parse(node, out)
159
+ when "smallcap" then smallcap_parse(node, out)
160
+ when "br" then br_parse(node, out)
161
+ when "hr" then hr_parse(node, out)
162
+ when "bookmark" then bookmark_parse(node, out)
163
+ when "pagebreak" then pagebreak_parse(node, out)
164
+ when "callout" then callout_parse(node, out)
165
+ when "stem" then stem_parse(node, out)
166
+ when "clause" then clause_parse(node, out)
167
+ when "xref" then xref_parse(node, out)
168
+ when "eref" then eref_parse(node, out)
169
+ when "origin" then origin_parse(node, out)
170
+ when "link" then link_parse(node, out)
171
+ when "ul" then ul_parse(node, out)
172
+ when "ol" then ol_parse(node, out)
173
+ when "li" then li_parse(node, out)
174
+ when "dl" then dl_parse(node, out)
175
+ when "fn" then footnote_parse(node, out)
176
+ when "p" then para_parse(node, out)
177
+ when "quote" then quote_parse(node, out)
178
+ when "tr" then tr_parse(node, out)
179
+ when "note" then note_parse(node, out)
180
+ when "review" then review_note_parse(node, out)
181
+ when "admonition" then admonition_parse(node, out)
182
+ when "formula" then formula_parse(node, out)
183
+ when "table" then table_parse(node, out)
184
+ when "figure" then figure_parse(node, out)
185
+ when "example" then example_parse(node, out)
186
+ when "image" then image_parse(node, out, nil)
187
+ when "sourcecode" then sourcecode_parse(node, out)
188
+ when "pre" then pre_parse(node, out)
189
+ when "annotation" then annotation_parse(node, out)
190
+ when "term" then termdef_parse(node, out)
191
+ when "preferred" then term_parse(node, out)
192
+ when "admitted" then admitted_term_parse(node, out)
193
+ when "deprecates" then deprecated_term_parse(node, out)
194
+ when "domain" then set_termdomain(node.text)
195
+ when "definition" then definition_parse(node, out)
196
+ when "termsource" then termref_parse(node, out)
197
+ when "modification" then modification_parse(node, out)
198
+ when "termnote" then termnote_parse(node, out)
199
+ when "termexample" then example_parse(node, out)
200
+ when "terms" then terms_parse(node, out)
201
+ when "definitions" then symbols_parse(node, out)
202
+ when "references" then bibliography_parse(node, out)
203
+ when "termdocsource" then termdocsource_parse(node, out)
204
+ when "requirement" then requirement_parse(node, out)
205
+ when "recommendation" then recommendation_parse(node, out)
206
+ when "permission" then permission_parse(node, out)
207
+ when "subject" then requirement_skip_parse(node, out)
208
+ when "classification" then requirement_skip_parse(node, out)
209
+ when "inherit" then requirement_component_parse(node, out)
210
+ when "description" then requirement_component_parse(node, out)
211
+ when "specification" then requirement_component_parse(node, out)
212
+ when "measurement-target" then requirement_component_parse(node, out)
213
+ when "verification" then requirement_component_parse(node, out)
214
+ when "import" then requirement_component_parse(node, out)
215
+ when "component" then requirement_component_parse(node, out)
216
+ when "index" then index_parse(node, out)
217
+ when "index-xref" then index_xref_parse(node, out)
218
+ when "termref" then termrefelem_parse(node, out)
219
+ when "copyright-statement" then copyright_parse(node, out)
220
+ when "license-statement" then license_parse(node, out)
221
+ when "legal-statement" then legal_parse(node, out)
222
+ when "feedback-statement" then feedback_parse(node, out)
223
+ when "passthrough" then passthrough_parse(node, out)
224
+ when "amend" then amend_parse(node, out)
225
+ when "tab" then clausedelimspace(out) # in Presentation XML only
226
+ when "svg" then svg_parse(node, out) # in Presentation XML only
227
+ when "add" then add_parse(node, out)
228
+ when "del" then del_parse(node, out)
229
+ when "form" then form_parse(node, out)
230
+ when "input" then input_parse(node, out)
231
+ when "select" then select_parse(node, out)
232
+ when "label" then label_parse(node, out)
233
+ when "option" then option_parse(node, out)
234
+ when "textarea" then textarea_parse(node, out)
235
+ when "toc" then toc_parse(node, out)
236
+ else error_parse(node, out)
237
+ end
235
238
  end
236
239
  end
237
240
  end