Sha256: 7b7982183c42b5246d5067bf17965bb8f4693c1c2e35ec861465167b4bfe8f6e

Contents?: true

Size: 1.11 KB

Versions: 21

Compression:

Stored size: 1.11 KB

Contents

require "isodoc"
require_relative "metadata"
require_relative "xref"
require_relative "i18n"

module IsoDoc
  module NIST
    module Init
      def metadata_init(lang, script, labels)
        @meta = Metadata.new(lang, script, labels)
      end

      def xref_init(lang, script, _klass, labels, options)
        @xrefs = Xref.new(lang, script, HtmlConvert.new(language: lang, script: script), labels, options)
      end

      def i18n_init(lang, script, i18nyaml = nil)
        @i18n = I18n.new(lang, script, i18nyaml || @i18nyaml)
      end

      def fileloc(loc)
        File.join(File.dirname(__FILE__), loc)
      end

      def suppress_biblio_title(node)
        return false unless node.parent.name == "annex"
        return false if node.parent.xpath("./references | ./clause | "\
                                          "./terms | ./definitions").size > 1
        title1 = node&.at(ns("./title"))&.text&.sub(/^[A-Z]\.(\d+\.)*/, "")
        return true unless title1 && !title1.empty?
        title2 = node&.parent&.at(ns("./title"))&.text&.sub(/^.*?— /, "")
        title1&.casecmp(title2) == 0
      end
    end
  end
end

Version data entries

21 entries across 21 versions & 2 rubygems

Version Path
metanorma-nist-1.3.2 lib/isodoc/nist/init.rb
metanorma-nist-1.3.1 lib/isodoc/nist/init.rb
metanorma-nist-1.3.0 lib/isodoc/nist/init.rb
metanorma-nist-1.2.16 lib/isodoc/nist/init.rb
metanorma-nist-1.2.15 lib/isodoc/nist/init.rb
metanorma-nist-1.2.14 lib/isodoc/nist/init.rb
metanorma-nist-1.2.13 lib/isodoc/nist/init.rb
metanorma-nist-1.2.12 lib/isodoc/nist/init.rb
metanorma-nist-1.2.11 lib/isodoc/nist/init.rb
metanorma-nist-1.2.10 lib/isodoc/nist/init.rb
metanorma-nist-1.2.9 lib/isodoc/nist/init.rb
metanorma-nist-1.2.8 lib/isodoc/nist/init.rb
metanorma-nist-1.2.7 lib/isodoc/nist/init.rb
metanorma-nist-1.2.6 lib/isodoc/nist/init.rb
metanorma-nist-1.2.5 lib/isodoc/nist/init.rb
metanorma-nist-1.2.4 lib/isodoc/nist/init.rb
metanorma-nist-1.2.3 lib/isodoc/nist/init.rb
metanorma-nist-1.2.2 lib/isodoc/nist/init.rb
metanorma-nist-1.2.1 lib/isodoc/nist/init.rb
metanorma-cli-1.3.4 gems/ruby/2.6.0/gems/metanorma-nist-1.2.0/lib/isodoc/nist/init.rb