relaton-iso-bib 1.16.2 → 1.18.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: 4da0e98206115f1448b10d16ba8c6521a38bc25762f9b1ecabf07e11b415c293
4
- data.tar.gz: f09b435e8ec48229bd3fbe516d476cda07f0ade028a5f141174fc97d7f3b07cc
3
+ metadata.gz: 240dcef5e33b4150ea0b8dbd7e5fca3d33b9142272444bec69f563465fef421f
4
+ data.tar.gz: 991fc22a605a89a0e60cf1e0fdcda36d762dbd009423b2a72f6c84eb31a44ca3
5
5
  SHA512:
6
- metadata.gz: bd267c0503570dc5e86586a574cb0da0f032680019d68eea433ab5d97ac11551f41c2a646653aef17b7ed70dea3879cc0f9eb8cfcd7b73f4751bf33d58c40a6d
7
- data.tar.gz: 1761fbed48d7aa9d0d200fb0061aa2ca17fc0e3c8264e3a75349ac3a797457f996c1557d23c16d43af6e4ddff6310f2ec6af57d0e5076150814805e4bc7b5937
6
+ metadata.gz: e4127f04b3be531d2bfd44faaa8c2d7df59c67009175ca06d52912cc0e0f4bac19a971ce60dba7d19f59abf6d178b8cc019035080b809bb92d0b123f155d7bf4
7
+ data.tar.gz: 45e28f577e029540ae0baaab72fc3cc2e1eb2fae114f71178d1f503a6c9c0ad9a4764379bcdd31869638eda4c831022779693064d55874d13b786f5a0924137e
@@ -10,4 +10,4 @@ on:
10
10
 
11
11
  jobs:
12
12
  rake:
13
- uses: relaton/support/.github/workflows/rake.yml@master
13
+ uses: relaton/support/.github/workflows/rake.yml@main
@@ -17,7 +17,7 @@ on:
17
17
 
18
18
  jobs:
19
19
  release:
20
- uses: relaton/support/.github/workflows/release.yml@master
20
+ uses: relaton/support/.github/workflows/release.yml@main
21
21
  with:
22
22
  next_version: ${{ github.event.inputs.next_version }}
23
23
  secrets:
@@ -95,8 +95,89 @@
95
95
  <ref name="pagebreak"/>
96
96
  <ref name="hr"/>
97
97
  <ref name="bookmark"/>
98
+ <ref name="amend"/>
98
99
  </choice>
99
100
  </define>
101
+ <define name="amend">
102
+ <element name="amend">
103
+ <ref name="AmendType"/>
104
+ </element>
105
+ </define>
106
+ <define name="AmendType">
107
+ <optional>
108
+ <attribute name="id">
109
+ <data type="ID"/>
110
+ </attribute>
111
+ </optional>
112
+ <attribute name="change">
113
+ <choice>
114
+ <value>add</value>
115
+ <value>modify</value>
116
+ <value>delete</value>
117
+ <value>replace</value>
118
+ </choice>
119
+ </attribute>
120
+ <optional>
121
+ <attribute name="path"/>
122
+ </optional>
123
+ <optional>
124
+ <attribute name="path_end"/>
125
+ </optional>
126
+ <optional>
127
+ <attribute name="title"/>
128
+ </optional>
129
+ <optional>
130
+ <element name="location">
131
+ <zeroOrMore>
132
+ <choice>
133
+ <ref name="locality"/>
134
+ <ref name="localityStack"/>
135
+ </choice>
136
+ </zeroOrMore>
137
+ </element>
138
+ </optional>
139
+ <optional>
140
+ <element name="description">
141
+ <zeroOrMore>
142
+ <ref name="BasicBlock"/>
143
+ </zeroOrMore>
144
+ </element>
145
+ </optional>
146
+ <optional>
147
+ <element name="newcontent">
148
+ <optional>
149
+ <attribute name="id">
150
+ <data type="ID"/>
151
+ </attribute>
152
+ </optional>
153
+ <zeroOrMore>
154
+ <ref name="BasicBlock"/>
155
+ </zeroOrMore>
156
+ </element>
157
+ </optional>
158
+ <zeroOrMore>
159
+ <ref name="classification"/>
160
+ </zeroOrMore>
161
+ <zeroOrMore>
162
+ <ref name="contributor"/>
163
+ </zeroOrMore>
164
+ </define>
165
+ <define name="classification">
166
+ <element name="classification">
167
+ <ref name="classification_tag"/>
168
+ <ref name="classification_value"/>
169
+ </element>
170
+ </define>
171
+ <define name="classification_tag">
172
+ <element name="tag">
173
+ <text/>
174
+ </element>
175
+ </define>
176
+ <define name="classification_value">
177
+ <element name="value">
178
+ <text/>
179
+ </element>
180
+ </define>
100
181
  <define name="paragraph">
101
182
  <element name="p">
102
183
  <ref name="ParagraphType"/>
@@ -715,27 +796,36 @@
715
796
  </define>
716
797
  <define name="ruby">
717
798
  <element name="ruby">
718
- <zeroOrMore>
719
- <choice>
720
- <ref name="PureTextElement"/>
721
- <ref name="rp"/>
722
- <ref name="rt"/>
723
- </choice>
724
- </zeroOrMore>
799
+ <choice>
800
+ <ref name="ruby_pronunciation"/>
801
+ <ref name="ruby_annotation"/>
802
+ </choice>
803
+ <choice>
804
+ <text/>
805
+ <ref name="ruby"/>
806
+ </choice>
725
807
  </element>
726
808
  </define>
727
- <define name="rp">
728
- <element name="rp">
729
- <zeroOrMore>
730
- <ref name="PureTextElement"/>
731
- </zeroOrMore>
809
+ <define name="ruby_pronunciation">
810
+ <element name="pronunciation">
811
+ <attribute name="value"/>
812
+ <optional>
813
+ <attribute name="script"/>
814
+ </optional>
815
+ <optional>
816
+ <attribute name="lang"/>
817
+ </optional>
732
818
  </element>
733
819
  </define>
734
- <define name="rt">
735
- <element name="rt">
736
- <zeroOrMore>
737
- <ref name="PureTextElement"/>
738
- </zeroOrMore>
820
+ <define name="ruby_annotation">
821
+ <element name="annotation">
822
+ <attribute name="value"/>
823
+ <optional>
824
+ <attribute name="script"/>
825
+ </optional>
826
+ <optional>
827
+ <attribute name="lang"/>
828
+ </optional>
739
829
  </element>
740
830
  </define>
741
831
  <define name="br">
@@ -914,44 +1004,49 @@
914
1004
  -->
915
1005
  <define name="image">
916
1006
  <element name="image">
917
- <attribute name="id">
918
- <data type="ID"/>
1007
+ <ref name="Image"/>
1008
+ </element>
1009
+ </define>
1010
+ <define name="Image">
1011
+ <attribute name="id">
1012
+ <data type="ID"/>
1013
+ </attribute>
1014
+ <attribute name="src">
1015
+ <data type="anyURI"/>
1016
+ </attribute>
1017
+ <attribute name="mimetype"/>
1018
+ <optional>
1019
+ <attribute name="filename"/>
1020
+ </optional>
1021
+ <optional>
1022
+ <attribute name="width">
1023
+ <ref name="ImageSize"/>
919
1024
  </attribute>
920
- <attribute name="src">
1025
+ </optional>
1026
+ <optional>
1027
+ <attribute name="height">
1028
+ <ref name="ImageSize"/>
1029
+ </attribute>
1030
+ </optional>
1031
+ <optional>
1032
+ <attribute name="alt"/>
1033
+ </optional>
1034
+ <optional>
1035
+ <attribute name="title"/>
1036
+ </optional>
1037
+ <optional>
1038
+ <attribute name="longdesc">
921
1039
  <data type="anyURI"/>
922
1040
  </attribute>
923
- <attribute name="mimetype"/>
924
- <optional>
925
- <attribute name="filename"/>
926
- </optional>
927
- <optional>
928
- <attribute name="width">
929
- <choice>
930
- <data type="int"/>
931
- <value>auto</value>
932
- </choice>
933
- </attribute>
934
- </optional>
935
- <optional>
936
- <attribute name="height">
937
- <choice>
938
- <data type="int"/>
939
- <value>auto</value>
940
- </choice>
941
- </attribute>
942
- </optional>
943
- <optional>
944
- <attribute name="alt"/>
945
- </optional>
946
- <optional>
947
- <attribute name="title"/>
948
- </optional>
949
- <optional>
950
- <attribute name="longdesc">
951
- <data type="anyURI"/>
952
- </attribute>
953
- </optional>
954
- </element>
1041
+ </optional>
1042
+ </define>
1043
+ <define name="ImageSize">
1044
+ <choice>
1045
+ <data type="string">
1046
+ <param name="pattern">\d+([.]\d+)?(%?)</param>
1047
+ </data>
1048
+ <value>auto</value>
1049
+ </choice>
955
1050
  </define>
956
1051
  <define name="video">
957
1052
  <element name="video">
@@ -9,11 +9,42 @@
9
9
  -->
10
10
  <include href="biblio.rng">
11
11
  <define name="BibData">
12
- <ref name="BibliographicItem"/>
12
+ <ref name="StandardBibliographicItem"/>
13
13
  <optional>
14
14
  <ref name="ext"/>
15
15
  </optional>
16
16
  </define>
17
+ <define name="docrelation">
18
+ <element name="relation">
19
+ <attribute name="type">
20
+ <ref name="DocRelationType"/>
21
+ </attribute>
22
+ <optional>
23
+ <element name="description">
24
+ <ref name="FormattedString"/>
25
+ </element>
26
+ </optional>
27
+ <element name="bibitem">
28
+ <ref name="StandardReducedBibliographicItem"/>
29
+ </element>
30
+ <choice>
31
+ <zeroOrMore>
32
+ <ref name="locality"/>
33
+ </zeroOrMore>
34
+ <zeroOrMore>
35
+ <ref name="localityStack"/>
36
+ </zeroOrMore>
37
+ </choice>
38
+ <choice>
39
+ <zeroOrMore>
40
+ <ref name="sourceLocality"/>
41
+ </zeroOrMore>
42
+ <zeroOrMore>
43
+ <ref name="sourceLocalityStack"/>
44
+ </zeroOrMore>
45
+ </choice>
46
+ </element>
47
+ </define>
17
48
  </include>
18
49
  <define name="ext">
19
50
  <element name="ext">
@@ -161,4 +192,16 @@
161
192
  </optional>
162
193
  </element>
163
194
  </define>
195
+ <define name="StandardBibliographicItem">
196
+ <ref name="BibliographicItem"/>
197
+ <zeroOrMore>
198
+ <ref name="amend"/>
199
+ </zeroOrMore>
200
+ </define>
201
+ <define name="StandardReducedBibliographicItem">
202
+ <ref name="ReducedBibliographicItem"/>
203
+ <zeroOrMore>
204
+ <ref name="amend"/>
205
+ </zeroOrMore>
206
+ </define>
164
207
  </grammar>
data/grammars/biblio.rng CHANGED
@@ -241,6 +241,9 @@
241
241
  </element>
242
242
  </define>
243
243
  <define name="FullNameType">
244
+ <optional>
245
+ <ref name="name_abbreviation"/>
246
+ </optional>
244
247
  <choice>
245
248
  <group>
246
249
  <zeroOrMore>
@@ -266,6 +269,11 @@
266
269
  <ref name="variantname"/>
267
270
  </zeroOrMore>
268
271
  </define>
272
+ <define name="name_abbreviation">
273
+ <element name="abbreviation">
274
+ <ref name="LocalizedString"/>
275
+ </element>
276
+ </define>
269
277
  <define name="prefix">
270
278
  <element name="prefix">
271
279
  <ref name="LocalizedString"/>
@@ -348,6 +356,9 @@
348
356
  <zeroOrMore>
349
357
  <ref name="contact"/>
350
358
  </zeroOrMore>
359
+ <optional>
360
+ <ref name="logo"/>
361
+ </optional>
351
362
  </element>
352
363
  </define>
353
364
  <define name="orgname">
@@ -366,6 +377,21 @@
366
377
  </choice>
367
378
  </element>
368
379
  </define>
380
+ <define name="logo">
381
+ <element name="logo">
382
+ <ref name="image"/>
383
+ </element>
384
+ </define>
385
+ <define name="depiction">
386
+ <element name="depiction">
387
+ <optional>
388
+ <attribute name="scope"/>
389
+ </optional>
390
+ <zeroOrMore>
391
+ <ref name="image"/>
392
+ </zeroOrMore>
393
+ </element>
394
+ </define>
369
395
  <define name="NameWithVariants">
370
396
  <element name="primary">
371
397
  <ref name="LocalizedString"/>
@@ -752,6 +778,9 @@
752
778
  <optional>
753
779
  <ref name="validity"/>
754
780
  </optional>
781
+ <optional>
782
+ <ref name="depiction"/>
783
+ </optional>
755
784
  </define>
756
785
  <define name="ReducedBibliographicItem">
757
786
  <optional>
@@ -849,6 +878,9 @@
849
878
  <optional>
850
879
  <ref name="validity"/>
851
880
  </optional>
881
+ <optional>
882
+ <ref name="depiction"/>
883
+ </optional>
852
884
  </define>
853
885
  <define name="btitle">
854
886
  <element name="title">
@@ -0,0 +1,32 @@
1
+ module RelatonIsoBib
2
+ class DocumentType < RelatonBib::DocumentType
3
+ DOCTYPES = %w[
4
+ international-standard technical-specification technical-report
5
+ publicly-available-specification international-workshop-agreement guide
6
+ amendment technical-corrigendum directive
7
+ ].freeze
8
+
9
+ #
10
+ # Create a new DocumentType object.
11
+ #
12
+ # @param [String] type document type
13
+ # @param [String, nil] abbreviation type abbreviation
14
+ #
15
+ def initialize(type:, abbreviation: nil)
16
+ check_doctype type
17
+ super
18
+ end
19
+
20
+ #
21
+ # Check if type is valid.
22
+ #
23
+ # @param [String] type document type
24
+ #
25
+ def check_doctype(type)
26
+ unless DOCTYPES.include? type
27
+ Util.warn "WARNING: invalid doctype: `#{type}`"
28
+ Util.warn "Allowed doctypes are: `#{DOCTYPES.join('`, `')}`"
29
+ end
30
+ end
31
+ end
32
+ end
@@ -1,52 +1,57 @@
1
1
  module RelatonIsoBib
2
- class HashConverter < RelatonBib::HashConverter
3
- class << self
4
- private
5
-
6
- #
7
- # Ovverides superclass's method
8
- #
9
- # @param item [Hash]
10
- # @retirn [RelatonIsoBib::IsoBibliographicItem]
11
- def bib_item(item)
12
- IsoBibliographicItem.new(**item)
13
- end
2
+ module HashConverter
3
+ include RelatonBib::HashConverter
4
+ extend self
14
5
 
15
- #
16
- # Ovverides superclass's method
17
- #
18
- # @param title [Hash]
19
- # @return [RelatonBib::TypedTitleString]
20
- def typed_title_strig(title)
21
- RelatonBib::TypedTitleString.new(**title)
22
- end
6
+ private
23
7
 
24
- # @param ret [Hash]
25
- def editorialgroup_hash_to_bib(ret)
26
- eg = ret[:editorialgroup]
27
- return unless eg
28
-
29
- ret[:editorialgroup] = EditorialGroup.new(
30
- technical_committee: RelatonBib.array(eg[:technical_committee]),
31
- subcommittee: RelatonBib.array(eg[:subcommittee]),
32
- workgroup: RelatonBib.array(eg[:workgroup]),
33
- secretariat: eg[:secretariat],
34
- )
35
- end
8
+ #
9
+ # Ovverides superclass's method
10
+ #
11
+ # @param item [Hash]
12
+ # @retirn [RelatonIsoBib::IsoBibliographicItem]
13
+ def bib_item(item)
14
+ IsoBibliographicItem.new(**item)
15
+ end
36
16
 
37
- # @param ret [Hash]
38
- def ics_hash_to_bib(ret)
39
- ret[:ics] = RelatonBib.array(ret[:ics]).map do |ics|
40
- Ics.new(ics[:code] || ics)
41
- end
42
- end
17
+ #
18
+ # Ovverides superclass's method
19
+ #
20
+ # @param title [Hash]
21
+ # @return [RelatonBib::TypedTitleString]
22
+ def typed_title_strig(title)
23
+ RelatonBib::TypedTitleString.new(**title)
24
+ end
43
25
 
44
- # @param ret [Hash]
45
- def structuredidentifier_hash_to_bib(ret)
46
- return unless ret[:structuredidentifier]
26
+ # @param ret [Hash]
27
+ def editorialgroup_hash_to_bib(ret)
28
+ eg = ret[:editorialgroup]
29
+ return unless eg
47
30
 
48
- ret[:structuredidentifier] = RelatonIsoBib::StructuredIdentifier.new(**ret[:structuredidentifier])
31
+ ret[:editorialgroup] = EditorialGroup.new(
32
+ technical_committee: RelatonBib.array(eg[:technical_committee]),
33
+ subcommittee: RelatonBib.array(eg[:subcommittee]),
34
+ workgroup: RelatonBib.array(eg[:workgroup]),
35
+ secretariat: eg[:secretariat],
36
+ )
37
+ end
38
+
39
+ # @param ret [Hash]
40
+ def ics_hash_to_bib(ret)
41
+ ret[:ics] = RelatonBib.array(ret[:ics]).map do |ics|
42
+ Ics.new(ics[:code] || ics)
49
43
  end
50
44
  end
45
+
46
+ # @param ret [Hash]
47
+ def structuredidentifier_hash_to_bib(ret)
48
+ return unless ret[:structuredidentifier]
49
+
50
+ ret[:structuredidentifier] = RelatonIsoBib::StructuredIdentifier.new(**ret[:structuredidentifier])
51
+ end
52
+
53
+ def create_doctype(**args)
54
+ DocumentType.new(**args)
55
+ end
51
56
  end
52
57
  end
@@ -18,22 +18,16 @@ end
18
18
  module RelatonIsoBib
19
19
  # Bibliographic item.
20
20
  class IsoBibliographicItem < RelatonBib::BibliographicItem
21
- DOCTYPES = %w[
22
- international-standard technical-specification technical-report
23
- publicly-available-specification international-workshop-agreement guide
24
- amendment technical-corrigendum directive
25
- ].freeze
26
-
27
21
  SUBDOCTYPES = %w[specification method-of-test vocabulary code-of-practice].freeze
28
22
 
29
23
  # @return [RelatonIsoBib::StructuredIdentifier]
30
24
  attr_reader :structuredidentifier
31
25
 
32
- # @!attribute [r] title
33
- # @return [Array<RelatonBib::TypedTitleString>]
26
+ # @return [String, nil]
27
+ attr_reader :stagename
34
28
 
35
- # @return [String, NilClass]
36
- attr_reader :doctype, :stagename
29
+ # @!attribute [r] subdoctype
30
+ # @return [RelatonIsoBib::DocumentType]
37
31
 
38
32
  # @return [Boolean, nil]
39
33
  attr_reader :horizontal
@@ -64,18 +58,13 @@ module RelatonIsoBib
64
58
  # @param classification [RelatonBib::Classification, NilClass]
65
59
  # @param validity [RelatonBib:Validity, NilClass]
66
60
  # @param docid [Array<RelatonBib::DocumentIdentifier>]
67
- # @param doctype [String, nil]
61
+ # @param doctype [RelatonIsoBib::DocumentType]
68
62
  # @param subdoctype [String, nil]
69
63
  # @param horizontal [Boolean, nil]
70
64
  # @param structuredidentifier [RelatonIsoBib::StructuredIdentifier]
71
65
  # @param stagename [String, NilClass]
72
66
  #
73
- # @param title [Array<Hash>]
74
- # @option title [String] :title_intro
75
- # @option title [String] :title_main
76
- # @option title [String] :title_part
77
- # @option title [String] :language
78
- # @option title [String] :script
67
+ # @param title [Array<Hash, RelatonBib::TypedTitleString>, RelatonBib::TypedTitleStringCollection]
79
68
  #
80
69
  # @param editorialgroup [Hash, RelatonIsoBib::EditorialGroup]
81
70
  # @option workgrpup [String] :name
@@ -128,8 +117,6 @@ module RelatonIsoBib
128
117
  #
129
118
  # @raise [ArgumentError]
130
119
  def initialize(**args)
131
- check_doctype args[:doctype]
132
-
133
120
  args[:type] ||= "standard"
134
121
  arg_names = %i[
135
122
  id title docnumber language script docstatus date abstract contributor
@@ -183,7 +170,7 @@ module RelatonIsoBib
183
170
  if block_given? then yield b
184
171
  elsif opts[:bibdata] && has_ext_attrs?
185
172
  ext = b.ext do
186
- b.doctype doctype if doctype
173
+ doctype.to_xml b if doctype
187
174
  b.subdoctype subdoctype if subdoctype
188
175
  b.horizontal horizontal unless horizontal.nil?
189
176
  editorialgroup&.to_xml b
@@ -224,15 +211,6 @@ module RelatonIsoBib
224
211
 
225
212
  private
226
213
 
227
- # @param doctype [String]
228
- # @raise ArgumentError
229
- def check_doctype(doctype)
230
- if doctype && !self.class::DOCTYPES.include?(doctype)
231
- Util.warn "WARNING: invalid doctype: #{doctype}"
232
- Util.warn "Allowed doctypes are: #{self.class::DOCTYPES.join(', ')}"
233
- end
234
- end
235
-
236
214
  def makeid(id, attribute, _delim = "") # rubocop:disable Metrics/CyclomaticComplexity,Metrics/PerceivedComplexity,Metrics/AbcSize
237
215
  return nil if attribute && !@id_attribute
238
216
 
@@ -1,3 +1,3 @@
1
1
  module RelatonIsoBib
2
- VERSION = "1.16.2".freeze
2
+ VERSION = "1.18.0".freeze
3
3
  end
@@ -4,6 +4,7 @@ require "relaton_bib"
4
4
  require "relaton_iso_bib/version"
5
5
  require "relaton_iso_bib/config"
6
6
  require "relaton_iso_bib/util"
7
+ require "relaton_iso_bib/document_type"
7
8
  require "relaton_iso_bib/iso_bibliographic_item"
8
9
  require "digest/md5"
9
10
 
@@ -27,5 +27,5 @@ Gem::Specification.new do |spec|
27
27
  spec.required_ruby_version = Gem::Requirement.new(">= 2.7.0")
28
28
 
29
29
  spec.add_dependency "isoics", "~> 0.1.6"
30
- spec.add_dependency "relaton-bib", "~> 1.16.0"
30
+ spec.add_dependency "relaton-bib", "~> 1.18.0"
31
31
  end
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.16.2
4
+ version: 1.18.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: 2023-11-15 00:00:00.000000000 Z
11
+ date: 2024-01-06 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: isoics
@@ -30,14 +30,14 @@ dependencies:
30
30
  requirements:
31
31
  - - "~>"
32
32
  - !ruby/object:Gem::Version
33
- version: 1.16.0
33
+ version: 1.18.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: 1.16.0
40
+ version: 1.18.0
41
41
  description: 'RelatonIsoBib: Ruby ISOXMLDOC impementation.'
42
42
  email:
43
43
  - open.source@ribose.com
@@ -64,6 +64,7 @@ files:
64
64
  - grammars/relaton-iso.rng
65
65
  - lib/relaton_iso_bib.rb
66
66
  - lib/relaton_iso_bib/config.rb
67
+ - lib/relaton_iso_bib/document_type.rb
67
68
  - lib/relaton_iso_bib/editorial_group.rb
68
69
  - lib/relaton_iso_bib/hash_converter.rb
69
70
  - lib/relaton_iso_bib/ics.rb