瀏覽代碼

Normalize xlink:href attributes like HTML href ones…

…so links inside SVGs, such as those in Rust's railroad diagrams, can
work properly.
Calum Smith 3 月之前
父節點
當前提交
ee0e347ed3
共有 1 個文件被更改,包括 5 次插入2 次删除
  1. 5 2
      lib/docs/filters/core/normalize_paths.rb

+ 5 - 2
lib/docs/filters/core/normalize_paths.rb

@@ -7,8 +7,11 @@ module Docs
       result[:store_path] = store_path
 
       css('a').each do |link|
-        next unless (href = link['href']) && relative_url_string?(href)
-        link['href'] = normalize_href(href)
+        href = link['href']
+        link['href'] = normalize_href(href) if href && relative_url_string?(href)
+
+        xlink_href = link['xlink:href']
+        link['xlink:href'] = normalize_href(xlink_href) if xlink_href && relative_url_string?(xlink_href)
       end
 
       doc