Skip to content

Commit 9aae9c8

Browse files
authored
Merge pull request #5172 from flip1995/gh-pages2
[gh-pages] Add documentation for `rust-1.*` tags
2 parents 2052bcf + 7a157ed commit 9aae9c8

File tree

41 files changed

+68390
-3080
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

41 files changed

+68390
-3080
lines changed

current

Lines changed: 0 additions & 1 deletion
This file was deleted.

list/index.html renamed to rust-1.29.0/index.html

Lines changed: 36 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
<meta charset="UTF-8"/>
55
<meta name="viewport" content="width=device-width, initial-scale=1"/>
66

7-
<title>Clippy</title>
7+
<title>ALL the Clippy Lints</title>
88

99
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/twitter-bootstrap/3.3.6/css/bootstrap.min.css"/>
1010
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/highlight.js/9.5.0/styles/github.min.css"/>
@@ -14,6 +14,9 @@
1414

1515
.form-inline .checkbox { margin-right: 0.6em }
1616

17+
.panel-heading { cursor: pointer; }
18+
.panel-heading:hover { background-color: #eee; }
19+
1720
.panel-title { display: flex; }
1821
.panel-title .label { display: inline-block; }
1922

@@ -73,8 +76,8 @@ <h1>ALL the Clippy Lints</h1>
7376
<div class="panel-body row">
7477
<div class="col-md-12 form-horizontal">
7578
<div class="input-group">
76-
<span class="input-group-addon" id="filter-label">Filter:</span>
77-
<input type="text" class="form-control" placeholder="Keywords or search string" aria-describedby="filter-label" ng-model="search" />
79+
<label class="input-group-addon" id="filter-label" for="filter-input">Filter:</label>
80+
<input type="text" class="form-control" placeholder="Keywords or search string" id="filter-input" ng-model="search" />
7881
<span class="input-group-btn">
7982
<button class="btn btn-default" type="button" ng-click="search = ''">
8083
Clear
@@ -122,7 +125,7 @@ <h4 class="list-group-item-heading">
122125
</div>
123126
</div>
124127

125-
<a href="https://github.com/rust-lang-nursery/rust-clippy">
128+
<a href="https://github.com/rust-lang/rust-clippy">
126129
<img style="position: absolute; top: 0; right: 0; border: 0;" src="https://s3.amazonaws.com/github/ribbons/forkme_right_darkblue_121621.png" alt="Fork me on Github"/>
127130
</a>
128131

@@ -164,6 +167,19 @@ <h4 class="list-group-item-heading">
164167
});
165168
}
166169

170+
function selectGroup($scope, selectedGroup) {
171+
var groups = $scope.groups;
172+
for (var group in groups) {
173+
if (groups.hasOwnProperty(group)) {
174+
if (group === selectedGroup) {
175+
groups[group] = true;
176+
} else {
177+
groups[group] = false;
178+
}
179+
}
180+
}
181+
}
182+
167183
angular.module("clippy", [])
168184
.filter('markdown', function ($sce) {
169185
return function (text) {
@@ -220,6 +236,11 @@ <h4 class="list-group-item-heading">
220236
return result;
221237
}, {});
222238

239+
var selectedGroup = getQueryVariable("sel");
240+
if (selectedGroup) {
241+
selectGroup($scope, selectedGroup.toLowerCase());
242+
}
243+
223244
scrollToLintByURL($scope);
224245
})
225246
.error(function (data) {
@@ -240,6 +261,17 @@ <h4 class="list-group-item-heading">
240261
}, false);
241262
});
242263
})();
264+
265+
function getQueryVariable(variable) {
266+
var query = window.location.search.substring(1);
267+
var vars = query.split('&');
268+
for (var i = 0; i < vars.length; i++) {
269+
var pair = vars[i].split('=');
270+
if (decodeURIComponent(pair[0]) == variable) {
271+
return decodeURIComponent(pair[1]);
272+
}
273+
}
274+
}
243275
</script>
244276
</body>
245277
</html>

list/lints.json renamed to rust-1.29.0/lints.json

Lines changed: 3074 additions & 3074 deletions
Large diffs are not rendered by default.

rust-1.29.1/index.html

Lines changed: 277 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,277 @@
1+
<!DOCTYPE html>
2+
<html lang="en">
3+
<head>
4+
<meta charset="UTF-8"/>
5+
<meta name="viewport" content="width=device-width, initial-scale=1"/>
6+
7+
<title>ALL the Clippy Lints</title>
8+
9+
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/twitter-bootstrap/3.3.6/css/bootstrap.min.css"/>
10+
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/highlight.js/9.5.0/styles/github.min.css"/>
11+
<style>
12+
blockquote { font-size: 1em; }
13+
[ng\:cloak], [ng-cloak], [data-ng-cloak], [x-ng-cloak], .ng-cloak, .x-ng-cloak { display: none !important; }
14+
15+
.form-inline .checkbox { margin-right: 0.6em }
16+
17+
.panel-heading { cursor: pointer; }
18+
.panel-heading:hover { background-color: #eee; }
19+
20+
.panel-title { display: flex; }
21+
.panel-title .label { display: inline-block; }
22+
23+
.panel-title-name { flex: 1; }
24+
.panel-title-name span { vertical-align: bottom; }
25+
26+
.panel .panel-title-name .anchor { display: none; }
27+
.panel:hover .panel-title-name .anchor { display: inline; color: #fff; }
28+
</style>
29+
</head>
30+
<body>
31+
<div class="container" ng-app="clippy" ng-controller="lintList">
32+
<div class="page-header">
33+
<h1>ALL the Clippy Lints</h1>
34+
</div>
35+
36+
<noscript>
37+
<div class="alert alert-danger" role="alert">
38+
Sorry, this site only works with JavaScript! :(
39+
</div>
40+
</noscript>
41+
42+
<div ng-cloak>
43+
44+
<div class="alert alert-info" role="alert" ng-if="loading">
45+
Loading&#x2026;
46+
</div>
47+
<div class="alert alert-danger" role="alert" ng-if="error">
48+
Error loading lints!
49+
</div>
50+
51+
<div class="panel panel-default" ng-show="data">
52+
<div class="panel-body row">
53+
<div class="col-md-6 form-inline">
54+
<div class="form-group form-group-lg">
55+
<p class="h4">Lint levels</p>
56+
<div class="checkbox" ng-repeat="(level, enabled) in levels">
57+
<label>
58+
<input type="checkbox" ng-model="levels[level]" />
59+
{{level}}
60+
</label>
61+
</div>
62+
</div>
63+
</div>
64+
<div class="col-md-6 form-inline">
65+
<div class="form-group form-group-lg">
66+
<p class="h4">Lint groups</p>
67+
<div class="checkbox" ng-repeat="(group, enabled) in groups">
68+
<label class="text-capitalize">
69+
<input type="checkbox" ng-model="groups[group]" />
70+
{{group}}
71+
</label>
72+
</div>
73+
</div>
74+
</div>
75+
</div>
76+
<div class="panel-body row">
77+
<div class="col-md-12 form-horizontal">
78+
<div class="input-group">
79+
<label class="input-group-addon" id="filter-label" for="filter-input">Filter:</label>
80+
<input type="text" class="form-control" placeholder="Keywords or search string" id="filter-input" ng-model="search" />
81+
<span class="input-group-btn">
82+
<button class="btn btn-default" type="button" ng-click="search = ''">
83+
Clear
84+
</button>
85+
</span>
86+
</div>
87+
</div>
88+
</div>
89+
</div>
90+
91+
<article class="panel panel-default" id="{{lint.id}}"
92+
ng-repeat="lint in data | filter:byLevels | filter:byGroups | filter:search | orderBy:'id' track by lint.id" on-finish-render="ngRepeatFinished">
93+
<header class="panel-heading" ng-click="open[lint.id] = !open[lint.id]">
94+
<h2 class="panel-title">
95+
<div class="panel-title-name">
96+
<span>{{lint.id}}</span>
97+
<a href="#{{lint.id}}" class="anchor label label-default" ng-click="open[lint.id] = true; $event.stopPropagation()">&para;</a>
98+
</div>
99+
100+
<div class="panel-title-addons">
101+
<span class="label label-default text-capitalize">{{lint.group}}</span>
102+
103+
<span ng-if="lint.level == 'Allow'" class="label label-success">Allow</span>
104+
<span ng-if="lint.level == 'Warn'" class="label label-warning">Warn</span>
105+
<span ng-if="lint.level == 'Deny'" class="label label-danger">Deny</span>
106+
<span ng-if="lint.level == 'Deprecated'" class="label label-default">Deprecated</span>
107+
108+
<button class="btn btn-default btn-xs">
109+
<span ng-show="open[lint.id]">&minus;</span>
110+
<span ng-hide="open[lint.id]">&plus;</span>
111+
</button>
112+
</div>
113+
</h2>
114+
</header>
115+
116+
<ul class="list-group lint-docs" ng-if="lint.docs" ng-class="{collapse: true, in: open[lint.id]}">
117+
<li class="list-group-item" ng-repeat="(title, text) in lint.docs">
118+
<h4 class="list-group-item-heading">
119+
{{title}}
120+
</h4>
121+
<div class="list-group-item-text" ng-bind-html="text | markdown"></div>
122+
</li>
123+
</ul>
124+
</article>
125+
</div>
126+
</div>
127+
128+
<a href="https://github.com/rust-lang/rust-clippy">
129+
<img style="position: absolute; top: 0; right: 0; border: 0;" src="https://s3.amazonaws.com/github/ribbons/forkme_right_darkblue_121621.png" alt="Fork me on Github"/>
130+
</a>
131+
132+
<script src="https://cdnjs.cloudflare.com/ajax/libs/markdown-it/7.0.0/markdown-it.min.js"></script>
133+
<script src="https://cdnjs.cloudflare.com/ajax/libs/highlight.js/9.5.0/highlight.min.js"></script>
134+
<script src="https://cdnjs.cloudflare.com/ajax/libs/highlight.js/9.5.0/languages/rust.min.js"></script>
135+
<script src="https://cdnjs.cloudflare.com/ajax/libs/angular.js/1.4.12/angular.min.js"></script>
136+
<script>
137+
(function () {
138+
var md = window.markdownit({
139+
html: true,
140+
linkify: true,
141+
typographer: true,
142+
highlight: function (str, lang) {
143+
if (lang && hljs.getLanguage(lang)) {
144+
try {
145+
return '<pre class="hljs"><code>' +
146+
hljs.highlight(lang, str, true).value +
147+
'</code></pre>';
148+
} catch (__) {}
149+
}
150+
151+
return '<pre class="hljs"><code>' + md.utils.escapeHtml(str) + '</code></pre>';
152+
}
153+
});
154+
155+
function scrollToLint(lintId) {
156+
var target = document.getElementById(lintId);
157+
if (!target) {
158+
return;
159+
}
160+
target.scrollIntoView();
161+
}
162+
163+
function scrollToLintByURL($scope) {
164+
var removeListener = $scope.$on('ngRepeatFinished', function(ngRepeatFinishedEvent) {
165+
scrollToLint(window.location.hash.slice(1));
166+
removeListener();
167+
});
168+
}
169+
170+
function selectGroup($scope, selectedGroup) {
171+
var groups = $scope.groups;
172+
for (var group in groups) {
173+
if (groups.hasOwnProperty(group)) {
174+
if (group === selectedGroup) {
175+
groups[group] = true;
176+
} else {
177+
groups[group] = false;
178+
}
179+
}
180+
}
181+
}
182+
183+
angular.module("clippy", [])
184+
.filter('markdown', function ($sce) {
185+
return function (text) {
186+
return $sce.trustAsHtml(
187+
md.render(text || '')
188+
// Oh deer, what a hack :O
189+
.replace('<table', '<table class="table"')
190+
);
191+
};
192+
})
193+
.directive('onFinishRender', function ($timeout) {
194+
return {
195+
restrict: 'A',
196+
link: function (scope, element, attr) {
197+
if (scope.$last === true) {
198+
$timeout(function () {
199+
scope.$emit(attr.onFinishRender);
200+
});
201+
}
202+
}
203+
};
204+
})
205+
.controller("lintList", function ($scope, $http, $timeout) {
206+
// Level filter
207+
var LEVEL_FILTERS_DEFAULT = {Allow: true, Warn: true, Deny: true, Deprecated: true};
208+
$scope.levels = LEVEL_FILTERS_DEFAULT;
209+
$scope.byLevels = function (lint) {
210+
return $scope.levels[lint.level];
211+
};
212+
213+
$scope.groups = {};
214+
$scope.byGroups = function (lint) {
215+
return $scope.groups[lint.group];
216+
};
217+
218+
// Get data
219+
$scope.open = {};
220+
$scope.loading = true;
221+
222+
if (window.location.hash.length > 1) {
223+
$scope.search = window.location.hash.slice(1);
224+
$scope.open[window.location.hash.slice(1)] = true;
225+
scrollToLintByURL($scope);
226+
}
227+
228+
$http.get('./lints.json')
229+
.success(function (data) {
230+
$scope.data = data;
231+
$scope.loading = false;
232+
233+
// Initialize lint groups (the same structure is also used to enable filtering)
234+
$scope.groups = data.reduce(function (result, val) {
235+
result[val.group] = true;
236+
return result;
237+
}, {});
238+
239+
var selectedGroup = getQueryVariable("sel");
240+
if (selectedGroup) {
241+
selectGroup($scope, selectedGroup.toLowerCase());
242+
}
243+
244+
scrollToLintByURL($scope);
245+
})
246+
.error(function (data) {
247+
$scope.error = data;
248+
$scope.loading = false;
249+
});
250+
251+
window.addEventListener('hashchange', function () {
252+
// trigger re-render
253+
$timeout(function () {
254+
$scope.levels = LEVEL_FILTERS_DEFAULT;
255+
$scope.search = window.location.hash.slice(1);
256+
$scope.open[window.location.hash.slice(1)] = true;
257+
258+
scrollToLintByURL($scope);
259+
});
260+
return true;
261+
}, false);
262+
});
263+
})();
264+
265+
function getQueryVariable(variable) {
266+
var query = window.location.search.substring(1);
267+
var vars = query.split('&');
268+
for (var i = 0; i < vars.length; i++) {
269+
var pair = vars[i].split('=');
270+
if (decodeURIComponent(pair[0]) == variable) {
271+
return decodeURIComponent(pair[1]);
272+
}
273+
}
274+
}
275+
</script>
276+
</body>
277+
</html>

0 commit comments

Comments
 (0)