metanorma-ietf 3.5.1 → 3.5.3

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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: da1665019f44fcc0eb18a283049b279819b7e185818f1f0722c7933c92a226aa
4
- data.tar.gz: 4b4defd2a8b051c5174f3f45c93035b7eee50b812448863f42f8eb435f126b0f
3
+ metadata.gz: 378d773da5d48f1d408bdf1764876cf9000c4fbc7d3c91dbf30df1c5f50ffa06
4
+ data.tar.gz: 49055c291b27e058204ff5958cc4e31c8f56fecc2503b3417dbd3723869550fc
5
5
  SHA512:
6
- metadata.gz: f80bd6987bc38d3dedd539c2573bfd458cdbb9911a03370f0e7a5bc40804076c6bb28e15fa970fe90473c7827aa8f29b77aec5d66ee6533da7a1d284cda4987e
7
- data.tar.gz: 4caff92a476ea68f7a99112c808c6f09344a3f2f2e38f9dd56dfc462ae23f948cbedce37532f2f82e02b2fbf8c2e950b7bec2882ab5c09b903f4d201fb2a0183
6
+ metadata.gz: f4aea53f5e58916d5fd7282089d6eb52c16a48f643888d1e0c39a6f8312955cc1ffa0b8de2eff1fd4045ecffcea9bc8f73b98f92d703920473a91ce6485d1969
7
+ data.tar.gz: 5320a0b3bbfadbc20035596de82b6c9856c165219dc65e3de56709e60fcf510a6a826bdd0b91f5797c6bb23c6c6614c9e3649d3435fb9b2ce1aeceda78f62a0a
@@ -164,7 +164,7 @@ module IsoDoc
164
164
 
165
165
  def review_note_parse(node, out)
166
166
  out.cref **attr_code(anchor: node["id"], display: node["display"],
167
- source: node["reviewer"]) do |c|
167
+ source: node["reviewer"], from: node["from"]) do |c|
168
168
  if name = node.at(ns("./name"))
169
169
  name.children.each { |n| parse(n, c) }
170
170
  c << " "
@@ -12,8 +12,8 @@ module IsoDoc
12
12
  sourcecode_cleanup(docxml)
13
13
  li_cleanup(docxml)
14
14
  deflist_cleanup(docxml)
15
+ cref_cleanup(docxml) # feeds bookmark
15
16
  bookmark_cleanup(docxml)
16
- cref_cleanup(docxml)
17
17
  front_cleanup(docxml)
18
18
  u_cleanup(docxml)
19
19
  biblio_cleanup(docxml) # feeds aside
@@ -110,14 +110,29 @@ module IsoDoc
110
110
  node.traverse do |n|
111
111
  n.text? and next
112
112
  %w(name callout annotation note sourcecode).include? n.name and next
113
- case n.name
114
- when "br" then n.replace("\n")
115
- when "t" then n.replace("\n\n#{n.children}")
116
- else n.replace(n.children)
117
- end
113
+ sourcecode_remove_markup_elem(n)
114
+ end
115
+ end
116
+
117
+ def sourcecode_remove_markup_elem(node)
118
+ case node.name
119
+ when "br" then node.replace("\n")
120
+ when "t" then node.replace("\n\n#{node.children}")
121
+ when "eref"
122
+ node.replace(node.children.empty? ? node["target"] : node.children)
123
+ when "xref"
124
+ node.children.empty? ? sourcecode_xref(node) : node.replace(node.children)
125
+ # when "relref" then n.replace(n.children.empty? ? n["target"] : n.children)
126
+ else node.replace(node.children)
118
127
  end
119
128
  end
120
129
 
130
+ def sourcecode_xref(node)
131
+ ret = @xrefs.anchor(node["target"], :xref, false)&.gsub(%r{<[^>]+>}, "")
132
+ s = node["section"] and ret += ", Section #{s}"
133
+ node.replace(ret)
134
+ end
135
+
121
136
  def annotation_cleanup(docxml)
122
137
  docxml.xpath("//reference").each do |r|
123
138
  while r.next_element&.name == "aside"
@@ -62,12 +62,28 @@ module IsoDoc
62
62
  end
63
63
 
64
64
  def cref_cleanup(docxml)
65
+ cref_move(docxml)
66
+ cref_unwrap(docxml)
67
+ end
68
+
69
+ # do not remove bookmarks until this is done,
70
+ # bookmarks can be cref destination
71
+ def cref_move(docxml)
72
+ docxml.xpath("//cref[@from]").each do |c|
73
+ dest = docxml.at("//*[@anchor = '#{c['from']}']")
74
+ t = dest.at(".//text()[not(ancestor::cref)]") and dest = t
75
+ c.delete("from")
76
+ c.delete("to")
77
+ dest.previous = c
78
+ end
79
+ end
80
+
81
+ def cref_unwrap(docxml)
65
82
  docxml.xpath("//cref").each do |c|
66
83
  c.xpath("./t").each do |t|
67
84
  t.replace(t.children)
68
85
  end
69
- next unless %w(section abstract).include? c.parent.name
70
-
86
+ %w(section abstract).include? c.parent.name or next
71
87
  c.wrap("<t></t>")
72
88
  end
73
89
  end
@@ -37,6 +37,8 @@ module IsoDoc
37
37
  info docxml, nil
38
38
  @xrefs.parse docxml
39
39
  @isodoc.xrefs = @xrefs
40
+ @isodoc.bibrender = @isodoc.bibrenderer
41
+ @isodoc.reference_names(docxml)
40
42
  @isodoc.permission(docxml)
41
43
  @isodoc.requirement(docxml)
42
44
  @isodoc.recommendation(docxml)
@@ -133,6 +133,7 @@ module IsoDoc
133
133
  out.back do |back|
134
134
  bibliography isoxml, back
135
135
  annex isoxml, back
136
+ comments isoxml, back
136
137
  end
137
138
  end
138
139
 
@@ -145,8 +146,7 @@ module IsoDoc
145
146
  end
146
147
 
147
148
  def clause_parse(node, out)
148
- return if node.at(ns(".//references"))
149
-
149
+ node.at(ns(".//references")) and return
150
150
  out.section **attr_code(
151
151
  anchor: node["id"], numbered: node["numbered"],
152
152
  removeInRFC: node["removeInRFC"], toc: node["toc"]
@@ -162,9 +162,6 @@ module IsoDoc
162
162
  isoxml.xpath("//xmlns:preface/child::*" \
163
163
  "[not(name() = 'abstract' or name() = 'foreword')] " \
164
164
  "| //xmlns:sections/child::*").each do |c|
165
- # cdup = c.dup
166
- # cdup.xpath(ns(".//references")).each { |r| r.remove }
167
- # cdup.at("./*[local-name() != 'title'][normalize-space(text()) != '']") or next
168
165
  clause_parse(c, out)
169
166
  end
170
167
  end
@@ -174,6 +171,12 @@ module IsoDoc
174
171
  clause_parse(c, out)
175
172
  end
176
173
  end
174
+
175
+ def comments(isoxml, out)
176
+ isoxml.xpath(ns("//review")).each do |c|
177
+ review_note_parse(c, out)
178
+ end
179
+ end
177
180
  end
178
181
  end
179
182
  end
@@ -382,33 +382,7 @@ in a document (e.g. sourcecode annotations)</a:documentation>
382
382
  <a:documentation>Block intended to capture reviewer comments about some text in the document</a:documentation>
383
383
  <element name="review">
384
384
  <ref name="RequiredId"/>
385
- <attribute name="reviewer">
386
- <a:documentation>The party who has offered the comment</a:documentation>
387
- </attribute>
388
- <optional>
389
- <attribute name="type">
390
- <a:documentation>The type of reviewer comment</a:documentation>
391
- </attribute>
392
- </optional>
393
- <optional>
394
- <attribute name="date">
395
- <a:documentation>The date when the comment was made</a:documentation>
396
- <data type="dateTime"/>
397
- </attribute>
398
- </optional>
399
- <optional>
400
- <attribute name="from">
401
- <a:documentation>Identifier for the start of the text or point in the text to which the comment applies.
402
- If not provided, the comment applies in the vicinity of the place it has been inserted into the text</a:documentation>
403
- <data type="IDREF"/>
404
- </attribute>
405
- </optional>
406
- <optional>
407
- <attribute name="to">
408
- <a:documentation>Identifier for the end of the text to which the comment applies</a:documentation>
409
- <data type="IDREF"/>
410
- </attribute>
411
- </optional>
385
+ <ref name="ReviewAttributes"/>
412
386
  <oneOrMore>
413
387
  <ref name="paragraph">
414
388
  <a:documentation>Reviewer comments content</a:documentation>
@@ -416,6 +390,35 @@ If not provided, the comment applies in the vicinity of the place it has been in
416
390
  </oneOrMore>
417
391
  </element>
418
392
  </define>
393
+ <define name="ReviewAttributes">
394
+ <attribute name="reviewer">
395
+ <a:documentation>The party who has offered the comment</a:documentation>
396
+ </attribute>
397
+ <optional>
398
+ <attribute name="type">
399
+ <a:documentation>The type of reviewer comment</a:documentation>
400
+ </attribute>
401
+ </optional>
402
+ <optional>
403
+ <attribute name="date">
404
+ <a:documentation>The date when the comment was made</a:documentation>
405
+ <data type="dateTime"/>
406
+ </attribute>
407
+ </optional>
408
+ <optional>
409
+ <attribute name="from">
410
+ <a:documentation>Identifier for the start of the text or point in the text to which the comment applies.
411
+ If not provided, the comment applies in the vicinity of the place it has been inserted into the text</a:documentation>
412
+ <data type="IDREF"/>
413
+ </attribute>
414
+ </optional>
415
+ <optional>
416
+ <attribute name="to">
417
+ <a:documentation>Identifier for the end of the text to which the comment applies</a:documentation>
418
+ <data type="IDREF"/>
419
+ </attribute>
420
+ </optional>
421
+ </define>
419
422
  <define name="NumberingAttributes">
420
423
  <optional>
421
424
  <attribute name="unnumbered">
@@ -857,6 +860,7 @@ in case the table cannot be rendered accessibly (HTML 5)</a:documentation>
857
860
  <define name="tr">
858
861
  <a:documentation>Sequence of cells to be displayed as a row in a table</a:documentation>
859
862
  <element name="tr">
863
+ <ref name="TrAttributes"/>
860
864
  <oneOrMore>
861
865
  <choice>
862
866
  <ref name="td">
@@ -869,6 +873,9 @@ in case the table cannot be rendered accessibly (HTML 5)</a:documentation>
869
873
  </oneOrMore>
870
874
  </element>
871
875
  </define>
876
+ <define name="TrAttributes">
877
+ <empty/>
878
+ </define>
872
879
  <define name="tr-no-id">
873
880
  <a:documentation>Sequence of cells to be displayed as a row in a table: optional ID attributes recursively (for use in Relaton, metadata)</a:documentation>
874
881
  <element name="tr">
@@ -6,9 +6,17 @@ module Metanorma
6
6
  abstract_cleanup(xmldoc)
7
7
  super
8
8
  cref_cleanup(xmldoc)
9
+ dt_cleanup(xmldoc)
9
10
  xmldoc
10
11
  end
11
12
 
13
+ def dt_cleanup(xmldoc)
14
+ xmldoc.xpath("//dt").each do |dt|
15
+ /:$/.match?(dt.text.strip) and next
16
+ dt << ":"
17
+ end
18
+ end
19
+
12
20
  def abstract_cleanup(xmldoc)
13
21
  xmldoc.xpath("//abstract[not(text())]").each do |x|
14
22
  x.remove
@@ -19,7 +27,10 @@ module Metanorma
19
27
  def cref_cleanup(xmldoc)
20
28
  xmldoc.xpath("//crefref").each do |r|
21
29
  if c = xmldoc.at("//review[@id = '#{r.text}']")
22
- r.replace(c.remove)
30
+ id = "_#{UUIDTools::UUID.random_create}"
31
+ c["from"] = id
32
+ c["to"] = id
33
+ r.replace("<bookmark id='#{id}'/>")
23
34
  else
24
35
  @log.add("Crossrefences", r,
25
36
  "No matching review for cref:[#{r.text}]", severity: 1)
@@ -43,8 +54,7 @@ module Metanorma
43
54
 
44
55
  def smartquotes_cleanup(xmldoc)
45
56
  xmldoc.traverse do |n|
46
- next unless n.text?
47
-
57
+ n.text? or next
48
58
  n.replace(HTMLEntities.new.encode(
49
59
  n.text.gsub(/\u2019|\u2018|\u201a|\u201b/, "'")
50
60
  .gsub(/\u201c|\u201d|\u201e|\u201f/, '"')
@@ -85,6 +95,7 @@ module Metanorma
85
95
  def section_names_refs_cleanup(xml); end
86
96
 
87
97
  def note_cleanup(xmldoc); end
98
+
88
99
  end
89
100
  end
90
101
  end
@@ -17,7 +17,7 @@
17
17
  these elements; we just want one namespace for any child grammars
18
18
  of this.
19
19
  -->
20
- <!-- VERSION v2.0.0 -->
20
+ <!-- VERSION v2.0.2 -->
21
21
  <grammar xmlns:a="http://relaxng.org/ns/compatibility/annotations/1.0" xmlns="http://relaxng.org/ns/structure/1.0" datatypeLibrary="http://www.w3.org/2001/XMLSchema-datatypes">
22
22
  <include href="reqt.rng"/>
23
23
  <include href="basicdoc.rng">
@@ -33,6 +33,15 @@
33
33
  </zeroOrMore>
34
34
  </element>
35
35
  </define>
36
+ <define name="fn" combine="interleave">
37
+ <optional>
38
+ <attribute name="hiddenref">
39
+ <a:documentation>If true, number the footnote as normal, but suppress display of the footnote reference in the document body.
40
+ This is done if the footnote reference is already presented in some other form, e.g. within a figure image.</a:documentation>
41
+ <data type="boolean"/>
42
+ </attribute>
43
+ </optional>
44
+ </define>
36
45
  <define name="index-primary">
37
46
  <element name="primary">
38
47
  <oneOrMore>
@@ -414,6 +423,21 @@ normative or informative references, some split references into sections organiz
414
423
  </oneOrMore>
415
424
  </choice>
416
425
  </define>
426
+ <define name="TdAttributes" combine="interleave">
427
+ <attribute name="style">
428
+ <a:documentation>CSS style: only background-color supported</a:documentation>
429
+ </attribute>
430
+ </define>
431
+ <define name="ThAttributes" combine="interleave">
432
+ <attribute name="style">
433
+ <a:documentation>CSS style: only background-color supported</a:documentation>
434
+ </attribute>
435
+ </define>
436
+ <define name="TrAttributes">
437
+ <attribute name="style">
438
+ <a:documentation>CSS style: only background-color supported</a:documentation>
439
+ </attribute>
440
+ </define>
417
441
  <define name="table-note">
418
442
  <element name="note">
419
443
  <ref name="OptionalId"/>
@@ -1263,6 +1287,11 @@ numbers</a:documentation>
1263
1287
  <a:documentation>Colophon or postface material</a:documentation>
1264
1288
  </ref>
1265
1289
  </optional>
1290
+ <optional>
1291
+ <ref name="review-container">
1292
+ <a:documentation>Annotations to the document</a:documentation>
1293
+ </ref>
1294
+ </optional>
1266
1295
  </element>
1267
1296
  </define>
1268
1297
  <define name="misccontainer">
@@ -1273,6 +1302,13 @@ numbers</a:documentation>
1273
1302
  </oneOrMore>
1274
1303
  </element>
1275
1304
  </define>
1305
+ <define name="review-container">
1306
+ <element name="review-container">
1307
+ <oneOrMore>
1308
+ <ref name="review"/>
1309
+ </oneOrMore>
1310
+ </element>
1311
+ </define>
1276
1312
  <define name="preface">
1277
1313
  <element name="preface">
1278
1314
  <oneOrMore>
@@ -1,5 +1,5 @@
1
1
  module Metanorma
2
2
  module Ietf
3
- VERSION = "3.5.1".freeze
3
+ VERSION = "3.5.3".freeze
4
4
  end
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: metanorma-ietf
3
3
  version: !ruby/object:Gem::Version
4
- version: 3.5.1
4
+ version: 3.5.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ribose Inc.
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2025-03-04 00:00:00.000000000 Z
11
+ date: 2025-03-31 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: metanorma-ietf-data