relaton-bib 1.9.22 → 1.9.23

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: d003dbfecade683b1474dfc3923c2210997574d956f3c96ef0b7b0f113100d66
4
- data.tar.gz: 6829735611e2ad3807ecb8014b6dddc115f8a2b8799328a11a7b7a229174a49c
3
+ metadata.gz: 69ae43ef45d31008eb5fcfb3939335a6ecb7731a198c7fb944ff671a018180c2
4
+ data.tar.gz: 82154362500a3a1476efd7415ccc37e2a9f8a878b889b2562b51024f8d691884
5
5
  SHA512:
6
- metadata.gz: fbb7e6611505b14b7b321893dd4c1941e91b0d52cd2de4ea4f6fe083e1e2378c6f8c34a6fe3c39bb9d028ee81e5548ba435a893483c6e42e16f01030dd230eaa
7
- data.tar.gz: 01aef015aefc3a321442118ccafd9ae310e9fccab9f57bce7d4e3e2c8c0abf70b9b5d4a1ad3877866daabc2054f572fec72be93311e7d66446c77f119b4ce781
6
+ metadata.gz: d151df39d087c6dfd66d50eeede28c8b14c3d4551197122f955000611f958fe89b7caa36c05730b77f34e5729ed4838d3d1cb52f85f53169babf624c5ac56c38
7
+ data.tar.gz: 2f0a0f3bf334cd1204eaafe55d90ce4825f6eeed884730f44ae4956ecb43a6bca9356bb27af473b421fb4a4a4ab4ad565721c0ced92f0e7b5b40b5b4a0104a49
@@ -330,15 +330,16 @@ module RelatonBib
330
330
  # Render BibXML (RFC)
331
331
  #
332
332
  # @param [Nokogiri::XML::Builder, nil] builder
333
+ # @param [Boolean] include_keywords (false)
333
334
  #
334
335
  # @return [String, Nokogiri::XML::Builder::NodeBuilder] XML
335
336
  #
336
- def to_bibxml(builder = nil)
337
+ def to_bibxml(builder = nil, include_keywords: false)
337
338
  if builder
338
- render_bibxml builder
339
+ render_bibxml builder, include_keywords
339
340
  else
340
341
  Nokogiri::XML::Builder.new(encoding: "UTF-8") do |xml|
341
- render_bibxml xml
342
+ render_bibxml xml, include_keywords
342
343
  end.doc.root.to_xml
343
344
  end
344
345
  end
@@ -764,14 +765,15 @@ module RelatonBib
764
765
  # Render BibXML (RFC, BCP)
765
766
  #
766
767
  # @param [Nokogiri::XML::Builder] builder
768
+ # @param [Boolean] include_bibdata
767
769
  #
768
- def render_bibxml(builder)
770
+ def render_bibxml(builder, include_keywords)
769
771
  target = link.detect { |l| l.type.casecmp("src").zero? } ||
770
772
  link.detect { |l| l.type.casecmp("doi").zero? }
771
773
  bxml = if docnumber&.match(/^BCP/) || docidentifier[0].id.include?("BCP")
772
- render_bibxml_refgroup(builder)
774
+ render_bibxml_refgroup(builder, include_keywords)
773
775
  else
774
- render_bibxml_ref(builder)
776
+ render_bibxml_ref(builder, include_keywords)
775
777
  end
776
778
  bxml[:target] = target.content.to_s if target
777
779
  end
@@ -780,11 +782,12 @@ module RelatonBib
780
782
  # Render BibXML (BCP)
781
783
  #
782
784
  # @param [Nokogiri::XML::Builder] builder
785
+ # @param [Boolean] include_keywords
783
786
  #
784
- def render_bibxml_refgroup(builder)
787
+ def render_bibxml_refgroup(builder, include_keywords)
785
788
  builder.referencegroup(**ref_attrs) do |b|
786
789
  relation.each do |r|
787
- r.bibitem.to_bibxml(b) if r.type == "includes"
790
+ r.bibitem.to_bibxml(b, include_keywords: include_keywords) if r.type == "includes"
788
791
  end
789
792
  end
790
793
  end
@@ -793,18 +796,19 @@ module RelatonBib
793
796
  # Render BibXML (RFC)
794
797
  #
795
798
  # @param [Nokogiri::XML::Builder] builder
799
+ # @param [Boolean] include_keywords
796
800
  #
797
- def render_bibxml_ref(builder)
801
+ def render_bibxml_ref(builder, include_keywords)
798
802
  builder.reference(**ref_attrs) do |xml|
799
803
  xml.front do
800
804
  xml.title title[0].title.content if title.any?
801
- render_seriesinfo xml
802
805
  render_authors xml
803
806
  render_date xml
804
807
  render_workgroup xml
805
- render_keyword xml
808
+ render_keyword xml if include_keywords
806
809
  render_abstract xml
807
810
  end
811
+ render_seriesinfo xml
808
812
  end
809
813
  end
810
814
 
@@ -849,8 +853,11 @@ module RelatonBib
849
853
  elm[:year] = y if y
850
854
  m = dt.on(:month) || dt.from(:month) || dt.to(:month)
851
855
  elm[:month] = Date::MONTHNAMES[m] if m
856
+ # rfcs = %w[RFC BCP FYI STD]
857
+ # unless rfcs.include?(doctype) && docidentifier.detect { |di| rfcs.include? di.type }
852
858
  d = dt.on(:day) || dt.from(:day) || dt.to(:day)
853
859
  elm[:day] = d if d
860
+ # end
854
861
  end
855
862
 
856
863
  # @param [Nokogiri::XML::Builder] builder
@@ -942,10 +949,10 @@ module RelatonBib
942
949
  # @param [Nokogiri::XML::Builder] builder
943
950
  # @param [RelatonBib::Organization] org
944
951
  def render_organization(builder, org)
945
- return unless org
952
+ # return unless org
946
953
 
947
- ab = org.abbreviation&.content
948
- on = org.name.first&.content
954
+ ab = org&.abbreviation&.content
955
+ on = org&.name&.first&.content
949
956
  orgname = if BibXMLParser::ORGNAMES.key?(ab) then ab
950
957
  else BibXMLParser::ORGNAMES.key(on) || on || ab
951
958
  end
@@ -1,3 +1,3 @@
1
1
  module RelatonBib
2
- VERSION = "1.9.22".freeze
2
+ VERSION = "1.9.23".freeze
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: relaton-bib
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.9.22
4
+ version: 1.9.23
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ribose Inc.
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2022-01-20 00:00:00.000000000 Z
11
+ date: 2022-01-21 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: byebug