metanorma-ietf 3.0.11 → 3.0.13

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: a1deb99aa6937a5ecea906469cd404152a74945e6e6fb595262c52358841bc53
4
- data.tar.gz: 0cd0c817dffcc423b00043479704a63851807d0e1aa0ea77856c80871e6d11df
3
+ metadata.gz: 39ea21861ccd96e10a9c03dcfa3672df68347437aed1c307680160a402195b4b
4
+ data.tar.gz: effa7116f2bf9f02e880e9fd2d478ef140aa45b520dc14d083dd1c6f409dad0f
5
5
  SHA512:
6
- metadata.gz: 5ee37a0a08b9f25e7aea0a381e383e154dadff6fd0bd9196cf375b7a4e3b199f327426e9f210452bf1ae4513220e4a7b6f1790d67aaf6e4a409134772fa1888b
7
- data.tar.gz: 4d1df87114db20f71ba28f2fea1f254f8bfb47a03db1269b8e6db1d0a10013dcd44f164a493f5c8b3409e0e1f311b2b7eb7d65dfe84401d70da76fbd13bb441d
6
+ metadata.gz: bdba57407ebf106d7ca311d94dfee3e778e6f1453de5a09772d42e1f696c6b951be24d2b84764d623fe8d9e3b81d192930881b6c9ed2619a630c30c0b52addce
7
+ data.tar.gz: f57b8315d127c4f7dacbd295d6a899855d5d4df1ee262a9e0d993b38126c82f8b4c4c7d22529895b0351a44303efb0f8107b2ed2d0d76b4d027e2790db9a900b
@@ -8,7 +8,7 @@ module IsoDoc
8
8
  errors = Jing.new(File.join(File.dirname(__FILE__), "v3.rng"))
9
9
  .validate(filename)
10
10
  errors.each do |error|
11
- warn "RFC XML: Line #{'%06d' % error[:line]}:#{error[:column]} "\
11
+ warn "RFC XML: Line #{'%06d' % error[:line]}:#{error[:column]} " \
12
12
  "#{error[:message]}"
13
13
  end
14
14
  rescue Jing::Error => e
@@ -38,26 +38,35 @@ module IsoDoc
38
38
  def numbered_sections_check(xml)
39
39
  ret = []
40
40
  xml.xpath("//section[@numbered = 'false']").each do |s1|
41
- s1.xpath("./section[not(@numbered) or @numbered = 'true']")
42
- .each do |s2|
43
- ret << "Numbered section #{label(s2)} under unnumbered section "\
44
- "#{label(s1)}"
45
- end
46
- s1.xpath("./following-sibling::*[name() = 'section']"\
47
- "[not(@numbered) or @numbered = 'true']").each do |s2|
48
- ret << "Numbered section #{label(s2)} following unnumbered "\
49
- "section #{label(s1)}"
50
- end
41
+ ret += numbered_sections_check1(s1)
42
+ ret += numbered_sections_check2(s1)
51
43
  end
52
44
  ret
53
45
  end
54
46
 
47
+ def numbered_sections_check1(section)
48
+ section.xpath("./section[not(@numbered) or @numbered = 'true']")
49
+ .each_with_object([]) do |s2, m|
50
+ m << "Numbered section #{label(s2)} under unnumbered section " \
51
+ "#{label(section)}"
52
+ end
53
+ end
54
+
55
+ def numbered_sections_check2(section)
56
+ section.xpath("./following-sibling::*[name() = 'section']" \
57
+ "[not(@numbered) or @numbered = 'true']")
58
+ .each_with_object([]) do |s2, m|
59
+ m << "Numbered section #{label(s2)} following unnumbered " \
60
+ "section #{label(section)}"
61
+ end
62
+ end
63
+
55
64
  # 5.2.7. Section "toc" attribute
56
65
  def toc_sections_check(xml)
57
66
  ret = []
58
67
  xml.xpath("//section[@toc = 'exclude']").each do |s1|
59
68
  s1.xpath(".//section[@toc = 'include']").each do |s2|
60
- ret << "Section #{label(s2)} with toc=include is included in "\
69
+ ret << "Section #{label(s2)} with toc=include is included in " \
61
70
  "section #{label(s1)} with toc=exclude"
62
71
  end
63
72
  end
@@ -69,14 +78,14 @@ module IsoDoc
69
78
  def references_check(xml)
70
79
  ret = []
71
80
  xml.xpath("//reference[not(@target)]").each do |s|
72
- s.xpath(".//seriesInfo[@name = 'RFC' or @name = 'Internet-Draft' "\
81
+ s.xpath(".//seriesInfo[@name = 'RFC' or @name = 'Internet-Draft' " \
73
82
  "or @name = 'DOI'][not(@value)]").each do |s1|
74
- ret << "for reference #{s['anchor']}, the seriesInfo with "\
83
+ ret << "for reference #{s['anchor']}, the seriesInfo with " \
75
84
  "name=#{s1['name']} has been given no value"
76
85
  end
77
86
  end
78
87
  xml.xpath("//references | //section").each do |s|
79
- s.at("./name") or ret << "Cannot generate table of contents entry "\
88
+ s.at("./name") or ret << "Cannot generate table of contents entry " \
80
89
  "for #{label(s)}, as it has no title"
81
90
  end
82
91
  ret
@@ -95,48 +104,48 @@ module IsoDoc
95
104
  x.delete("section") if x["section"] && x["section"].empty?
96
105
  if x["format"] == "title" && t.name == "reference"
97
106
  t.at("./front/title") or
98
- ret << "reference #{t['anchor']} has been referenced by #{x.name} "\
107
+ ret << "reference #{t['anchor']} has been referenced by #{x.name} " \
99
108
  "with format=title, but the reference has no title"
100
109
  end
101
110
  if x["format"] == "counter" && !%w(section table figure li
102
111
  reference references t dt).include?(t.name)
103
- ret << "#{x.to_xml} with format=counter is only allowed for "\
104
- "clauses, tables, figures, list entries, definition terms, "\
112
+ ret << "#{x.to_xml} with format=counter is only allowed for " \
113
+ "clauses, tables, figures, list entries, definition terms, " \
105
114
  "paragraphs, bibliographies, and bibliographic entries"
106
115
  end
107
116
  if x["format"] == "counter" && t.name == "reference" && !x["section"]
108
- ret << "reference #{t['anchor']} has been referenced by xref "\
109
- "#{x.to_xml} with format=counter, which requires a "\
117
+ ret << "reference #{t['anchor']} has been referenced by xref " \
118
+ "#{x.to_xml} with format=counter, which requires a " \
110
119
  "section attribute"
111
120
  end
112
121
  if x["format"] == "counter" && t.name == "li" && t.parent.name != "ol"
113
- ret << "#{x.to_xml} with format=counter refers to an unnumbered "\
122
+ ret << "#{x.to_xml} with format=counter refers to an unnumbered " \
114
123
  "list entry"
115
124
  end
116
125
  if x["format"] == "title" && %w(u author contact).include?(t.name)
117
- ret << "#{x.to_xml} with format=title cannot reference a "\
126
+ ret << "#{x.to_xml} with format=title cannot reference a " \
118
127
  "<#{t.name}> element"
119
128
  end
120
129
  if x["relative"] && !x["section"]
121
- ret << "#{x.to_xml} with relative attribute requires a section "\
130
+ ret << "#{x.to_xml} with relative attribute requires a section " \
122
131
  "attribute"
123
132
  end
124
133
  if (x["section"]) && t.name != "reference"
125
- ret << "#{x.to_xml} has a section attribute, but #{x['target']} "\
134
+ ret << "#{x.to_xml} has a section attribute, but #{x['target']} " \
126
135
  "points to a #{t.name}"
127
136
  end
128
137
  if (x["relative"]) && t.name != "reference"
129
- ret << "#{x.to_xml} has a relative attribute, but #{x['target']} "\
138
+ ret << "#{x.to_xml} has a relative attribute, but #{x['target']} " \
130
139
  "points to a #{t.name}"
131
140
  end
132
- if !x["relative"] && x["section"] && !t.at(".//seriesInfo[@name = 'RFC' or @name = "\
141
+ if !x["relative"] && x["section"] && !t.at(".//seriesInfo[@name = 'RFC' or @name = " \
133
142
  "'Internet-Draft']")
134
- ret << "#{x.to_xml} must use a relative attribute, "\
143
+ ret << "#{x.to_xml} must use a relative attribute, " \
135
144
  "since it does not point to a RFC or Internet-Draft reference"
136
145
  end
137
- if x["relative"] && !(t.at(".//seriesInfo[@name = 'RFC' or @name = "\
146
+ if x["relative"] && !(t.at(".//seriesInfo[@name = 'RFC' or @name = " \
138
147
  "'Internet-Draft']") || t["target"])
139
- ret << "need an explicit target= URL attribute in the reference "\
148
+ ret << "need an explicit target= URL attribute in the reference " \
140
149
  "pointed to by #{x.to_xml}"
141
150
  end
142
151
  end
@@ -155,8 +164,8 @@ module IsoDoc
155
164
  def link_check(xml)
156
165
  l = xml&.at("//link[@rel = 'convertedFrom']")&.text
157
166
  !l || %r{^https://datatracker\.ietf\.org/doc/draft-}.match(l) or
158
- return ["<link rel='convertedFrom'> (:derived-from: document "\
159
- "attribute) must start with "\
167
+ return ["<link rel='convertedFrom'> (:derived-from: document " \
168
+ "attribute) must start with " \
160
169
  "https://datatracker.ietf.org/doc/draft-"]
161
170
  []
162
171
  end
@@ -168,12 +177,12 @@ module IsoDoc
168
177
  rfcinfo = xml.at("//front//seriesInfo[@name = 'RFC']")
169
178
  rfcnumber = xml.root["number"]
170
179
  rfcinfo && rfcnumber && rfcnumber != rfcinfo["value"] and
171
- ret << "Mismatch between <rfc number='#{rfcnumber}'> "\
172
- "(:docnumber: NUMBER) "\
173
- "and <seriesInfo name='RFC' value='#{rfcinfo['value']}'> "\
180
+ ret << "Mismatch between <rfc number='#{rfcnumber}'> " \
181
+ "(:docnumber: NUMBER) " \
182
+ "and <seriesInfo name='RFC' value='#{rfcinfo['value']}'> " \
174
183
  "(:intended-series: TYPE NUMBER)"
175
184
  rfcinfo && !/^\d+$/.match(rfcnumber) and
176
- ret << "RFC identifier <rfc number='#{rfcnumber}'> "\
185
+ ret << "RFC identifier <rfc number='#{rfcnumber}'> " \
177
186
  "(:docnumber: NUMBER) must be a number"
178
187
  ret
179
188
  end
@@ -183,7 +192,7 @@ module IsoDoc
183
192
  xml.root["ipr"] or
184
193
  return ["Missing ipr attribute on <rfc> element (:ipr:)"]
185
194
  /trust200902$/.match(xml.root["ipr"]) or
186
- return ["Unknown ipr attribute on <rfc> element (:ipr:): "\
195
+ return ["Unknown ipr attribute on <rfc> element (:ipr:): " \
187
196
  "#{xml.root['ipr']}"]
188
197
  []
189
198
  end
@@ -1,10 +1,5 @@
1
1
  <?xml version="1.0" encoding="UTF-8"?>
2
2
  <grammar xmlns="http://relaxng.org/ns/structure/1.0" datatypeLibrary="http://www.w3.org/2001/XMLSchema-datatypes">
3
- <include href="biblio.rng">
4
- <start>
5
- <ref name="document"/>
6
- </start>
7
- </include>
8
3
  <define name="document">
9
4
  <element name="document">
10
5
  <optional>
@@ -1125,26 +1120,4 @@
1125
1120
  </zeroOrMore>
1126
1121
  </element>
1127
1122
  </define>
1128
- <define name="ext">
1129
- <element name="ext">
1130
- <ref name="BibDataExtensionType"/>
1131
- </element>
1132
- </define>
1133
- <define name="BibDataExtensionType">
1134
- <ref name="doctype"/>
1135
- </define>
1136
- <define name="doctype">
1137
- <element name="doctype">
1138
- <ref name="DocumentType"/>
1139
- </element>
1140
- </define>
1141
- <define name="DocumentType">
1142
- <value>document</value>
1143
- </define>
1144
- <define name="BibData">
1145
- <ref name="BibliographicItem"/>
1146
- <optional>
1147
- <ref name="ext"/>
1148
- </optional>
1149
- </define>
1150
1123
  </grammar>
@@ -0,0 +1,164 @@
1
+ <?xml version="1.0" encoding="UTF-8"?>
2
+ <grammar xmlns="http://relaxng.org/ns/structure/1.0">
3
+ <!--
4
+ Add-ons to biblio.rnc for standoc model: defines the extension point BibDataExtensionType
5
+ of relaton
6
+
7
+ Specialisations as for biblio.rnc. Extension point can be redefined completely for a flavour of standoc
8
+ (SDO); but other elements in Bibdata can only be extended (more specialised vocabularies for Bibdata)
9
+ -->
10
+ <include href="biblio.rng">
11
+ <define name="BibData">
12
+ <ref name="BibliographicItem"/>
13
+ <optional>
14
+ <ref name="ext"/>
15
+ </optional>
16
+ </define>
17
+ </include>
18
+ <define name="ext">
19
+ <element name="ext">
20
+ <ref name="BibDataExtensionType"/>
21
+ </element>
22
+ </define>
23
+ <define name="BibDataExtensionType">
24
+ <optional>
25
+ <attribute name="schema-version"/>
26
+ </optional>
27
+ <ref name="doctype"/>
28
+ <optional>
29
+ <ref name="docsubtype"/>
30
+ </optional>
31
+ <optional>
32
+ <ref name="editorialgroup"/>
33
+ </optional>
34
+ <zeroOrMore>
35
+ <ref name="ics"/>
36
+ </zeroOrMore>
37
+ <zeroOrMore>
38
+ <ref name="structuredidentifier"/>
39
+ </zeroOrMore>
40
+ </define>
41
+ <define name="doctype">
42
+ <element name="doctype">
43
+ <optional>
44
+ <attribute name="abbreviation"/>
45
+ </optional>
46
+ <ref name="DocumentType"/>
47
+ </element>
48
+ </define>
49
+ <define name="DocumentType">
50
+ <value>document</value>
51
+ </define>
52
+ <define name="docsubtype">
53
+ <element name="subdoctype">
54
+ <ref name="DocumentSubtype"/>
55
+ </element>
56
+ </define>
57
+ <define name="DocumentSubtype">
58
+ <text/>
59
+ </define>
60
+ <define name="editorialgroup">
61
+ <element name="editorialgroup">
62
+ <oneOrMore>
63
+ <ref name="technical-committee"/>
64
+ </oneOrMore>
65
+ </element>
66
+ </define>
67
+ <define name="technical-committee">
68
+ <element name="technical-committee">
69
+ <ref name="IsoWorkgroup"/>
70
+ </element>
71
+ </define>
72
+ <define name="IsoWorkgroup">
73
+ <optional>
74
+ <attribute name="number"/>
75
+ </optional>
76
+ <optional>
77
+ <attribute name="type"/>
78
+ </optional>
79
+ <optional>
80
+ <attribute name="identifier"/>
81
+ </optional>
82
+ <optional>
83
+ <attribute name="prefix"/>
84
+ </optional>
85
+ <text/>
86
+ </define>
87
+ <define name="ics">
88
+ <element name="ics">
89
+ <element name="code">
90
+ <text/>
91
+ </element>
92
+ <optional>
93
+ <element name="text">
94
+ <text/>
95
+ </element>
96
+ </optional>
97
+ </element>
98
+ </define>
99
+ <define name="structuredidentifier">
100
+ <element name="structuredidentifier">
101
+ <optional>
102
+ <attribute name="type"/>
103
+ </optional>
104
+ <oneOrMore>
105
+ <element name="agency">
106
+ <text/>
107
+ </element>
108
+ </oneOrMore>
109
+ <optional>
110
+ <element name="class">
111
+ <text/>
112
+ </element>
113
+ </optional>
114
+ <element name="docnumber">
115
+ <text/>
116
+ </element>
117
+ <optional>
118
+ <element name="partnumber">
119
+ <text/>
120
+ </element>
121
+ </optional>
122
+ <optional>
123
+ <element name="edition">
124
+ <text/>
125
+ </element>
126
+ </optional>
127
+ <optional>
128
+ <element name="version">
129
+ <text/>
130
+ </element>
131
+ </optional>
132
+ <optional>
133
+ <element name="supplementtype">
134
+ <text/>
135
+ </element>
136
+ </optional>
137
+ <optional>
138
+ <element name="supplementnumber">
139
+ <text/>
140
+ </element>
141
+ </optional>
142
+ <optional>
143
+ <element name="amendment">
144
+ <text/>
145
+ </element>
146
+ </optional>
147
+ <optional>
148
+ <element name="corrigendum">
149
+ <text/>
150
+ </element>
151
+ </optional>
152
+ <optional>
153
+ <element name="language">
154
+ <text/>
155
+ </element>
156
+ </optional>
157
+ <optional>
158
+ <element name="year">
159
+ <text/>
160
+ </element>
161
+ </optional>
162
+ </element>
163
+ </define>
164
+ </grammar>
@@ -33,9 +33,10 @@
33
33
  <param name="pattern">([\+\-]?\d{4})((-?)((0[1-9]|1[0-2])((-?)([12]\d|0[1-9]|3[01]))?|W([0-4]\d|5[0-2])(-?[1-7])?|(00[1-9]|0[1-9]\d|[12]\d{2}|3([0-5]\d|6[1-6]))))?</param>
34
34
  </data>
35
35
  </define>
36
- <start>
37
- <ref name="bibitem"/>
38
- </start>
36
+ <!-- start = bibitem -->
37
+ <define name="BibData">
38
+ <ref name="BibliographicItem"/>
39
+ </define>
39
40
  <define name="status">
40
41
  <element name="status">
41
42
  <ref name="stage"/>
@@ -170,27 +171,30 @@
170
171
  </define>
171
172
  <define name="contributor">
172
173
  <element name="contributor">
173
- <zeroOrMore>
174
+ <oneOrMore>
174
175
  <ref name="role"/>
175
- </zeroOrMore>
176
+ </oneOrMore>
176
177
  <ref name="ContributorInfo"/>
177
178
  </element>
178
179
  </define>
179
180
  <define name="role">
180
181
  <element name="role">
181
- <optional>
182
- <attribute name="type">
183
- <choice>
184
- <value>author</value>
185
- <value>performer</value>
186
- <value>publisher</value>
187
- <value>editor</value>
188
- <value>adapter</value>
189
- <value>translator</value>
190
- <value>distributor</value>
191
- </choice>
192
- </attribute>
193
- </optional>
182
+ <attribute name="type">
183
+ <choice>
184
+ <value>author</value>
185
+ <value>performer</value>
186
+ <value>publisher</value>
187
+ <value>editor</value>
188
+ <value>adapter</value>
189
+ <value>translator</value>
190
+ <value>distributor</value>
191
+ <value>realizer</value>
192
+ <value>owner</value>
193
+ <value>authorizer</value>
194
+ <value>enabler</value>
195
+ <value>subject</value>
196
+ </choice>
197
+ </attribute>
194
198
  <zeroOrMore>
195
199
  <ref name="roledescription"/>
196
200
  </zeroOrMore>
@@ -512,6 +516,17 @@
512
516
  </define>
513
517
  <define name="localityStack">
514
518
  <element name="localityStack">
519
+ <optional>
520
+ <attribute name="connective">
521
+ <choice>
522
+ <value>and</value>
523
+ <value>or</value>
524
+ <value>from</value>
525
+ <value>to</value>
526
+ <value/>
527
+ </choice>
528
+ </attribute>
529
+ </optional>
515
530
  <zeroOrMore>
516
531
  <ref name="locality"/>
517
532
  </zeroOrMore>
@@ -524,6 +539,17 @@
524
539
  </define>
525
540
  <define name="sourceLocalityStack">
526
541
  <element name="sourceLocalityStack">
542
+ <optional>
543
+ <attribute name="connective">
544
+ <choice>
545
+ <value>and</value>
546
+ <value>or</value>
547
+ <value>from</value>
548
+ <value>to</value>
549
+ <value/>
550
+ </choice>
551
+ </attribute>
552
+ </optional>
527
553
  <zeroOrMore>
528
554
  <ref name="sourceLocality"/>
529
555
  </zeroOrMore>
@@ -626,6 +652,9 @@
626
652
  <ref name="BibItemType"/>
627
653
  </attribute>
628
654
  </optional>
655
+ <optional>
656
+ <attribute name="schema-version"/>
657
+ </optional>
629
658
  <optional>
630
659
  <ref name="fetched"/>
631
660
  </optional>
@@ -720,6 +749,9 @@
720
749
  <ref name="BibItemType"/>
721
750
  </attribute>
722
751
  </optional>
752
+ <optional>
753
+ <attribute name="schema-version"/>
754
+ </optional>
723
755
  <optional>
724
756
  <ref name="fetched"/>
725
757
  </optional>
@@ -58,7 +58,7 @@ module Metanorma
58
58
  xmldoc
59
59
  end
60
60
 
61
- def xref_to_eref(xref)
61
+ def xref_to_eref(xref, name)
62
62
  super
63
63
  xref.delete("format")
64
64
  end
@@ -77,7 +77,7 @@ module Metanorma
77
77
  x["uri"] = x["target"]
78
78
  x.delete("target")
79
79
  else
80
- xref_to_eref(x)
80
+ xref_to_eref(x, "source")
81
81
  end
82
82
  end
83
83
  end