From 9f69c3d520d61bb9ede86db53faa8b7fd7421362 Mon Sep 17 00:00:00 2001 From: m5o Date: Tue, 16 Jan 2018 16:10:15 +0100 Subject: [PATCH 1/3] Use bugify without custom Jekyll plugin. --- _includes/bugify.html | 36 ++++++++++++++++++++++++++++++++++++ _plugins/bugify.rb | 27 --------------------------- docs/4.0/browser-bugs.md | 12 ++++++------ 3 files changed, 42 insertions(+), 33 deletions(-) create mode 100644 _includes/bugify.html delete mode 100644 _plugins/bugify.rb diff --git a/_includes/bugify.html b/_includes/bugify.html new file mode 100644 index 000000000000..a8e00d0d89d8 --- /dev/null +++ b/_includes/bugify.html @@ -0,0 +1,36 @@ +{%- assign words = include.content | split: " " -%} + +{%- for word in words -%} + {% if word contains "#" %} + {% if word contains "," %}{% assign separator = true %}{% else %}{% assign separator = false %}{% endif %} + {%- assign data = word | split: "#" -%} + {%- assign bug_cat = data[0] | strip_newlines -%} + {%- assign bug_id = data[1] | strip_newlines | remove: "," -%} + + {%- case bug_cat -%} + {%- when "Bootstrap" -%} + #{{ bug_id }} + {%- when "Edge" -%} + Edge issue #{{ bug_id }} + {%- when "A11yUserVoice" -%} + Microsoft A11y UserVoice idea #{{ bug_id }} + {%- when "UserVoice" -%} + Edge UserVoice idea #{{ bug_id }} + {%- when "Mozilla" -%} + Mozilla bug #{{ bug_id }} + {%- when "Chromium" -%} + Chromium issue #{{ bug_id }} + {%- when "WebKit" -%} + WebKit bug #{{ bug_id }} + {%- when "Safari" -%} + Apple Safari Radar #{{ bug_id }} + {%- when "Normalize" -%} + Normalize #{{ bug_id }} + {%- else -%} + parse error + {%- endcase -%}{% if separator %}, {% endif %} + + {% else %} + {{ word }} + {%- endif -%} +{%- endfor -%} diff --git a/_plugins/bugify.rb b/_plugins/bugify.rb deleted file mode 100644 index 0f910718becf..000000000000 --- a/_plugins/bugify.rb +++ /dev/null @@ -1,27 +0,0 @@ -module Jekyll - module BugFilter - def bugify(input) - upstream_map = { - "Bootstrap" => "https://github.com/twbs/bootstrap/issues/", - "Edge" => ["https://developer.microsoft.com/en-us/microsoft-edge/platform/issues/", "Edge issue"], - "A11yUserVoice" => ["https://microsoftaccessibility.uservoice.com/forums/307429-microsoft-accessibility-feedback/suggestions/", "Microsoft A11y UserVoice idea"], - "UserVoice" => ["https://wpdev.uservoice.com/forums/257854-microsoft-edge-developer/suggestions/", "Edge UserVoice idea"], - "Mozilla" => ["https://bugzilla.mozilla.org/show_bug.cgi?id=", "Mozilla bug"], - "Chromium" => ["https://bugs.chromium.org/p/chromium/issues/detail?id=", "Chromium issue"], - "WebKit" => ["https://bugs.webkit.org/show_bug.cgi?id=", "WebKit bug"], - "Safari" => ["https://openradar.appspot.com/", "Apple Safari Radar"], - "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]} " : "" - input = input.gsub(/#{key}#(\d+)/, "#{label}#\\1") - end - - return input - end - end -end - -Liquid::Template.register_filter(Jekyll::BugFilter) diff --git a/docs/4.0/browser-bugs.md b/docs/4.0/browser-bugs.md index 0fb6f8505efa..d6d911562013 100644 --- a/docs/4.0/browser-bugs.md +++ b/docs/4.0/browser-bugs.md @@ -28,9 +28,9 @@ See also: {% for bug in site.data.browser-bugs %} {{ bug.browser }} - {{ bug.summary | markdownify | bugify }} - {{ bug.upstream_bug | bugify }} - {{ bug.origin | bugify }} + {{ bug.summary | markdownify }} + {% include bugify.html content=bug.upstream_bug %} + {% include bugify.html content=bug.origin %} {% endfor %} @@ -55,9 +55,9 @@ We publicly list these "most wanted" feature requests here, in the hopes of expe {% for feat in site.data.browser-features %} {{ feat.browser }} - {{ feat.summary | markdownify | bugify }} - {{ feat.upstream_bug | bugify }} - {{ feat.origin | bugify }} + {{ feat.summary | markdownify }} + {% include bugify.html content=feat.upstream_bug %} + {% include bugify.html content=feat.origin %} {% endfor %} From 82f7df19abf0498e73a9b5c061477e5c3686557a Mon Sep 17 00:00:00 2001 From: m5o Date: Mon, 12 Mar 2018 21:59:06 +0100 Subject: [PATCH 2/3] add comment with short usage instructions --- _includes/bugify.html | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/_includes/bugify.html b/_includes/bugify.html index a8e00d0d89d8..db397f3b0c4d 100644 --- a/_includes/bugify.html +++ b/_includes/bugify.html @@ -1,3 +1,8 @@ +{%- comment -%} +Usage: {% include bugify.html content=text %}, +where content is a text contains bug reference name and id. +e.g. Bootstrap#19984 +{%- endcomment -%} {%- assign words = include.content | split: " " -%} {%- for word in words -%} From c84dddeabf4d66f02ddc14708d9e287d22eb2727 Mon Sep 17 00:00:00 2001 From: XhmikosR Date: Mon, 12 Mar 2018 23:04:59 +0200 Subject: [PATCH 3/3] Update bugify.html --- _includes/bugify.html | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/_includes/bugify.html b/_includes/bugify.html index db397f3b0c4d..6a02bd23ec0c 100644 --- a/_includes/bugify.html +++ b/_includes/bugify.html @@ -1,8 +1,9 @@ {%- comment -%} Usage: {% include bugify.html content=text %}, -where content is a text contains bug reference name and id. +where content is a string that contains a bug reference name and id. e.g. Bootstrap#19984 {%- endcomment -%} + {%- assign words = include.content | split: " " -%} {%- for word in words -%}