Class: Commonmarker::Merge::SmartMerger
- Inherits:
-
Markdown::Merge::SmartMerger
- Object
- Markdown::Merge::SmartMerger
- Commonmarker::Merge::SmartMerger
- Defined in:
- lib/commonmarker/merge/smart_merger.rb
Overview
Orchestrates the smart merge process for Markdown files using CommonMarker.
This is a thin wrapper around Markdown::Merge::SmartMerger that:
- Forces the :commonmarker backend
- Sets commonmarker-specific defaults (freeze token, inner_merge_code_blocks)
- Exposes commonmarker-specific options (options hash)
Instance Method Summary collapse
-
#create_file_analysis(content, **opts) ⇒ Commonmarker::Merge::FileAnalysis
Create a FileAnalysis instance for parsing.
-
#destination_parse_error_class ⇒ Class
Returns the DestinationParseError class to use.
-
#initialize(template_content, dest_content, signature_generator: nil, preference: :destination, add_template_only_nodes: false, freeze_token: DEFAULT_FREEZE_TOKEN, options: {}, match_refiner: nil, node_typing: nil, **extra_options) ⇒ SmartMerger
constructor
Creates a new SmartMerger for intelligent Markdown file merging.
-
#template_parse_error_class ⇒ Class
Returns the TemplateParseError class to use.
Constructor Details
#initialize(template_content, dest_content, signature_generator: nil, preference: :destination, add_template_only_nodes: false, freeze_token: DEFAULT_FREEZE_TOKEN, options: {}, match_refiner: nil, node_typing: nil, **extra_options) ⇒ SmartMerger
Creates a new SmartMerger for intelligent Markdown file merging.
82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 |
# File 'lib/commonmarker/merge/smart_merger.rb', line 82 def initialize( template_content, dest_content, signature_generator: nil, preference: :destination, add_template_only_nodes: false, freeze_token: DEFAULT_FREEZE_TOKEN, options: {}, match_refiner: nil, node_typing: nil, ** ) super( template_content, dest_content, backend: :commonmarker, signature_generator: signature_generator, preference: preference, add_template_only_nodes: add_template_only_nodes, inner_merge_code_blocks: DEFAULT_INNER_MERGE_CODE_BLOCKS, freeze_token: freeze_token, match_refiner: match_refiner, node_typing: node_typing, options: , ** ) end |
Instance Method Details
#create_file_analysis(content, **opts) ⇒ Commonmarker::Merge::FileAnalysis
Create a FileAnalysis instance for parsing.
129 130 131 132 133 134 135 136 |
# File 'lib/commonmarker/merge/smart_merger.rb', line 129 def create_file_analysis(content, **opts) FileAnalysis.new( content, freeze_token: opts[:freeze_token], signature_generator: opts[:signature_generator], options: opts[:options] || {}, ) end |
#destination_parse_error_class ⇒ Class
Returns the DestinationParseError class to use.
120 121 122 |
# File 'lib/commonmarker/merge/smart_merger.rb', line 120 def destination_parse_error_class DestinationParseError end |
#template_parse_error_class ⇒ Class
Returns the TemplateParseError class to use.
113 114 115 |
# File 'lib/commonmarker/merge/smart_merger.rb', line 113 def template_parse_error_class TemplateParseError end |