Class: Uniword::Batch::NormalizeStylesStage
- Inherits:
-
ProcessingStage
- Object
- ProcessingStage
- Uniword::Batch::NormalizeStylesStage
- Defined in:
- lib/uniword/batch/stages/normalize_styles_stage.rb
Overview
Processing stage that normalizes document styles.
Responsibility: Remove direct formatting and apply standard styles. Single Responsibility - only handles style normalization.
Instance Attribute Summary
Attributes inherited from ProcessingStage
Instance Method Summary collapse
-
#description ⇒ String
Get stage description.
-
#initialize(options = {}) ⇒ NormalizeStylesStage
constructor
Initialize normalize styles stage.
-
#process(document, context = {}) ⇒ Document
Process document to normalize styles.
Methods inherited from ProcessingStage
Constructor Details
#initialize(options = {}) ⇒ NormalizeStylesStage
Initialize normalize styles stage
24 25 26 27 28 29 30 31 32 |
# File 'lib/uniword/batch/stages/normalize_styles_stage.rb', line 24 def initialize( = {}) super @remove_direct_formatting = .fetch(:remove_direct_formatting, true) @apply_standard_styles = .fetch(:apply_standard_styles, true) @preserve_semantic_styles = .fetch(:preserve_semantic_styles, true) @target_styles = .fetch(:target_styles, default_target_styles) end |
Instance Method Details
#description ⇒ String
Get stage description
52 53 54 |
# File 'lib/uniword/batch/stages/normalize_styles_stage.rb', line 52 def description "Normalize document styles" end |
#process(document, context = {}) ⇒ Document
Process document to normalize styles
39 40 41 42 43 44 45 46 47 |
# File 'lib/uniword/batch/stages/normalize_styles_stage.rb', line 39 def process(document, context = {}) log "Normalizing styles in #{context[:filename]}" normalize_paragraph_styles(document) if @apply_standard_styles remove_direct_formatting_from_runs(document) if @remove_direct_formatting log "Style normalization complete" document end |