Method: Documatic::OpenDocumentText::Helper#line_break

Defined in:
lib/documatic/open_document_text/helper.rb

#line_break(lines) ⇒ Object

Turns an array of strings into a single, escaped string with OpenDocument line breaks (<text:line-break/>), omitting any blank lines. Perfect for address blocks etc.



35
36
37
38
39
40
41
42
# File 'lib/documatic/open_document_text/helper.rb', line 35

def line_break(lines)
  lines_esc = lines.collect do |line|
    ERB::Util.h(line)
  end
  return (lines_esc.find_all do |line|
            line && line.to_s.length > 0
          end).join('<text:line-break/>')
end