class Docxtor::Document::Paragraph
Constants
- NESTED_PROPERTIES
- PLAIN_PROPERTIES
- PROPERTIES
- STYLE
Public Instance Methods
after_initialize(*args)
click to toggle source
# File lib/docxtor/document/paragraph.rb, line 38 def after_initialize(*args) @contents = [] @contents << args.shift if args.first.is_a? String create_params(args.shift || {}) NESTED_PROPERTIES.each do |name, element| @params[name] ||= {} end @params[:space] ||= 'default' end
aliases()
click to toggle source
# File lib/docxtor/document/paragraph.rb, line 87 def aliases { :b => :bold, :i => :italic, :u => :underline } end
line_break()
click to toggle source
# File lib/docxtor/document/paragraph.rb, line 75 def line_break @contents << :br end
Also aliased as: br
preserve_whitespace()
click to toggle source
# File lib/docxtor/document/paragraph.rb, line 79 def preserve_whitespace @params[:space] = 'preserve' end
properties()
click to toggle source
# File lib/docxtor/document/paragraph.rb, line 71 def properties PROPERTIES end
render(xml)
click to toggle source
Calls superclass method
Docxtor::Document::Element#render
# File lib/docxtor/document/paragraph.rb, line 50 def render(xml) super write_element(:p) do write_element(:r) do write_contents end end end
write(text)
click to toggle source
# File lib/docxtor/document/paragraph.rb, line 83 def write(text) @contents << text end
Also aliased as: w
Private Instance Methods
write_content(content)
click to toggle source
# File lib/docxtor/document/paragraph.rb, line 101 def write_content(content) content == :br ? write_line_break : write_text(content) end
write_contents()
click to toggle source
# File lib/docxtor/document/paragraph.rb, line 97 def write_contents @contents.each { |c| write_content(c) } end
write_line_break()
click to toggle source
# File lib/docxtor/document/paragraph.rb, line 107 def write_line_break @xml.w :br end
write_text(text)
click to toggle source
# File lib/docxtor/document/paragraph.rb, line 111 def write_text(text) @xml.w :t, 'xml:space' => @params[:space] do @xml.text! text end end