Skip to content

Commit f64381d

Browse files
committed
Add closing tags for definition terms
Without the closing tags, the dt elements contain whitespace after the text. This normally isn't a big deal, but it messes some things up, e.g: using `::after` and `content: ", "` in the stylesheets.
1 parent 72ca1e0 commit f64381d

File tree

2 files changed

+7
-7
lines changed

2 files changed

+7
-7
lines changed

lib/rdoc/markup/to_html.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -407,7 +407,7 @@ def list_item_start(list_item, list_type)
407407
"<li>"
408408
when :LABEL, :NOTE then
409409
Array(list_item.label).map do |label|
410-
"<dt>#{to_html label}\n"
410+
"<dt>#{to_html label}</dt>\n"
411411
end.join << "<dd>"
412412
else
413413
raise RDoc::Error, "Invalid list type: #{list_type.inspect}"

test/rdoc/test_rdoc_markup_to_html.rb

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -146,21 +146,21 @@ def accept_list_item_start_bullet
146146
end
147147

148148
def accept_list_item_start_label
149-
assert_equal "<dl class=\"rdoc-list label-list\"><dt>cat\n<dd>", @to.res.join
149+
assert_equal "<dl class=\"rdoc-list label-list\"><dt>cat</dt>\n<dd>", @to.res.join
150150
end
151151

152152
def accept_list_item_start_lalpha
153153
assert_equal "<ol style=\"list-style-type: lower-alpha\"><li>", @to.res.join
154154
end
155155

156156
def accept_list_item_start_note
157-
assert_equal "<dl class=\"rdoc-list note-list\"><dt>cat\n<dd>",
157+
assert_equal "<dl class=\"rdoc-list note-list\"><dt>cat</dt>\n<dd>",
158158
@to.res.join
159159
end
160160

161161
def accept_list_item_start_note_2
162162
expected = <<-EXPECTED
163-
<dl class="rdoc-list note-list"><dt><code>teletype</code>
163+
<dl class="rdoc-list note-list"><dt><code>teletype</code></dt>
164164
<dd>
165165
<p>teletype description</p>
166166
</dd></dl>
@@ -171,7 +171,7 @@ def accept_list_item_start_note_2
171171

172172
def accept_list_item_start_note_multi_description
173173
expected = <<-EXPECTED
174-
<dl class="rdoc-list note-list"><dt>label
174+
<dl class="rdoc-list note-list"><dt>label</dt>
175175
<dd>
176176
<p>description one</p>
177177
</dd><dd>
@@ -184,8 +184,8 @@ def accept_list_item_start_note_multi_description
184184

185185
def accept_list_item_start_note_multi_label
186186
expected = <<-EXPECTED
187-
<dl class="rdoc-list note-list"><dt>one
188-
<dt>two
187+
<dl class="rdoc-list note-list"><dt>one</dt>
188+
<dt>two</dt>
189189
<dd>
190190
<p>two headers</p>
191191
</dd></dl>

0 commit comments

Comments
 (0)