Class: Metanorma::Cli::SiteGenerator
- Inherits:
-
Object
- Object
- Metanorma::Cli::SiteGenerator
- Defined in:
- lib/metanorma/cli/site_generator.rb
Constant Summary collapse
- DEFAULT_RELATON_COLLECTION_INDEX =
"documents.xml"- DEFAULT_ASSET_FOLDER =
"documents"- DEFAULT_SITE_INDEX =
"index.html"- DEFAULT_CONFIG_FILE =
"metanorma.yml"
Class Method Summary collapse
-
.generate!(source, options = {}, compile_options = {}) ⇒ Object
rubocop:enable Metrics/AbcSize.
Instance Method Summary collapse
- #generate! ⇒ Object
-
#initialize(source, options = {}, compile_options = {}) ⇒ SiteGenerator
constructor
rubocop:disable Metrics/AbcSize.
Constructor Details
#initialize(source, options = {}, compile_options = {}) ⇒ SiteGenerator
rubocop:disable Metrics/AbcSize
16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 |
# File 'lib/metanorma/cli/site_generator.rb', line 16 def initialize(source, = {}, = {}) @collection_queue = [] @source = find_realpath(source) @site_path = .fetch( :output_dir, Commands::Site::SITE_OUTPUT_DIRNAME ).to_s @asset_folder = .fetch(:asset_folder, DEFAULT_ASSET_FOLDER).to_s @relaton_collection_index = .fetch( :collection_name, DEFAULT_RELATON_COLLECTION_INDEX, ) @manifest_file = find_realpath(.fetch(:config, default_config)) @template_dir = .fetch(:template_dir, template_data("path")) @stylesheet = .fetch(:stylesheet, template_data("stylesheet")) @output_filename_template = .fetch( :output_filename_template, template_data("output_filename"), ) @compile_options = end |
Class Method Details
.generate!(source, options = {}, compile_options = {}) ⇒ Object
rubocop:enable Metrics/AbcSize
41 42 43 |
# File 'lib/metanorma/cli/site_generator.rb', line 41 def self.generate!(source, = {}, = {}) new(source, , ).generate! end |
Instance Method Details
#generate! ⇒ Object
45 46 47 48 49 50 51 52 53 54 55 56 57 |
# File 'lib/metanorma/cli/site_generator.rb', line 45 def generate! ensure_site_asset_directory! compile_files!(select_source_files) site_directory = asset_directory.join("..") Dir.chdir(site_directory) do build_collection_file!(relaton_collection_index) convert_to_html_page!(relaton_collection_index, DEFAULT_SITE_INDEX) end dequeue_jobs! end |