metanorma-nist 0.0.4 → 0.0.5

Sign up to get free protection for your applications and to get access to all the features.
@@ -144,8 +144,7 @@ style='mso-tab-count:1'>                            
144
144
  <div style='mso-element:footer' id=f3>
145
145
 
146
146
  <p class=MsoFooter style='line-height:12.0pt'><span lang=EN-GB
147
- style='font-size:10.0pt;mso-bidi-font-size:11.0pt' NIST.&nbsp;{{ docyear }}&nbsp;– All
148
- rights reserved<span style='mso-tab-count:1'>                                                                                                                                                                           </span></span><!--[if supportFields]><b
147
+ style='font-size:10.0pt;mso-bidi-font-size:11.0pt'><span style='mso-tab-count:1'>                                                                                                                                                                           </span></span><!--[if supportFields]><b
149
148
  style='mso-bidi-font-weight:normal'><span lang=EN-GB style='font-size:10.0pt;
150
149
  mso-bidi-font-size:11.0pt'><span style='mso-element:field-begin'></span>
151
150
  PAGE<span style='mso-spacerun:yes'>   </span>\* MERGEFORMAT <span
@@ -21,6 +21,18 @@ CODEN: NSPUE2</p>
21
21
  <p>Organizations are encouraged to review all draft publications during public comment periods and provide feedback to NIST. Many NIST cybersecurity publications, other than the ones noted above, are available at <a href="https://csrc.nist.gov/publications">https://csrc.nist.gov/publications</a>.
22
22
  </div>
23
23
 
24
+ {% if comment_extended %}
25
+ <p align="center">[{{ comment_extended}}: Comment period extended]</p>
26
+ {% endif %}
27
+
28
+ {% if comment_from and comment_to %}
29
+ <p align="center"><b>Public comment period: <i>{{ comment_from }}</i> through <i>{{comment_to}}</i></b></p>
30
+ {% else %}
31
+ {% if comment_from %}
32
+ <p align="center"><b>Public comment period: from <i>{{ comment_from }}</i></b></p>
33
+ {% endif %}
34
+ {% endif %}
35
+
24
36
  <h2>Comments on this publication may be submitted to:</h2>
25
37
 
26
38
  <p align="center">National Institute of Standards and Technology <br/>
@@ -20,7 +20,7 @@
20
20
 
21
21
  <div class="coverpage-doc-identity">
22
22
  <div class="doc-number">
23
- <div>{{ docnumber }}</div>
23
+ <div>{{ docnumber_long }}</div>
24
24
  {% if edition %} <div> Revision {{ edition }}</div> {% endif %}
25
25
  <div> {{ draftinfo }}</div>
26
26
  </div>
@@ -30,6 +30,9 @@
30
30
  {% if docsubtitle %}
31
31
  <br/><span class="title-second">{{ docsubtitle }}</span>
32
32
  {% endif %}
33
+ {% if docparttitle %}
34
+ <br/><span class="title-second">{{ docparttitle }}</span>
35
+ {% endif %}
33
36
  </div>
34
37
  </div>
35
38
 
@@ -38,7 +41,7 @@
38
41
  </div>
39
42
 
40
43
  <div class="coverpage-tc-name">
41
- <span>{{ tc }}</span>
44
+ <span>{{ subseries }}</span>
42
45
  </div>
43
46
 
44
47
  <div class="rule-thick"></div>
@@ -57,7 +60,7 @@
57
60
  This publication is available free of charge from: <br>
58
61
  <a href="{{url}}">{{ url }}</a>
59
62
 
60
- <div class="category">{{ tc }}</div>
63
+ <div class="category">{{ subseries }}</div>
61
64
 
62
65
  </div>
63
66
 
@@ -108,18 +111,6 @@
108
111
  <div class="info-section">
109
112
  <div class="copyright">
110
113
 
111
- <p class="year">
112
- &copy; {{ docyear }} NIST.
113
- </p>
114
-
115
- <p class="message">
116
- All rights reserved. Unless otherwise specified, no part of this
117
- publication may be reproduced or utilized otherwise in any form or by any
118
- means, electronic or mechanical, including photocopying, or posting on the
119
- internet or an intranet, without prior written permission. Permission can
120
- be requested from the address below.
121
- </p>
122
-
123
114
  <div class="contact-info">
124
115
  <p class="name">National Institute of Standards and Technology</p>
125
116
  <p class="address">
@@ -354,11 +354,11 @@ p.document-stage {
354
354
  }
355
355
 
356
356
 
357
- #standard-band, #published-band {
357
+ #standard-band, #final-band {
358
358
  color: rgb(123, 168, 18);
359
359
  background-color: rgb(216, 236, 168); }
360
360
 
361
- #standard, #published {
361
+ #standard, #final {
362
362
  color: #9ABD48; }
363
363
 
364
364
  #governance, #policy-and-procedures {
@@ -380,22 +380,22 @@ color: rgb(123, 168, 18);
380
380
  margin: 0 0 2em 0;
381
381
  text-transform: uppercase; }
382
382
 
383
- #working-draft, #proposal {
383
+ #internal-draft, #proposal {
384
384
  border-bottom: solid 3px #F7803C; }
385
385
 
386
- #working-draft-band, #proposal-band {
386
+ #internal-draft-band, #proposal-band {
387
387
  background-color: #F7803C; }
388
388
 
389
- #committee-draft {
389
+ #public-draft, #initial-public-draft, #final-public-draft {
390
390
  border-bottom: solid 3px #fd06fd; }
391
391
 
392
- #committee-draft-band {
392
+ #public-draft-band, #initial-public-draft-band, #final-public-draft-band {
393
393
  background-color: #fd06fd; }
394
394
 
395
- #draft-standard {
395
+ #retired-draft {
396
396
  border-bottom: solid 3px #fdf906; }
397
397
 
398
- #draft-standard-band {
398
+ #retired-draft-band {
399
399
  background-color: #fdf906; }
400
400
 
401
401
  #standard {
@@ -404,10 +404,10 @@ color: rgb(123, 168, 18);
404
404
  #standard-band {
405
405
  background-color: #9ABD48; }
406
406
 
407
- #obsolete {
407
+ #withdrawn {
408
408
  border-bottom: solid 3px #7e0d13; }
409
409
 
410
- #obsolete-band {
410
+ #withdrawn-band {
411
411
  background-color: #7e0d13; }
412
412
 
413
413
  .coverpage-maturity {
@@ -103,6 +103,19 @@ font-family:"Arial",sans-serif;color:black'><o:p></o:p></span></b></p>
103
103
 
104
104
  </div>
105
105
 
106
+ {% if comment_extended %}
107
+ <p class=MsoNormal align="center">[{{ comment_extended}}: Comment period extended]</p>
108
+ {% endif %}
109
+
110
+ {% if comment_from and comment_to %}
111
+ <p class=MsoNormal align="center"><b>Public comment period: <i>{{ comment_from }}</i> through <i>{{comment_to}}</i></b></p>
112
+ {% else %}
113
+ {% if comment_from %}
114
+ <p class=MsoNormal align="center"><b>Public comment period: from <i>{{ comment_from }}</i></b></p>
115
+ {% endif %}
116
+ {% endif %}
117
+
118
+
106
119
  <p class=MsoNormal align=center style='margin-bottom:6.0pt;text-align:center'><b><span
107
120
  lang=EN-US style='font-size:11.0pt;font-family:"Arial",sans-serif'>Comments
108
121
  on this publication may be submitted to:</span></b><b style='mso-bidi-font-weight:
@@ -14,6 +14,9 @@ mso-border-top-alt:thin-thick-small-gap windowtext 4.5pt;padding:6.0pt 0cm 0cm 0
14
14
  {% if docsubtitle %}
15
15
  <p class="CoverSubtitle"><span lang="EN-US">{{ docsubtitle }}<o:p></o:p></span></p>
16
16
  {% endif %}
17
+ {% if docparttitle %}
18
+ <p class="CoverSubtitle"><span lang="EN-US">{{ docparttitle }}<o:p></o:p></span></p>
19
+ {% endif %}
17
20
 
18
21
  <div style='mso-element:para-border-div;border:none;border-top:solid black 1.5pt;
19
22
  mso-border-top-themecolor:text1;padding:1.0pt 0cm 0cm 0cm'>
@@ -65,7 +68,7 @@ padding:1.0pt 0cm 1.0pt 0cm'>
65
68
  <p class="MsoNormal" align="center" style='text-align:center;border:none;
66
69
  mso-border-top-alt:solid windowtext 1.5pt;mso-border-bottom-alt:solid windowtext 1.5pt;
67
70
  padding:0cm;mso-padding-alt:1.0pt 0cm 1.0pt 0cm'><span lang="EN-US"
68
- style='font-size:16.0pt;font-family:"Arial",sans-serif;mso-ansi-language:EN-US;letter-spacing:10.0pt'>{{ tc }}<o:p></o:p></span></p>
71
+ style='font-size:16.0pt;font-family:"Arial",sans-serif;mso-ansi-language:EN-US;letter-spacing:10.0pt'>{{ subseries }}<o:p></o:p></span></p>
69
72
 
70
73
  </div>
71
74
 
@@ -13,6 +13,7 @@ module IsoDoc
13
13
  end
14
14
 
15
15
  def convert1(docxml, filename, dir)
16
+ @bibliographycount = docxml.xpath(ns("//bibliography/references | //annex/references | //bibliography/clause/references")).size
16
17
  FileUtils.cp html_doc_path('logo.png'), "#{@localdir}/logo.png"
17
18
  FileUtils.cp html_doc_path('commerce-logo-color.png'), "#{@localdir}/commerce-logo-color.png"
18
19
  @files_to_delete << "#{@localdir}/logo.png"
@@ -97,7 +98,11 @@ module IsoDoc
97
98
  isoxml.xpath(ns("//bibliography/clause | //bibliography/references")).each do |f|
98
99
  out.div do |div|
99
100
  div.h1 **{ class: "Section3" } do |h1|
100
- f&.at(ns("./title"))&.children.each { |n| parse(n, h1) }
101
+ if @bibliographycount == 1
102
+ h1 << "References"
103
+ else
104
+ f&.at(ns("./title"))&.children.each { |n| parse(n, h1) }
105
+ end
101
106
  end
102
107
  f.elements.reject do |e|
103
108
  ["reference", "title", "bibitem"].include? e.name
@@ -145,9 +150,9 @@ module IsoDoc
145
150
 
146
151
  def skip_render(c, isoxml)
147
152
  return false unless c.name == "reviewernote"
148
- status = isoxml&.at(ns("//bibdata/status"))&.text
153
+ status = isoxml&.at(ns("//bibdata/status/stage"))&.text
149
154
  return true if status.nil?
150
- return ["published", "withdrawn"].include? status
155
+ return ["final", "withdrawn"].include? status
151
156
  end
152
157
 
153
158
  def term_defs_boilerplate(div, source, term, preface)
@@ -166,15 +171,6 @@ module IsoDoc
166
171
  File.join(File.dirname(__FILE__), loc)
167
172
  end
168
173
 
169
- def term_cleanup(docxml)
170
- docxml.xpath("//p[@class = 'Terms']").each do |d|
171
- h2 = d.at("./preceding-sibling::*[@class = 'TermNum'][1]")
172
- h2.add_child("&nbsp;")
173
- h2.add_child(d.remove)
174
- end
175
- docxml
176
- end
177
-
178
174
  def requirement_cleanup(docxml)
179
175
  docxml.xpath("//div[@class = 'recommend' or @class = 'require' "\
180
176
  "or @class = 'permission'][title]").each do |d|
@@ -320,6 +316,8 @@ module IsoDoc
320
316
 
321
317
  def info(isoxml, out)
322
318
  @meta.keywords isoxml, out
319
+ @meta.series isoxml, out
320
+ @meta.commentperiod isoxml, out
323
321
  super
324
322
  end
325
323
 
@@ -479,7 +477,11 @@ module IsoDoc
479
477
  div.h1 **{ class: "Annex" } do |t|
480
478
  t << "#{get_anchors[annex['id']][:label]} &mdash; "
481
479
  t.b do |b|
482
- name&.children&.each { |c2| parse(c2, b) }
480
+ if @bibliographycount == 1 && annex.at(ns("./references"))
481
+ b << "References"
482
+ else
483
+ name&.children&.each { |c2| parse(c2, b) }
484
+ end
483
485
  end
484
486
  end
485
487
  end
@@ -488,6 +490,69 @@ module IsoDoc
488
490
  "-"
489
491
  end
490
492
 
493
+ def annex_names(clause, num)
494
+ @anchors[clause["id"]] = { label: annex_name_lbl(clause, num), type: "clause",
495
+ xref: "#{@annex_lbl} #{num}", level: 1 }
496
+ clause.xpath(ns("./clause | ./terms | ./term | ./references")).each_with_index do |c, i|
497
+ annex_names1(c, "#{num}.#{i + 1}", 2)
498
+ end
499
+ hierarchical_asset_names(clause, num)
500
+ end
501
+
502
+ def annex_names1(clause, num, level)
503
+ @anchors[clause["id"]] = { label: num, xref: "#{@annex_lbl} #{num}",
504
+ level: level, type: "clause" }
505
+ clause.xpath(ns("./clause | ./terms | ./term | ./references")).each_with_index do |c, i|
506
+ annex_names1(c, "#{num}.#{i + 1}", level + 1)
507
+ end
508
+ end
509
+
510
+ def terms_parse(node, out)
511
+ out.div **attr_code(id: node["id"]) do |div|
512
+ node.at(ns("./title")) and
513
+ clause_parse_title(node, div, node.at(ns("./title")), out)
514
+ term_defs_boilerplate(div, node.xpath(ns(".//termdocsource")),
515
+ node.at(ns(".//term")), node.at(ns("./p")))
516
+ node.elements.each do |e|
517
+ parse(e, div) unless %w{title source}.include? e.name
518
+ end
519
+ end
520
+ end
521
+
522
+ def termdef_parse(node, out)
523
+ pref = node.at(ns("./preferred"))
524
+ out.dl **{ class: "terms_dl" } do |dl|
525
+ dl.dt do |dt|
526
+ pref.children.each { |n| parse(n, dt) }
527
+ end
528
+ set_termdomain("")
529
+ dl.dd do |dd|
530
+ node.children.each { |n| parse(n, dd) unless n.name == "preferred" }
531
+ end
532
+ end
533
+ end
534
+
535
+ def term_cleanup(docxml)
536
+ docxml.xpath("//dl[@class = 'terms_dl']").each do |d|
537
+ prev = d.previous_element
538
+ next unless prev.name == "dl" and prev["class"] == "terms_dl"
539
+ d.children.each { |n| prev.add_child(n.remove) }
540
+ d.remove
541
+ end
542
+ docxml
543
+ end
544
+
545
+ def bibliography_parse(node, out)
546
+ title = node&.at(ns("./title"))&.text || ""
547
+ out.div do |div|
548
+ node.parent.name == "annex" or
549
+ div.h2 title, **{ class: "Section3" }
550
+ node.elements.reject do |e|
551
+ ["reference", "title", "bibitem"].include? e.name
552
+ end.each { |e| parse(e, div) }
553
+ biblio_list(node, div, true)
554
+ end
555
+ end
491
556
  end
492
557
  end
493
558
  end
@@ -1,4 +1,5 @@
1
1
  require "isodoc"
2
+ require "twitter_cldr"
2
3
 
3
4
  module IsoDoc
4
5
  module NIST
@@ -9,13 +10,13 @@ module IsoDoc
9
10
  set(:status, "XXX")
10
11
  end
11
12
 
12
- def title(isoxml, _out)
13
- main = isoxml&.at(ns("//bibdata/title[@language='en']"))&.text
13
+ def title(isoxml, out)
14
+ main = isoxml&.at(ns("//bibdata/title/title-main"))&.text
14
15
  set(:doctitle, main)
15
16
  end
16
17
 
17
18
  def subtitle(isoxml, _out)
18
- main = isoxml&.at(ns("//bibdata/subtitle[@language='en']"))&.text
19
+ main = isoxml&.at(ns("//bibdata/title/title-sub"))&.text or return
19
20
  set(:docsubtitle, main)
20
21
  end
21
22
 
@@ -26,22 +27,25 @@ module IsoDoc
26
27
  end
27
28
 
28
29
  def docid(isoxml, _out)
29
- docnumber_node = isoxml.at(ns("//bibdata/docidentifier"))
30
- docnumber = docnumber_node&.text
30
+ docid = isoxml.at(ns("//bibdata/docidentifier[@type = 'nist']"))&.text
31
+ docid_long = isoxml.at(ns("//bibdata/docidentifier"\
32
+ "[@type = 'nist-long']"))&.text
33
+ docnumber = isoxml.at(ns("//bibdata/docnumber"))&.text
34
+ set(:docidentifier, docid)
35
+ set(:docidentifier_long, draft_prefix(docid_long, isoxml))
31
36
  set(:docnumber, docnumber)
32
- # TODO: for NIST SPs only!!!
33
- docnumber and set(:docnumber_long,
34
- docnumber.gsub("NIST SP", "NIST Special Publication"))
35
37
  end
36
38
 
37
- def status_abbr(status)
38
- case status
39
- when "working-draft" then "wd"
40
- when "committee-draft" then "cd"
41
- when "draft-standard" then "d"
42
- else
43
- ""
44
- end
39
+ def draft_prefix(docidentifier_long, isoxml)
40
+ return nil if docidentifier_long.nil?
41
+ docstatus = isoxml.at(ns("//bibdata/status/stage"))&.text
42
+ return docidentifier_long unless docstatus && docstatus != "final"
43
+ iter = isoxml.at(ns("//bibdata/status/iteration"))&.text
44
+ prefix = "DRAFT "
45
+ /^\d+$/.match iter and
46
+ iter = iter.to_i.localize.to_rbnf_s("OrdinalRules", "digits-ordinal")
47
+ prefix += "(#{iter}) " if iter
48
+ prefix + docidentifier_long
45
49
  end
46
50
 
47
51
  def draftinfo(draft, revdate)
@@ -53,12 +57,38 @@ module IsoDoc
53
57
  IsoDoc::Function::I18n::l10n(draftinfo, @lang, @script)
54
58
  end
55
59
 
60
+ def docstatus(isoxml, _out)
61
+ docstatus = isoxml.at(ns("//bibdata/status/stage"))&.text
62
+ iter = isoxml.at(ns("//bibdata/status/iteration"))&.text
63
+ docstatus = adjust_docstatus(docstatus, iter)
64
+ set(:unpublished, docstatus != "final")
65
+ set(:iteration, iter) if iter
66
+ set(:status, status_print(docstatus || "final"))
67
+ end
68
+
69
+ def adjust_docstatus(status, iter)
70
+ return unless iter and status
71
+ status = "initial-public-draft" if status == "public-draft" &&
72
+ (iter == "1" || iter == "initial")
73
+ status = "final-public-draft" if status == "public-draft" &&
74
+ (iter == "final")
75
+ status
76
+ end
77
+
56
78
  def version(isoxml, _out)
57
79
  super
58
80
  revdate = get[:revdate]
59
81
  set(:revdate_monthyear, monthyr(revdate))
60
82
  end
61
83
 
84
+ def series(isoxml, _out)
85
+ series = isoxml.at(ns("//bibdata/series[@type = 'main']/title"))&.text
86
+ set(:series, series) if series
87
+ subseries = isoxml.at(ns("//bibdata/series[@type = 'secondary']/"\
88
+ "title"))&.text
89
+ set(:subseries, subseries) if subseries
90
+ end
91
+
62
92
  MONTHS = {
63
93
  "01": "January",
64
94
  "02": "February",
@@ -88,11 +118,22 @@ module IsoDoc
88
118
  set(:keywords, keywords)
89
119
  end
90
120
 
121
+ def commentperiod(isoxml, _out)
122
+ from = isoxml.at(ns("//bibdata/commentperiod/from"))&.text
123
+ to = isoxml.at(ns("//bibdata/commentperiod/to"))&.text
124
+ extended = isoxml.at(ns("//bibdata/commentperiod/extended"))&.text
125
+ set(:comment_from, from) if from
126
+ set(:comment_to, to) if to
127
+ set(:comment_extended, extended) if extended
128
+ end
129
+
91
130
  def url(xml, _out)
92
131
  super
93
132
  a = xml.at(ns("//bibdata/uri[@type = 'email']")) and set(:email, a.text)
133
+ a = xml.at(ns("//bibdata/uri[@type = 'doi']")) and set(:doi, a.text)
134
+ a = xml.at(ns("//bibdata/uri[@type = 'uri' or not(@type)]")) and
135
+ set(:url, a.text)
94
136
  end
95
-
96
137
  end
97
138
  end
98
139
  end
@@ -10,8 +10,10 @@ module IsoDoc
10
10
  def initialize(options)
11
11
  @libdir = File.dirname(__FILE__)
12
12
  super
13
- end
13
+ end
14
+
14
15
  def convert1(docxml, filename, dir)
16
+ @bibliographycount = docxml.xpath(ns("//bibliography/references | //annex/references | //bibliography/clause/references")).size
15
17
  FileUtils.cp html_doc_path('logo.png'), File.join(@localdir, "logo.png")
16
18
  FileUtils.cp html_doc_path('commerce-logo-color.png'), File.join(@localdir, "commerce-logo-color.png")
17
19
  @files_to_delete << File.join(@localdir, "logo.png")
@@ -305,7 +307,11 @@ module IsoDoc
305
307
  isoxml.xpath(ns("//bibliography/clause | //bibliography/references")).each do |f|
306
308
  out.div do |div|
307
309
  div.h1 **{ class: "Section3" } do |h1|
308
- f&.at(ns("./title"))&.children.each { |n| parse(n, h1) }
310
+ if @bibliographycount == 1
311
+ h1 << "References"
312
+ else
313
+ f&.at(ns("./title"))&.children.each { |n| parse(n, h1) }
314
+ end
309
315
  end
310
316
  f.elements.reject do |e|
311
317
  ["reference", "title", "bibitem"].include? e.name
@@ -317,6 +323,8 @@ module IsoDoc
317
323
 
318
324
  def info(isoxml, out)
319
325
  @meta.keywords isoxml, out
326
+ @meta.series isoxml, out
327
+ @meta.commentperiod isoxml, out
320
328
  super
321
329
  end
322
330
 
@@ -349,7 +357,7 @@ module IsoDoc
349
357
  end
350
358
  end
351
359
 
352
- def middle_section_asset_names(d)
360
+ def middle_section_asset_names(d)
353
361
  middle_sections =
354
362
  "//xmlns:preface/child::* | //xmlns:sections/child::*"
355
363
  sequential_asset_names(d.xpath(middle_sections))
@@ -449,7 +457,11 @@ module IsoDoc
449
457
  div.h1 **{ class: "Annex" } do |t|
450
458
  t << "#{get_anchors[annex['id']][:label]} &mdash; "
451
459
  t.b do |b|
452
- name&.children&.each { |c2| parse(c2, b) }
460
+ if @bibliographycount == 1 && annex.at(ns("./references"))
461
+ b << "References"
462
+ else
463
+ name&.children&.each { |c2| parse(c2, b) }
464
+ end
453
465
  end
454
466
  end
455
467
  end
@@ -458,8 +470,69 @@ module IsoDoc
458
470
  "-"
459
471
  end
460
472
 
473
+ def annex_names(clause, num)
474
+ @anchors[clause["id"]] = { label: annex_name_lbl(clause, num), type: "clause",
475
+ xref: "#{@annex_lbl} #{num}", level: 1 }
476
+ clause.xpath(ns("./clause | ./terms | ./term | ./references")).each_with_index do |c, i|
477
+ annex_names1(c, "#{num}.#{i + 1}", 2)
478
+ end
479
+ hierarchical_asset_names(clause, num)
480
+ end
481
+
482
+ def annex_names1(clause, num, level)
483
+ @anchors[clause["id"]] = { label: num, xref: "#{@annex_lbl} #{num}",
484
+ level: level, type: "clause" }
485
+ clause.xpath(ns("./clause | ./terms | ./term | ./references")).each_with_index do |c, i|
486
+ annex_names1(c, "#{num}.#{i + 1}", level + 1)
487
+ end
488
+ end
489
+
490
+ def terms_parse(node, out)
491
+ out.div **attr_code(id: node["id"]) do |div|
492
+ node.at(ns("./title")) and
493
+ clause_parse_title(node, div, node.at(ns("./title")), out)
494
+ term_defs_boilerplate(div, node.xpath(ns(".//termdocsource")),
495
+ node.at(ns(".//term")), node.at(ns("./p")))
496
+ node.elements.each do |e|
497
+ parse(e, div) unless %w{title source}.include? e.name
498
+ end
499
+ end
500
+ end
501
+
502
+ def termdef_parse(node, out)
503
+ pref = node.at(ns("./preferred"))
504
+ out.dl **{ class: "terms_dl" } do |dl|
505
+ dl.dt do |dt|
506
+ pref.children.each { |n| parse(n, dt) }
507
+ end
508
+ set_termdomain("")
509
+ dl.dd do |dd|
510
+ node.children.each { |n| parse(n, dd) unless n.name == "preferred" }
511
+ end
512
+ end
513
+ end
461
514
 
515
+ def term_cleanup(docxml)
516
+ docxml.xpath("//dl[@class = 'terms_dl']").each do |d|
517
+ prev = d.previous_element
518
+ next unless prev.name == "dl" and prev["class"] == "terms_dl"
519
+ d.children.each { |n| prev.add_child(n.remove) }
520
+ d.remove
521
+ end
522
+ docxml
523
+ end
462
524
 
525
+ def bibliography_parse(node, out)
526
+ title = node&.at(ns("./title"))&.text || ""
527
+ out.div do |div|
528
+ node.parent.name == "annex" or
529
+ div.h2 title, **{ class: "Section3" }
530
+ node.elements.reject do |e|
531
+ ["reference", "title", "bibitem"].include? e.name
532
+ end.each { |e| parse(e, div) }
533
+ biblio_list(node, div, true)
534
+ end
535
+ end
463
536
  end
464
537
  end
465
538
  end