summaryrefslogtreecommitdiff
path: root/lib/rdoc/markup/heading.rb
diff options
context:
space:
mode:
Diffstat (limited to 'lib/rdoc/markup/heading.rb')
-rw-r--r--lib/rdoc/markup/heading.rb13
1 files changed, 13 insertions, 0 deletions
diff --git a/lib/rdoc/markup/heading.rb b/lib/rdoc/markup/heading.rb
index b1f372222f..535e310e54 100644
--- a/lib/rdoc/markup/heading.rb
+++ b/lib/rdoc/markup/heading.rb
@@ -48,6 +48,19 @@ RDoc::Markup::Heading =
end
##
+ # Creates a fully-qualified label which will include the label from
+ # +context+. This helps keep ids unique in HTML.
+
+ def label context = nil
+ label = aref
+
+ label = [context.aref, label].compact.join '-' if
+ context and context.respond_to? :aref
+
+ label
+ end
+
+ ##
# HTML markup of the text of this label without the surrounding header
# element.