isodoc 1.1.3.pre.alpha → 1.2.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (55) hide show
  1. checksums.yaml +4 -4
  2. data/isodoc.gemspec +1 -1
  3. data/lib/isodoc-yaml/i18n-en.yaml +4 -1
  4. data/lib/isodoc-yaml/i18n-fr.yaml +4 -1
  5. data/lib/isodoc-yaml/i18n-zh-Hans.yaml +4 -1
  6. data/lib/isodoc.rb +1 -0
  7. data/lib/isodoc/base_style/all.css +207 -0
  8. data/lib/isodoc/base_style/blocks.css +0 -0
  9. data/lib/isodoc/base_style/coverpage.css +0 -0
  10. data/lib/isodoc/base_style/defaults.css +0 -0
  11. data/lib/isodoc/base_style/metanorma_word.css +34 -0
  12. data/lib/isodoc/base_style/nav.css +0 -0
  13. data/lib/isodoc/base_style/reset.css +105 -0
  14. data/lib/isodoc/base_style/typography.css +0 -0
  15. data/lib/isodoc/common.rb +0 -2
  16. data/lib/isodoc/convert.rb +49 -44
  17. data/lib/isodoc/function/blocks.rb +10 -22
  18. data/lib/isodoc/function/blocks_example_note.rb +14 -15
  19. data/lib/isodoc/function/cleanup.rb +5 -4
  20. data/lib/isodoc/function/inline.rb +6 -76
  21. data/lib/isodoc/function/references.rb +10 -9
  22. data/lib/isodoc/function/reqt.rb +12 -11
  23. data/lib/isodoc/function/section.rb +39 -54
  24. data/lib/isodoc/function/table.rb +1 -6
  25. data/lib/isodoc/function/terms.rb +13 -6
  26. data/lib/isodoc/function/to_word_html.rb +1 -0
  27. data/lib/isodoc/function/utils.rb +4 -3
  28. data/lib/isodoc/gem_tasks.rb +33 -10
  29. data/lib/isodoc/html_function/html.rb +0 -1
  30. data/lib/isodoc/{function/i18n.rb → i18n.rb} +37 -36
  31. data/lib/isodoc/metadata.rb +4 -3
  32. data/lib/isodoc/metadata_date.rb +1 -1
  33. data/lib/isodoc/presentation_function/block.rb +138 -0
  34. data/lib/isodoc/presentation_function/inline.rb +131 -0
  35. data/lib/isodoc/presentation_function/section.rb +46 -0
  36. data/lib/isodoc/presentation_xml_convert.rb +38 -5
  37. data/lib/isodoc/version.rb +1 -1
  38. data/lib/isodoc/word_function/body.rb +12 -8
  39. data/lib/isodoc/word_function/inline.rb +3 -1
  40. data/lib/isodoc/xref.rb +5 -3
  41. data/lib/isodoc/xref/xref_sect_gen.rb +3 -3
  42. data/spec/assets/i18n.yaml +12 -1
  43. data/spec/isodoc/blocks_spec.rb +1101 -147
  44. data/spec/isodoc/cleanup_spec.rb +2 -2
  45. data/spec/isodoc/footnotes_spec.rb +2 -2
  46. data/spec/isodoc/i18n_spec.rb +679 -110
  47. data/spec/isodoc/inline_spec.rb +323 -142
  48. data/spec/isodoc/lists_spec.rb +2 -2
  49. data/spec/isodoc/postproc_spec.rb +1311 -1333
  50. data/spec/isodoc/ref_spec.rb +181 -3
  51. data/spec/isodoc/section_spec.rb +508 -680
  52. data/spec/isodoc/table_spec.rb +155 -4
  53. data/spec/isodoc/terms_spec.rb +111 -79
  54. data/spec/isodoc/xref_spec.rb +1569 -1186
  55. metadata +19 -8
@@ -1,13 +1,13 @@
1
1
  # frozen_string_literal: true
2
-
3
- require 'isodoc/common'
4
- require 'fileutils'
5
- require 'tempfile'
2
+ require "isodoc/common"
3
+ require "fileutils"
4
+ require "tempfile"
5
+ require_relative "i18n"
6
6
 
7
7
  module IsoDoc
8
8
  class Convert < ::IsoDoc::Common
9
9
  attr_reader :options
10
- attr_accessor :labels
10
+ attr_accessor :i18n
11
11
 
12
12
  # htmlstylesheet: Generic stylesheet for HTML
13
13
  # wordstylesheet: Generic stylesheet for Word
@@ -38,15 +38,9 @@ module IsoDoc
38
38
  @options = options
39
39
  @files_to_delete = []
40
40
  @tempfile_cache = []
41
- @htmlstylesheet_name = precompiled_style_or_original(
42
- options[:htmlstylesheet]
43
- )
44
- @wordstylesheet_name = precompiled_style_or_original(
45
- options[:wordstylesheet]
46
- )
47
- @standardstylesheet_name = precompiled_style_or_original(
48
- options[:standardstylesheet]
49
- )
41
+ @htmlstylesheet_name = options[:htmlstylesheet]
42
+ @wordstylesheet_name = options[:wordstylesheet]
43
+ @standardstylesheet_name = options[:standardstylesheet]
50
44
  @header = options[:header]
51
45
  @htmlcoverpage = options[:htmlcoverpage]
52
46
  @wordcoverpage = options[:wordcoverpage]
@@ -72,10 +66,10 @@ module IsoDoc
72
66
  @in_figure = false
73
67
  @seen_footnote = Set.new
74
68
  @c = HTMLEntities.new
75
- @openmathdelim = '`'
76
- @closemathdelim = '`'
77
- @lang = 'en'
78
- @script = 'Latn'
69
+ @openmathdelim = "`"
70
+ @closemathdelim = "`"
71
+ @lang = options[:language] || "en"
72
+ @script = options[:script] || "Latn"
79
73
  @maxwidth = 1200
80
74
  @maxheight = 800
81
75
  @wordToClevels = options[:doctoclevels].to_i
@@ -121,8 +115,8 @@ module IsoDoc
121
115
  }
122
116
  end
123
117
 
124
- # none for this parent gem, but will be populated in child
125
- # gems which have access to stylesheets &c; e.g.
118
+ # none for this parent gem, but will be populated in child gems
119
+ # which have access to stylesheets &c; e.g.
126
120
  # {
127
121
  # htmlstylesheet: html_doc_path("htmlstyle.scss"),
128
122
  # htmlcoverpage: html_doc_path("html_rsd_titlepage.html"),
@@ -155,8 +149,12 @@ module IsoDoc
155
149
  "$bodyfont: #{b};\n$headerfont: #{h};\n$monospacefont: #{m};\n"
156
150
  end
157
151
 
158
- def html_doc_path(file)
159
- File.join(@libdir, File.join('html', file))
152
+ def html_doc_path(*file)
153
+ file.each do |f|
154
+ ret = File.join(@libdir, File.join('html', f))
155
+ File.exist?(ret) and return ret
156
+ end
157
+ nil
160
158
  end
161
159
 
162
160
  def convert_scss(filename, stylesheet)
@@ -165,17 +163,18 @@ module IsoDoc
165
163
 
166
164
  [File.join(Gem.loaded_specs['isodoc'].full_gem_path,
167
165
  'lib', 'isodoc'),
168
- File.dirname(filename)].each do |name|
169
- SassC.load_paths << name
170
- end
171
- SassC::Engine.new(scss_fontheader + stylesheet, syntax: :scss,
172
- importer: SasscImporter)
166
+ File.dirname(filename)].each do |name|
167
+ SassC.load_paths << name
168
+ end
169
+ SassC::Engine.new(scss_fontheader + stylesheet, syntax: :scss,
170
+ importer: SasscImporter)
173
171
  .render
174
172
  end
175
173
 
176
174
  def generate_css(filename, stripwordcss)
177
175
  return nil if filename.nil?
178
176
 
177
+ filename = precompiled_style_or_original(filename)
179
178
  stylesheet = File.read(filename, encoding: 'UTF-8')
180
179
  stylesheet = populate_template(stylesheet, :word)
181
180
  stylesheet.gsub!(/(\s|\{)mso-[^:]+:[^;]+;/m, '\\1') if stripwordcss
@@ -202,32 +201,38 @@ module IsoDoc
202
201
  end.join("\n")
203
202
  end
204
203
 
205
- def metadata_init(lang, script, labels)
206
- @meta = Metadata.new(lang, script, labels)
204
+ def metadata_init(lang, script, i18n)
205
+ @meta = Metadata.new(lang, script, i18n)
206
+ end
207
+
208
+ def xref_init(lang, script, _klass, i18n, options)
209
+ html = HtmlConvert.new(language: @lang, script: @script)
210
+ @xrefs = Xref.new(lang, script, html, i18n, options)
211
+ end
212
+
213
+ def i18n_init(lang, script, i18nyaml = nil)
214
+ @i18n = I18n.new(lang, script, i18nyaml || @i18nyaml)
207
215
  end
208
216
 
209
- def xref_init(lang, script, klass, labels, options)
210
- @xrefs = Xref.new(lang, script, klass, labels, options)
217
+ def l10n(x, lang = @lang, script = @script)
218
+ @i18n.l10n(x, lang, script)
211
219
  end
212
220
 
213
221
  def convert_init(file, input_filename, debug)
214
222
  docxml = Nokogiri::XML(file)
215
223
  filename, dir = init_file(input_filename, debug)
216
- docxml.root.default_namespace = ''
217
- lang = docxml&.at(ns('//bibdata/language'))&.text || @lang
218
- script = docxml&.at(ns('//bibdata/script'))&.text || @script
219
- i18n_init(lang, script)
220
- metadata_init(lang, script, @labels)
221
- @meta.fonts_options = fonts_options
222
- xref_init(lang, script, self, @labels, {})
224
+ docxml.root.default_namespace = ""
225
+ lang = docxml&.at(ns("//bibdata/language"))&.text and @lang = lang
226
+ script = docxml&.at(ns("//bibdata/script"))&.text and @script = script
227
+ i18n_init(@lang, @script)
228
+ metadata_init(@lang, @script, @i18n)
229
+ xref_init(@lang, @script, self, @i18n, {})
223
230
  [docxml, filename, dir]
224
231
  end
225
232
 
226
- def convert(input_filename,
227
- file = nil,
228
- debug = false,
233
+ def convert(input_filename, file = nil, debug = false,
229
234
  output_filename = nil)
230
- file = File.read(input_filename, encoding: 'utf-8') if file.nil?
235
+ file = File.read(input_filename, encoding: "utf-8") if file.nil?
231
236
  @openmathdelim, @closemathdelim = extract_delims(file)
232
237
  docxml, filename, dir = convert_init(file, input_filename, debug)
233
238
  result = convert1(docxml, filename, dir)
@@ -238,8 +243,8 @@ module IsoDoc
238
243
  end
239
244
 
240
245
  def middle_clause
241
- "//clause[parent::sections][not(xmlns:title = 'Scope')]"\
242
- '[not(descendant::terms)]'
246
+ "//clause[parent::sections][not(@type = 'scope')]"\
247
+ '[not(descendant::terms)]'
243
248
  end
244
249
  end
245
250
  end
@@ -5,20 +5,15 @@ module IsoDoc::Function
5
5
  @annotation = false
6
6
 
7
7
  def figure_name_parse(node, div, name)
8
- return if name.nil? && node.at(ns("./figure"))
9
- lbl = @xrefs.anchor(node['id'], :label, false)
10
- lbl = nil if labelled_ancestor(node) && node.ancestors("figure").empty?
11
- return if lbl.nil? && name.nil?
8
+ return if name.nil?
12
9
  div.p **{ class: "FigureTitle", style: "text-align:center;" } do |p|
13
- lbl.nil? or p << l10n("#{@figure_lbl} #{lbl}")
14
- name and !lbl.nil? and p << "&nbsp;&mdash; "
15
- name and name.children.each { |n| parse(n, div) }
10
+ name.children.each { |n| parse(n, div) }
16
11
  end
17
12
  end
18
13
 
19
14
  def figure_key(out)
20
15
  out.p **{ style: "page-break-after:avoid;"} do |p|
21
- p.b { |b| b << @key_lbl }
16
+ p.b { |b| b << @i18n.key }
22
17
  end
23
18
  end
24
19
 
@@ -55,15 +50,9 @@ module IsoDoc::Function
55
50
  end
56
51
 
57
52
  def sourcecode_name_parse(node, div, name)
58
- lbl = @xrefs.anchor(node['id'], :label, false)
59
- lbl = nil if labelled_ancestor(node)
60
- return if lbl.nil? && name.nil?
53
+ return if name.nil?
61
54
  div.p **{ class: "SourceTitle", style: "text-align:center;" } do |p|
62
- if node.ancestors("example").empty?
63
- lbl.nil? or p << l10n("#{@figure_lbl} #{lbl}")
64
- name and !lbl.nil? and p << "&nbsp;&mdash; "
65
- end
66
- name&.children&.each { |n| parse(n, p) }
55
+ name.children.each { |n| parse(n, p) }
67
56
  end
68
57
  end
69
58
 
@@ -109,8 +98,8 @@ module IsoDoc::Function
109
98
  def admonition_name(node, type)
110
99
  name = node&.at(ns("./name")) and return name
111
100
  name = Nokogiri::XML::Node.new('name', node.document)
112
- return unless type && @admonition[type]
113
- name << @admonition[type]&.upcase
101
+ return unless type && @i18n.admonition[type]
102
+ name << @i18n.admonition[type]&.upcase
114
103
  name
115
104
  end
116
105
 
@@ -131,7 +120,7 @@ module IsoDoc::Function
131
120
  def formula_where(dl, out)
132
121
  return unless dl
133
122
  out.p **{ style: "page-break-after:avoid;"} do |p|
134
- p << @where_lbl
123
+ p << @i18n.where
135
124
  end
136
125
  parse(dl, out)
137
126
  out.parent.at("./dl")["class"] = "formula_dl"
@@ -141,8 +130,7 @@ module IsoDoc::Function
141
130
  out.div **attr_code(class: "formula") do |div|
142
131
  div.p do |p|
143
132
  parse(node.at(ns("./stem")), div)
144
- lbl = @xrefs.anchor(node['id'], :label, false)
145
- unless lbl.nil?
133
+ if lbl = node&.at(ns("./name"))&.text
146
134
  insert_tab(div, 1)
147
135
  div << "(#{lbl})"
148
136
  end
@@ -159,7 +147,7 @@ module IsoDoc::Function
159
147
  formula_parse1(node, div)
160
148
  formula_where(node.at(ns("./dl")), div)
161
149
  node.children.each do |n|
162
- next if %w(stem dl).include? n.name
150
+ next if %w(stem dl name).include? n.name
163
151
  parse(n, div)
164
152
  end
165
153
  end
@@ -1,13 +1,9 @@
1
1
  module IsoDoc::Function
2
2
  module Blocks
3
3
  def example_label(node, div, name)
4
- n = @xrefs.get[node["id"]]
4
+ return if name.nil?
5
5
  div.p **{ class: "example-title" } do |p|
6
- lbl = (n.nil? || n[:label].nil? || n[:label].empty?) ? @example_lbl :
7
- l10n("#{@example_lbl} #{n[:label]}")
8
- p << lbl
9
- name and !lbl.nil? and p << "&nbsp;&mdash; "
10
- name and name.children.each { |n| parse(n, div) }
6
+ name.children.each { |n| parse(n, div) }
11
7
  end
12
8
  end
13
9
 
@@ -55,16 +51,16 @@ module IsoDoc::Function
55
51
  example_div_parse(node, out)
56
52
  end
57
53
 
58
- def note_label(node)
59
- n = @xrefs.get[node["id"]]
60
- return @note_lbl if n.nil? || n[:label].nil? || n[:label].empty?
61
- l10n("#{@note_lbl} #{n[:label]}")
54
+ def note_delim
55
+ ""
62
56
  end
63
57
 
64
58
  def note_p_parse(node, div)
59
+ name = node&.at(ns("./name"))&.remove
65
60
  div.p do |p|
66
- p.span **{ class: "note_label" } do |s|
67
- s << note_label(node)
61
+ name and p.span **{ class: "note_label" } do |s|
62
+ name and name.children.each { |n| parse(n, s) }
63
+ s << note_delim
68
64
  end
69
65
  insert_tab(p, 1)
70
66
  node.first_element_child.children.each { |n| parse(n, p) }
@@ -73,9 +69,11 @@ module IsoDoc::Function
73
69
  end
74
70
 
75
71
  def note_parse1(node, div)
76
- div.p do |p|
72
+ name = node&.at(ns("./name"))&.remove
73
+ name and div.p do |p|
77
74
  p.span **{ class: "note_label" } do |s|
78
- s << note_label(node)
75
+ name.children.each { |n| parse(n, s) }
76
+ s << note_delim
79
77
  end
80
78
  insert_tab(p, 1)
81
79
  end
@@ -99,7 +97,8 @@ module IsoDoc::Function
99
97
  def note_parse(node, out)
100
98
  @note = true
101
99
  out.div **note_attrs(node) do |div|
102
- node.first_element_child.name == "p" ?
100
+ node&.at(ns("./*[local-name() != 'name'][1]"))&.name == "p" ?
101
+ #node.first_element_child.name == "p" ?
103
102
  note_p_parse(node, div) : note_parse1(node, div)
104
103
  end
105
104
  @note = false
@@ -7,10 +7,10 @@ module IsoDoc::Function
7
7
  def termref_cleanup(docxml)
8
8
  docxml.
9
9
  gsub(%r{\s*\[/TERMREF\]\s*</p>\s*<p>\s*\[TERMREF\]}, "; ").
10
- gsub(/\[TERMREF\]\s*/, l10n("[#{@source_lbl}: ")).
11
- gsub(/\s*\[MODIFICATION\]\s*\[\/TERMREF\]/, l10n(", #{@modified_lbl} [/TERMREF]")).
10
+ gsub(/\[TERMREF\]\s*/, l10n("[#{@i18n.source}: ")).
11
+ gsub(/\s*\[MODIFICATION\]\s*\[\/TERMREF\]/, l10n(", #{@i18n.modified} [/TERMREF]")).
12
12
  gsub(%r{\s*\[\/TERMREF\]\s*}, l10n("]")).
13
- gsub(/\s*\[MODIFICATION\]/, l10n(", #{@modified_lbl} &mdash; "))
13
+ gsub(/\s*\[MODIFICATION\]/, l10n(", #{@i18n.modified} &mdash; "))
14
14
  end
15
15
 
16
16
  def passthrough_cleanup(docxml)
@@ -21,6 +21,7 @@ module IsoDoc::Function
21
21
  end
22
22
 
23
23
  def cleanup(docxml)
24
+ @i18n ||= i18n_init(@lang, @script)
24
25
  comment_cleanup(docxml)
25
26
  footnote_cleanup(docxml)
26
27
  inline_header_cleanup(docxml)
@@ -80,7 +81,7 @@ module IsoDoc::Function
80
81
  def figure_get_or_make_dl(t)
81
82
  dl = t.at(".//dl")
82
83
  if dl.nil?
83
- t.add_child("<p><b>#{@key_lbl}</b></p><dl></dl>")
84
+ t.add_child("<p><b>#{@i18n.key}</b></p><dl></dl>")
84
85
  dl = t.at(".//dl")
85
86
  end
86
87
  dl
@@ -16,85 +16,16 @@ module IsoDoc::Function
16
16
  out << " &lt;#{node.text}&gt;"
17
17
  end
18
18
 
19
- def prefix_container(container, linkend, _target)
20
- l10n(@xrefs.anchor(container, :xref) + ", " + linkend)
21
- end
22
-
23
- def anchor_linkend(node, linkend)
24
- if node["citeas"].nil? && node["bibitemid"]
25
- return @xrefs.anchor(node["bibitemid"] ,:xref) || "???"
26
- elsif node["target"] && !/.#./.match(node["target"])
27
- linkend = @xrefs.anchor(node["target"], :xref)
28
- container = @xrefs.anchor(node["target"], :container, false)
29
- (container && get_note_container_id(node) != container &&
30
- @xrefs.get[node["target"]]) &&
31
- linkend = prefix_container(container, linkend, node["target"])
32
- linkend = capitalise_xref(node, linkend)
19
+ def no_locality_parse(node, out)
20
+ node.children.each do |n|
21
+ parse(n, out) unless %w{locality localityStack}.include? n.name
33
22
  end
34
- linkend || "???"
35
- end
36
-
37
- def capitalise_xref(node, linkend)
38
- return linkend unless %w(Latn Cyrl Grek).include? @script
39
- return linkend&.capitalize if node["case"] == "capital"
40
- return linkend&.downcase if node["case"] == "lowercase"
41
- return linkend if linkend[0,1].match(/\p{Upper}/)
42
- prec = nearest_block_parent(node).xpath("./descendant-or-self::text()") &
43
- node.xpath("./preceding::text()")
44
- (prec.empty? || /(?!<[^.].)\.\s+$/.match(prec.map { |p| p.text }.join)) ?
45
- linkend&.capitalize : linkend
46
- end
47
-
48
- def nearest_block_parent(node)
49
- until %w(p title td th name formula
50
- li dt dd sourcecode pre).include?(node.name)
51
- node = node.parent
52
- end
53
- node
54
- end
55
-
56
- def get_linkend(node)
57
- contents = node.children.select do |c|
58
- !%w{locality localityStack}.include? c.name
59
- end.select { |c| !c.text? || /\S/.match(c) }
60
- !contents.empty? and
61
- return Nokogiri::XML::NodeSet.new(node.document, contents).to_xml
62
- link = anchor_linkend(node, docid_l10n(node["target"] || node["citeas"]))
63
- link + eref_localities(node.xpath(ns("./locality | ./localityStack")),
64
- link)
65
- # so not <origin bibitemid="ISO7301" citeas="ISO 7301">
66
- # <locality type="section"><reference>3.1</reference></locality></origin>
67
23
  end
68
24
 
69
25
  def xref_parse(node, out)
70
26
  target = /#/.match(node["target"]) ? node["target"].sub(/#/, ".html#") :
71
27
  "##{node["target"]}"
72
- out.a(**{ "href": target }) { |l| l << get_linkend(node) }
73
- end
74
-
75
- def eref_localities(refs, target)
76
- ret = ""
77
- refs.each_with_index do |r, i|
78
- delim = ","
79
- delim = ";" if r.name == "localityStack" && i>0
80
- if r.name == "localityStack"
81
- r.elements.each_with_index do |rr, j|
82
- ret += eref_localities0(rr, j, target, delim)
83
- delim = ","
84
- end
85
- else
86
- ret += eref_localities0(r, i, target, delim)
87
- end
88
- end
89
- ret
90
- end
91
-
92
- def eref_localities0(r, i, target, delim)
93
- if r["type"] == "whole" then l10n("#{delim} #{@wholeoftext_lbl}")
94
- else
95
- eref_localities1(target, r["type"], r.at(ns("./referenceFrom")),
96
- r.at(ns("./referenceTo")), delim, @lang)
97
- end
28
+ out.a(**{ "href": target }) { |l| no_locality_parse(node, l) }
98
29
  end
99
30
 
100
31
  def suffix_url(url)
@@ -114,14 +45,13 @@ module IsoDoc::Function
114
45
  end
115
46
 
116
47
  def eref_parse(node, out)
117
- linkend = get_linkend(node)
118
48
  href = eref_target(node)
119
49
  if node["type"] == "footnote"
120
50
  out.sup do |s|
121
- s.a(**{ "href": href }) { |l| l << linkend }
51
+ s.a(**{ "href": href }) { |l| no_locality_parse(node, l) }
122
52
  end
123
53
  else
124
- out.a(**{ "href": href }) { |l| l << linkend }
54
+ out.a(**{ "href": href }) { |l| no_locality_parse(node, l) }
125
55
  end
126
56
  end
127
57
 
@@ -5,7 +5,7 @@ module IsoDoc::Function
5
5
  # references anyway; keeping here instead of in IsoDoc::Iso for now
6
6
  def docid_l10n(x)
7
7
  return x if x.nil?
8
- x.gsub(/All Parts/i, @all_parts_lbl.downcase) if @all_parts_lbl
8
+ x.gsub(/All Parts/i, @i18n.all_parts.downcase) if @i18n.all_parts
9
9
  x
10
10
  end
11
11
 
@@ -155,14 +155,14 @@ module IsoDoc::Function
155
155
 
156
156
  def norm_ref_xpath
157
157
  "//bibliography/references[@normative = 'true'] | "\
158
- "//bibliography/clause[.//references[@normative = 'true']]"
158
+ "//bibliography/clause[.//references[@normative = 'true']]"
159
159
  end
160
160
 
161
161
  def norm_ref(isoxml, out, num)
162
162
  f = isoxml.at(ns(norm_ref_xpath)) or return num
163
163
  out.div do |div|
164
164
  num = num + 1
165
- clause_name(num, @normref_lbl, div, nil)
165
+ clause_name(num, f.at(ns("./title")), div, nil)
166
166
  if f.name == "clause"
167
167
  f.elements.each { |e| parse(e, div) unless e.name == "title" }
168
168
  else
@@ -174,15 +174,18 @@ module IsoDoc::Function
174
174
 
175
175
  def bibliography_xpath
176
176
  "//bibliography/clause[.//references]"\
177
- "[not(.//references[@normative = 'true'])] | "\
178
- "//bibliography/references[@normative = 'false']"
177
+ "[not(.//references[@normative = 'true'])] | "\
178
+ "//bibliography/references[@normative = 'false']"
179
179
  end
180
180
 
181
181
  def bibliography(isoxml, out)
182
182
  f = isoxml.at(ns(bibliography_xpath)) || return
183
183
  page_break(out)
184
184
  out.div do |div|
185
- div.h1 @bibliography_lbl, **{ class: "Section3" }
185
+ #div.h1 @bibliography_lbl, **{ class: "Section3" }
186
+ div.h1 **{class: "Section3"} do |h1|
187
+ f&.at(ns("./title"))&.children&.each { |c2| parse(c2, h1) }
188
+ end
186
189
  biblio_list(f, div, true)
187
190
  end
188
191
  end
@@ -190,9 +193,7 @@ module IsoDoc::Function
190
193
  def bibliography_parse(node, out)
191
194
  title = node&.at(ns("./title"))&.text || ""
192
195
  out.div do |div|
193
- @xrefs.anchor(node['id'], :label, false) and
194
- clause_parse_title(node, div, node.at(ns("./title")), out) or
195
- div.h2 title, **{ class: "Section3" }
196
+ clause_parse_title(node, div, node.at(ns("./title")), out, { class: "Section3" })
196
197
  biblio_list(node, div, true)
197
198
  end
198
199
  end