2014-11-03 20:17:03 +01:00
|
|
|
module Jekyll
|
|
|
|
module BugFilter
|
|
|
|
def bugify(input)
|
|
|
|
upstream_map = {
|
|
|
|
"Bootstrap" => "https://github.com/twbs/bootstrap/issues/",
|
2016-04-05 01:25:09 +02:00
|
|
|
"Edge" => ["https://developer.microsoft.com/en-us/microsoft-edge/platform/issues/", "Edge issue"],
|
2016-06-26 06:32:23 +02:00
|
|
|
"UserVoice" => ["https://wpdev.uservoice.com/forums/257854-microsoft-edge-developer/suggestions/", "Edge UserVoice idea"],
|
2014-11-03 20:17:03 +01:00
|
|
|
"Mozilla" => ["https://bugzilla.mozilla.org/show_bug.cgi?id=", "Mozilla bug"],
|
2016-02-26 01:52:57 +01:00
|
|
|
"Chromium" => ["https://bugs.chromium.org/p/chromium/issues/detail?id=", "Chromium issue"],
|
2014-11-03 20:17:03 +01:00
|
|
|
"WebKit" => ["https://bugs.webkit.org/show_bug.cgi?id=", "WebKit bug"],
|
2014-11-04 19:40:39 +01:00
|
|
|
"Safari" => ["https://openradar.appspot.com/", "Apple Safari Radar"],
|
2014-11-03 20:17:03 +01:00
|
|
|
"Normalize" => ["https://github.com/necolas/normalize.css/issues/", "Normalize"]
|
|
|
|
}
|
|
|
|
|
|
|
|
upstream_map.each do |key, data|
|
|
|
|
url = data.is_a?(Array) ? data[0] : data
|
|
|
|
label = data.is_a?(Array) ? "#{data[1]} " : ""
|
2018-09-18 21:27:46 +02:00
|
|
|
input = input.gsub(/#{key}#(\d+)/, "<a href=\"#{url}\\1#{key === 'Edge' ? '/' : ''}\">#{label}#\\1</a>")
|
2014-11-03 20:17:03 +01:00
|
|
|
end
|
|
|
|
|
|
|
|
return input
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
2015-10-11 01:31:57 +02:00
|
|
|
Liquid::Template.register_filter(Jekyll::BugFilter)
|