validate-website 1.9.2 → 1.9.3

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: fc639550c1560c9c30de32a770a398594030920917b57994d257c817715f8373
4
- data.tar.gz: fbc6b126cb99f1f6276b2e7e384a640b971330813d985ddb317311d323e1c916
3
+ metadata.gz: 9bc6ec31c18ead2191fb2c32b24cb7760b84cd9edc296e1ae5a16ef904ca4fd1
4
+ data.tar.gz: a5d08b83a6e6263bc3be738aaeab2836b14019575a385a801e5240cab23e1415
5
5
  SHA512:
6
- metadata.gz: 32079467f77389509dd01dd8ce400acbd9bb6a0821658b8d604e891eb5129f1f25413b1f1ec37c53550b4ebe065a603ae14ffdad12ebf8c6fbb7ba99c8a26ab0
7
- data.tar.gz: 540b198e6ecdd6f804ec9afb63f7e8282eef0c13bb5825d252770f7eed864696a3e77e196932640ac94e6d3d0176a6bbd77e77e82a3240e7c706870672662793
6
+ metadata.gz: 1d1ed522d9721e37c17db84fc63257afe632622a684012aa2d6585cfeb1f740482c887977f94a208e3844c6c6d4731d2511ea2e1dbf52076585869e4a3d3b61d
7
+ data.tar.gz: e4c0d75cbfb629a41d7eccbb766be3aaa0dff5bf9dd1532b6786e02a11ad7fe3955b4c5516cc5ea52358114b64218268de5fa66230f16978ef11820d7021df40
data/History.md CHANGED
@@ -1,4 +1,10 @@
1
1
 
2
+ 1.9.3 / 2019-04-11
3
+ ==================
4
+
5
+ * Update tidy_ffi to 1.0
6
+ * Avoid testing tidy bug with js
7
+
2
8
  1.9.2 / 2019-03-09
3
9
  ==================
4
10
 
@@ -2,5 +2,5 @@
2
2
 
3
3
  # Version file for ValidateWebsite
4
4
  module ValidateWebsite
5
- VERSION = '1.9.2'.freeze
5
+ VERSION = '1.9.3'.freeze
6
6
  end
@@ -118,333 +118,6 @@
118
118
  </div>
119
119
  </div>
120
120
 
121
- <script type="text/javascript">
122
- include = function() {
123
-
124
- // save references to save a few bytes
125
- var args = arguments;
126
- var doc = document;
127
-
128
- var toLoad = args.length; // load this many scripts
129
- var lastArgument = args[toLoad - 1];
130
- var hasCallback = lastArgument.call; // is the last arg a callback?
131
- if (hasCallback) {
132
- toLoad--;
133
- }
134
-
135
- function onScriptLoaded() {
136
- var readyState = this.readyState; // we test for "complete" or "loaded" if on IE
137
- if (!readyState || /ded|te/.test(readyState)) {
138
- toLoad--;
139
- if (!toLoad && hasCallback) {
140
- lastArgument();
141
- }
142
- }
143
- }
144
-
145
- for (var i = 0; i < toLoad; i++) {
146
-
147
- var script = doc.createElement('script');
148
- script.src = arguments[i];
149
- script.async = true;
150
- script.onload = script.onerror = script.onreadystatechange = onScriptLoaded;
151
- (
152
- doc.head ||
153
- doc.getElementsByTagName('head')[0]
154
- ).appendChild(script);
155
-
156
- }
157
-
158
- };
159
-
160
-
161
- include("https://cdn.jsdelivr.net/ace/1.1.3/noconflict/ace.js", function () {
162
- include("https://cdn.jsdelivr.net/ace/1.1.3/noconflict/mode-rust.js", function () {
163
- (function () {
164
- "use strict";
165
- // ECMAScript 6 Backwards compatability
166
- if (typeof String.prototype.startsWith !== 'function') {
167
- String.prototype.startsWith = function(str) {
168
- return this.slice(0, str.length) === str;
169
- };
170
- }
171
-
172
- // Regex for finding new lines
173
- var newLineRegex = /(?:\r\n|\r|\n)/g;
174
-
175
- // Fetching DOM items
176
- var activeCode = document.getElementById("active-code");
177
- var editorDiv = document.getElementById("editor");
178
- var staticCode = document.getElementById("static-code");
179
- var runButton = document.getElementById("run-code");
180
- var resultDiv = document.getElementById("result");
181
- var playLink = document.getElementById("playlink");
182
-
183
- // Background colors for program result on success/error
184
- var successColor = "#E2EEF6";
185
- var errorColor = "#F6E2E2";
186
- var warningColor = "#FFFBCB";
187
-
188
- // Message to show when the program is running
189
- var runningMsg = resultDiv.getAttribute("data-msg-running") || "Running...";
190
-
191
- // Error message to return when there's a server failure
192
- var errMsg = "The server encountered an error while running the program.";
193
-
194
- // Stores ACE editor markers (highights) for errors
195
- var markers = [];
196
-
197
- // Status codes, because there are no enums in Javascript
198
- var SUCCESS = 0;
199
- var ERROR = 1;
200
- var WARNING = 2;
201
-
202
- // JS exists, display ACE editor
203
- staticCode.style.display = "none";
204
- activeCode.style.display = "block";
205
-
206
- // Setting up ace editor
207
- var editor = ace.edit("editor");
208
- var Range = ace.require('ace/range').Range;
209
- editor.setTheme("ace/theme/chrome");
210
- editor.getSession().setMode("ace/mode/rust");
211
- editor.setShowPrintMargin(false);
212
- editor.renderer.setShowGutter(false);
213
- editor.setHighlightActiveLine(false);
214
-
215
- // Changes the height of the editor to match its contents
216
- function updateEditorHeight() {
217
- // https://stackoverflow.com/questions/11584061/
218
- var newHeight = editor.getSession().getScreenLength()
219
- * editor.renderer.lineHeight
220
- + editor.renderer.scrollBar.getWidth();
221
-
222
- editorDiv.style.height = Math.ceil(newHeight).toString() + "px";
223
- editor.resize();
224
- }
225
-
226
- // Set initial size to match initial content
227
- updateEditorHeight();
228
-
229
- // Safely remove all content from the result div
230
- function clearResultDiv() {
231
- // Clearing the result div will break our reference to
232
- // the playlink icon, so let's save it if it exists
233
- var newPlayLink = document.getElementById("playlink");
234
- if (newPlayLink) {
235
- playLink = resultDiv.removeChild(newPlayLink);
236
- }
237
- resultDiv.innerHTML = "";
238
- }
239
-
240
- function escapeHTML(unsafe) {
241
- return unsafe
242
- .replace(/&/g, "&amp;")
243
- .replace(/</g, "&lt;")
244
- .replace(/>/g, "&gt;")
245
- .replace(/"/g, "&quot;")
246
- .replace(/'/g, "&#039;")
247
- .replace(newLineRegex, '<br />');
248
- }
249
-
250
- // Dispatches a XMLHttpRequest to the Rust playpen, running the program, and
251
- // issues a callback to `callback` with the result (or null on error)
252
- function runProgram(program, callback) {
253
- var req = new XMLHttpRequest();
254
- var data = JSON.stringify({
255
- version: "beta",
256
- optimize: "0",
257
- code: program
258
- });
259
-
260
- req.timeout = 6000;
261
-
262
- // console.log("Sending", data);
263
- req.open('POST', "https://play.rust-lang.org/evaluate.json", true);
264
- req.onload = function(e) {
265
- var statusCode = false;
266
- var result = null;
267
-
268
- if (req.readyState === 4 && req.status === 200) {
269
- result = JSON.parse(req.response);
270
-
271
- // handle application errors from playpen
272
- if (typeof result['error'] === 'string') {
273
- statusCode = ERROR;
274
- result = 'Playpen Error: ' + result['error'];
275
- } else if (typeof result['result'] === 'string') {
276
- statusCode = SUCCESS;
277
- result = result['result'];
278
-
279
- // handle rustc errors/warnings
280
- // Need server support to get an accurate version of this.
281
- if (result.indexOf("error:") !== -1) {
282
- statusCode = ERROR;
283
- } else if (result.indexOf("warning:") !== -1) {
284
- statusCode = WARNING;
285
- }
286
- }
287
- }
288
-
289
- callback(statusCode, result);
290
- };
291
-
292
- req.onerror = function(e) {
293
- callback(false, null);
294
- };
295
-
296
- req.ontimeout = function(e) {
297
- var statusCode = ERROR;
298
- var result = "play.rust-lang.org not responding, please check back later";
299
-
300
- callback(statusCode, result);
301
- }
302
-
303
- req.setRequestHeader("Content-Type", "application/json");
304
- req.send(data);
305
- }
306
-
307
- // The callback to runProgram
308
- function handleResult(statusCode, message) {
309
- // Dispatch depending on result type
310
- if (result == null) {
311
- clearResultDiv();
312
- resultDiv.style.backgroundColor = errorColor;
313
- resultDiv.innerHTML = errMsg;
314
- } else if (statusCode === SUCCESS) {
315
- handleSuccess(message);
316
- } else if (statusCode === WARNING) {
317
- handleWarning(message);
318
- } else {
319
- handleError(message);
320
- }
321
- }
322
-
323
- // Called on successful program run: display output and playground icon
324
- function handleSuccess(message) {
325
- resultDiv.style.backgroundColor = successColor;
326
- displayOutput(escapeHTML(message), editor.getValue());
327
- }
328
-
329
- // Called when program run results in warning(s)
330
- function handleWarning(message) {
331
- resultDiv.style.backgroundColor = warningColor;
332
- handleProblem(message, "warning");
333
- }
334
-
335
- // Called when program run results in error(s)
336
- function handleError(message) {
337
- resultDiv.style.backgroundColor = errorColor;
338
- handleProblem(message, "error");
339
- }
340
-
341
- // Called on unsuccessful program run. Detects and prints problems (either
342
- // warnings or errors) in program output and highlights relevant lines and text
343
- // in the code.
344
- function handleProblem(message, problem) {
345
- // Getting list of ranges with problems
346
- var lines = message.split(newLineRegex);
347
-
348
- // Cleaning up the message: keeps only relevant problem output.
349
- var cleanMessage = lines.filter(function(line) {
350
- return !line.trim().startsWith("--> <anon>")
351
- && !line.startsWith("playpen:")
352
- && !line.trim().startsWith("error: aborting");
353
- }).map(function(line) {
354
- return escapeHTML(line);
355
- }).filter(function(line) {
356
- return line != "";
357
- }).map(function(line) {
358
- return line.replace(/ /g, '\u00a0\u00a0');
359
- }).join("<br />");
360
-
361
- // Get all of the row:col in the message.
362
- var errorLines = lines.filter(function(line) {
363
- return line.indexOf("--> <anon>") !== -1;
364
- }).map(function(line) {
365
- var lineIndex = line.indexOf(":");
366
- if (lineIndex !== -1) {
367
- return line.slice(lineIndex);
368
- }
369
-
370
- return "";
371
- }).filter(function(line) {
372
- return line != "";
373
- });
374
-
375
- // Setting message
376
- displayOutput(cleanMessage, editor.getValue());
377
-
378
- // Highlighting the lines
379
- var ranges = parseProblems(errorLines);
380
- markers = ranges.map(function(range) {
381
- return editor.getSession().addMarker(range, "ace-" + problem + "-line",
382
- "fullLine", false);
383
- });
384
-
385
- // Highlighting the specific text
386
- markers = markers.concat(ranges.map(function(range) {
387
- return editor.getSession().addMarker(range, "ace-" + problem + "-text",
388
- "text", false);
389
- }));
390
- }
391
-
392
- // Parses a problem message returning a list of ranges (row:col, row:col) where
393
- // problems in the code have occured.
394
- function parseProblems(lines) {
395
- var ranges = [];
396
- for (var i in lines) {
397
- var line = lines[i];
398
- var parts = line.split(/:\s?|\s+/, 5).slice(1, 5);
399
- var ip = parts.map(function(p) { return parseInt(p, 10) - 1; });
400
- console.log("line:", line, parts, ip);
401
- ranges.push(new Range(ip[0], ip[1], ip[2], ip[3]));
402
- }
403
-
404
- return ranges;
405
- }
406
-
407
- // Registering handler for run button click
408
- runButton.addEventListener("click", function(ev) {
409
- resultDiv.style.display = "block";
410
- clearResultDiv();
411
- resultDiv.innerHTML = runningMsg;
412
-
413
- // clear previous markers, if any
414
- markers.map(function(id) { editor.getSession().removeMarker(id); });
415
-
416
- // Get the code, run the program
417
- var program = editor.getValue();
418
- runProgram(program, handleResult);
419
- });
420
-
421
- // Display an output message and a link to the Rust playground
422
- function displayOutput(message, program) {
423
- var programUrl = "https://play.rust-lang.org/?code=" +
424
- encodeURIComponent(program) + "&run=1";
425
- playLink.href = programUrl;
426
-
427
- clearResultDiv(); // clear resultDiv, then add
428
- resultDiv.appendChild(playLink); // playLink icon and message
429
- resultDiv.innerHTML += message;
430
- }
431
-
432
- // Highlight active line when focused
433
- editor.on('focus', function() {
434
- editor.setHighlightActiveLine(true);
435
- });
436
-
437
- // Don't when not
438
- editor.on('blur', function() {
439
- editor.setHighlightActiveLine(false);
440
- });
441
- }());
442
-
443
- });
444
- });
445
- </script>
446
-
447
-
448
121
  <footer>
449
122
  <p>Our site in other languages:
450
123
  <a href="/en-US/">English</a>,
@@ -462,15 +135,5 @@
462
135
  </p>
463
136
  </footer>
464
137
 
465
- <script>
466
- (function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){
467
- (i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),
468
- m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)
469
- })(window,document,'script','//www.google-analytics.com/analytics.js','ga');
470
-
471
- ga('create', 'UA-58390457-1', 'auto');
472
- ga('send', 'pageview');
473
-
474
- </script>
475
138
  </body>
476
139
  </html>
@@ -102,7 +102,7 @@ describe ValidateWebsite::Validator do
102
102
  validator = subject.new(@html5_page.doc,
103
103
  @html5_page.body)
104
104
  validator.valid?.must_equal false
105
- validator.errors.size.must_equal 4
105
+ validator.errors.size.must_equal 3
106
106
  end
107
107
 
108
108
  it 'should exclude errors ignored by :ignore option' do
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: validate-website
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.9.2
4
+ version: 1.9.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Laurent Arnoud
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2019-03-09 00:00:00.000000000 Z
11
+ date: 2019-04-11 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: crass
@@ -72,14 +72,14 @@ dependencies:
72
72
  requirements:
73
73
  - - "~>"
74
74
  - !ruby/object:Gem::Version
75
- version: '0.1'
75
+ version: '1.0'
76
76
  type: :runtime
77
77
  prerelease: false
78
78
  version_requirements: !ruby/object:Gem::Requirement
79
79
  requirements:
80
80
  - - "~>"
81
81
  - !ruby/object:Gem::Version
82
- version: '0.1'
82
+ version: '1.0'
83
83
  - !ruby/object:Gem::Dependency
84
84
  name: w3c_validators
85
85
  requirement: !ruby/object:Gem::Requirement
@@ -281,7 +281,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
281
281
  version: '0'
282
282
  requirements: []
283
283
  rubyforge_project:
284
- rubygems_version: 2.7.6
284
+ rubygems_version: 2.7.6.2
285
285
  signing_key:
286
286
  specification_version: 4
287
287
  summary: Web crawler for checking the validity of your documents