소스 검색

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