PluginProbe
Smart Grid-Layout Design for Contact Form 7 / 4.5
Smart Grid-Layout Design for Contact Form 7 v4.5
4.18.0 4.17.0 3.2.0 3.2.1 3.3.0 3.3.1 3.3.2 3.3.3 3.3.4 3.3.5 3.3.6 3.3.7 3.3.8 4.0.0 4.0.1 4.1.0 4.1.1 4.1.2 4.1.3 4.1.4 4.10 4.11 4.12 4.13 4.14 All 119 releases
cf7-grid-layout / assets / codemirror / addon / lint / html-lint.js

html-lint.js in Smart Grid-Layout Design for Contact Form 7 4.5, at assets/codemirror/addon/lint/html-lint.js

54 lines 1.8 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 // CodeMirror, copyright (c) by Marijn Haverbeke and others
2 // Distributed under an MIT license: http://codemirror.net/LICENSE
3
4 // Depends on htmlhint.js from http://htmlhint.com/js/htmlhint.js
5
6 // declare global: HTMLHint
7
8 (function(mod) {
9 if (typeof exports == "object" && typeof module == "object") // CommonJS
10 mod(require("../../lib/codemirror"), require("htmlhint"));
11 else if (typeof define == "function" && define.amd) // AMD
12 define(["../../lib/codemirror", "htmlhint"], mod);
13 else // Plain browser env
14 mod(CodeMirror, window.HTMLHint);
15 })(function(CodeMirror, HTMLHint) {
16 "use strict";
17
18 var defaultRules = {
19 "tagname-lowercase": true,
20 "attr-lowercase": true,
21 "attr-value-double-quotes": true,
22 "doctype-first": false,
23 "tag-pair": true,
24 "spec-char-escape": true,
25 "id-unique": true,
26 "src-not-empty": true,
27 "attr-no-duplication": true
28 };
29
30 CodeMirror.registerHelper("lint", "html", function(text, options) {
31 var found = [];
32 if (HTMLHint && !HTMLHint.verify) HTMLHint = HTMLHint.HTMLHint;
33 if (!HTMLHint) HTMLHint = window.HTMLHint;
34 if (!HTMLHint) {
35 if (window.console) {
36 window.console.error("Error: HTMLHint not found, not defined on window, or not available through define/require, CodeMirror HTML linting cannot run.");
37 }
38 return found;
39 }
40 var messages = HTMLHint.verify(text, options && options.rules || defaultRules);
41 for (var i = 0; i < messages.length; i++) {
42 var message = messages[i];
43 var startLine = message.line - 1, endLine = message.line - 1, startCol = message.col - 1, endCol = message.col;
44 found.push({
45 from: CodeMirror.Pos(startLine, startCol),
46 to: CodeMirror.Pos(endLine, endCol),
47 message: message.message,
48 severity : message.type
49 });
50 }
51 return found;
52 });
53 });
54