relaton-bib 1.16.5 → 1.17.1

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: 9cd83f1b6817d3aff3fb219312882391f32f69a31e1683e6437e48771985b4a2
4
- data.tar.gz: ecbc877b14f379f0138470922b4a40feffcec3be4a7d351d50a134108317d73b
3
+ metadata.gz: a507a7fa74bc5be4e5148c8f80f91dc77a602b356187168d412beb958d30ad67
4
+ data.tar.gz: 41d821df9469b709f76d98288d6ec80fa0959d3d6e7ab867f08095283ed3eaf9
5
5
  SHA512:
6
- metadata.gz: 04f486d465f35b8214bc0978a15d47678e26fc2e78d72bb6e3875771af2c480bc21f2cef576a3deee9fb99c72ecec40da6a6826c88cbf81607aba51e84757647
7
- data.tar.gz: 17a64cd868fa320959cf44a65e0794273aaf8ba992d36d4bf90bd774b66484d4021dde1285144530892a398d84b955f8aba1774ffdcbc7532d56d60ee6c6c738
6
+ metadata.gz: 0d1daace14ed81e05633e2340d26c1f591afcb8d5ea8b742c3cabe66e74f92def40966a20fadbd182b1b4808e6cbfa3cae9f1abb3dd40035ad2c2bc118392d85
7
+ data.tar.gz: a08ae4ae1f9c3563c242d8940172cf44bd23e182237b39d91a37f572719694695bbaf9b5805bfcafb76e201eaead8506a8bd878ec8f0aed7722c7d6815e19441
@@ -914,44 +914,47 @@
914
914
  -->
915
915
  <define name="image">
916
916
  <element name="image">
917
- <attribute name="id">
918
- <data type="ID"/>
917
+ <ref name="Image"/>
918
+ </element>
919
+ </define>
920
+ <define name="Image">
921
+ <attribute name="id">
922
+ <data type="ID"/>
923
+ </attribute>
924
+ <attribute name="src">
925
+ <data type="anyURI"/>
926
+ </attribute>
927
+ <attribute name="mimetype"/>
928
+ <optional>
929
+ <attribute name="filename"/>
930
+ </optional>
931
+ <optional>
932
+ <attribute name="width">
933
+ <choice>
934
+ <data type="int"/>
935
+ <value>auto</value>
936
+ </choice>
919
937
  </attribute>
920
- <attribute name="src">
938
+ </optional>
939
+ <optional>
940
+ <attribute name="height">
941
+ <choice>
942
+ <data type="int"/>
943
+ <value>auto</value>
944
+ </choice>
945
+ </attribute>
946
+ </optional>
947
+ <optional>
948
+ <attribute name="alt"/>
949
+ </optional>
950
+ <optional>
951
+ <attribute name="title"/>
952
+ </optional>
953
+ <optional>
954
+ <attribute name="longdesc">
921
955
  <data type="anyURI"/>
922
956
  </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>
957
+ </optional>
955
958
  </define>
956
959
  <define name="video">
957
960
  <element name="video">
data/grammars/biblio.rng CHANGED
@@ -348,6 +348,9 @@
348
348
  <zeroOrMore>
349
349
  <ref name="contact"/>
350
350
  </zeroOrMore>
351
+ <optional>
352
+ <ref name="logo"/>
353
+ </optional>
351
354
  </element>
352
355
  </define>
353
356
  <define name="orgname">
@@ -366,6 +369,21 @@
366
369
  </choice>
367
370
  </element>
368
371
  </define>
372
+ <define name="logo">
373
+ <element name="logo">
374
+ <ref name="image"/>
375
+ </element>
376
+ </define>
377
+ <define name="depiction">
378
+ <element name="depiction">
379
+ <optional>
380
+ <attribute name="scope"/>
381
+ </optional>
382
+ <zeroOrMore>
383
+ <ref name="image"/>
384
+ </zeroOrMore>
385
+ </element>
386
+ </define>
369
387
  <define name="NameWithVariants">
370
388
  <element name="primary">
371
389
  <ref name="LocalizedString"/>
@@ -752,6 +770,9 @@
752
770
  <optional>
753
771
  <ref name="validity"/>
754
772
  </optional>
773
+ <optional>
774
+ <ref name="depiction"/>
775
+ </optional>
755
776
  </define>
756
777
  <define name="ReducedBibliographicItem">
757
778
  <optional>
@@ -1,8 +1,8 @@
1
1
  {
2
- "relaton-models": "v1.2.5",
2
+ "relaton-models": "v1.2.7",
3
3
  "basicdoc-models": "v1.0.3",
4
4
  "metanorma-requirements-models": "v1.0.0",
5
- "relaton-model-ieee": "v1.0.0",
5
+ "relaton-model-ieee": "v1.0.1",
6
6
  "relaton-model-iso": "v1.0.0",
7
7
  "relaton-model-iec": "v1.0.0",
8
8
  "relaton-model-bsi": "v1.0.2",
@@ -28,7 +28,7 @@
28
28
  "relaton-model-omg": "v1.0.0",
29
29
  "relaton-model-oasis": "v1.0.1",
30
30
  "relaton-model-jis": "v0.0.1",
31
- "relaton-model-etsi": "v0.0.1",
32
- "metanorma-model": "v1.2.8",
33
- "date": "2023-11-13T23:08:26Z"
31
+ "relaton-model-etsi": "v0.0.3",
32
+ "metanorma-model": "v1.2.9",
33
+ "date": "2023-12-02T16:19:25Z"
34
34
  }
@@ -46,9 +46,12 @@ module RelatonBib
46
46
  attr_accessor :all_parts
47
47
 
48
48
  # @return [String, nil]
49
- attr_reader :id, :type, :docnumber, :doctype, :subdoctype
49
+ attr_reader :id, :type, :docnumber, :subdoctype
50
50
 
51
- # @return [RelatonBib::Edition, nil] <description>
51
+ # @return [RelatonBib::DocumentType] document type
52
+ attr_reader :doctype
53
+
54
+ # @return [RelatonBib::Edition, nil] edition
52
55
  attr_reader :edition
53
56
 
54
57
  # @!attribute [r] title
@@ -157,7 +160,7 @@ module RelatonBib
157
160
  # @param validity [RelatonBib:Validity, nil]
158
161
  # @param fetched [Date, nil] default nil
159
162
  # @param keyword [Array<String>]
160
- # @param doctype [String]
163
+ # @param doctype [RelatonBib::DocumentType]
161
164
  # @param subdoctype [String]
162
165
  # @param editorialgroup [RelatonBib::EditorialGroup, nil]
163
166
  # @param ics [Array<RelatonBib::ICS>]
@@ -321,7 +324,7 @@ module RelatonBib
321
324
  end
322
325
  end
323
326
 
324
- # @param identifier [RelatonBib::DocumentIdentifier]
327
+ # @param identifier [RelatonBib::DocumentIdentifier, nil]
325
328
  # @param attribute [Boolean, nil]
326
329
  # @return [String]
327
330
  def makeid(identifier, attribute)
@@ -330,11 +333,7 @@ module RelatonBib
330
333
  identifier ||= @docidentifier.reject { |i| i.type == "DOI" }[0]
331
334
  return unless identifier
332
335
 
333
- # contribs = publishers.map { |p| p&.entity&.abbreviation }.join '/'
334
- # idstr = "#{contribs}#{delim}#{id.project_number}"
335
- # idstr = id.project_number.to_s
336
- idstr = identifier.id.gsub(/[:\/]/, "-").gsub(/\s/, "")
337
- # if id.part_number&.size&.positive? then idstr += "-#{id.part_number}"
336
+ idstr = identifier.id.gsub(/[:\/]/, "-").gsub(/[\s\(\)]/, "")
338
337
  idstr.strip
339
338
  end
340
339
 
@@ -421,7 +420,7 @@ module RelatonBib
421
420
  hash["fetched"] = fetched.to_s if fetched
422
421
  hash["keyword"] = single_element_array(keyword) if keyword&.any?
423
422
  hash["license"] = single_element_array(license) if license&.any?
424
- hash["doctype"] = doctype if doctype
423
+ hash["doctype"] = doctype.to_hash if doctype
425
424
  hash["subdoctype"] = subdoctype if subdoctype
426
425
  if editorialgroup&.presence?
427
426
  hash["editorialgroup"] = editorialgroup.to_hash
@@ -576,7 +575,7 @@ module RelatonBib
576
575
  end
577
576
  out += relation.to_asciibib prefix if relation
578
577
  series.each { |s| out += s.to_asciibib prefix, series.size }
579
- out += "#{pref}doctype:: #{doctype}\n" if doctype
578
+ out += doctype.to_asciibib prefix if doctype
580
579
  out += "#{pref}subdoctype:: #{subdoctype}\n" if subdoctype
581
580
  out += "#{pref}formattedref:: #{formattedref}\n" if formattedref
582
581
  keyword.each { |kw| out += kw.to_asciibib "#{pref}keyword", keyword.size }
@@ -639,7 +638,7 @@ module RelatonBib
639
638
  elsif opts[:bibdata] && (doctype || editorialgroup || ics&.any? ||
640
639
  structuredidentifier&.presence?)
641
640
  ext = builder.ext do |b|
642
- b.doctype doctype if doctype
641
+ doctype.to_xml b if doctype
643
642
  b.subdoctype subdoctype if subdoctype
644
643
  editorialgroup&.to_xml b
645
644
  ics.each { |i| i.to_xml b }
@@ -409,11 +409,12 @@ module RelatonBib
409
409
  # @param anchor [String]
410
410
  # @return [String]
411
411
  def doctype(anchor)
412
- case anchor
413
- when /I-D/ then "internet-draft"
414
- when /IEEE/ then "ieee"
415
- else "rfc"
416
- end
412
+ type = case anchor
413
+ when /I-D/ then "internet-draft"
414
+ when /IEEE/ then "ieee"
415
+ else "rfc"
416
+ end
417
+ DocumentType.new type: type
417
418
  end
418
419
 
419
420
  extend BibXMLParser
@@ -0,0 +1,52 @@
1
+ module RelatonBib
2
+ class DocumentType
3
+ attr_reader :type, :abbreviation
4
+
5
+ #
6
+ # Initialize a DocumentType.
7
+ #
8
+ # @param [String] type document type
9
+ # @param [String, nil] abbreviation type abbreviation
10
+ #
11
+ def initialize(type:, abbreviation: nil)
12
+ @type = type
13
+ @abbreviation = abbreviation
14
+ end
15
+
16
+ #
17
+ # Build XML representation of the document type.
18
+ #
19
+ # @param [Nokogiri::XML::Builder] builder XML builder
20
+ #
21
+ def to_xml(builder)
22
+ xml = builder.doctype @type
23
+ xml[:abbreviation] = @abbreviation if @abbreviation
24
+ end
25
+
26
+ #
27
+ # Hash representation of the document type.
28
+ #
29
+ # @return [Hash]
30
+ #
31
+ def to_hash
32
+ hash = { "type" => @type }
33
+ hash["abbreviation"] = @abbreviation if @abbreviation
34
+ hash
35
+ end
36
+
37
+ #
38
+ # Asciibib representation of the document type.
39
+ #
40
+ # @param [String] prefix prefix
41
+ #
42
+ # @return [String] AsciiBib representation
43
+ #
44
+ def to_asciibib(prefix = "")
45
+ pref = prefix.empty? ? prefix : prefix + "."
46
+ pref += "doctype."
47
+ out = "#{pref}type:: #{@type}\n"
48
+ out += "#{pref}abbreviation:: #{@abbreviation}\n" if @abbreviation
49
+ out
50
+ end
51
+ end
52
+ end