Class: Howdoc::Writers::Index

Inherits:
Object
  • Object
show all
Defined in:
lib/howdoc/writers.rb

Overview

Writes one index per locale, from the guides the run just produced.

Class Method Summary collapse

Class Method Details

.call(locale:, records:, root: Howdoc.config.root, languages: []) ⇒ Object



73
74
75
76
77
78
79
80
81
82
83
84
# File 'lib/howdoc/writers.rb', line 73

def self.call(locale:, records:, root: Howdoc.config.root, languages: [])
  dir = File.join(root, locale.to_s)
  FileUtils.mkdir_p(dir)

  markup = Templates.render(
    'index/html/layout.haml',
    locale:, records:, languages:, config: Howdoc.config
  )
  path = File.join(dir, 'index.html')
  File.write(path, markup)
  path
end