diff --git a/lib/rdoc/markup/to_html_crossref.rb b/lib/rdoc/markup/to_html_crossref.rb
index 2fbddeb83b..4a1350a73c 100644
--- a/lib/rdoc/markup/to_html_crossref.rb
+++ b/lib/rdoc/markup/to_html_crossref.rb
@@ -153,7 +153,7 @@ class RDoc::Markup::ToHtmlCrossref < RDoc::Markup::ToHtml
ref.sections.any? { |section| label == section.title } then
path << "##{label}"
else
- path << "#label-#{label}"
+ path << "##{ref.aref}-label-#{label}"
end if label
"#{text}"
diff --git a/test/rdoc/test_rdoc_markup_to_html_crossref.rb b/test/rdoc/test_rdoc_markup_to_html_crossref.rb
index 598bae3d3f..3d80980791 100644
--- a/test/rdoc/test_rdoc_markup_to_html_crossref.rb
+++ b/test/rdoc/test_rdoc_markup_to_html_crossref.rb
@@ -19,7 +19,7 @@ class TestRDocMarkupToHtmlCrossref < XrefTestCase
def test_convert_CROSSREF_label
result = @to.convert 'C1@foo'
- assert_equal para("foo at C1
"), result
+ assert_equal para("foo at C1
"), result
result = @to.convert 'C1#m@foo'
assert_equal para("foo at C1#m
"),
@@ -28,12 +28,12 @@ class TestRDocMarkupToHtmlCrossref < XrefTestCase
def test_convert_CROSSREF_label_period
result = @to.convert 'C1@foo.'
- assert_equal para("foo at C1
."), result
+ assert_equal para("foo at C1
."), result
end
def test_convert_CROSSREF_label_space
result = @to.convert 'C1@foo+bar'
- assert_equal para("foo bar at C1
"),
+ assert_equal para("foo bar at C1
"),
result
end
@@ -104,7 +104,7 @@ class TestRDocMarkupToHtmlCrossref < XrefTestCase
def test_convert_RDOCLINK_rdoc_ref_label
result = @to.convert 'rdoc-ref:C1@foo'
- assert_equal para("foo at C1
"), result,
+ assert_equal para("foo at C1
"), result,
'rdoc-ref:C1@foo'
end