Sha256: a11723bbe1a1209fbee5687c9bd41eb2d38a1eceffbf0d77a1710b8bdef2496c

Contents?: true

Size: 1.24 KB

Versions: 4

Compression:

Stored size: 1.24 KB

Contents

require "isodoc"

module IsoDoc
  module Acme

    class Metadata < IsoDoc::Metadata
      def initialize(lang, script, labels)
        super
        here = File.dirname(__FILE__)
        default_logo_path = File.expand_path(File.join(here, "html", "logo.jpg"))
        set(:logo, baselocation(configuration.logo_path) || default_logo_path)
      end

      class << self
        attr_accessor :_file
      end

      def self.inherited( k )
        k._file = caller_locations.first.absolute_path
      end

      def baselocation(loc)
        return nil if loc.nil?
        File.expand_path(File.join(File.dirname(self.class::_file || __FILE__), "..", "..", "..", loc))
      end

      def configuration
        Metanorma::Acme.configuration
      end

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

      def stage_abbr(status)
        return super unless configuration.stage_abbreviations
        Hash(configuration.stage_abbreviations).dig(status)
      end

      def unpublished(status)
        stages = configuration&.published_stages || ["published"]
        !(Array(stages).map { |m| m.downcase }.include? status.downcase)
      end
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
metanorma-acme-1.4.4 lib/isodoc/acme/metadata.rb
metanorma-acme-1.4.3 lib/isodoc/acme/metadata.rb
metanorma-acme-1.4.2 lib/isodoc/acme/metadata.rb
metanorma-acme-1.4.1 lib/isodoc/acme/metadata.rb