Skip to content

Commit 049f92c

Browse files
committed
handle definition lists correctly, they belong in the same <dl>
1 parent d09d872 commit 049f92c

File tree

2 files changed

+9
-2
lines changed

2 files changed

+9
-2
lines changed

lib/wikicloth/wiki_buffer.rb

+2-2
Original file line numberDiff line numberDiff line change
@@ -397,7 +397,7 @@ def render_list_data()
397397

398398
common = 0
399399
(0..last.length - 1).each do |i|
400-
if last[i] == pieces[i]
400+
if list_tag_for(last[i]) == list_tag_for(pieces[i])
401401
common += 1
402402
else
403403
break
@@ -412,7 +412,7 @@ def render_list_data()
412412
end
413413
if open == '' && pieces != ''
414414
if last != ''
415-
ret << "</#{list_inner_tag_for(pieces[-1,1])}>"
415+
ret << "</#{list_inner_tag_for(last[-1,1])}>"
416416
end
417417
ret << "<#{list_inner_tag_for(pieces[-1,1])}>"
418418
end

test/wiki_cloth_test.rb

+7
Original file line numberDiff line numberDiff line change
@@ -379,6 +379,13 @@ class WikiClothTest < Test::Unit::TestCase
379379
assert_equal count.to_s, "6"
380380
end
381381

382+
test "definition lists" do
383+
wiki = WikiParser.new(:data => ";definition term\n:definition data")
384+
data = wiki.to_html
385+
puts data
386+
assert data.include?("<dl><dt>definition term</dt><dd>definition data</dd></dl>")
387+
end
388+
382389
test "noinclude and includeonly tags" do
383390
wiki = WikiParser.new(:data => "<noinclude>main page</noinclude><includeonly>never seen</includeonly>{{noinclude}}\n")
384391
data = wiki.to_html

0 commit comments

Comments
 (0)