Class: Sablon::HTMLConverter::Paragraph

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

Direct Known Subclasses

ListParagraph

Constant Summary collapse

PATTERN =
<<-XML.gsub("\n", "")
<w:p>
<w:pPr>
<w:pStyle w:val="%s" />
%s
</w:pPr>
%s
</w:p>
XML

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods inherited from Node

node_name

Constructor Details

#initialize(style, runs) ⇒ Paragraph

Returns a new instance of Paragraph.



49
50
51
# File 'lib/sablon/html/ast.rb', line 49

def initialize(style, runs)
  @style, @runs = style, runs
end

Instance Attribute Details

#runsObject

Returns the value of attribute runs.



48
49
50
# File 'lib/sablon/html/ast.rb', line 48

def runs
  @runs
end

#styleObject

Returns the value of attribute style.



48
49
50
# File 'lib/sablon/html/ast.rb', line 48

def style
  @style
end

Instance Method Details

#accept(visitor) ⇒ Object



67
68
69
70
# File 'lib/sablon/html/ast.rb', line 67

def accept(visitor)
  super
  runs.accept(visitor)
end

#inspectObject



72
73
74
# File 'lib/sablon/html/ast.rb', line 72

def inspect
  "<Paragraph{#{style}}: #{runs.inspect}>"
end

#to_docxObject



63
64
65
# File 'lib/sablon/html/ast.rb', line 63

def to_docx
  PATTERN % [style, ppr_docx, runs.to_docx]
end