lib/docxify/element/paragraph.rb in docxify-0.1.1 vs lib/docxify/element/paragraph.rb in docxify-0.1.2

- old
+ new

@@ -12,25 +12,27 @@ @color = options[:color] || @document&.color || "#000000" @highlight = options[:highlight] || false @background = options[:background] if options[:background] @background ||= @document&.background if @document&.background @align = options[:align] || :left + @after = options[:after] @inline_styling = options.key?(:inline_styling) ? options[:inline_styling] : true @tab_stops_cm = options[:tab_stops_cm] || [] @hanging_cm = options[:hanging_cm] || 0 end def to_s(_container = nil) nodes = if @inline_styling - parse_simple_html(@text) - else - [@text.gsub("<", "&lt;").gsub(">", "&gt;")] - end + parse_simple_html(@text) + else + [@text.gsub("<", "&lt;").gsub(">", "&gt;")] + end xml = "<w:p>" xml << "<w:pPr>" xml << "<w:jc w:val=\"#{@align}\"/>" if @align != :left + xml << "<w:spacing w:after=\"#{DocXify.pt2spacing @after}\"/>" if @after if tab_stops_cm.any? xml << "<w:tabs>" tab_stops_cm.each do |stop| xml << "<w:tab w:pos=\"#{DocXify.cm2dxa(stop)}\" w:val=\"left\"/>"