diff options
Diffstat (limited to 'new/lib/crys/builder.rb')
-rw-r--r-- | new/lib/crys/builder.rb | 18 |
1 files changed, 11 insertions, 7 deletions
diff --git a/new/lib/crys/builder.rb b/new/lib/crys/builder.rb index 3b1ed388..ee4fb8ce 100644 --- a/new/lib/crys/builder.rb +++ b/new/lib/crys/builder.rb @@ -5,10 +5,12 @@ module Crys def initialize(file_path:, output_dir:, image_dir:) @file_path = file_path @output_dir = output_dir - @processor = processor_class.new(file_path: file_path, image_dir: image_dir) + @image_dir = image_dir end - def build + def build + @processor = processor_class.new(file_path: file_path, image_dir: image_dir) + process_content process_assets @@ -17,7 +19,7 @@ module Crys private - attr_reader :file_path, :output_dir, :processor, :db + attr_reader :file_path, :output_dir, :processor, :db, :image_dir def pages_db_manager Crys::PagesDbManager.new @@ -31,11 +33,13 @@ module Crys end def process_content - content = processor.parsed_content - filename = processor.filename - output_path = "#{output_dir}/#{filename}" + processor.parsed_pages.each do |page| + content = page.content + filename = page.filename + output_path = "#{output_dir}/#{filename}" - File.write(output_path, content) + File.write(output_path, content) + end end def processor_class |