Skip to content

Commit

Permalink
Merge pull request #473 from murashitas/support_markdown_dl
Browse files Browse the repository at this point in the history
Support definition lists in Markdown
  • Loading branch information
takahashim committed Dec 19, 2015
2 parents d0d9b5b + b73d2ca commit 7616126
Show file tree
Hide file tree
Showing 2 changed files with 33 additions and 0 deletions.
16 changes: 16 additions & 0 deletions lib/review/markdownbuilder.rb
Original file line number Diff line number Diff line change
Expand Up @@ -99,6 +99,22 @@ def ol_end
blank
end

def dl_begin
puts '<dl>'
end

def dt(line)
puts "<dt>#{line}</dt>"
end

def dd(lines)
puts "<dd>#{lines.join}</dd>"
end

def dl_end
puts '</dl>'
end

def emlist(lines, caption = nil, lang = nil)
blank
if caption
Expand Down
17 changes: 17 additions & 0 deletions test/test_markdownbuilder.rb
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,23 @@ def test_cmd
assert_equal "```shell-session\nlineA\nlineB\n```\n", actual
end


def test_dlist
actual = compile_block(": foo\n foo.\n bar.\n")
assert_equal %Q|<dl>\n<dt>foo</dt>\n<dd>foo.bar.</dd>\n</dl>\n|, actual
end

def test_dlist_with_bracket
actual = compile_block(": foo[bar]\n foo.\n bar.\n")
assert_equal %Q|<dl>\n<dt>foo[bar]</dt>\n<dd>foo.bar.</dd>\n</dl>\n|, actual
end

def test_dlist_with_comment
source = ": title\n body\n\#@ comment\n\#@ comment\n: title2\n body2\n"
actual = compile_block(source)
assert_equal %Q|<dl>\n<dt>title</dt>\n<dd>body</dd>\n<dt>title2</dt>\n<dd>body2</dd>\n</dl>\n|, actual
end

def test_list
actual = compile_block(<<-EOS)
//list[name][caption]{
Expand Down

0 comments on commit 7616126

Please sign in to comment.