lib/markdown2confluence/convertor/confluence.rb in markdown2confluence-0.0.2 vs lib/markdown2confluence/convertor/confluence.rb in markdown2confluence-0.0.3

- old
+ new

@@ -80,14 +80,13 @@ def convert_text(el, indent) el.value end def convert_p(el, indent) - "#{' '*indent}#{inner(el, indent)}\n\n" + "#{' '*indent}#{inner(el, indent)}\n" end - def convert_blockquote(el, indent) "#{' '*indent}bq. #{inner(el, indent)}\n" end def convert_header(el, indent) @@ -104,11 +103,11 @@ alias :convert_ol :convert_ul alias :convert_dl :convert_ul def convert_li(el, indent) - "#{'-'}#{inner(el, indent)}" + "#{'-'*(indent/2)}#{inner(el, 0)}" end alias :convert_dd :convert_li def convert_dt(el, indent) @@ -117,11 +116,11 @@ def convert_html_element(el, indent) markup=case el.value when "iframe" then "{iframe:src=#{el.attr["src"]}}" when "pre" then - if inner(el,indent).strip.match(/\n/) + if inner(el,indent).strip.match(/\n/) "{code}#{inner(el,indent)}{code}" else "{{#{inner(el,indent).strip}}}" end else inner(el, indent) @@ -159,20 +158,18 @@ def convert_br(el, indent) "\\" end def convert_a(el, indent) - text=inner(el,indent) - link=el.attr['href'] - markup="[#{text+'|' unless text.nil?}#{link}]" - return markup + text = inner(el,indent) + link = el.attr['href'] + "[#{text+'|' unless text.nil?}#{link}]" end def convert_img(el, indent) - src=el.attr['src'] - alt=el.attr['alt'] - markup="!#{src}#{"|alt=" unless alt.nil?}!" - return markup + src = el.attr['src'] + alt = el.attr['alt'] + alt.to_s.empty? ? "!#{src}!" : "!#{src}|alt=#{alt}!" end def convert_codeblock(el, indent) "{code}#{el.value}{code}\n" end