relaton-ietf 1.0.0 → 1.1.0

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: 90fd47e0ac20635313f5f5efc2bad4dd324b926b9c97040eb101848f791ae3fe
4
- data.tar.gz: c8a3d00abf8be207d9c2b8f2cc7b2ad0d40d79b8ddfc41df6dd7d56d071a444e
3
+ metadata.gz: 6f77df06fb1337cae0194f2b9efb8f93d17f573fad72693dd7b2e83a11409897
4
+ data.tar.gz: 84de7f674a172fed2b369c4233b4446bf641e45a72e6bbe16bc529a99226acff
5
5
  SHA512:
6
- metadata.gz: 53c9f971d9e2d86439ef6186641ebdf8bd1a9211b06965025e7de6b631bed72f989e3876c864f7dfbf514a72853bf10232ea9df6d1b28097057cbb3324f0291b
7
- data.tar.gz: 07a073802b7b5210efc1db3c5ea9032a666a26a49a158f06cca220ae1e6f5f4f9c30fa84dd447b430455cd58adcba9172d89433b9760a3754a4e7654d0100882
6
+ metadata.gz: 68cf9fb90d6106a178a6bbe712c07b4bd574a8f5e00c34bd3474c1e1961d551afeec0ace6c502bb882eb96450ab639dbd354ca00585acef28355bb674d68d65f
7
+ data.tar.gz: 0d85bd98e4f3085e05fd11177e18ad8b21fd629d6408b88614da9475a3ae96e8341e128cf86ed2872a3e0c46bb7a7cf32507c37c778910e9e8855a2033b40d81
@@ -88,7 +88,7 @@
88
88
  <text/>
89
89
  </element>
90
90
  </define>
91
- <define name="LocalizedString">
91
+ <define name="LocalizedString1">
92
92
  <optional>
93
93
  <!-- multiple languages and scripts possible: comma delimit them if so -->
94
94
  <attribute name="language"/>
@@ -98,6 +98,16 @@
98
98
  </optional>
99
99
  <text/>
100
100
  </define>
101
+ <define name="LocalizedString">
102
+ <choice>
103
+ <ref name="LocalizedString1"/>
104
+ <oneOrMore>
105
+ <element name="variant">
106
+ <ref name="LocalizedString1"/>
107
+ </element>
108
+ </oneOrMore>
109
+ </choice>
110
+ </define>
101
111
  <!--
102
112
  Unlike UML, change type to format: type is overloaded
103
113
  Would be need if plain were default value and could omit the attribute
@@ -121,7 +131,7 @@
121
131
  </optional>
122
132
  <ref name="LocalizedStringOrXsAny"/>
123
133
  </define>
124
- <define name="LocalizedStringOrXsAny">
134
+ <define name="LocalizedStringOrXsAny1">
125
135
  <optional>
126
136
  <!-- multiple languages and scripts possible: comma delimit them if so -->
127
137
  <attribute name="language"/>
@@ -136,6 +146,16 @@
136
146
  </choice>
137
147
  </oneOrMore>
138
148
  </define>
149
+ <define name="LocalizedStringOrXsAny">
150
+ <choice>
151
+ <ref name="LocalizedStringOrXsAny1"/>
152
+ <oneOrMore>
153
+ <element name="variant">
154
+ <ref name="LocalizedStringOrXsAny1"/>
155
+ </element>
156
+ </oneOrMore>
157
+ </choice>
158
+ </define>
139
159
  <define name="contributor">
140
160
  <element name="contributor">
141
161
  <zeroOrMore>
@@ -641,9 +661,9 @@
641
661
  <optional>
642
662
  <ref name="status"/>
643
663
  </optional>
644
- <optional>
664
+ <zeroOrMore>
645
665
  <ref name="copyright"/>
646
- </optional>
666
+ </zeroOrMore>
647
667
  <zeroOrMore>
648
668
  <ref name="docrelation"/>
649
669
  </zeroOrMore>
@@ -767,6 +787,8 @@
767
787
  <value>unchanged</value>
768
788
  <value>circulated</value>
769
789
  <value>adapted</value>
790
+ <value>vote-started</value>
791
+ <value>vote-ended</value>
770
792
  </choice>
771
793
  </define>
772
794
  <define name="bdate">
@@ -999,7 +1021,17 @@
999
1021
  <optional>
1000
1022
  <ref name="to"/>
1001
1023
  </optional>
1002
- <ref name="owner"/>
1024
+ <oneOrMore>
1025
+ <ref name="owner"/>
1026
+ </oneOrMore>
1027
+ <optional>
1028
+ <ref name="copyright_scope"/>
1029
+ </optional>
1030
+ </element>
1031
+ </define>
1032
+ <define name="copyright_scope">
1033
+ <element name="scope">
1034
+ <text/>
1003
1035
  </element>
1004
1036
  </define>
1005
1037
  <define name="from">
@@ -1019,38 +1051,63 @@
1019
1051
  </define>
1020
1052
  <define name="DocRelationType">
1021
1053
  <choice>
1022
- <value>obsoletes</value>
1023
- <value>obsoletedBy</value>
1024
- <value>supersedes</value>
1025
- <value>supersededBy</value>
1026
- <value>updates</value>
1027
- <value>updatedBy</value>
1028
- <value>complements</value>
1029
- <value>derivedFrom</value>
1030
- <value>translatedFrom</value>
1031
- <value>hasTranslation</value>
1032
- <value>adoptedFrom</value>
1033
- <value>equivalent</value>
1034
- <value>identical</value>
1035
- <value>nonequivalent</value>
1036
- <value>includedIn</value>
1037
1054
  <value>includes</value>
1038
- <value>instance</value>
1039
- <value>instanceOf</value>
1040
- <value>partOf</value>
1055
+ <value>includedIn</value>
1041
1056
  <value>hasPart</value>
1042
- <value>hasDraft</value>
1043
- <value>draftOf</value>
1057
+ <value>partOf</value>
1044
1058
  <value>merges</value>
1059
+ <value>mergedInto</value>
1045
1060
  <value>splits</value>
1046
- <value>amends</value>
1047
- <value>amendedBy</value>
1048
- <value>corrects</value>
1049
- <value>correctedBy</value>
1050
- <value>revises</value>
1051
- <value>revisedBy</value>
1061
+ <value>splitInto</value>
1062
+ <value>instance</value>
1063
+ <value>hasInstance</value>
1064
+ <value>exemplarOf</value>
1065
+ <value>hasExemplar</value>
1066
+ <value>manifestationOf</value>
1067
+ <value>hasManifestation</value>
1068
+ <value>reproductionOf</value>
1069
+ <value>hasReproduction</value>
1070
+ <value>reprintOf</value>
1071
+ <value>hasReprint</value>
1072
+ <value>expressionOf</value>
1073
+ <value>hasExpression</value>
1074
+ <value>translatedFrom</value>
1075
+ <value>hasTranslation</value>
1076
+ <value>arrangementOf</value>
1077
+ <value>hasArrangement</value>
1078
+ <value>abridgementOf</value>
1079
+ <value>hasAbridgement</value>
1080
+ <value>annotationOf</value>
1081
+ <value>hasAnnotation</value>
1082
+ <value>draftOf</value>
1083
+ <value>hasDraft</value>
1084
+ <value>editionOf</value>
1085
+ <value>hasEdition</value>
1086
+ <value>updates</value>
1087
+ <value>updatedBy</value>
1088
+ <value>derivedFrom</value>
1089
+ <value>derives</value>
1052
1090
  <value>describes</value>
1053
1091
  <value>describedBy</value>
1092
+ <value>catalogues</value>
1093
+ <value>cataloguedBy</value>
1094
+ <value>hasSuccessor</value>
1095
+ <value>successorOf</value>
1096
+ <value>adaptedFrom</value>
1097
+ <value>hasAdaptation</value>
1098
+ <value>adoptedFrom</value>
1099
+ <value>adoptedAs</value>
1100
+ <value>reviewOf</value>
1101
+ <value>hasReview</value>
1102
+ <value>commentaryOf</value>
1103
+ <value>hasCommentary</value>
1104
+ <value>related</value>
1105
+ <value>complements</value>
1106
+ <value>complementOf</value>
1107
+ <value>obsoletes</value>
1108
+ <value>obsoletedBy</value>
1109
+ <value>cited</value>
1110
+ <value>isCitedIn</value>
1054
1111
  </choice>
1055
1112
  </define>
1056
1113
  <define name="docrelation">
@@ -53,6 +53,14 @@
53
53
  <optional>
54
54
  <attribute name="alt"/>
55
55
  </optional>
56
+ <optional>
57
+ <attribute name="case">
58
+ <choice>
59
+ <value>capital</value>
60
+ <value>lowercase</value>
61
+ </choice>
62
+ </attribute>
63
+ </optional>
56
64
  <text/>
57
65
  </element>
58
66
  </define>
@@ -129,6 +137,9 @@
129
137
  </choice>
130
138
  </attribute>
131
139
  </optional>
140
+ <attribute name="normative">
141
+ <data type="boolean"/>
142
+ </attribute>
132
143
  <optional>
133
144
  <ref name="section-title"/>
134
145
  </optional>
@@ -303,11 +314,11 @@
303
314
  <ref name="paragraph"/>
304
315
  </element>
305
316
  </define>
306
- <define name="TextElement" combine="choice">
307
- <ref name="concept"/>
308
- </define>
309
317
  </include>
310
318
  <!-- end overrides -->
319
+ <define name="TextElement" combine="choice">
320
+ <ref name="concept"/>
321
+ </define>
311
322
  <define name="concept">
312
323
  <element name="concept">
313
324
  <optional>
@@ -899,7 +910,15 @@
899
910
  <attribute name="id">
900
911
  <data type="ID"/>
901
912
  </attribute>
902
- <ref name="paragraph"/>
913
+ <oneOrMore>
914
+ <choice>
915
+ <ref name="paragraph"/>
916
+ <ref name="ul"/>
917
+ <ref name="ol"/>
918
+ <ref name="dl"/>
919
+ <ref name="formula"/>
920
+ </choice>
921
+ </oneOrMore>
903
922
  </element>
904
923
  </define>
905
924
  <define name="termexample">
@@ -91,6 +91,12 @@
91
91
  </define>
92
92
  <define name="sections">
93
93
  <element name="sections">
94
+ <zeroOrMore>
95
+ <choice>
96
+ <ref name="note"/>
97
+ <ref name="admonition"/>
98
+ </choice>
99
+ </zeroOrMore>
94
100
  <ref name="clause"/>
95
101
  <optional>
96
102
  <choice>
@@ -263,6 +269,8 @@
263
269
  <value>publicly-available-specification</value>
264
270
  <value>international-workshop-agreement</value>
265
271
  <value>guide</value>
272
+ <value>amendment</value>
273
+ <value>technical-corrigendum</value>
266
274
  </choice>
267
275
  </define>
268
276
  <define name="structuredidentifier">
@@ -510,7 +518,7 @@
510
518
  </attribute>
511
519
  </optional>
512
520
  <oneOrMore>
513
- <ref name="paragraph-with-footnote"/>
521
+ <ref name="BasicBlock"/>
514
522
  </oneOrMore>
515
523
  </element>
516
524
  </define>
@@ -192,7 +192,8 @@ module RelatonIetf
192
192
 
193
193
  # @return [Array<Hash{Symbol=>RelatonBib::Person,Symbol=>Array<String>}>]
194
194
  def persons(reference)
195
- reference.xpath("./front/author").map do |author|
195
+ reference.xpath("./front/author[@surname]|./front/author[@fullname]").
196
+ map do |author|
196
197
  entity = RelatonBib::Person.new(
197
198
  name: full_name(author, reference),
198
199
  affiliation: [affiliation(author)],
@@ -204,29 +205,33 @@ module RelatonIetf
204
205
 
205
206
  # @return [Array<Hash{Symbol=>RelatonBib::Organization,Symbol=>Array<String>}>]
206
207
  def organizations(reference)
207
- reference.xpath("./seriesinfo").map do |si|
208
- next unless si[:stream]
208
+ publisher = { entity: new_org, role: [type: "publisher"] }
209
+ reference.xpath("./seriesinfo").reduce([publisher]) do |mem, si|
210
+ next mem unless si[:stream]
209
211
 
210
- entity = RelatonBib::Organization.new name: si[:stream]
211
- { entity: entity, role: [type: "author"] }
212
- end.compact
212
+ mem << { entity: new_org(si[:stream]), role: [type: "author"] }
213
+ end
213
214
  end
214
215
 
215
216
  # @param author [Nokogiri::XML::Document]
216
217
  # @param ref [Nokogiri::XML::Document]
217
218
  # @return [RelatonBib::FullName]
218
219
  def full_name(author, ref)
220
+ lang = language ref
219
221
  RelatonBib::FullName.new(
220
- completename: localized_string(author[:fullname], ref),
221
- initial: [localized_string(author[:initials], ref)],
222
- surname: [localized_string(author[:surname], ref)],
222
+ completename: localized_string(author[:fullname], lang),
223
+ initial: [localized_string(author[:initials], lang)].compact,
224
+ surname: localized_string(author[:surname], lang),
223
225
  )
224
226
  end
225
227
 
226
228
  # @param content [String]
229
+ # @param lang [String]
227
230
  # @return [RelatonBib::LocalizedString]
228
- def localized_string(content, ref)
229
- RelatonBib::LocalizedString.new(content, language(ref))
231
+ def localized_string(content, lang)
232
+ return unless content
233
+
234
+ RelatonBib::LocalizedString.new(content, lang)
230
235
  end
231
236
 
232
237
  # @param postal [Nokogiri::XML::Document]
@@ -267,13 +272,21 @@ module RelatonIetf
267
272
  # @return [RelatonBib::Affiliation]
268
273
  def affiliation(author)
269
274
  organization = author.at("./organization")
270
- org = RelatonBib::Organization.new(
271
- name: organization.nil? || organization.text.empty? ? "IETF" : organization.text,
272
- abbreviation: organization.nil? ? "IETF" : (organization[:abbrev] || "IETF"),
273
- )
275
+ org = if organization.nil? || organization&.text&.empty?
276
+ new_org
277
+ else
278
+ new_org organization.text, organization[:abbrev]
279
+ end
274
280
  RelatonBib::Affiliation.new organization: org
275
281
  end
276
282
 
283
+ # @param name [String]
284
+ # @param abbr [String]
285
+ # @return [RelatonBib::Organization]
286
+ def new_org(name = "Internet Engineering Task Force", abbr = "IETF")
287
+ RelatonBib::Organization.new name: name, abbreviation: abbr
288
+ end
289
+
277
290
  # @param author [Nokogiri::XML::Document]
278
291
  # @return [Hash]
279
292
  def contributor_role(author)
@@ -281,6 +294,7 @@ module RelatonIetf
281
294
  end
282
295
 
283
296
  def month(mon)
297
+ return 1 if !mon || mon.empty?
284
298
  return mon if /^\d+$/ =~ mon
285
299
 
286
300
  Date::MONTHNAMES.index(mon)
@@ -294,12 +308,14 @@ module RelatonIetf
294
308
  def dates(reference)
295
309
  return unless (date = reference.at "./front/date")
296
310
 
297
- d = [date[:year], month(date[:month]) || "01",
298
- (date[:day] || "01")].compact.join "-"
311
+ d = [date[:year], month(date[:month]),
312
+ (date[:day] || 1)].compact.join "-"
299
313
  date = Time.parse(d).strftime "%Y-%m-%d"
300
314
  [RelatonBib::BibliographicDate.new(type: "published", on: date)]
301
315
  end
302
316
 
317
+ # rubocop:disable Metrics/MethodLength, Metrics/AbcSize
318
+
303
319
  #
304
320
  # Extract document identifiers from reference
305
321
  #
@@ -323,6 +339,7 @@ module RelatonIetf
323
339
  RelatonBib::DocumentIdentifier.new(id: id, type: si[:name])
324
340
  end.compact
325
341
  end
342
+ # enable Metrics/MethodLength, Metrics/AbcSize
326
343
 
327
344
  #
328
345
  # Extract series form reference
@@ -1,3 +1,3 @@
1
1
  module RelatonIetf
2
- VERSION = "1.0.0".freeze
2
+ VERSION = "1.1.0".freeze
3
3
  end
@@ -40,5 +40,5 @@ Gem::Specification.new do |spec|
40
40
  spec.add_development_dependency "vcr"
41
41
  spec.add_development_dependency "webmock"
42
42
 
43
- spec.add_dependency "relaton-bib", "~> 1.0.0"
43
+ spec.add_dependency "relaton-bib", "~> 1.1.0"
44
44
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: relaton-ietf
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.0
4
+ version: 1.1.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: 2020-04-25 00:00:00.000000000 Z
11
+ date: 2020-06-03 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: debase
@@ -156,14 +156,14 @@ dependencies:
156
156
  requirements:
157
157
  - - "~>"
158
158
  - !ruby/object:Gem::Version
159
- version: 1.0.0
159
+ version: 1.1.0
160
160
  type: :runtime
161
161
  prerelease: false
162
162
  version_requirements: !ruby/object:Gem::Requirement
163
163
  requirements:
164
164
  - - "~>"
165
165
  - !ruby/object:Gem::Version
166
- version: 1.0.0
166
+ version: 1.1.0
167
167
  description: "RelatonIetf: retrieve IETF Standards for bibliographic use \nusing the
168
168
  BibliographicItem model.\n\nFormerly known as rfcbib.\n"
169
169
  email: