Class: PrmGenerator::MainDocumentGenerator
- Inherits:
-
Object
- Object
- PrmGenerator::MainDocumentGenerator
- Extended by:
- T::Sig
- Defined in:
- lib/udb/prm_generator.rb
Overview
Generates the main PRM document by combining all chapters and content
Instance Method Summary collapse
- #generate ⇒ Object
-
#initialize(prm, resolver, output_base_dir, template_dir, root_dir) ⇒ MainDocumentGenerator
constructor
A new instance of MainDocumentGenerator.
Constructor Details
#initialize(prm, resolver, output_base_dir, template_dir, root_dir) ⇒ MainDocumentGenerator
Returns a new instance of MainDocumentGenerator.
402 403 404 405 406 407 408 409 |
# File 'lib/udb/prm_generator.rb', line 402 def initialize(prm, resolver, output_base_dir, template_dir, root_dir) @prm = prm @resolver = resolver @output_base_dir = Pathname.new(output_base_dir) @template_dir = Pathname.new(template_dir) @root_dir = Pathname.new(root_dir) @processor_config = prm.processor_config end |
Instance Method Details
#generate ⇒ Object
411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 |
# File 'lib/udb/prm_generator.rb', line 411 def generate # Reset tracking for external files Udb::ExternalDocumentationRenderer.reset_included_files template_path = @template_dir / "templates" / "prm_main.adoc.erb" raise GenerationError, "Main template not found: #{template_path}" unless template_path.exist? template = ERB.new(File.read(template_path, encoding: 'UTF-8'), trim_mode: "-") template.filename = template_path.to_s # Prepare template variables prepare_template_variables # Validate configuration before generation validate_configuration # Generate content content = template.result(binding) content = ContentSanitizer.sanitize(content) content = LinkResolver.resolve(@processor_config, content) # Validate generated content validate_generated_content(content) content end |