Class: Metanorma::CustomAssets

Inherits:
Object
  • Object
show all
Defined in:
lib/metanorma/customassets/version.rb,
lib/metanorma/customassets/customassets.rb

Constant Summary collapse

VERSION =
"0.0.1".freeze

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(flavor) ⇒ CustomAssets

Returns a new instance of CustomAssets.



3
4
5
# File 'lib/metanorma/customassets/customassets.rb', line 3

def initialize(flavor)
  @flavor = flavor
end

Class Method Details

.aliasesObject



7
8
9
# File 'lib/metanorma/customassets/customassets.rb', line 7

def self.aliases
  { icc: :iso }
end

Instance Method Details

#process_input_adoc_overrides(attrs, options) ⇒ Object



11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
# File 'lib/metanorma/customassets/customassets.rb', line 11

def process_input_adoc_overrides(attrs, options)
  # Insert after the second element (index 1)
  # If attrs has fewer than 2 elements, this will handle it appropriately
  insertion_index = [attrs.length, 2].min
  case @flavor
  when :icc
    f1 = File.join(File.dirname(__FILE__), "assets", "icc-boilerplate.adoc")
    f2 = File.join(File.dirname(__FILE__), "assets", "icc-i18n.yaml")
    new_attrs = [
      ":boilerplate-authority: #{f1}",
      ":i18nyaml: #{f2}",
      ":publisher: International Color Consortium",
      ":publisher_abbr: ICC",
      ":presentation-metadata-color-secondary: #376795",
      ":presentation-metadata-backcover-text: color.org",
    ]
    attrs.insert(insertion_index, *new_attrs)
    options[":boilerplate-authority:"] = f1
  end
  attrs
end