History

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 committed 1 year ago

Commit ee0e3471 parent d777a8a1 file · +5 −2Browse files

Unified · Split

lib/docs/filters/core/normalize_paths.rb+5−2
@@ -7,8 +7,11 @@ module Docs · 6 unmodified lines
77 result[:store_path] = store_path
88
99 css('a').each do |link|
10− next unless (href = link['href']) && relative_url_string?(href)
11− link['href'] = normalize_href(href)
10+ href = link['href']
11+ link['href'] = normalize_href(href) if href && relative_url_string?(href)
12+
13+ xlink_href = link['xlink:href']
14+ link['xlink:href'] = normalize_href(xlink_href) if xlink_href && relative_url_string?(xlink_href)
1215 end
1316
1417 doc