From ea50b1adb699b878af295dda6f047215104f8c98 Mon Sep 17 00:00:00 2001 From: Stan Lo Date: Thu, 18 Dec 2025 12:01:00 +0000 Subject: [PATCH] Make sure path link in footers work correctly --- lib/rdoc/generator/aliki.rb | 17 +++++++++++++++++ lib/rdoc/generator/template/aliki/_footer.rhtml | 2 +- 2 files changed, 18 insertions(+), 1 deletion(-) diff --git a/lib/rdoc/generator/aliki.rb b/lib/rdoc/generator/aliki.rb index fc62d55f22..d8314196f9 100644 --- a/lib/rdoc/generator/aliki.rb +++ b/lib/rdoc/generator/aliki.rb @@ -1,5 +1,7 @@ # frozen_string_literal: true +require 'uri' + ## # Aliki theme for RDoc documentation # @@ -115,6 +117,21 @@ def write_search_index File.write search_index_path, "var search_data = #{JSON.generate(data)};" end + ## + # Resolves a URL for use in templates. Absolute URLs are returned unchanged. + # Relative URLs are prefixed with rel_prefix to ensure they resolve correctly from any page. + + def resolve_url(rel_prefix, url) + uri = URI.parse(url) + if uri.absolute? + url + else + "#{rel_prefix}/#{url}" + end + rescue URI::InvalidURIError + "#{rel_prefix}/#{url}" + end + private def build_class_module_entry(klass) diff --git a/lib/rdoc/generator/template/aliki/_footer.rhtml b/lib/rdoc/generator/template/aliki/_footer.rhtml index b29abc42e3..525d853dec 100644 --- a/lib/rdoc/generator/template/aliki/_footer.rhtml +++ b/lib/rdoc/generator/template/aliki/_footer.rhtml @@ -6,7 +6,7 @@

<%= h column_title %>