Skip to content

Commit

Permalink
Convert subsub-header correctly
Browse files Browse the repository at this point in the history
  • Loading branch information
dtan4 committed May 6, 2014
1 parent 6253014 commit 0b6209a
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
4 changes: 2 additions & 2 deletions lib/md2pukiwiki.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,14 @@

module Md2pukiwiki
def self.convert(text)
prefixed_type = %w{header list numbered_list}
decorated_type = %w{bold italic strikethrough}
prefixed_type = %w{header list numbered_list}
special_type = %w{image link}

text.lines.map do |line|
new_line = line.chomp

[prefixed_type, decorated_type, special_type].flatten.each do |type|
[decorated_type, prefixed_type, special_type].flatten.each do |type|
new_line = self.send("convert_#{type}", new_line)
end

Expand Down
4 changes: 4 additions & 0 deletions spec/md2pukiwiki_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,10 @@
expect(Md2pukiwiki.convert("## header")).to eq "**header"
end

it "should convert subsub-header" do
expect(Md2pukiwiki.convert("### header")).to eq "***header"
end

it "should convert list" do
expect(Md2pukiwiki.convert("* list")).to eq "- list"
end
Expand Down

0 comments on commit 0b6209a

Please sign in to comment.