Class: Metanorma::Cli::SiteGenerator
- Inherits:
-
Object
- Object
- Metanorma::Cli::SiteGenerator
- Defined in:
- lib/metanorma/cli/site_generator.rb
Class Method Summary collapse
Instance Method Summary collapse
- #generate ⇒ Object
-
#initialize(source, options = {}, compile_options = {}) ⇒ SiteGenerator
constructor
A new instance of SiteGenerator.
Constructor Details
#initialize(source, options = {}, compile_options = {}) ⇒ SiteGenerator
Returns a new instance of SiteGenerator.
8 9 10 11 12 13 14 15 16 17 18 19 20 21 |
# File 'lib/metanorma/cli/site_generator.rb', line 8 def initialize(source, = {}, = {}) @collection_queue = [] @source = find_realpath(source) @site_path = .fetch(:output_dir, "site").to_s @asset_folder = .fetch(:asset_folder, "documents").to_s @collection_name = .fetch(:collection_name, "documents.xml") @manifest_file = find_realpath(.fetch(:config, default_config)) @template_dir = .fetch(:template_dir, template_data("path")) @stylesheet = .fetch(:stylesheet, template_data("stylesheet")) @compile_options = ensure_site_asset_directory! end |
Class Method Details
.generate(source, options = {}, compile_options = {}) ⇒ Object
23 24 25 |
# File 'lib/metanorma/cli/site_generator.rb', line 23 def self.generate(source, = {}, = {}) new(source, , ).generate end |
Instance Method Details
#generate ⇒ Object
27 28 29 30 31 32 33 34 35 36 37 |
# File 'lib/metanorma/cli/site_generator.rb', line 27 def generate site_directory = asset_directory.join("..") select_source_files.each { |source| compile(source) } Dir.chdir(site_directory) do build_collection_file(collection_name) convert_to_html_page(collection_name, "index.html") end dequeue_jobs end |