]> git.lizzy.rs Git - rust.git/blob - util/gh-pages/index.html
Merge pull request #2960 from matthiaskrgr/typos
[rust.git] / util / gh-pages / index.html
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>Clippy</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 { pointer: cursor; }
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                             <span class="input-group-addon" id="filter-label">Filter:</span>
80                             <input type="text" class="form-control" placeholder="Keywords or search string" aria-describedby="filter-label" 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-nursery/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         angular.module("clippy", [])
171         .filter('markdown', function ($sce) {
172             return function (text) {
173                 return $sce.trustAsHtml(
174                     md.render(text || '')
175                     // Oh deer, what a hack :O
176                     .replace('<table', '<table class="table"')
177                 );
178             };
179         })
180         .directive('onFinishRender', function ($timeout) {
181             return {
182                 restrict: 'A',
183                 link: function (scope, element, attr) {
184                     if (scope.$last === true) {
185                         $timeout(function () {
186                             scope.$emit(attr.onFinishRender);
187                         });
188                     }
189                 }
190             };
191         })
192         .controller("lintList", function ($scope, $http, $timeout) {
193             // Level filter
194             var LEVEL_FILTERS_DEFAULT = {Allow: true, Warn: true, Deny: true, Deprecated: true};
195             $scope.levels = LEVEL_FILTERS_DEFAULT;
196             $scope.byLevels = function (lint) {
197                 return $scope.levels[lint.level];
198             };
199
200             $scope.groups = {};
201             $scope.byGroups = function (lint) {
202                 return $scope.groups[lint.group];
203             };
204
205             // Get data
206             $scope.open = {};
207             $scope.loading = true;
208
209             if (window.location.hash.length > 1) {
210                 $scope.search = window.location.hash.slice(1);
211                 $scope.open[window.location.hash.slice(1)] = true;
212                 scrollToLintByURL($scope);
213             }
214
215             $http.get('./lints.json')
216             .success(function (data) {
217                 $scope.data = data;
218                 $scope.loading = false;
219
220                 // Initialize lint groups (the same structure is also used to enable filtering)
221                 $scope.groups = data.reduce(function (result, val) {
222                     result[val.group] = true;
223                     return result;
224                 }, {});
225
226                 scrollToLintByURL($scope);
227             })
228             .error(function (data) {
229                 $scope.error = data;
230                 $scope.loading = false;
231             });
232
233             window.addEventListener('hashchange', function () {
234                 // trigger re-render
235                 $timeout(function () {
236                     $scope.levels = LEVEL_FILTERS_DEFAULT;
237                     $scope.search = window.location.hash.slice(1);
238                     $scope.open[window.location.hash.slice(1)] = true;
239
240                     scrollToLintByURL($scope);
241                 });
242                 return true;
243             }, false);
244         });
245     })();
246     </script>
247 </body>
248 </html>