Skip to content

Commit 8ea07e5

Browse files
committed
feat: show impl url for issue trackers
1 parent 269d011 commit 8ea07e5

File tree

3 files changed

+67
-2
lines changed

3 files changed

+67
-2
lines changed

_layouts/feature.html

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -66,6 +66,7 @@ <h1 class="feature-title">
6666
{% comment %}
6767
4. Let's start the loop!
6868
{% endcomment %}
69+
{% assign has-unsupported = false -%}
6970
{% for family in page-families-in-order %}
7071
{% assign family-key = family -%}
7172
{% assign family-values = page.stats[family] -%}
@@ -107,6 +108,7 @@ <h4 class="data-platform-name">
107108
{% assign stat-class-name = 'supported' -%}
108109
{% when 'n' %}
109110
{% assign stat-class-name = 'unsupported' -%}
111+
{% assign has-unsupported = true -%}
110112
{% when 'a' %}
111113
{% assign stat-class-name = 'mitigated' -%}
112114
{% when 'u' %}
@@ -167,6 +169,9 @@ <h4 class="data-platform-name">
167169
{% endfor %}
168170
</div>
169171
</div>
172+
{% if has-unsupported and page.has_impl_urls %}
173+
<p class="hint-tracker">Please check the <a href="#resources">resources section</a> for links to the issue tracker. They often provide a feature to upvote issues and show your support.</p>
174+
{% endif %}
170175
<footer class="feature-footer">
171176
{% assign has-page-notes = false -%}
172177
{% if page.notes != nil and page.notes != "" %}
@@ -199,7 +204,7 @@ <h3 class="list-subtitle">Unsupported keys in WebViews</h3>
199204
{% endif %}
200205
{% endif %}
201206
{% if page.links.size > 0 %}
202-
<h2 class="list-title">Resources</h2>
207+
<h2 class="list-title" id="resources">Resources</h2>
203208
<ul class="list">
204209
{% for link in page.links %}
205210
{% assign link-title = link | first -%}

_plugins/generated_features.rb

Lines changed: 44 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,46 @@ module Generated
55
class FeaturesGenerator < Jekyll::Generator
66
safe true
77

8+
def getBugTrackerLabel(url)
9+
if url.include?('crbug.com') || url.include?('bugs.chromium.org')
10+
"Chromium issue tracker"
11+
elsif url.include?('webkit.org') || url.include?('bugs.webkit.org')
12+
"WebKit issue tracker"
13+
elsif url.include?('bugzil.la') || url.include?('bugzilla.mozilla.org')
14+
"Firefox issue tracker"
15+
else
16+
"Issue tracker"
17+
end
18+
end
19+
20+
def getImplUrls(feature)
21+
platforms = ['webview_ios', 'webview_android', 'chrome_android', 'safari_ios']
22+
urls = []
23+
24+
platforms.each do |platform|
25+
next unless feature['__compat']['support'].key?(platform)
26+
support = feature['__compat']['support'][platform]
27+
entries = support.kind_of?(Array) ? support : [support]
28+
entries.each do |entry|
29+
next unless entry.kind_of?(Hash) && entry.key?('impl_url')
30+
url_list = entry['impl_url'].kind_of?(Array) ? entry['impl_url'] : [entry['impl_url']]
31+
urls.concat(url_list)
32+
end
33+
end
34+
35+
urls.uniq!
36+
tracker_counts = Hash.new(0)
37+
result = {}
38+
urls.each do |url|
39+
base_label = getBugTrackerLabel(url)
40+
tracker_counts[base_label] += 1
41+
count = tracker_counts[base_label]
42+
label = count > 1 ? "#{base_label} (#{count})" : base_label
43+
result[label] = url
44+
end
45+
result
46+
end
47+
848
def getVersions(feature, platform)
949
if !feature['__compat']["support"].key?(platform) then
1050
return {
@@ -68,9 +108,12 @@ def generate_bcd_from_section(site, section, timestamp, category, appended_title
68108
doc.data['keywords'] = 'todo'
69109
doc.data['last_test_date'] = timestamp
70110
doc.data['notes'] = data_source
71-
doc.data['links'] = feature["__compat"].key?("mdn_url") ? {
111+
links = feature["__compat"].key?("mdn_url") ? {
72112
"MDN reference" => feature["__compat"]["mdn_url"]
73113
} : {}
114+
impl_urls = getImplUrls(feature)
115+
doc.data['links'] = links.merge(impl_urls)
116+
doc.data['has_impl_urls'] = !impl_urls.empty?
74117
doc.data['stats'] = {
75118
"wkwebview" => {
76119
"macos" => {

_sass/_pages/_feature.scss

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -531,6 +531,23 @@
531531
}
532532
}
533533

534+
.hint-tracker {
535+
padding: rem(12px) rem(32px);
536+
font-size: rem(14px);
537+
line-height: 1.5;
538+
color: rgba(255, 255, 255, 0.7);
539+
border-top: 1px solid #3c3c3d;
540+
541+
a {
542+
color: inherit;
543+
text-decoration: underline;
544+
545+
&:hover, &:focus {
546+
color: #fff;
547+
}
548+
}
549+
}
550+
534551
.data-version-notes {
535552
position: absolute;
536553
left: 0;

0 commit comments

Comments
 (0)