Skip to content

Commit

Permalink
Merge pull request #18 from synthead/convert_numbered_lists
Browse files Browse the repository at this point in the history
Convert ordered lists.
  • Loading branch information
jedi4ever committed Mar 2, 2016
2 parents 3aa5c6f + 118a50c commit 2862756
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion lib/markdown2confluence/convertor/confluence.rb
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,11 @@ def inner(el, indent)
result = ''
indent += @indent
@stack.push(el)

if el.type == :ol
el.children.each {|c, i| c.options[:ordered] = true}
end

el.children.each do |inner_el|
result << send(DISPATCHER[inner_el.type], inner_el, indent)
end
Expand Down Expand Up @@ -106,7 +111,8 @@ def convert_ul(el, indent)
alias :convert_dl :convert_ul

def convert_li(el, indent)
"#{'*'*(indent/2)}#{inner(el, 0)}"
li_char = el.options[:ordered] ? "#" : "*"
"#{li_char*(indent/2)}#{inner(el, 0)}"
end

alias :convert_dd :convert_li
Expand Down

0 comments on commit 2862756

Please sign in to comment.