Class: MarkdownProcessor
- Inherits:
-
Object
- Object
- MarkdownProcessor
- Includes:
- CodeBlockHelper, DaliboHelper, EnumHelper, ResultHelper
- Defined in:
- lib/markdown_processor.rb
Instance Method Summary collapse
-
#initialize(temp_dir, input_file_path = nil) ⇒ MarkdownProcessor
constructor
A new instance of MarkdownProcessor.
- #process_file(file_enum) ⇒ Object
Constructor Details
#initialize(temp_dir, input_file_path = nil) ⇒ MarkdownProcessor
Returns a new instance of MarkdownProcessor.
18 19 20 21 22 23 24 25 26 27 |
# File 'lib/markdown_processor.rb', line 18 def initialize(temp_dir, input_file_path = nil) @temp_dir = temp_dir @input_file_path = input_file_path @output_lines = [] reset_code_block_state @language_resolver = LanguageResolver.new @frontmatter_parser = FrontmatterParser.new(@language_resolver) @code_block_parser = CodeBlockParser.new(@frontmatter_parser, @language_resolver) end |
Instance Method Details
#process_file(file_enum) ⇒ Object
29 30 31 32 33 34 35 36 37 38 39 |
# File 'lib/markdown_processor.rb', line 29 def process_file(file_enum) @frontmatter_parser.parse_frontmatter(file_enum, @output_lines) loop do current_line = get_next_line(file_enum) break unless current_line handle_line(current_line, file_enum) end @output_lines end |