]> git.lizzy.rs Git - rust.git/blob - util/gh-pages/index.html
Adjust HTML Docs
[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         .panel .anchor { display: none; }
15         .panel:hover .anchor { display: inline; color: #fff; }
16     </style>
17 </head>
18 <body>
19     <div class="container" ng-app="clippy" ng-controller="lintList">
20         <div class="page-header">
21             <h1>ALL the Clippy Lints</h1>
22         </div>
23
24         <noscript>
25             <div class="alert alert-danger" role="alert">
26                 Sorry, this site only works with JavaScript!
27             </div>
28         </noscript>
29
30         <div ng-cloak>
31
32             <div class="alert alert-info" role="alert" ng-if="loading">
33                 Loading&#x2026;
34             </div>
35             <div class="alert alert-danger" role="alert" ng-if="error">
36                 Error loading lints!
37             </div>
38
39             <div class="panel panel-default" ng-show="data">
40                 <div class="panel-body row">
41                     <div class="col-md-6 form-inline">
42                         <div class="form-group form-group-lg">
43                             <div class="checkbox" ng-repeat="(level, enabled) in levels" style="margin-right: 0.6em">
44                                 <label>
45                                     <input type="checkbox" ng-model="levels[level]" />
46                                     {{level}}
47                                 </label>
48                             </div>
49                         </div>
50                     </div>
51                     <div class="col-md-6">
52                         <div class="input-group">
53                             <span class="input-group-addon" id="filter-label">Filter:</span>
54                             <input type="text" class="form-control" placeholder="Keywords or search string" aria-describedby="filter-label" ng-model="search" />
55                             <span class="input-group-btn">
56                                 <button class="btn btn-default" type="button" ng-click="search = ''">
57                                     Clear
58                                 </button>
59                             </span>
60                         </div>
61                     </div>
62                 </div>
63             </div>
64
65             <article class="panel panel-default" id="{{lint.id}}" ng-repeat="lint in data | filter:byLevels | filter:search | orderBy:'id' track by lint.id">
66                 <header class="panel-heading" ng-click="open[lint.id] = !open[lint.id]">
67                     <button class="btn btn-default btn-sm pull-right" style="margin-top: -6px;">
68                         <span ng-show="open[lint.id]">&minus;</span>
69                         <span ng-hide="open[lint.id]">&plus;</span>
70                     </button>
71
72                     <h2 class="panel-title">
73                         {{lint.id}}
74
75                         <span ng-if="lint.level == 'Allow'" class="label label-info">Allow</span>
76                         <span ng-if="lint.level == 'Warn'" class="label label-warning">Warn</span>
77                         <span ng-if="lint.level == 'Deny'" class="label label-danger">Deny</span>
78
79                         <a href="#{{lint.id}}" class="anchor label label-default">&para;</a>
80                     </h2>
81                 </header>
82
83                 <ul class="list-group" ng-if="lint.docs" ng-class="{collapse: true, in: open[lint.id]}">
84                     <li class="list-group-item" ng-repeat="(title, text) in lint.docs">
85                         <h4 class="list-group-item-heading">
86                             {{title}}
87                         </h4>
88                         <div class="list-group-item-text" ng-bind-html="text | markdown"></div>
89                     </li>
90                 </ul>
91             </article>
92         </div>
93     </div>
94
95     <a href="https://github.com/Manishearth/rust-clippy">
96         <img style="position: absolute; top: 0; right: 0; border: 0;" src="https://s3.amazonaws.com/github/ribbons/forkme_right_darkblue_121621.png"/>
97     </a>
98     
99     <script src="https://cdnjs.cloudflare.com/ajax/libs/markdown-it/7.0.0/markdown-it.min.js"></script>
100     <script src="https://cdnjs.cloudflare.com/ajax/libs/highlight.js/9.5.0/highlight.min.js"></script>
101     <script src="https://cdnjs.cloudflare.com/ajax/libs/highlight.js/9.5.0/languages/rust.min.js"></script>
102     <script src="https://cdnjs.cloudflare.com/ajax/libs/angular.js/1.4.12/angular.min.js"></script>
103     <script>
104     (function () {
105         var md = window.markdownit({
106             html: true,
107             linkify: true,
108             typographer: true,
109             highlight: function (str, lang) {
110                 if (lang && hljs.getLanguage(lang)) {
111                     try {
112                         return '<pre class="hljs"><code>' +
113                             hljs.highlight(lang, str, true).value +
114                             '</code></pre>';
115                     } catch (__) {}
116                 }
117
118                 return '<pre class="hljs"><code>' + md.utils.escapeHtml(str) + '</code></pre>';
119             }
120         });
121
122         angular.module("clippy", [])
123         .filter('markdown', function ($sce) {
124             return function (text) {
125                 return $sce.trustAsHtml(
126                     md.render(text || '')
127                     // Oh deer, what a hack :O
128                     .replace('<table', '<table class="table"')
129                 );
130             };
131         })
132         .controller("lintList", function ($scope, $http) {
133             // Level filter
134             $scope.levels = {Allow: true, Warn: true, Deny: true};
135             $scope.byLevels = function (lint) {
136                 return $scope.levels[lint.level];
137             };
138
139             // Get data
140             $scope.open = {};
141             $scope.loading = true;
142
143             $http.get('./lints.json')
144             .success(function (data) {
145                 $scope.data = data;
146                 $scope.loading = false;
147             })
148             .error(function (data) {
149                 $scope.error = data;
150                 $scope.loading = false;
151             });
152         })
153     })();
154     </script>
155 </body>
156 </html>