relaton-bib 1.2.0 → 1.3.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
 - data/.github/workflows/ubuntu.yml +1 -0
 - data/.rubocop.yml +2 -2
 - data/README.adoc +16 -0
 - data/lib/relaton_bib.rb +15 -15
 - data/lib/relaton_bib/bib_item_locality.rb +13 -1
 - data/lib/relaton_bib/biblio_note.rb +11 -0
 - data/lib/relaton_bib/biblio_version.rb +12 -0
 - data/lib/relaton_bib/bibliographic_date.rb +13 -0
 - data/lib/relaton_bib/bibliographic_item.rb +80 -24
 - data/lib/relaton_bib/classification.rb +11 -0
 - data/lib/relaton_bib/contribution_info.rb +27 -1
 - data/lib/relaton_bib/contributor.rb +55 -1
 - data/lib/relaton_bib/copyright_association.rb +14 -1
 - data/lib/relaton_bib/document_identifier.rb +20 -4
 - data/lib/relaton_bib/document_relation.rb +15 -5
 - data/lib/relaton_bib/document_relation_collection.rb +12 -0
 - data/lib/relaton_bib/document_status.rb +10 -0
 - data/lib/relaton_bib/editorial_group.rb +9 -0
 - data/lib/relaton_bib/formatted_ref.rb +7 -0
 - data/lib/relaton_bib/formatted_string.rb +11 -0
 - data/lib/relaton_bib/hash_converter.rb +55 -36
 - data/lib/relaton_bib/ics.rb +11 -0
 - data/lib/relaton_bib/localized_string.rb +23 -6
 - data/lib/relaton_bib/medium.rb +11 -0
 - data/lib/relaton_bib/organization.rb +27 -7
 - data/lib/relaton_bib/person.rb +54 -7
 - data/lib/relaton_bib/place.rb +13 -1
 - data/lib/relaton_bib/series.rb +25 -4
 - data/lib/relaton_bib/structured_identifier.rb +30 -0
 - data/lib/relaton_bib/technical_committee.rb +11 -0
 - data/lib/relaton_bib/typed_title_string.rb +13 -7
 - data/lib/relaton_bib/typed_uri.rb +11 -0
 - data/lib/relaton_bib/validity.rb +11 -0
 - data/lib/relaton_bib/version.rb +1 -1
 - data/lib/relaton_bib/workgroup.rb +10 -0
 - data/lib/relaton_bib/xml_parser.rb +54 -39
 - metadata +5 -5
 
| 
         @@ -32,5 +32,16 @@ module RelatonBib 
     | 
|
| 
       32 
32 
     | 
    
         
             
                  hash["type"] = type.to_s if type
         
     | 
| 
       33 
33 
     | 
    
         
             
                  hash
         
     | 
| 
       34 
34 
     | 
    
         
             
                end
         
     | 
| 
      
 35 
     | 
    
         
            +
             
     | 
| 
      
 36 
     | 
    
         
            +
                # @param prefix [String]
         
     | 
| 
      
 37 
     | 
    
         
            +
                # @param count [Integer] number of links
         
     | 
| 
      
 38 
     | 
    
         
            +
                # @return [String]
         
     | 
| 
      
 39 
     | 
    
         
            +
                def to_asciibib(prefix = "", count = 1)
         
     | 
| 
      
 40 
     | 
    
         
            +
                  pref = prefix.empty? ? "link" : prefix + ".link"
         
     | 
| 
      
 41 
     | 
    
         
            +
                  out = count > 1 ? "#{pref}::\n" : ""
         
     | 
| 
      
 42 
     | 
    
         
            +
                  out += "#{pref}.type:: #{type}\n" if type
         
     | 
| 
      
 43 
     | 
    
         
            +
                  out += "#{pref}.content:: #{content}\n"
         
     | 
| 
      
 44 
     | 
    
         
            +
                  out
         
     | 
| 
      
 45 
     | 
    
         
            +
                end
         
     | 
| 
       35 
46 
     | 
    
         
             
              end
         
     | 
| 
       36 
47 
     | 
    
         
             
            end
         
     | 
    
        data/lib/relaton_bib/validity.rb
    CHANGED
    
    | 
         @@ -37,5 +37,16 @@ module RelatonBib 
     | 
|
| 
       37 
37 
     | 
    
         
             
                  hash["revision"] = revision.strftime(FORMAT) if revision
         
     | 
| 
       38 
38 
     | 
    
         
             
                  hash
         
     | 
| 
       39 
39 
     | 
    
         
             
                end
         
     | 
| 
      
 40 
     | 
    
         
            +
             
     | 
| 
      
 41 
     | 
    
         
            +
                # @param prefix [String]
         
     | 
| 
      
 42 
     | 
    
         
            +
                # @return [String]
         
     | 
| 
      
 43 
     | 
    
         
            +
                def to_asciibib(prefix = "")
         
     | 
| 
      
 44 
     | 
    
         
            +
                  pref = prefix.empty? ? "validity." : prefix + ".validity."
         
     | 
| 
      
 45 
     | 
    
         
            +
                  out = ""
         
     | 
| 
      
 46 
     | 
    
         
            +
                  out += "#{pref}begins:: #{begins.strftime(FORMAT)}\n" if begins
         
     | 
| 
      
 47 
     | 
    
         
            +
                  out += "#{pref}ends:: #{ends.strftime(FORMAT)}\n" if ends
         
     | 
| 
      
 48 
     | 
    
         
            +
                  out += "#{pref}revision:: #{revision.strftime(FORMAT)}\n" if revision
         
     | 
| 
      
 49 
     | 
    
         
            +
                  out
         
     | 
| 
      
 50 
     | 
    
         
            +
                end
         
     | 
| 
       40 
51 
     | 
    
         
             
              end
         
     | 
| 
       41 
52 
     | 
    
         
             
            end
         
     | 
    
        data/lib/relaton_bib/version.rb
    CHANGED
    
    
| 
         @@ -32,5 +32,15 @@ module RelatonBib 
     | 
|
| 
       32 
32 
     | 
    
         
             
                  hash["type"] = type if type
         
     | 
| 
       33 
33 
     | 
    
         
             
                  hash
         
     | 
| 
       34 
34 
     | 
    
         
             
                end
         
     | 
| 
      
 35 
     | 
    
         
            +
             
     | 
| 
      
 36 
     | 
    
         
            +
                # @param prefix [String]
         
     | 
| 
      
 37 
     | 
    
         
            +
                # @return [String]
         
     | 
| 
      
 38 
     | 
    
         
            +
                def to_asciibib(prefix = "")
         
     | 
| 
      
 39 
     | 
    
         
            +
                  pref = prefix.empty? ? prefix : prefix + "."
         
     | 
| 
      
 40 
     | 
    
         
            +
                  out = "#{pref}content:: #{content}\n"
         
     | 
| 
      
 41 
     | 
    
         
            +
                  out += "#{pref}number:: #{number}\n" if number
         
     | 
| 
      
 42 
     | 
    
         
            +
                  out += "#{pref}type:: #{type}\n" if type
         
     | 
| 
      
 43 
     | 
    
         
            +
                  out
         
     | 
| 
      
 44 
     | 
    
         
            +
                end
         
     | 
| 
       35 
45 
     | 
    
         
             
              end
         
     | 
| 
       36 
46 
     | 
    
         
             
            end
         
     | 
| 
         @@ -10,7 +10,8 @@ module RelatonBib 
     | 
|
| 
       10 
10 
     | 
    
         
             
                    if bibitem
         
     | 
| 
       11 
11 
     | 
    
         
             
                      bib_item item_data(bibitem)
         
     | 
| 
       12 
12 
     | 
    
         
             
                    else
         
     | 
| 
       13 
     | 
    
         
            -
                      warn "[relaton-bib] WARNING: can't find bibitem or bibdata element  
     | 
| 
      
 13 
     | 
    
         
            +
                      warn "[relaton-bib] WARNING: can't find bibitem or bibdata element "\
         
     | 
| 
      
 14 
     | 
    
         
            +
                      "in the XML"
         
     | 
| 
       14 
15 
     | 
    
         
             
                    end
         
     | 
| 
       15 
16 
     | 
    
         
             
                  end
         
     | 
| 
       16 
17 
     | 
    
         | 
| 
         @@ -19,7 +20,7 @@ module RelatonBib 
     | 
|
| 
       19 
20 
     | 
    
         
             
                  # rubocop:disable Metrics/MethodLength, Metrics/AbcSize
         
     | 
| 
       20 
21 
     | 
    
         | 
| 
       21 
22 
     | 
    
         
             
                  # @return [Hash]
         
     | 
| 
       22 
     | 
    
         
            -
                  def item_data(bibitem)
         
     | 
| 
      
 23 
     | 
    
         
            +
                  def item_data(bibitem) # rubocop:disable Metrics/CyclomaticComplexity
         
     | 
| 
       23 
24 
     | 
    
         
             
                    ext = bibitem.at "//ext"
         
     | 
| 
       24 
25 
     | 
    
         
             
                    {
         
     | 
| 
       25 
26 
     | 
    
         
             
                      id: bibitem[:id]&.empty? ? nil : bibitem[:id],
         
     | 
| 
         @@ -80,25 +81,28 @@ module RelatonBib 
     | 
|
| 
       80 
81 
     | 
    
         
             
                        type: n[:type],
         
     | 
| 
       81 
82 
     | 
    
         
             
                        format: n[:format],
         
     | 
| 
       82 
83 
     | 
    
         
             
                        language: n[:language],
         
     | 
| 
       83 
     | 
    
         
            -
                        script: n[:script] 
     | 
| 
      
 84 
     | 
    
         
            +
                        script: n[:script]
         
     | 
| 
       84 
85 
     | 
    
         
             
                      )
         
     | 
| 
       85 
86 
     | 
    
         
             
                    end
         
     | 
| 
       86 
87 
     | 
    
         
             
                  end
         
     | 
| 
       87 
88 
     | 
    
         | 
| 
       88 
89 
     | 
    
         
             
                  def fetch_language(item)
         
     | 
| 
       89 
     | 
    
         
            -
                    item.xpath("./language").reduce([])  
     | 
| 
      
 90 
     | 
    
         
            +
                    item.xpath("./language").reduce([]) do |a, l|
         
     | 
| 
      
 91 
     | 
    
         
            +
                      l.text.empty? ? a : a << l.text
         
     | 
| 
      
 92 
     | 
    
         
            +
                    end
         
     | 
| 
       90 
93 
     | 
    
         
             
                  end
         
     | 
| 
       91 
94 
     | 
    
         | 
| 
       92 
95 
     | 
    
         
             
                  def fetch_script(item)
         
     | 
| 
       93 
     | 
    
         
            -
                    item.xpath("./script").reduce([])  
     | 
| 
      
 96 
     | 
    
         
            +
                    item.xpath("./script").reduce([]) do |a, s|
         
     | 
| 
      
 97 
     | 
    
         
            +
                      s.text.empty? ? a : a << s.text
         
     | 
| 
      
 98 
     | 
    
         
            +
                    end
         
     | 
| 
       94 
99 
     | 
    
         
             
                  end
         
     | 
| 
       95 
100 
     | 
    
         | 
| 
       96 
     | 
    
         
            -
                  # rubocop:disable Metrics/AbcSize, Metrics/MethodLength
         
     | 
| 
       97 
     | 
    
         
            -
             
     | 
| 
       98 
     | 
    
         
            -
                  def fetch_series(item)
         
     | 
| 
      
 101 
     | 
    
         
            +
                  def fetch_series(item) # rubocop:disable Metrics/CyclomaticComplexity, Metrics/AbcSize, Metrics/MethodLength
         
     | 
| 
       99 
102 
     | 
    
         
             
                    item.xpath("./series").reduce([]) do |mem, sr|
         
     | 
| 
       100 
103 
     | 
    
         
             
                      abbr = sr.at "abbreviation"
         
     | 
| 
       101 
     | 
    
         
            -
                      abbreviation = abbr  
     | 
| 
      
 104 
     | 
    
         
            +
                      abbreviation = abbr &&
         
     | 
| 
      
 105 
     | 
    
         
            +
                        LocalizedString.new(abbr.text, abbr[:language], abbr[:script])
         
     | 
| 
       102 
106 
     | 
    
         
             
                      formattedref = fref(sr)
         
     | 
| 
       103 
107 
     | 
    
         
             
                      title = ttitle(sr.at("title"))
         
     | 
| 
       104 
108 
     | 
    
         
             
                      next mem unless formattedref || title
         
     | 
| 
         @@ -113,7 +117,6 @@ module RelatonBib 
     | 
|
| 
       113 
117 
     | 
    
         
             
                      )
         
     | 
| 
       114 
118 
     | 
    
         
             
                    end
         
     | 
| 
       115 
119 
     | 
    
         
             
                  end
         
     | 
| 
       116 
     | 
    
         
            -
                  # rubocop:enable Metrics/AbcSize, Metrics/MethodLength
         
     | 
| 
       117 
120 
     | 
    
         | 
| 
       118 
121 
     | 
    
         
             
                  def fetch_medium(item)
         
     | 
| 
       119 
122 
     | 
    
         
             
                    medium = item.at("./medium")
         
     | 
| 
         @@ -143,9 +146,12 @@ module RelatonBib 
     | 
|
| 
       143 
146 
     | 
    
         
             
                    vl = item.at("./validity")
         
     | 
| 
       144 
147 
     | 
    
         
             
                    return unless vl
         
     | 
| 
       145 
148 
     | 
    
         | 
| 
       146 
     | 
    
         
            -
                    begins = (b = vl.at("validityBegins"))  
     | 
| 
       147 
     | 
    
         
            -
             
     | 
| 
       148 
     | 
    
         
            -
                     
     | 
| 
      
 149 
     | 
    
         
            +
                    begins = (b = vl.at("validityBegins")) &&
         
     | 
| 
      
 150 
     | 
    
         
            +
                      Time.strptime(b.text, "%Y-%m-%d %H:%M")
         
     | 
| 
      
 151 
     | 
    
         
            +
                    ends = (e = vl.at("validityEnds")) &&
         
     | 
| 
      
 152 
     | 
    
         
            +
                      Time.strptime(e.text, "%Y-%m-%d %H:%M")
         
     | 
| 
      
 153 
     | 
    
         
            +
                    revision = (r = vl.at("revision")) &&
         
     | 
| 
      
 154 
     | 
    
         
            +
                      Time.strptime(r.text, "%Y-%m-%d %H:%M")
         
     | 
| 
       149 
155 
     | 
    
         
             
                    Validity.new begins: begins, ends: ends, revision: revision
         
     | 
| 
       150 
156 
     | 
    
         
             
                  end
         
     | 
| 
       151 
157 
     | 
    
         | 
| 
         @@ -153,7 +159,8 @@ module RelatonBib 
     | 
|
| 
       153 
159 
     | 
    
         
             
                  # @return [Array<RelatonBib::DocumentIdentifier>]
         
     | 
| 
       154 
160 
     | 
    
         
             
                  def fetch_docid(item)
         
     | 
| 
       155 
161 
     | 
    
         
             
                    item.xpath("./docidentifier").map do |did|
         
     | 
| 
       156 
     | 
    
         
            -
                      DocumentIdentifier.new(id: did.text, type: did[:type] 
     | 
| 
      
 162 
     | 
    
         
            +
                      DocumentIdentifier.new(id: did.text, type: did[:type],
         
     | 
| 
      
 163 
     | 
    
         
            +
                                             scope: did[:scope])
         
     | 
| 
       157 
164 
     | 
    
         
             
                    end
         
     | 
| 
       158 
165 
     | 
    
         
             
                  end
         
     | 
| 
       159 
166 
     | 
    
         | 
| 
         @@ -182,7 +189,7 @@ module RelatonBib 
     | 
|
| 
       182 
189 
     | 
    
         
             
                    DocumentStatus.new(
         
     | 
| 
       183 
190 
     | 
    
         
             
                      stage: stg ? stage(stg) : status.text,
         
     | 
| 
       184 
191 
     | 
    
         
             
                      substage: stage(status.at("substage")),
         
     | 
| 
       185 
     | 
    
         
            -
                      iteration: status.at("iteration")&.text 
     | 
| 
      
 192 
     | 
    
         
            +
                      iteration: status.at("iteration")&.text
         
     | 
| 
       186 
193 
     | 
    
         
             
                    )
         
     | 
| 
       187 
194 
     | 
    
         
             
                  end
         
     | 
| 
       188 
195 
     | 
    
         | 
| 
         @@ -191,21 +198,24 @@ module RelatonBib 
     | 
|
| 
       191 
198 
     | 
    
         
             
                  def stage(elm)
         
     | 
| 
       192 
199 
     | 
    
         
             
                    return unless elm
         
     | 
| 
       193 
200 
     | 
    
         | 
| 
       194 
     | 
    
         
            -
                    DocumentStatus::Stage.new 
     | 
| 
      
 201 
     | 
    
         
            +
                    DocumentStatus::Stage.new(value: elm.text,
         
     | 
| 
      
 202 
     | 
    
         
            +
                                              abbreviation: elm[:abbreviation])
         
     | 
| 
       195 
203 
     | 
    
         
             
                  end
         
     | 
| 
       196 
204 
     | 
    
         | 
| 
       197 
     | 
    
         
            -
                  def fetch_dates(item)
         
     | 
| 
      
 205 
     | 
    
         
            +
                  def fetch_dates(item) # rubocop:disable Metrics/AbcSize, Metrics/CyclomaticComplexity
         
     | 
| 
       198 
206 
     | 
    
         
             
                    item.xpath("./date").reduce([]) do |a, d|
         
     | 
| 
       199 
207 
     | 
    
         
             
                      type = d[:type].to_s.empty? ? "published" : d[:type]
         
     | 
| 
       200 
208 
     | 
    
         
             
                      if (on = d.at("on"))
         
     | 
| 
       201 
     | 
    
         
            -
                        a << RelatonBib::BibliographicDate.new(type: type, on: on.text, 
     | 
| 
      
 209 
     | 
    
         
            +
                        a << RelatonBib::BibliographicDate.new(type: type, on: on.text,
         
     | 
| 
      
 210 
     | 
    
         
            +
                                                               to: d.at("to")&.text)
         
     | 
| 
       202 
211 
     | 
    
         
             
                      elsif (from = d.at("from"))
         
     | 
| 
       203 
     | 
    
         
            -
                        a << RelatonBib::BibliographicDate.new(type: type, from: from.text, 
     | 
| 
      
 212 
     | 
    
         
            +
                        a << RelatonBib::BibliographicDate.new(type: type, from: from.text,
         
     | 
| 
      
 213 
     | 
    
         
            +
                                                               to: d.at("to")&.text)
         
     | 
| 
       204 
214 
     | 
    
         
             
                      end
         
     | 
| 
       205 
215 
     | 
    
         
             
                    end
         
     | 
| 
       206 
216 
     | 
    
         
             
                  end
         
     | 
| 
       207 
217 
     | 
    
         | 
| 
       208 
     | 
    
         
            -
                  def get_org(org)
         
     | 
| 
      
 218 
     | 
    
         
            +
                  def get_org(org) # rubocop:disable Metrics/AbcSize, Metrics/MethodLength
         
     | 
| 
       209 
219 
     | 
    
         
             
                    names = org.xpath("name").map do |n|
         
     | 
| 
       210 
220 
     | 
    
         
             
                      { content: n.text, language: n[:language], script: n[:script] }
         
     | 
| 
       211 
221 
     | 
    
         
             
                    end
         
     | 
| 
         @@ -219,7 +229,7 @@ module RelatonBib 
     | 
|
| 
       219 
229 
     | 
    
         
             
                                     identifier: identifier)
         
     | 
| 
       220 
230 
     | 
    
         
             
                  end
         
     | 
| 
       221 
231 
     | 
    
         | 
| 
       222 
     | 
    
         
            -
                  def get_person(person)
         
     | 
| 
      
 232 
     | 
    
         
            +
                  def get_person(person) # rubocop:disable Metrics/AbcSize, Metrics/MethodLength, Metrics/CyclomaticComplexity
         
     | 
| 
       223 
233 
     | 
    
         
             
                    affiliations = person.xpath("./affiliation").map do |a|
         
     | 
| 
       224 
234 
     | 
    
         
             
                      org = a.at "./organization"
         
     | 
| 
       225 
235 
     | 
    
         
             
                      desc = a.xpath("./description").map do |e|
         
     | 
| 
         @@ -229,7 +239,7 @@ module RelatonBib 
     | 
|
| 
       229 
239 
     | 
    
         
             
                      Affiliation.new organization: get_org(org), description: desc
         
     | 
| 
       230 
240 
     | 
    
         
             
                    end
         
     | 
| 
       231 
241 
     | 
    
         | 
| 
       232 
     | 
    
         
            -
                    contact = person.xpath("./address 
     | 
| 
      
 242 
     | 
    
         
            +
                    contact = person.xpath("./address|./phone|./email|./uri").map do |c|
         
     | 
| 
       233 
243 
     | 
    
         
             
                      if c.name == "address"
         
     | 
| 
       234 
244 
     | 
    
         
             
                        streets = c.xpath("./street").map(&:text)
         
     | 
| 
       235 
245 
     | 
    
         
             
                        Address.new(
         
     | 
| 
         @@ -237,7 +247,7 @@ module RelatonBib 
     | 
|
| 
       237 
247 
     | 
    
         
             
                          city: c.at("./city")&.text,
         
     | 
| 
       238 
248 
     | 
    
         
             
                          state: c.at("./state")&.text,
         
     | 
| 
       239 
249 
     | 
    
         
             
                          country: c.at("./country")&.text,
         
     | 
| 
       240 
     | 
    
         
            -
                          postcode: c.at("./postcode")&.text 
     | 
| 
      
 250 
     | 
    
         
            +
                          postcode: c.at("./postcode")&.text
         
     | 
| 
       241 
251 
     | 
    
         
             
                        )
         
     | 
| 
       242 
252 
     | 
    
         
             
                      else
         
     | 
| 
       243 
253 
     | 
    
         
             
                        Contact.new(type: c.name, value: c.text)
         
     | 
| 
         @@ -255,15 +265,17 @@ module RelatonBib 
     | 
|
| 
       255 
265 
     | 
    
         | 
| 
       256 
266 
     | 
    
         
             
                    name = FullName.new(
         
     | 
| 
       257 
267 
     | 
    
         
             
                      completename: cname, surname: sname,
         
     | 
| 
       258 
     | 
    
         
            -
                      initial: name_part(person, "initial"), 
     | 
| 
       259 
     | 
    
         
            -
                       
     | 
| 
      
 268 
     | 
    
         
            +
                      initial: name_part(person, "initial"),
         
     | 
| 
      
 269 
     | 
    
         
            +
                      forename: name_part(person, "forename"),
         
     | 
| 
      
 270 
     | 
    
         
            +
                      addition: name_part(person, "addition"),
         
     | 
| 
      
 271 
     | 
    
         
            +
                      prefix: name_part(person, "prefix")
         
     | 
| 
       260 
272 
     | 
    
         
             
                    )
         
     | 
| 
       261 
273 
     | 
    
         | 
| 
       262 
274 
     | 
    
         
             
                    Person.new(
         
     | 
| 
       263 
275 
     | 
    
         
             
                      name: name,
         
     | 
| 
       264 
276 
     | 
    
         
             
                      affiliation: affiliations,
         
     | 
| 
       265 
277 
     | 
    
         
             
                      contact: contact,
         
     | 
| 
       266 
     | 
    
         
            -
                      identifier: identifier 
     | 
| 
      
 278 
     | 
    
         
            +
                      identifier: identifier
         
     | 
| 
       267 
279 
     | 
    
         
             
                    )
         
     | 
| 
       268 
280 
     | 
    
         
             
                  end
         
     | 
| 
       269 
281 
     | 
    
         | 
| 
         @@ -281,7 +293,8 @@ module RelatonBib 
     | 
|
| 
       281 
293 
     | 
    
         
             
                               elsif (person = c.at "./person") then get_person(person)
         
     | 
| 
       282 
294 
     | 
    
         
             
                               end
         
     | 
| 
       283 
295 
     | 
    
         
             
                      role = c.xpath("./role").map do |r|
         
     | 
| 
       284 
     | 
    
         
            -
                        { type: r[:type], 
     | 
| 
      
 296 
     | 
    
         
            +
                        { type: r[:type],
         
     | 
| 
      
 297 
     | 
    
         
            +
                          description: r.xpath("./description").map(&:text) }
         
     | 
| 
       285 
298 
     | 
    
         
             
                      end
         
     | 
| 
       286 
299 
     | 
    
         
             
                      ContributionInfo.new entity: entity, role: role
         
     | 
| 
       287 
300 
     | 
    
         
             
                    end
         
     | 
| 
         @@ -320,15 +333,17 @@ module RelatonBib 
     | 
|
| 
       320 
333 
     | 
    
         
             
                  end
         
     | 
| 
       321 
334 
     | 
    
         | 
| 
       322 
335 
     | 
    
         
             
                  # @param item [Nokogiri::XML::Element]
         
     | 
| 
      
 336 
     | 
    
         
            +
                  # @param klass [RelatonBib::DocumentRelation.class,
         
     | 
| 
      
 337 
     | 
    
         
            +
                  #   RelatonNist::DocumentRelation.class]
         
     | 
| 
       323 
338 
     | 
    
         
             
                  # @return [Array<RelatonBib::DocumentRelation>]
         
     | 
| 
       324 
     | 
    
         
            -
                  def fetch_relations(item)
         
     | 
| 
      
 339 
     | 
    
         
            +
                  def fetch_relations(item, klass = DocumentRelation)
         
     | 
| 
       325 
340 
     | 
    
         
             
                    item.xpath("./relation").map do |rel|
         
     | 
| 
       326 
     | 
    
         
            -
                       
     | 
| 
      
 341 
     | 
    
         
            +
                      klass.new(
         
     | 
| 
       327 
342 
     | 
    
         
             
                        type: rel[:type]&.empty? ? nil : rel[:type],
         
     | 
| 
       328 
343 
     | 
    
         
             
                        description: relation_description(rel),
         
     | 
| 
       329 
344 
     | 
    
         
             
                        bibitem: bib_item(item_data(rel.at("./bibitem"))),
         
     | 
| 
       330 
345 
     | 
    
         
             
                        locality: localities(rel),
         
     | 
| 
       331 
     | 
    
         
            -
                        source_locality: source_localities(rel) 
     | 
| 
      
 346 
     | 
    
         
            +
                        source_locality: source_localities(rel)
         
     | 
| 
       332 
347 
     | 
    
         
             
                      )
         
     | 
| 
       333 
348 
     | 
    
         
             
                    end
         
     | 
| 
       334 
349 
     | 
    
         
             
                  end
         
     | 
| 
         @@ -368,18 +383,21 @@ module RelatonBib 
     | 
|
| 
       368 
383 
     | 
    
         
             
                    klass.new(
         
     | 
| 
       369 
384 
     | 
    
         
             
                      loc[:type],
         
     | 
| 
       370 
385 
     | 
    
         
             
                      LocalizedString.new(loc.at("./referenceFrom").text),
         
     | 
| 
       371 
     | 
    
         
            -
                      ref_to 
     | 
| 
      
 386 
     | 
    
         
            +
                      ref_to
         
     | 
| 
       372 
387 
     | 
    
         
             
                    )
         
     | 
| 
       373 
388 
     | 
    
         
             
                  end
         
     | 
| 
       374 
389 
     | 
    
         | 
| 
       375 
390 
     | 
    
         
             
                  # @param rel [Nokogiri::XML::Element]
         
     | 
| 
       376 
     | 
    
         
            -
                  # @return [Array<RelatonBib::SourceLocality, 
     | 
| 
      
 391 
     | 
    
         
            +
                  # @return [Array<RelatonBib::SourceLocality,
         
     | 
| 
      
 392 
     | 
    
         
            +
                  #   RelatonBib::SourceLocalityStack>]
         
     | 
| 
       377 
393 
     | 
    
         
             
                  def source_localities(rel)
         
     | 
| 
       378 
394 
     | 
    
         
             
                    rel.xpath("./sourceLocality|./sourceLocalityStack").map do |lc|
         
     | 
| 
       379 
395 
     | 
    
         
             
                      if lc[:type]
         
     | 
| 
       380 
396 
     | 
    
         
             
                        SourceLocalityStack.new [locality(lc, SourceLocality)]
         
     | 
| 
       381 
397 
     | 
    
         
             
                      else
         
     | 
| 
       382 
     | 
    
         
            -
                        sls = lc.xpath("./sourceLocality").map  
     | 
| 
      
 398 
     | 
    
         
            +
                        sls = lc.xpath("./sourceLocality").map do |l|
         
     | 
| 
      
 399 
     | 
    
         
            +
                          locality l, SourceLocality
         
     | 
| 
      
 400 
     | 
    
         
            +
                        end
         
     | 
| 
       383 
401 
     | 
    
         
             
                        SourceLocalityStack.new sls
         
     | 
| 
       384 
402 
     | 
    
         
             
                      end
         
     | 
| 
       385 
403 
     | 
    
         
             
                    end
         
     | 
| 
         @@ -414,15 +432,13 @@ module RelatonBib 
     | 
|
| 
       414 
432 
     | 
    
         
             
                    return [] unless ext
         
     | 
| 
       415 
433 
     | 
    
         | 
| 
       416 
434 
     | 
    
         
             
                    ext.xpath("ics").map do |ics|
         
     | 
| 
       417 
     | 
    
         
            -
                      ICS.new code: ics.at("code") 
     | 
| 
      
 435 
     | 
    
         
            +
                      ICS.new code: ics.at("code")&.text, text: ics.at("text")&.text
         
     | 
| 
       418 
436 
     | 
    
         
             
                    end
         
     | 
| 
       419 
437 
     | 
    
         
             
                  end
         
     | 
| 
       420 
438 
     | 
    
         | 
| 
       421 
     | 
    
         
            -
                  # rubocop:disable Metrics/AbcSize, Metrics/MethodLength
         
     | 
| 
       422 
     | 
    
         
            -
             
     | 
| 
       423 
439 
     | 
    
         
             
                  # @param ext [Nokogiri::XML::Element]
         
     | 
| 
       424 
440 
     | 
    
         
             
                  # @return [RelatonBib::StructuredIdentifierCollection]
         
     | 
| 
       425 
     | 
    
         
            -
                  def fetch_structuredidentifier(ext)
         
     | 
| 
      
 441 
     | 
    
         
            +
                  def fetch_structuredidentifier(ext) # rubocop:disable Metrics/AbcSize, Metrics/MethodLength, Metrics/CyclomaticComplexity
         
     | 
| 
       426 
442 
     | 
    
         
             
                    return unless ext
         
     | 
| 
       427 
443 
     | 
    
         | 
| 
       428 
444 
     | 
    
         
             
                    sids = ext.xpath("structuredidentifier").map do |si|
         
     | 
| 
         @@ -437,12 +453,11 @@ module RelatonBib 
     | 
|
| 
       437 
453 
     | 
    
         
             
                        supplementtype: si.at("supplementtype")&.text,
         
     | 
| 
       438 
454 
     | 
    
         
             
                        supplementnumber: si.at("supplementnumber")&.text,
         
     | 
| 
       439 
455 
     | 
    
         
             
                        language: si.at("language")&.text,
         
     | 
| 
       440 
     | 
    
         
            -
                        year: si.at("year")&.text 
     | 
| 
      
 456 
     | 
    
         
            +
                        year: si.at("year")&.text
         
     | 
| 
       441 
457 
     | 
    
         
             
                      )
         
     | 
| 
       442 
458 
     | 
    
         
             
                    end
         
     | 
| 
       443 
459 
     | 
    
         
             
                    StructuredIdentifierCollection.new sids
         
     | 
| 
       444 
460 
     | 
    
         
             
                  end
         
     | 
| 
       445 
     | 
    
         
            -
                  # rubocop:enable Metrics/AbcSize, Metrics/MethodLength
         
     | 
| 
       446 
461 
     | 
    
         
             
                end
         
     | 
| 
       447 
462 
     | 
    
         
             
              end
         
     | 
| 
       448 
463 
     | 
    
         
             
            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. 
     | 
| 
      
 4 
     | 
    
         
            +
              version: 1.3.1
         
     | 
| 
       5 
5 
     | 
    
         
             
            platform: ruby
         
     | 
| 
       6 
6 
     | 
    
         
             
            authors:
         
     | 
| 
       7 
7 
     | 
    
         
             
            - Ribose Inc.
         
     | 
| 
       8 
     | 
    
         
            -
            autorequire: 
     | 
| 
      
 8 
     | 
    
         
            +
            autorequire:
         
     | 
| 
       9 
9 
     | 
    
         
             
            bindir: exe
         
     | 
| 
       10 
10 
     | 
    
         
             
            cert_chain: []
         
     | 
| 
       11 
     | 
    
         
            -
            date: 2020- 
     | 
| 
      
 11 
     | 
    
         
            +
            date: 2020-08-27 00:00:00.000000000 Z
         
     | 
| 
       12 
12 
     | 
    
         
             
            dependencies:
         
     | 
| 
       13 
13 
     | 
    
         
             
            - !ruby/object:Gem::Dependency
         
     | 
| 
       14 
14 
     | 
    
         
             
              name: byebug
         
     | 
| 
         @@ -248,7 +248,7 @@ homepage: https://github.com/relaton/relaton-bib 
     | 
|
| 
       248 
248 
     | 
    
         
             
            licenses:
         
     | 
| 
       249 
249 
     | 
    
         
             
            - BSD-2-Clause
         
     | 
| 
       250 
250 
     | 
    
         
             
            metadata: {}
         
     | 
| 
       251 
     | 
    
         
            -
            post_install_message: 
     | 
| 
      
 251 
     | 
    
         
            +
            post_install_message:
         
     | 
| 
       252 
252 
     | 
    
         
             
            rdoc_options: []
         
     | 
| 
       253 
253 
     | 
    
         
             
            require_paths:
         
     | 
| 
       254 
254 
     | 
    
         
             
            - lib
         
     | 
| 
         @@ -264,7 +264,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement 
     | 
|
| 
       264 
264 
     | 
    
         
             
                  version: '0'
         
     | 
| 
       265 
265 
     | 
    
         
             
            requirements: []
         
     | 
| 
       266 
266 
     | 
    
         
             
            rubygems_version: 3.0.6
         
     | 
| 
       267 
     | 
    
         
            -
            signing_key: 
     | 
| 
      
 267 
     | 
    
         
            +
            signing_key:
         
     | 
| 
       268 
268 
     | 
    
         
             
            specification_version: 4
         
     | 
| 
       269 
269 
     | 
    
         
             
            summary: 'RelatonBib: Ruby XMLDOC impementation.'
         
     | 
| 
       270 
270 
     | 
    
         
             
            test_files: []
         
     |