Sha256: 433c576051077aff83cb3ec88527bbe3c0f2c1a0779c582d90e527095e6bb641

Contents?: true

Size: 1.2 KB

Versions: 8

Compression:

Stored size: 1.2 KB

Contents

require "isodoc"
require "metanorma/cc"

module IsoDoc
  module Cc
    class Metadata < IsoDoc::Generic::Metadata
      def configuration
        Metanorma::Cc.configuration
      end

      def initialize(lang, script, locale, labels)
        super
        set(:tc, "XXXX")
      end

      def title(isoxml, _out)
        main = isoxml.at(ns("//bibdata/title[@language='en']"))&.children&.to_xml
        set(:doctitle, main)
      end

      def subtitle(_isoxml, _out)
        nil
      end

      def author(isoxml, _out)
        tc = isoxml.at(ns("//bibdata/ext/editorialgroup/committee"))
        set(:tc, tc.text) if tc
        super
      end

      def personal_authors(isoxml)
        set(:roles_authors_affiliations, roles_authors_affiliations(isoxml))
        super
      end

      def roles_authors_affiliations(isoxml)
        isoxml.xpath(ns("//bibdata/contributor/role/@type"))
          .inject([]) { |m, t| m << t.value }
          .uniq.sort.each_with_object({}) do |r, m|
          names = isoxml.xpath(ns("//bibdata/contributor[role/@type = '#{r}']"\
                                  "/person"))
          names.empty? or m[r] = extract_person_names_affiliations(names)
        end
      end
    end
  end
end

Version data entries

8 entries across 8 versions & 1 rubygems

Version Path
metanorma-cc-2.5.11 lib/isodoc/cc/metadata.rb
metanorma-cc-2.5.10 lib/isodoc/cc/metadata.rb
metanorma-cc-2.5.9 lib/isodoc/cc/metadata.rb
metanorma-cc-2.5.8 lib/isodoc/cc/metadata.rb
metanorma-cc-2.5.7 lib/isodoc/cc/metadata.rb
metanorma-cc-2.5.6 lib/isodoc/cc/metadata.rb
metanorma-cc-2.5.5 lib/isodoc/cc/metadata.rb
metanorma-cc-2.5.4 lib/isodoc/cc/metadata.rb