Class: Sablon::HTMLConverter::Run

Inherits:
Node
  • Object
show all
Defined in:
lib/sablon/html/ast.rb

Overview

Create a run of text in the document, runs cannot be nested within each other

Direct Known Subclasses

Newline

Constant Summary collapse

PROPERTIES =
%w[b i caps color dstrike emboss imprint highlight outline
rStyle shadow shd smallCaps strike sz u vanish
vertAlign rFonts].freeze

Instance Method Summary collapse

Methods inherited from Node

#accept, convert_style_property, node_name, process_properties, style_conversion

Constructor Details

#initialize(_env, node, properties) ⇒ Run

Returns a new instance of Run.



485
486
487
488
489
490
# File 'lib/sablon/html/ast.rb', line 485

def initialize(_env, node, properties)
  super
  properties = self.class.process_properties(properties)
  @properties = NodeProperties.run(properties)
  @string = node.to_s # using `text` doesn't reconvert HTML entities
end

Instance Method Details

#inspectObject



496
497
498
# File 'lib/sablon/html/ast.rb', line 496

def inspect
  "<Run{#{@properties.inspect}}: #{@string}>"
end

#to_docxObject



492
493
494
# File 'lib/sablon/html/ast.rb', line 492

def to_docx
  super('w:r')
end