Skip to content

Commit

Permalink
added better pre display support if it is only one line, + li works a…
Browse files Browse the repository at this point in the history
…gain
  • Loading branch information
jedi4ever committed Dec 13, 2011
1 parent cbce2fd commit db0ce64
Showing 1 changed file with 15 additions and 4 deletions.
19 changes: 15 additions & 4 deletions lib/markdown2confluence/convertor/confluence.rb
Original file line number Diff line number Diff line change
Expand Up @@ -99,14 +99,16 @@ def convert_hr(el, indent)
end

def convert_ul(el, indent)
""
inner(el,indent)
end

alias :convert_ol :convert_ul
alias :convert_dl :convert_ul

def convert_li(el, indent)
"#{'-'*el.options[:level]} #{inner(el, indent)}\n"
"#{'-'}#{inner(el, indent)}"
end

alias :convert_dd :convert_li

def convert_dt(el, indent)
Expand All @@ -116,7 +118,12 @@ def convert_dt(el, indent)
def convert_html_element(el, indent)
markup=case el.value
when "iframe" then "{iframe:src=#{el.attr["src"]}}"
when "pre" then "{code}#{inner(el,indent)}{code}"
when "pre" then
if inner(el,indent).strip.match(/\n/)
"{code}#{inner(el,indent)}{code}"
else
"{{#{inner(el,indent).strip}}}"
end
else inner(el, indent)
end
end
Expand Down Expand Up @@ -172,7 +179,11 @@ def convert_codeblock(el, indent)
end

def convert_codespan(el, indent)
"{code}#{el.value}{code}\n"
if el.value.strip.match(/\n/)
"{code}#{el.value}{code}\n"
else
"{{#{el.value.strip}}}"
end
end

def convert_footnote(el, indent)
Expand Down

0 comments on commit db0ce64

Please sign in to comment.