Sha256: bd4ccef77074918fc85bad0a957033964226032ef6b84208ac9faa299531a677

Contents?: true

Size: 1.33 KB

Versions: 7

Compression:

Stored size: 1.33 KB

Contents

require "isodoc"

module IsoDoc
  module M3d
    # 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
        here = File.dirname(__FILE__)
        set(:logo_html,
            File.expand_path(File.join(here, "html", "m3-logo.png")))
        set(:logo_word,
            File.expand_path(File.join(here, "html", "logo.jpg")))
      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, nil)
        tc = isoxml.at(ns("//bibdata/ext/editorialgroup/committee"))
        set(:tc, tc.text) if tc
        super
      end

      def docid(isoxml, _out)
        docnumber = isoxml.at(ns("//bibdata/docidentifier"))
        set(:docnumber, docnumber&.text)
      end

      def stage_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

7 entries across 7 versions & 1 rubygems

Version Path
metanorma-m3d-1.3.22 lib/isodoc/m3d/metadata.rb
metanorma-m3d-1.3.21 lib/isodoc/m3d/metadata.rb
metanorma-m3d-1.3.20 lib/isodoc/m3d/metadata.rb
metanorma-m3d-1.3.19 lib/isodoc/m3d/metadata.rb
metanorma-m3d-1.3.18 lib/isodoc/m3d/metadata.rb
metanorma-m3d-1.3.17 lib/isodoc/m3d/metadata.rb
metanorma-m3d-1.3.16 lib/isodoc/m3d/metadata.rb