Sha256: 2de0613c830e6be5195e117b450361071fbb9d5f49bf79e6b4ceb0b3a0932851

Contents?: true

Size: 1.13 KB

Versions: 14

Compression:

Stored size: 1.13 KB

Contents

require "isodoc"

module IsoDoc
  module Csand
    # A {Converter} implementation that generates CSAND output, and a document
    # schema encapsulation of the document for validation
    class Metadata < IsoDoc::Metadata
            def initialize(lang, script, labels)
        super
      end

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

      def subtitle(_isoxml, _out)
        nil
      end

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


      def docid(isoxml, _out)
        docnumber = isoxml.at(ns("//bibdata/docidentifier[@type = 'csand']"))
        set(:docnumber, docnumber&.text)
      end

      def status_abbr(status)
        case status
        when "working-draft" then "wd"
        when "committee-draft" then "cd"
        when "draft-standard" then "d"
        else
          ""
        end
      end

      def unpublished(status)
        !%w(published withdrawn).include? status.downcase
      end
    end
  end
end

Version data entries

14 entries across 14 versions & 1 rubygems

Version Path
metanorma-csand-1.3.9 lib/isodoc/csand/metadata.rb
metanorma-csand-1.3.8 lib/isodoc/csand/metadata.rb
metanorma-csand-1.3.7 lib/isodoc/csand/metadata.rb
metanorma-csand-1.3.6 lib/isodoc/csand/metadata.rb
metanorma-csand-1.3.5 lib/isodoc/csand/metadata.rb
metanorma-csand-1.3.4 lib/isodoc/csand/metadata.rb
metanorma-csand-1.3.3 lib/isodoc/csand/metadata.rb
metanorma-csand-1.3.2 lib/isodoc/csand/metadata.rb
metanorma-csand-1.3.1 lib/isodoc/csand/metadata.rb
metanorma-csand-1.3.0 lib/isodoc/csand/metadata.rb
metanorma-csand-1.2.3 lib/isodoc/csand/metadata.rb
metanorma-csand-1.2.2 lib/isodoc/csand/metadata.rb
metanorma-csand-1.2.1 lib/isodoc/csand/metadata.rb
metanorma-csand-1.2.0 lib/isodoc/csand/metadata.rb