Class: Vivlio::Starter::CLI::PreProcessCommands::MarkdownPreprocessor
- Inherits:
-
Object
- Object
- Vivlio::Starter::CLI::PreProcessCommands::MarkdownPreprocessor
- Defined in:
- lib/vivlio/starter/cli/pre_process/markdown_preprocessor.rb
Overview
Markdown 前処理を段階的に実行するクラス
Instance Attribute Summary collapse
-
#context ⇒ Object
readonly
Returns the value of attribute context.
Instance Method Summary collapse
-
#initialize(md_file, entry) ⇒ MarkdownPreprocessor
constructor
A new instance of MarkdownPreprocessor.
-
#run ⇒ Object
指定Markdownの前処理パイプラインを順次実行する.
Constructor Details
#initialize(md_file, entry) ⇒ MarkdownPreprocessor
Returns a new instance of MarkdownPreprocessor.
55 56 57 58 59 60 61 62 63 64 65 |
# File 'lib/vivlio/starter/cli/pre_process/markdown_preprocessor.rb', line 55 def initialize(md_file, entry) filename = File.basename(md_file) @context = PreProcessContext.new( source_path: md_file, output_path: filename, filename: filename, file_type: entry.kind.to_s, chapter_number: entry.number, content: File.read(md_file, encoding: 'utf-8') ) end |
Instance Attribute Details
#context ⇒ Object (readonly)
Returns the value of attribute context.
51 52 53 |
# File 'lib/vivlio/starter/cli/pre_process/markdown_preprocessor.rb', line 51 def context @context end |
Instance Method Details
#run ⇒ Object
指定Markdownの前処理パイプラインを順次実行する
68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 |
# File 'lib/vivlio/starter/cli/pre_process/markdown_preprocessor.rb', line 68 def run Common.log_info("#{context.source_path} → #{context.output_path}") apply_frontmatter! strip_html_comments! process_data_streams! normalize_image_paths! validate_links_and_images! process_code_includes! normalize_html_block_boundaries! escape_inline_code_html! transform_text_right_inlines! transform_text_align_containers! transform_book_cards! transform_table_rotations! transform_table_containers! transform_links! expose_container_footnotes! strip_index_markup! write_output! end |