relaton-iso-bib 1.7.1 → 1.8.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/grammars/basicdoc.rng +165 -20
- data/grammars/biblio.rng +4 -6
- data/grammars/isodoc.rng +460 -6
- data/grammars/isostandard.rng +42 -104
- data/grammars/reqt.rng +31 -2
- data/lib/relaton_iso_bib/iso_bibliographic_item.rb +27 -13
- data/lib/relaton_iso_bib/version.rb +1 -1
- data/lib/relaton_iso_bib/xml_parser.rb +2 -3
- data/relaton_iso_bib.gemspec +1 -1
- metadata +4 -4
data/grammars/isostandard.rng
CHANGED
@@ -38,6 +38,9 @@
|
|
38
38
|
</define>
|
39
39
|
<define name="BibDataExtensionType">
|
40
40
|
<ref name="doctype"/>
|
41
|
+
<optional>
|
42
|
+
<ref name="horizontal"/>
|
43
|
+
</optional>
|
41
44
|
<ref name="editorialgroup"/>
|
42
45
|
<zeroOrMore>
|
43
46
|
<ref name="ics"/>
|
@@ -76,19 +79,6 @@
|
|
76
79
|
</choice>
|
77
80
|
</element>
|
78
81
|
</define>
|
79
|
-
<define name="ul">
|
80
|
-
<element name="ul">
|
81
|
-
<attribute name="id">
|
82
|
-
<data type="ID"/>
|
83
|
-
</attribute>
|
84
|
-
<oneOrMore>
|
85
|
-
<ref name="ul_li"/>
|
86
|
-
</oneOrMore>
|
87
|
-
<zeroOrMore>
|
88
|
-
<ref name="note"/>
|
89
|
-
</zeroOrMore>
|
90
|
-
</element>
|
91
|
-
</define>
|
92
82
|
<define name="sections">
|
93
83
|
<element name="sections">
|
94
84
|
<zeroOrMore>
|
@@ -137,22 +127,28 @@
|
|
137
127
|
</choice>
|
138
128
|
</attribute>
|
139
129
|
</optional>
|
130
|
+
<optional>
|
131
|
+
<attribute name="type"/>
|
132
|
+
</optional>
|
140
133
|
<optional>
|
141
134
|
<ref name="section-title"/>
|
142
135
|
</optional>
|
143
|
-
<
|
144
|
-
<
|
145
|
-
<
|
146
|
-
<
|
147
|
-
|
148
|
-
|
149
|
-
<
|
150
|
-
|
151
|
-
|
136
|
+
<group>
|
137
|
+
<choice>
|
138
|
+
<group>
|
139
|
+
<oneOrMore>
|
140
|
+
<ref name="BasicBlock"/>
|
141
|
+
</oneOrMore>
|
142
|
+
<zeroOrMore>
|
143
|
+
<ref name="note"/>
|
144
|
+
</zeroOrMore>
|
145
|
+
</group>
|
146
|
+
<ref name="amend"/>
|
147
|
+
</choice>
|
152
148
|
<oneOrMore>
|
153
149
|
<ref name="clause-subsection"/>
|
154
150
|
</oneOrMore>
|
155
|
-
</
|
151
|
+
</group>
|
156
152
|
</define>
|
157
153
|
<define name="term">
|
158
154
|
<element name="term">
|
@@ -183,17 +179,6 @@
|
|
183
179
|
</zeroOrMore>
|
184
180
|
</element>
|
185
181
|
</define>
|
186
|
-
<define name="definition">
|
187
|
-
<element name="definition">
|
188
|
-
<oneOrMore>
|
189
|
-
<choice>
|
190
|
-
<ref name="paragraph"/>
|
191
|
-
<ref name="figure"/>
|
192
|
-
<ref name="formula"/>
|
193
|
-
</choice>
|
194
|
-
</oneOrMore>
|
195
|
-
</element>
|
196
|
-
</define>
|
197
182
|
<define name="annex">
|
198
183
|
<element name="annex">
|
199
184
|
<optional>
|
@@ -271,6 +256,7 @@
|
|
271
256
|
<value>guide</value>
|
272
257
|
<value>amendment</value>
|
273
258
|
<value>technical-corrigendum</value>
|
259
|
+
<value>directive</value>
|
274
260
|
</choice>
|
275
261
|
</define>
|
276
262
|
<define name="structuredidentifier">
|
@@ -324,6 +310,11 @@
|
|
324
310
|
<optional>
|
325
311
|
<attribute name="script"/>
|
326
312
|
</optional>
|
313
|
+
<optional>
|
314
|
+
<attribute name="inline-header">
|
315
|
+
<data type="boolean"/>
|
316
|
+
</attribute>
|
317
|
+
</optional>
|
327
318
|
<optional>
|
328
319
|
<attribute name="obligation">
|
329
320
|
<choice>
|
@@ -332,6 +323,12 @@
|
|
332
323
|
</choice>
|
333
324
|
</attribute>
|
334
325
|
</optional>
|
326
|
+
<optional>
|
327
|
+
<attribute name="number"/>
|
328
|
+
</optional>
|
329
|
+
<optional>
|
330
|
+
<attribute name="type"/>
|
331
|
+
</optional>
|
335
332
|
<optional>
|
336
333
|
<ref name="section-title"/>
|
337
334
|
</optional>
|
@@ -349,54 +346,6 @@
|
|
349
346
|
</oneOrMore>
|
350
347
|
</choice>
|
351
348
|
</define>
|
352
|
-
<define name="table">
|
353
|
-
<element name="table">
|
354
|
-
<attribute name="id">
|
355
|
-
<data type="ID"/>
|
356
|
-
</attribute>
|
357
|
-
<optional>
|
358
|
-
<attribute name="width"/>
|
359
|
-
</optional>
|
360
|
-
<optional>
|
361
|
-
<attribute name="unnumbered">
|
362
|
-
<data type="boolean"/>
|
363
|
-
</attribute>
|
364
|
-
</optional>
|
365
|
-
<optional>
|
366
|
-
<attribute name="number"/>
|
367
|
-
</optional>
|
368
|
-
<optional>
|
369
|
-
<attribute name="subsequence"/>
|
370
|
-
</optional>
|
371
|
-
<optional>
|
372
|
-
<attribute name="alt"/>
|
373
|
-
</optional>
|
374
|
-
<optional>
|
375
|
-
<attribute name="summary"/>
|
376
|
-
</optional>
|
377
|
-
<optional>
|
378
|
-
<attribute name="uri">
|
379
|
-
<data type="anyURI"/>
|
380
|
-
</attribute>
|
381
|
-
</optional>
|
382
|
-
<optional>
|
383
|
-
<ref name="tname"/>
|
384
|
-
</optional>
|
385
|
-
<optional>
|
386
|
-
<ref name="thead"/>
|
387
|
-
</optional>
|
388
|
-
<ref name="tbody"/>
|
389
|
-
<optional>
|
390
|
-
<ref name="tfoot"/>
|
391
|
-
</optional>
|
392
|
-
<zeroOrMore>
|
393
|
-
<ref name="table-note"/>
|
394
|
-
</zeroOrMore>
|
395
|
-
<optional>
|
396
|
-
<ref name="dl"/>
|
397
|
-
</optional>
|
398
|
-
</element>
|
399
|
-
</define>
|
400
349
|
</include>
|
401
350
|
<!-- end overrides -->
|
402
351
|
<!--
|
@@ -416,6 +365,9 @@
|
|
416
365
|
<zeroOrMore>
|
417
366
|
<ref name="termdocsource"/>
|
418
367
|
</zeroOrMore>
|
368
|
+
<optional>
|
369
|
+
<ref name="misccontainer"/>
|
370
|
+
</optional>
|
419
371
|
<optional>
|
420
372
|
<ref name="boilerplate"/>
|
421
373
|
</optional>
|
@@ -427,6 +379,14 @@
|
|
427
379
|
<ref name="annex"/>
|
428
380
|
</zeroOrMore>
|
429
381
|
<ref name="bibliography"/>
|
382
|
+
<zeroOrMore>
|
383
|
+
<ref name="indexsect"/>
|
384
|
+
</zeroOrMore>
|
385
|
+
</element>
|
386
|
+
</define>
|
387
|
+
<define name="horizontal">
|
388
|
+
<element name="horizontal">
|
389
|
+
<data type="boolean"/>
|
430
390
|
</element>
|
431
391
|
</define>
|
432
392
|
<define name="documentnumber">
|
@@ -510,28 +470,6 @@
|
|
510
470
|
<ref name="Clause-Section"/>
|
511
471
|
</element>
|
512
472
|
</define>
|
513
|
-
<define name="ul_li">
|
514
|
-
<element name="li">
|
515
|
-
<optional>
|
516
|
-
<attribute name="id">
|
517
|
-
<data type="ID"/>
|
518
|
-
</attribute>
|
519
|
-
</optional>
|
520
|
-
<optional>
|
521
|
-
<attribute name="uncheckedcheckbox">
|
522
|
-
<data type="boolean"/>
|
523
|
-
</attribute>
|
524
|
-
</optional>
|
525
|
-
<optional>
|
526
|
-
<attribute name="checkedcheckbox">
|
527
|
-
<data type="boolean"/>
|
528
|
-
</attribute>
|
529
|
-
</optional>
|
530
|
-
<oneOrMore>
|
531
|
-
<ref name="BasicBlock"/>
|
532
|
-
</oneOrMore>
|
533
|
-
</element>
|
534
|
-
</define>
|
535
473
|
<define name="stagename">
|
536
474
|
<element name="stagename">
|
537
475
|
<text/>
|
data/grammars/reqt.rng
CHANGED
@@ -30,15 +30,34 @@
|
|
30
30
|
<data type="boolean"/>
|
31
31
|
</attribute>
|
32
32
|
</optional>
|
33
|
+
<optional>
|
34
|
+
<attribute name="number"/>
|
35
|
+
</optional>
|
33
36
|
<optional>
|
34
37
|
<attribute name="subsequence"/>
|
35
38
|
</optional>
|
39
|
+
<optional>
|
40
|
+
<attribute name="keep-with-next">
|
41
|
+
<data type="boolean"/>
|
42
|
+
</attribute>
|
43
|
+
</optional>
|
44
|
+
<optional>
|
45
|
+
<attribute name="keep-lines-together">
|
46
|
+
<data type="boolean"/>
|
47
|
+
</attribute>
|
48
|
+
</optional>
|
36
49
|
<attribute name="id">
|
37
50
|
<data type="ID"/>
|
38
51
|
</attribute>
|
39
52
|
<optional>
|
40
53
|
<attribute name="filename"/>
|
41
54
|
</optional>
|
55
|
+
<optional>
|
56
|
+
<attribute name="model"/>
|
57
|
+
</optional>
|
58
|
+
<optional>
|
59
|
+
<attribute name="type"/>
|
60
|
+
</optional>
|
42
61
|
<optional>
|
43
62
|
<ref name="reqtitle"/>
|
44
63
|
</optional>
|
@@ -48,9 +67,9 @@
|
|
48
67
|
<optional>
|
49
68
|
<ref name="subject"/>
|
50
69
|
</optional>
|
51
|
-
<
|
70
|
+
<zeroOrMore>
|
52
71
|
<ref name="reqinherit"/>
|
53
|
-
</
|
72
|
+
</zeroOrMore>
|
54
73
|
<zeroOrMore>
|
55
74
|
<ref name="classification"/>
|
56
75
|
</zeroOrMore>
|
@@ -135,6 +154,16 @@
|
|
135
154
|
<data type="boolean"/>
|
136
155
|
</attribute>
|
137
156
|
</optional>
|
157
|
+
<optional>
|
158
|
+
<attribute name="keep-with-next">
|
159
|
+
<data type="boolean"/>
|
160
|
+
</attribute>
|
161
|
+
</optional>
|
162
|
+
<optional>
|
163
|
+
<attribute name="keep-lines-together">
|
164
|
+
<data type="boolean"/>
|
165
|
+
</attribute>
|
166
|
+
</optional>
|
138
167
|
<oneOrMore>
|
139
168
|
<ref name="BasicBlock"/>
|
140
169
|
</oneOrMore>
|
@@ -24,7 +24,7 @@ module RelatonIsoBib
|
|
24
24
|
TYPES = %w[
|
25
25
|
international-standard technical-specification technical-report
|
26
26
|
publicly-available-specification international-workshop-agreement guide
|
27
|
-
amendment technical-corrigendum
|
27
|
+
amendment technical-corrigendum directive
|
28
28
|
].freeze
|
29
29
|
|
30
30
|
# @return [RelatonIsoBib::StructuredIdentifier]
|
@@ -36,6 +36,9 @@ module RelatonIsoBib
|
|
36
36
|
# @return [String, NilClass]
|
37
37
|
attr_reader :doctype, :stagename
|
38
38
|
|
39
|
+
# @return [Boolean, nil]
|
40
|
+
attr_reader :horizontal
|
41
|
+
|
39
42
|
# @return [RelatonIsoBib::EditorialGroup]
|
40
43
|
attr_reader :editorialgroup
|
41
44
|
|
@@ -62,6 +65,8 @@ module RelatonIsoBib
|
|
62
65
|
# @param classification [RelatonBib::Classification, NilClass]
|
63
66
|
# @param validity [RelatonBib:Validity, NilClass]
|
64
67
|
# @param docid [Array<RelatonBib::DocumentIdentifier>]
|
68
|
+
# @param doctype [String, nil]
|
69
|
+
# @param horizontal [Boolean, nil]
|
65
70
|
# @param structuredidentifier [RelatonIsoBib::StructuredIdentifier]
|
66
71
|
# @param stagename [String, NilClass]
|
67
72
|
#
|
@@ -143,7 +148,7 @@ module RelatonIsoBib
|
|
143
148
|
end
|
144
149
|
|
145
150
|
@structuredidentifier = args[:structuredidentifier]
|
146
|
-
|
151
|
+
@horizontal = args[:horizontal]
|
147
152
|
@ics = args.fetch(:ics, []).map { |i| i.is_a?(Hash) ? Ics.new(**i) : i }
|
148
153
|
@stagename = args[:stagename]
|
149
154
|
@id_attribute = true
|
@@ -156,22 +161,22 @@ module RelatonIsoBib
|
|
156
161
|
# @return [String] XML
|
157
162
|
def to_xml(**opts)
|
158
163
|
super **opts do |b|
|
159
|
-
if
|
160
|
-
|
161
|
-
block_given?)
|
164
|
+
if block_given? then yield b
|
165
|
+
elsif opts[:bibdata] && has_ext_attrs?
|
162
166
|
b.ext do
|
163
167
|
b.doctype doctype if doctype
|
164
|
-
b.
|
168
|
+
b.horizontal horizontal unless horizontal.nil?
|
169
|
+
# b.docsubtype docsubtype if respond_to?(:docsubtype) && docsubtype
|
165
170
|
# GB renders gbcommittee elements istead of an editorialgroup
|
166
|
-
if respond_to? :committee
|
167
|
-
|
168
|
-
else
|
169
|
-
|
170
|
-
end
|
171
|
+
# if respond_to? :committee
|
172
|
+
# committee&.to_xml b
|
173
|
+
# else
|
174
|
+
editorialgroup&.to_xml b
|
175
|
+
# end
|
171
176
|
ics.each { |i| i.to_xml b }
|
172
177
|
structuredidentifier&.to_xml b
|
173
178
|
b.stagename stagename if stagename
|
174
|
-
yield b if block_given?
|
179
|
+
# yield b if block_given?
|
175
180
|
end
|
176
181
|
end
|
177
182
|
end
|
@@ -183,6 +188,7 @@ module RelatonIsoBib
|
|
183
188
|
# @return [Hash]
|
184
189
|
def to_hash
|
185
190
|
hash = super
|
191
|
+
hash["horizontal"] = horizontal unless horizontal.nil?
|
186
192
|
hash["stagename"] = stagename if stagename
|
187
193
|
hash
|
188
194
|
end
|
@@ -190,7 +196,7 @@ module RelatonIsoBib
|
|
190
196
|
# @param prefix [String]
|
191
197
|
# @return [String]
|
192
198
|
def to_asciibib(prefix = "")
|
193
|
-
pref = prefix.empty? ? prefix : prefix
|
199
|
+
pref = prefix.empty? ? prefix : "#{prefix}."
|
194
200
|
out = super
|
195
201
|
out += "#{pref}stagename:: #{stagename}\n" if stagename
|
196
202
|
out
|
@@ -218,5 +224,13 @@ module RelatonIsoBib
|
|
218
224
|
end
|
219
225
|
idstr&.gsub(/:/, "-")&.gsub(/\s/, "")&.strip
|
220
226
|
end
|
227
|
+
|
228
|
+
#
|
229
|
+
# @return [Boolean]
|
230
|
+
#
|
231
|
+
def has_ext_attrs? # rubocop:disable Metrics/CyclomaticComplexity
|
232
|
+
(doctype || !horizontal.nil? || editorialgroup || ics.any? ||
|
233
|
+
structuredidentifier || stagename || horizontal)
|
234
|
+
end
|
221
235
|
end
|
222
236
|
end
|
@@ -13,9 +13,8 @@ module RelatonIsoBib
|
|
13
13
|
ext = isoitem.at "./ext"
|
14
14
|
return data unless ext
|
15
15
|
|
16
|
-
|
17
|
-
data[:
|
18
|
-
data[:structuredidentifier] = fetch_structuredidentifier ext
|
16
|
+
hrzt = ext.at("./horizontal")
|
17
|
+
data[:horizontal] = hrzt.text == "true" if hrzt
|
19
18
|
data[:stagename] = ext.at("./stagename")&.text
|
20
19
|
data
|
21
20
|
end
|
data/relaton_iso_bib.gemspec
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: relaton-iso-bib
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.
|
4
|
+
version: 1.8.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: 2021-
|
11
|
+
date: 2021-05-17 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: equivalent-xml
|
@@ -114,14 +114,14 @@ dependencies:
|
|
114
114
|
requirements:
|
115
115
|
- - "~>"
|
116
116
|
- !ruby/object:Gem::Version
|
117
|
-
version: 1.
|
117
|
+
version: 1.8.0
|
118
118
|
type: :runtime
|
119
119
|
prerelease: false
|
120
120
|
version_requirements: !ruby/object:Gem::Requirement
|
121
121
|
requirements:
|
122
122
|
- - "~>"
|
123
123
|
- !ruby/object:Gem::Version
|
124
|
-
version: 1.
|
124
|
+
version: 1.8.0
|
125
125
|
description: 'RelatonIsoBib: Ruby ISOXMLDOC impementation.'
|
126
126
|
email:
|
127
127
|
- open.source@ribose.com
|