Module: Metanorma::Util

Defined in:
lib/metanorma/util.rb

Defined Under Namespace

Classes: DisambigFiles

Class Method Summary collapse

Class Method Details

.log(message, type = :info) ⇒ Object



3
4
5
6
7
8
9
10
11
12
13
# 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) ⇒ Object



26
27
28
29
30
# 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) ⇒ Object

dependency ordering



16
17
18
19
20
21
22
23
24
# 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