summaryrefslogtreecommitdiff
path: root/new/lib/crys/processors/html_processor.rb
diff options
context:
space:
mode:
Diffstat (limited to 'new/lib/crys/processors/html_processor.rb')
-rw-r--r--new/lib/crys/processors/html_processor.rb31
1 files changed, 21 insertions, 10 deletions
diff --git a/new/lib/crys/processors/html_processor.rb b/new/lib/crys/processors/html_processor.rb
index bcc9768b..eccc748b 100644
--- a/new/lib/crys/processors/html_processor.rb
+++ b/new/lib/crys/processors/html_processor.rb
@@ -1,26 +1,37 @@
-require 'erb'
-require_relative "common_functions"
-require_relative "common_parts"
+# frozen_string_literal: true
+
+require_relative 'mixins/common_functions'
+require_relative 'mixins/common_parts'
module Crys
class HtmlProcessor
-
include CommonFunctions
include CommonParts
-
+
def initialize(file_path:, image_dir:)
@file_path = file_path
@image_dir = image_dir
@assets = []
end
- def parsed_content
- html_file = ERB.new(File.read(file_path))
- html_file.result(local_binding)
+ def parsed_pages
+ [
+ ProcessedPage.new(
+ filename: filename,
+ content: html_content,
+ source: file_path,
+ last_updated_at: Time.now
+ )
+ ]
end
def filename
- file_path.scan(/.*\/(.*)\.erb/).flatten.first
+ file_path.scan(%r{.*/(.*)\.erb}).flatten.first
+ end
+
+ def html_content
+ html_file = ERB.new(File.read(file_path))
+ html_file.result(local_binding)
end
attr_reader :assets, :file_path
@@ -31,7 +42,7 @@ module Crys
attr_writer :assets
def local_binding
- local_binding ||= binding.clone
+ @local_binding ||= binding.clone
end
end
end