metanorma-ietf 3.5.7 → 3.6.0

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: 5a7a8acefbf989aea665a8fbbb0e60447c921ee34527b9b1ba07526d281c35db
4
- data.tar.gz: 5fdd90c1ad276336baf77616781b92bde24fa381752f6e8fc523f8d3a79d9c08
3
+ metadata.gz: 89f6ac422dac62904d909f6993446eb129be1d8c7e4de293efff0a00d7a214f6
4
+ data.tar.gz: 2e143432805fa1d7cd1cb206b7c7145b957771819ad222674583380923576104
5
5
  SHA512:
6
- metadata.gz: 6e431686a4ed4fae904657b67f891c8dd1dc7f5ef1c33a1dbb04bc9d07b993801ab1b7d0423ff298d73ff4c2319393b9a0890d3d167177a70fcdee0289c80488
7
- data.tar.gz: e9d77d069d55d1e36b98fa249e0e4ac8e0183a71c6fb53014626ccaa5a2a344d4b1952ef95c3f3bc4bad0160e6fe6bb10c602ef7f33b030e4b4701c11db8bcdf
6
+ metadata.gz: 990260a7fbc5f14ee4df3d5b354fc2f4e5cf7f5e2ab5192350cf2fec94da5bef65a506726eda678faf76f54381e0344d9f9d4ebdafe9557379193c15c23caa2d
7
+ data.tar.gz: f95f99fc706252db1900bd701a13d6f95903db3340b764e67728a88e4549efd4b80222769ea88c04852b8eda19732a306f76591bd6bb308c71f5550545b78949
@@ -83,10 +83,10 @@ module IsoDoc
83
83
 
84
84
  def annotation_parse(node, out)
85
85
  @sourcecode = false
86
- node.at(ns("./annotation")) or return
86
+ node.at(ns("./callout-annotation")) or return
87
87
  out.t { |p| p << @i18n.key }
88
88
  out.dl do |dl|
89
- node.xpath(ns("./annotation")).each do |a|
89
+ node.xpath(ns("./callout-annotation")).each do |a|
90
90
  annotation_parse1(a, dl)
91
91
  end
92
92
  end
@@ -162,7 +162,14 @@ module IsoDoc
162
162
  end
163
163
  end
164
164
 
165
+ def render_annotations?(node)
166
+ node.at(ns("//presentation-metadata/render-document-annotations"))
167
+ &.text == "true" ||
168
+ node.at(ns("//bibdata/ext/notedraftinprogress"))
169
+ end
170
+
165
171
  def review_note_parse(node, out)
172
+ render_annotations?(node) or return
166
173
  out.cref **attr_code(anchor: node["id"], display: node["display"],
167
174
  source: node["reviewer"], from: node["from"]) do |c|
168
175
  if name = node.at(ns("./name"))
@@ -109,7 +109,7 @@ module IsoDoc
109
109
  def sourcecode_remove_markup(node)
110
110
  node.traverse do |n|
111
111
  n.text? and next
112
- %w(name callout annotation note sourcecode).include? n.name and next
112
+ %w(name callout callout-annotation note sourcecode).include? n.name and next
113
113
  sourcecode_remove_markup_elem(n)
114
114
  end
115
115
  end
@@ -37,7 +37,7 @@ module IsoDoc
37
37
  end
38
38
 
39
39
  def seriesinfo(isoxml, front)
40
- rfc_seriesinfo(isoxml, front) if @meta.get[:doctype] == "Rfc"
40
+ rfc_seriesinfo(isoxml, front) if @meta.get[:doctype] == "RFC"
41
41
  id_seriesinfo(isoxml, front) if @meta.get[:doctype] == "Internet Draft"
42
42
  end
43
43
 
@@ -55,8 +55,8 @@ module IsoDoc
55
55
  i = isoxml&.at(ns("//bibdata/series[@type = 'intended']")) and
56
56
  front.seriesInfo nil,
57
57
  **attr_code(name: "",
58
- status: i&.at(ns("./title"))&.text,
59
- value: i&.at(ns("./number"))&.text || "")
58
+ status: i.at(ns("./title"))&.text,
59
+ value: i.at(ns("./number"))&.text || "")
60
60
  end
61
61
 
62
62
  def id_seriesinfo(isoxml, front)
@@ -2,7 +2,7 @@ require "isodoc"
2
2
 
3
3
  module IsoDoc
4
4
  module Ietf
5
- class Metadata < IsoDoc::Metadata
5
+ class Metadata < IsoDoc::Metadata
6
6
  TITLE_RFC = "//bibdata//title[@type='main' and @language='en']".freeze
7
7
 
8
8
  def title(isoxml, _out)
@@ -47,7 +47,7 @@ module IsoDoc
47
47
 
48
48
  def doctype(isoxml, _out)
49
49
  super
50
- set(:doctype, "Rfc") if get[:doctype].nil?
50
+ set(:doctype, "RFC") if get[:doctype].nil?
51
51
  end
52
52
  end
53
53
  end
@@ -3,7 +3,7 @@ module IsoDoc
3
3
  class RfcConvert < ::IsoDoc::Convert
4
4
  def recommendation_name(node, out)
5
5
  out.t **{ keepWithNext: "true" } do |p|
6
- node.children.each { |n| parse(n, p) }
6
+ node.children&.each { |n| parse(n, p) }
7
7
  end
8
8
  end
9
9
 
@@ -34,6 +34,7 @@ module IsoDoc
34
34
  @isodoc.reqt_models = Metanorma::Requirements
35
35
  .new({ default: "default", lang: @lang, script: @script,
36
36
  locale: @locale, labels: @i18n.get })
37
+ populate_id(docxml)
37
38
  info docxml, nil
38
39
  @xrefs.parse docxml
39
40
  @isodoc.xrefs = @xrefs
@@ -46,12 +47,25 @@ module IsoDoc
46
47
  @xrefs.parse docxml
47
48
  end
48
49
 
50
+ def populate_id(docxml)
51
+ docxml.xpath("//*[@id]").each do |x|
52
+ x["semx-id"] = x["id"]
53
+ x["anchor"] and x["id"] = to_ncname(x["anchor"])
54
+ end
55
+ end
56
+
57
+ # do not sanitise "#"
58
+ def to_ncname(ident)
59
+ ret = ident.split("#", 2)
60
+ ret.map { |x| Metanorma::Utils::to_ncname(x) }.join("#")
61
+ end
62
+
49
63
  def metadata_init(lang, script, locale, i18n)
50
64
  @meta = Metadata.new(lang, script, locale, i18n)
51
65
  end
52
66
 
53
- def xref_init(lang, script, klass, i18n, options)
54
- @xrefs = Xref.new(lang, script, klass, i18n, options)
67
+ def xref_init(lang, script, _klass, i18n, options)
68
+ @xrefs = Xref.new(lang, script, self, i18n, options)
55
69
  end
56
70
 
57
71
  def extract_delims(text)
@@ -173,7 +173,7 @@ module IsoDoc
173
173
  end
174
174
 
175
175
  def comments(isoxml, out)
176
- isoxml.xpath(ns("//review")).each do |c|
176
+ isoxml.xpath(ns("//annotation")).each do |c|
177
177
  review_note_parse(c, out)
178
178
  end
179
179
  end
@@ -38,14 +38,13 @@ module Metanorma
38
38
  ))
39
39
  end
40
40
 
41
- def todo_attrs(node)
41
+ def sidebar_attrs(node)
42
42
  super.merge(attr_code(display: node.attr("display")))
43
43
  end
44
44
 
45
45
  def sidebar(node)
46
- draft? or return
47
46
  noko do |xml|
48
- xml.review **sidebar_attrs(node) do |r|
47
+ xml.annotation **sidebar_attrs(node) do |r|
49
48
  block_title(node, r)
50
49
  wrap_in_para(node, r)
51
50
  end
@@ -10,6 +10,16 @@ module Metanorma
10
10
  xmldoc
11
11
  end
12
12
 
13
+ # simplified
14
+ def boilerplate_isodoc(xmldoc)
15
+ x = xmldoc.dup
16
+ x.root.add_namespace(nil, xml_namespace)
17
+ #xml = Nokogiri::XML(x.to_xml)
18
+ @isodoc ||= isodoc(@lang, @script, @locale)
19
+ # initialise @isodoc.xrefs, for @isodoc.xrefs.info
20
+ @isodoc
21
+ end
22
+
13
23
  def dt_cleanup(xmldoc)
14
24
  xmldoc.xpath("//dt").each do |dt|
15
25
  /:$/.match?(dt.text.strip) and next
@@ -26,14 +36,14 @@ module Metanorma
26
36
 
27
37
  def cref_cleanup(xmldoc)
28
38
  xmldoc.xpath("//crefref").each do |r|
29
- if c = xmldoc.at("//review[@anchor = '#{r.text}']")
39
+ if c = xmldoc.at("//annotation[@anchor = '#{r.text}']")
30
40
  id = "_#{UUIDTools::UUID.random_create}"
31
41
  c["from"] = id
32
42
  c["to"] = id
33
43
  r.replace("<bookmark id='#{id}'/>")
34
44
  else
35
45
  @log.add("Crossrefences", r,
36
- "No matching review for cref:[#{r.text}]", severity: 1)
46
+ "No matching annotation for cref:[#{r.text}]", severity: 1)
37
47
  end
38
48
  end
39
49
  end
@@ -25,7 +25,6 @@ module Metanorma
25
25
  end
26
26
 
27
27
  def makexml(node)
28
- @draft = node.attributes.has_key?("draft")
29
28
  @workgroups = cache_workgroup(node)
30
29
  @bcp_bold = !node.attr?("no-rfc-bold-bcp14")
31
30
  @xinclude = node.attr?("use-xinclude")
@@ -1,6 +1,6 @@
1
1
  <?xml version="1.0" encoding="UTF-8"?>
2
2
  <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">
3
- <!-- VERSION v2.0.7 -->
3
+ <!-- VERSION v2.0.8 -->
4
4
 
5
5
  <!--
6
6
  ALERT: cannot have root comments, because of https://github.com/metanorma/metanorma/issues/437
@@ -72,6 +72,46 @@ but to `@anchor`, the user-supplied cross-reference</a:documentation>
72
72
  </oneOrMore>
73
73
  </element>
74
74
  </define>
75
+ <define name="review">
76
+ <a:documentation>Generalise BasicDoc element from just review comments, to general annotations;
77
+ the type attribute defaults to `review` for reviews</a:documentation>
78
+ <element name="annotation">
79
+ <ref name="RequiredId"/>
80
+ <ref name="ReviewAttributes"/>
81
+ <oneOrMore>
82
+ <ref name="paragraph">
83
+ <a:documentation>Reviewer comments content</a:documentation>
84
+ </ref>
85
+ </oneOrMore>
86
+ </element>
87
+ </define>
88
+ <define name="ruby_pronunciation">
89
+ <a:documentation>Ruby annotation giving pronunciation of text: change tag from BasicDoc for disambiguation</a:documentation>
90
+ <element name="ruby-pronunciation">
91
+ <attribute name="value">
92
+ <a:documentation>Ruby annotation value</a:documentation>
93
+ </attribute>
94
+ <ref name="LocalizedStringAttributes"/>
95
+ </element>
96
+ </define>
97
+ <define name="ruby_annotation">
98
+ <a:documentation>Ruby annotation giving information other than pronunciation of text: change tag from BasicDoc for disambiguation</a:documentation>
99
+ <element name="ruby-annotation">
100
+ <attribute name="value">
101
+ <a:documentation>Ruby annotation value</a:documentation>
102
+ </attribute>
103
+ <ref name="LocalizedStringAttributes"/>
104
+ </element>
105
+ </define>
106
+ <define name="annotation">
107
+ <a:documentation>Source code annotation, corresponding to a callout</a:documentation>
108
+ <element name="callout-annotation">
109
+ <ref name="RequiredId"/>
110
+ <oneOrMore>
111
+ <ref name="paragraph"/>
112
+ </oneOrMore>
113
+ </element>
114
+ </define>
75
115
  <define name="section-title">
76
116
  <a:documentation>Title(s) of a clause</a:documentation>
77
117
  <element name="title">
@@ -540,7 +580,7 @@ normative or informative references, some split references into sections organiz
540
580
  <ref name="OptionalId"/>
541
581
  <optional>
542
582
  <attribute name="style">
543
- <a:documentation>CSS style: only background-color supported</a:documentation>
583
+ <a:documentation>CSS style: only background-color, color, border supported</a:documentation>
544
584
  </attribute>
545
585
  </optional>
546
586
  </define>
@@ -620,7 +660,7 @@ This is done if the footnote reference is already presented in some other form,
620
660
  <ref name="RequiredId"/>
621
661
  <optional>
622
662
  <attribute name="style">
623
- <a:documentation>CSS style: only background-color supported</a:documentation>
663
+ <a:documentation>CSS style: only background-color, color, border supported</a:documentation>
624
664
  </attribute>
625
665
  </optional>
626
666
  </define>
@@ -700,6 +740,11 @@ titlecase, or lowercase</a:documentation>
700
740
  <a:documentation>Width of the table block in rendering</a:documentation>
701
741
  </attribute>
702
742
  </optional>
743
+ <optional>
744
+ <attribute name="style">
745
+ <a:documentation>CSS style: only background-color, color, border supported</a:documentation>
746
+ </attribute>
747
+ </optional>
703
748
  <ref name="BlockAttributes"/>
704
749
  </define>
705
750
  <define name="FigureAttributes" combine="interleave">
@@ -1417,7 +1462,7 @@ numbers</a:documentation>
1417
1462
  </optional>
1418
1463
  <ref name="DocumentBody"/>
1419
1464
  <optional>
1420
- <ref name="review-container">
1465
+ <ref name="annotation-container">
1421
1466
  <a:documentation>Annotations to the document</a:documentation>
1422
1467
  </ref>
1423
1468
  </optional>
@@ -1461,8 +1506,8 @@ numbers</a:documentation>
1461
1506
  </oneOrMore>
1462
1507
  </element>
1463
1508
  </define>
1464
- <define name="review-container">
1465
- <element name="review-container">
1509
+ <define name="annotation-container">
1510
+ <element name="annotation-container">
1466
1511
  <oneOrMore>
1467
1512
  <ref name="review"/>
1468
1513
  </oneOrMore>
@@ -1,5 +1,5 @@
1
1
  module Metanorma
2
2
  module Ietf
3
- VERSION = "3.5.7".freeze
3
+ VERSION = "3.6.0".freeze
4
4
  end
5
5
  end
@@ -17,10 +17,10 @@ module Relaton
17
17
  module Ietf
18
18
  module Template
19
19
  class Name < ::Relaton::Render::Template::Name
20
- def customise_liquid
21
- super
22
- ::Liquid::Template
23
- .register_filter(::Relaton::Render::Template::Ascii)
20
+ def create_liquid_environment
21
+ env = super
22
+ env.register_filter(::Relaton::Render::Template::Ascii)
23
+ env
24
24
  end
25
25
  end
26
26
  end
@@ -37,7 +37,7 @@ Gem::Specification.new do |spec|
37
37
  spec.required_ruby_version = Gem::Requirement.new(">= 3.1.0")
38
38
 
39
39
  spec.add_dependency "metanorma-ietf-data"
40
- spec.add_dependency "metanorma-standoc", "~> 3.0.0"
40
+ spec.add_dependency "metanorma-standoc", "~> 3.1.0"
41
41
  spec.add_dependency "relaton-render"
42
42
 
43
43
  spec.add_development_dependency "debug"
@@ -50,7 +50,6 @@ Gem::Specification.new do |spec|
50
50
  spec.add_development_dependency "rubocop-performance"
51
51
  spec.add_development_dependency "simplecov", "~> 0.15"
52
52
  spec.add_development_dependency "timecop", "~> 0.9"
53
- spec.add_development_dependency "vcr", "~> 6.1.0"
54
53
  spec.add_development_dependency "webmock"
55
54
  spec.add_development_dependency "xml-c14n"
56
55
  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.7
4
+ version: 3.6.0
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-06-09 00:00:00.000000000 Z
11
+ date: 2025-07-05 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: metanorma-ietf-data
@@ -30,14 +30,14 @@ dependencies:
30
30
  requirements:
31
31
  - - "~>"
32
32
  - !ruby/object:Gem::Version
33
- version: 3.0.0
33
+ version: 3.1.0
34
34
  type: :runtime
35
35
  prerelease: false
36
36
  version_requirements: !ruby/object:Gem::Requirement
37
37
  requirements:
38
38
  - - "~>"
39
39
  - !ruby/object:Gem::Version
40
- version: 3.0.0
40
+ version: 3.1.0
41
41
  - !ruby/object:Gem::Dependency
42
42
  name: relaton-render
43
43
  requirement: !ruby/object:Gem::Requirement
@@ -192,20 +192,6 @@ dependencies:
192
192
  - - "~>"
193
193
  - !ruby/object:Gem::Version
194
194
  version: '0.9'
195
- - !ruby/object:Gem::Dependency
196
- name: vcr
197
- requirement: !ruby/object:Gem::Requirement
198
- requirements:
199
- - - "~>"
200
- - !ruby/object:Gem::Version
201
- version: 6.1.0
202
- type: :development
203
- prerelease: false
204
- version_requirements: !ruby/object:Gem::Requirement
205
- requirements:
206
- - - "~>"
207
- - !ruby/object:Gem::Version
208
- version: 6.1.0
209
195
  - !ruby/object:Gem::Dependency
210
196
  name: webmock
211
197
  requirement: !ruby/object:Gem::Requirement