module Metanorma::Util

Public Class Methods

log(message, type = :info) click to toggle source
# File lib/metanorma/util.rb, line 3
def self.log(message, type = :info)
  log_types = Metanorma.configuration.logs.map(&:to_s) || []

  if log_types.include?(type.to_s)
    puts(message)
  end

  if type == :fatal
    exit(1)
  end
end
sort_extensions_execution(ext) click to toggle source
# File lib/metanorma/util.rb, line 26
def self.sort_extensions_execution(ext)
  ext.sort do |a, b|
    sort_extensions_execution_ord(a) <=> sort_extensions_execution_ord(b)
  end
end
sort_extensions_execution_ord(ext) click to toggle source

dependency ordering

# File lib/metanorma/util.rb, line 16
def self.sort_extensions_execution_ord(ext)
  case ext
  when :xml then 0
  when :rxl then 1
  when :presentation then 2
  else
    99
  end
end