isodoc 1.7.1 → 1.7.4

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.
Files changed (41) hide show
  1. checksums.yaml +4 -4
  2. data/isodoc.gemspec +2 -1
  3. data/lib/isodoc/convert.rb +1 -0
  4. data/lib/isodoc/css.rb +3 -3
  5. data/lib/isodoc/function/blocks.rb +180 -168
  6. data/lib/isodoc/function/blocks_example_note.rb +85 -79
  7. data/lib/isodoc/function/cleanup.rb +181 -175
  8. data/lib/isodoc/function/inline.rb +110 -108
  9. data/lib/isodoc/function/inline_simple.rb +55 -55
  10. data/lib/isodoc/function/lists.rb +75 -71
  11. data/lib/isodoc/function/references.rb +165 -160
  12. data/lib/isodoc/function/reqt.rb +91 -85
  13. data/lib/isodoc/function/section.rb +140 -190
  14. data/lib/isodoc/function/section_titles.rb +82 -0
  15. data/lib/isodoc/function/table.rb +90 -87
  16. data/lib/isodoc/function/terms.rb +58 -56
  17. data/lib/isodoc/function/to_word_html.rb +208 -204
  18. data/lib/isodoc/html_convert.rb +0 -4
  19. data/lib/isodoc/html_function/mathvariant_to_plain.rb +5 -3
  20. data/lib/isodoc/presentation_function/inline.rb +1 -1
  21. data/lib/isodoc/presentation_function/math.rb +9 -0
  22. data/lib/isodoc/presentation_function/section.rb +12 -1
  23. data/lib/isodoc/presentation_xml_convert.rb +2 -0
  24. data/lib/isodoc/version.rb +1 -1
  25. data/lib/isodoc/word_function/body.rb +5 -5
  26. data/lib/isodoc/xslfo_convert.rb +2 -2
  27. data/lib/isodoc.rb +2 -1
  28. data/lib/metanorma/output/base.rb +13 -0
  29. data/lib/metanorma/output/utils.rb +17 -0
  30. data/lib/metanorma/output/xslfo.rb +21 -0
  31. data/lib/metanorma/output.rb +7 -0
  32. data/spec/assets/outputtest/a.xml +66 -0
  33. data/spec/assets/outputtest/iso.international-standard.xsl +3011 -0
  34. data/spec/isodoc/blocks_spec.rb +441 -243
  35. data/spec/isodoc/inline_spec.rb +197 -114
  36. data/spec/isodoc/postproc_spec.rb +2 -2
  37. data/spec/isodoc/presentation_xml_spec.rb +84 -0
  38. data/spec/isodoc/section_spec.rb +639 -0
  39. metadata +23 -18
  40. data/lib/isodoc/html_function/sectionsplit.rb +0 -244
  41. data/spec/isodoc/sectionsplit_spec.rb +0 -190
@@ -1,116 +1,119 @@
1
- module IsoDoc::Function
2
- module Table
3
- def table_title_parse(node, out)
4
- name = node.at(ns("./name")) or return
5
- out.p **{ class: "TableTitle", style: "text-align:center;" } do |p|
6
- name&.children&.each { |n| parse(n, p) }
1
+ module IsoDoc
2
+ module Function
3
+ module Table
4
+ def table_title_parse(node, out)
5
+ name = node.at(ns("./name")) or return
6
+ out.p **{ class: "TableTitle", style: "text-align:center;" } do |p|
7
+ name&.children&.each { |n| parse(n, p) }
8
+ end
7
9
  end
8
- end
9
10
 
10
- def thead_parse(node, table)
11
- thead = node.at(ns("./thead"))
12
- if thead
13
- table.thead do |h|
14
- thead.element_children.each_with_index do |n, i|
15
- tr_parse(n, h, i, thead.element_children.size, true)
11
+ def thead_parse(node, table)
12
+ thead = node.at(ns("./thead"))
13
+ if thead
14
+ table.thead do |h|
15
+ thead.element_children.each_with_index do |n, i|
16
+ tr_parse(n, h, i, thead.element_children.size, true)
17
+ end
16
18
  end
17
19
  end
18
20
  end
19
- end
20
21
 
21
- def tbody_parse(node, table)
22
- tbody = node.at(ns("./tbody")) || return
23
- table.tbody do |h|
24
- tbody.element_children.each_with_index do |n, i|
25
- tr_parse(n, h, i, tbody.element_children.size, false)
22
+ def tbody_parse(node, table)
23
+ tbody = node.at(ns("./tbody")) || return
24
+ table.tbody do |h|
25
+ tbody.element_children.each_with_index do |n, i|
26
+ tr_parse(n, h, i, tbody.element_children.size, false)
27
+ end
26
28
  end
27
29
  end
28
- end
29
30
 
30
- def tfoot_parse(node, table)
31
- tfoot = node.at(ns("./tfoot"))
32
- if tfoot
33
- table.tfoot do |h|
34
- tfoot.element_children.each_with_index do |n, i|
35
- tr_parse(n, h, i, tfoot.element_children.size, false)
31
+ def tfoot_parse(node, table)
32
+ tfoot = node.at(ns("./tfoot"))
33
+ if tfoot
34
+ table.tfoot do |h|
35
+ tfoot.element_children.each_with_index do |n, i|
36
+ tr_parse(n, h, i, tfoot.element_children.size, false)
37
+ end
36
38
  end
37
39
  end
38
40
  end
39
- end
40
41
 
41
- def table_attrs(node)
42
- width = node["width"] ? "width:#{node['width']};" : nil
43
- attr_code(
44
- id: node["id"],
45
- class: "MsoISOTable",
46
- style: "border-width:1px;border-spacing:0;#{width}#{keep_style(node)}",
47
- title: node["alt"],
48
- )
49
- end
42
+ def table_attrs(node)
43
+ width = node["width"] ? "width:#{node['width']};" : nil
44
+ attr_code(
45
+ id: node["id"],
46
+ class: "MsoISOTable",
47
+ style: "border-width:1px;border-spacing:0;"\
48
+ "#{width}#{keep_style(node)}",
49
+ title: node["alt"],
50
+ )
51
+ end
50
52
 
51
- def tcaption(node, table)
52
- return unless node["summary"]
53
+ def tcaption(node, table)
54
+ return unless node["summary"]
53
55
 
54
- table.caption do |c|
55
- c.span **{ style: "display:none" } do |s|
56
- s << node["summary"]
56
+ table.caption do |c|
57
+ c.span **{ style: "display:none" } do |s|
58
+ s << node["summary"]
59
+ end
57
60
  end
58
61
  end
59
- end
60
62
 
61
- def colgroup(node, table)
62
- colgroup = node.at(ns("./colgroup")) or return
63
- table.colgroup do |cg|
64
- colgroup.xpath(ns("./col")).each do |c|
65
- cg.col **{ style: "width: #{c['width']};" }
63
+ def colgroup(node, table)
64
+ colgroup = node.at(ns("./colgroup")) or return
65
+ table.colgroup do |cg|
66
+ colgroup.xpath(ns("./col")).each do |c|
67
+ cg.col **{ style: "width: #{c['width']};" }
68
+ end
66
69
  end
67
70
  end
68
- end
69
71
 
70
- def table_parse(node, out)
71
- @in_table = true
72
- table_title_parse(node, out)
73
- out.table **table_attrs(node) do |t|
74
- tcaption(node, t)
75
- colgroup(node, t)
76
- thead_parse(node, t)
77
- tbody_parse(node, t)
78
- tfoot_parse(node, t)
79
- (dl = node.at(ns("./dl"))) && parse(dl, out)
80
- node.xpath(ns("./note")).each { |n| parse(n, out) }
72
+ def table_parse(node, out)
73
+ @in_table = true
74
+ table_title_parse(node, out)
75
+ out.table **table_attrs(node) do |t|
76
+ tcaption(node, t)
77
+ colgroup(node, t)
78
+ thead_parse(node, t)
79
+ tbody_parse(node, t)
80
+ tfoot_parse(node, t)
81
+ (dl = node.at(ns("./dl"))) && parse(dl, out)
82
+ node.xpath(ns("./note")).each { |n| parse(n, out) }
83
+ end
84
+ @in_table = false
85
+ # out.p { |p| p << "&nbsp;" }
81
86
  end
82
- @in_table = false
83
- # out.p { |p| p << "&nbsp;" }
84
- end
85
87
 
86
- SW = "solid windowtext".freeze
88
+ SW = "solid windowtext".freeze
87
89
 
88
- # def make_tr_attr(td, row, totalrows, cols, totalcols, header)
89
- # border-left:#{col.zero? ? "#{SW} 1.5pt;" : "none;"}
90
- # border-right:#{SW} #{col == totalcols && !header ? "1.5" : "1.0"}pt;
90
+ # def make_tr_attr(td, row, totalrows, cols, totalcols, header)
91
+ # border-left:#{col.zero? ? "#{SW} 1.5pt;" : "none;"}
92
+ # border-right:#{SW} #{col == totalcols && !header ? "1.5" : "1.0"}pt;
91
93
 
92
- def make_tr_attr(cell, row, totalrows, header)
93
- style = cell.name == "th" ? "font-weight:bold;" : ""
94
- cell["align"] and style += "text-align:#{cell['align']};"
95
- cell["valign"] and style += "vertical-align:#{cell['valign']};"
96
- rowmax = cell["rowspan"] ? row + cell["rowspan"].to_i - 1 : row
97
- style += <<~STYLE
98
- border-top:#{row.zero? ? "#{SW} 1.5pt;" : 'none;'}
99
- border-bottom:#{SW} #{rowmax == totalrows ? '1.5' : '1.0'}pt;
100
- STYLE
101
- header and scope = (cell["colspan"] ? "colgroup" : "col")
102
- !header and cell.name == "th" and scope =
103
- (cell["rowspan"] ? "rowgroup" : "row")
104
- { rowspan: cell["rowspan"], colspan: cell["colspan"],
105
- style: style.gsub(/\n/, ""), scope: scope }
106
- end
94
+ def make_tr_attr(cell, row, totalrows, header)
95
+ style = cell.name == "th" ? "font-weight:bold;" : ""
96
+ cell["align"] and style += "text-align:#{cell['align']};"
97
+ cell["valign"] and style += "vertical-align:#{cell['valign']};"
98
+ rowmax = cell["rowspan"] ? row + cell["rowspan"].to_i - 1 : row
99
+ style += <<~STYLE
100
+ border-top:#{row.zero? ? "#{SW} 1.5pt;" : 'none;'}
101
+ border-bottom:#{SW} #{rowmax == totalrows ? '1.5' : '1.0'}pt;
102
+ STYLE
103
+ header and scope = (cell["colspan"] ? "colgroup" : "col")
104
+ !header && cell.name == "th" and
105
+ scope = (cell["rowspan"] ? "rowgroup" : "row")
106
+ { rowspan: cell["rowspan"], colspan: cell["colspan"],
107
+ style: style.gsub(/\n/, ""), scope: scope }
108
+ end
107
109
 
108
- def tr_parse(node, out, ord, totalrows, header)
109
- out.tr do |r|
110
- node.elements.each do |td|
111
- attrs = make_tr_attr(td, ord, totalrows - 1, header)
112
- r.send td.name, **attr_code(attrs) do |entry|
113
- td.children.each { |n| parse(n, entry) }
110
+ def tr_parse(node, out, ord, totalrows, header)
111
+ out.tr do |r|
112
+ node.elements.each do |td|
113
+ attrs = make_tr_attr(td, ord, totalrows - 1, header)
114
+ r.send td.name, **attr_code(attrs) do |entry|
115
+ td.children.each { |n| parse(n, entry) }
116
+ end
114
117
  end
115
118
  end
116
119
  end
@@ -1,77 +1,79 @@
1
- module IsoDoc::Function
2
- module Terms
3
- def definition_parse(node, out)
4
- node.children.each { |n| parse(n, out) }
5
- end
1
+ module IsoDoc
2
+ module Function
3
+ module Terms
4
+ def definition_parse(node, out)
5
+ node.children.each { |n| parse(n, out) }
6
+ end
6
7
 
7
- def modification_parse(node, out)
8
- out << "[MODIFICATION]"
9
- para = node.at(ns("./p"))
10
- para.children.each { |n| parse(n, out) }
11
- end
8
+ def modification_parse(node, out)
9
+ out << "[MODIFICATION]"
10
+ para = node.at(ns("./p"))
11
+ para.children.each { |n| parse(n, out) }
12
+ end
12
13
 
13
- def deprecated_term_parse(node, out)
14
- out.p **{ class: "DeprecatedTerms", style: "text-align:left;" } do |p|
15
- p << l10n("#{@i18n.deprecated}: ")
16
- node.children.each { |c| parse(c, p) }
14
+ def deprecated_term_parse(node, out)
15
+ out.p **{ class: "DeprecatedTerms", style: "text-align:left;" } do |p|
16
+ p << l10n("#{@i18n.deprecated}: ")
17
+ node.children.each { |c| parse(c, p) }
18
+ end
17
19
  end
18
- end
19
20
 
20
- def admitted_term_parse(node, out)
21
- out.p **{ class: "AltTerms", style: "text-align:left;" } do |p|
22
- node.children.each { |c| parse(c, p) }
21
+ def admitted_term_parse(node, out)
22
+ out.p **{ class: "AltTerms", style: "text-align:left;" } do |p|
23
+ node.children.each { |c| parse(c, p) }
24
+ end
23
25
  end
24
- end
25
26
 
26
- def term_parse(node, out)
27
- out.p **{ class: "Terms", style: "text-align:left;" } do |p|
28
- node.children.each { |c| parse(c, p) }
27
+ def term_parse(node, out)
28
+ out.p **{ class: "Terms", style: "text-align:left;" } do |p|
29
+ node.children.each { |c| parse(c, p) }
30
+ end
29
31
  end
30
- end
31
32
 
32
- def para_then_remainder(first, node, para, div)
33
- if first.name == "p"
34
- first.children.each { |n| parse(n, para) }
35
- node.elements.drop(1).each { |n| parse(n, div) }
36
- else
37
- node.elements.each { |n| parse(n, div) }
33
+ def para_then_remainder(first, node, para, div)
34
+ if first.name == "p"
35
+ first.children.each { |n| parse(n, para) }
36
+ node.elements.drop(1).each { |n| parse(n, div) }
37
+ else
38
+ node.elements.each { |n| parse(n, div) }
39
+ end
38
40
  end
39
- end
40
41
 
41
- def termnote_delim
42
- l10n(": ")
43
- end
42
+ def termnote_delim
43
+ l10n(": ")
44
+ end
44
45
 
45
- def termnote_parse(node, out)
46
- name = node&.at(ns("./name"))&.remove
47
- out.div **note_attrs(node) do |div|
48
- div.p do |p|
49
- if name
50
- name.children.each { |n| parse(n, p) }
51
- p << termnote_delim
46
+ def termnote_parse(node, out)
47
+ name = node&.at(ns("./name"))&.remove
48
+ out.div **note_attrs(node) do |div|
49
+ div.p do |p|
50
+ if name
51
+ name.children.each { |n| parse(n, p) }
52
+ p << termnote_delim
53
+ end
54
+ para_then_remainder(node.first_element_child, node, p, div)
52
55
  end
53
- para_then_remainder(node.first_element_child, node, p, div)
54
56
  end
55
57
  end
56
- end
57
58
 
58
- def termref_parse(node, out)
59
- out.p do |p|
60
- p << "[TERMREF]"
61
- node.children.each { |n| parse(n, p) }
62
- p << "[/TERMREF]"
59
+ def termref_parse(node, out)
60
+ out.p do |p|
61
+ p << "[TERMREF]"
62
+ node.children.each { |n| parse(n, p) }
63
+ p << "[/TERMREF]"
64
+ end
63
65
  end
64
- end
65
66
 
66
- def termdef_parse(node, out)
67
- name = node&.at(ns("./name"))&.remove
68
- out.p **{ class: "TermNum", id: node["id"] } do |p|
69
- name&.children&.each { |n| parse(n, p) }
67
+ def termdef_parse(node, out)
68
+ name = node&.at(ns("./name"))&.remove
69
+ out.p **{ class: "TermNum", id: node["id"] } do |p|
70
+ name&.children&.each { |n| parse(n, p) }
71
+ end
72
+ set_termdomain("")
73
+ node.children.each { |n| parse(n, out) }
70
74
  end
71
- set_termdomain("")
72
- node.children.each { |n| parse(n, out) }
73
- end
74
75
 
75
- def termdocsource_parse(_node, _out); end
76
+ def termdocsource_parse(_node, _out); end
77
+ end
76
78
  end
77
79
  end
@@ -1,237 +1,241 @@
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
+ when "variant-title" then variant_title(node, out)
237
+ else error_parse(node, out)
238
+ end
235
239
  end
236
240
  end
237
241
  end