-
-
Notifications
You must be signed in to change notification settings - Fork 200
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Introduces `--report-missing-doctype`, defaulting to false, to report on missing `<!DOCTYPE html>` at the beginning of the document. Depends on Nokogumbo >= 1.4.10 for rubys/nokogumbo#46 Fixes #318.
- Loading branch information
Showing
14 changed files
with
65 additions
and
68 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,3 @@ | ||
source 'http://rubygems.org' | ||
source 'https://rubygems.org' | ||
|
||
gemspec |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,26 +1,29 @@ | ||
class HtmlCheck < ::HTMLProofer::Check | ||
# tags embedded in scripts are used in templating languages: http://git.io/vOovv | ||
SCRIPT_EMBEDS_MSG = /Element script embeds close tag/ | ||
INVALID_TAG_MSG = /Tag ([\w\-:]+) invalid/ | ||
INVALID_PREFIX = /Namespace prefix/ | ||
PARSE_ENTITY_REF = /htmlParseEntityRef: no name/ | ||
DOCTYPE_MSG = /The doctype must be the first token in the document/ | ||
|
||
def run | ||
@html.errors.each do |error| | ||
message = error.message | ||
line = error.line | ||
|
||
if message =~ INVALID_TAG_MSG || message =~ INVALID_PREFIX | ||
next unless options[:validation][:report_invalid_tags] | ||
end | ||
|
||
if message =~ PARSE_ENTITY_REF | ||
next unless options[:validation][:report_missing_names] | ||
end | ||
|
||
# tags embedded in scripts are used in templating languages: http://git.io/vOovv | ||
next if !options[:validation][:report_script_embeds] && message =~ SCRIPT_EMBEDS_MSG | ||
add_issue(error.message, line: error.line) if report?(error.message) | ||
end | ||
end | ||
|
||
add_issue(message, line: line) | ||
def report?(message) | ||
case message | ||
when SCRIPT_EMBEDS_MSG | ||
options[:validation][:report_script_embeds] | ||
when INVALID_TAG_MSG, INVALID_PREFIX | ||
options[:validation][:report_invalid_tags] | ||
when PARSE_ENTITY_REF | ||
options[:validation][:report_missing_names] | ||
when DOCTYPE_MSG | ||
options[:validation][:report_missing_doctype] | ||
else | ||
true | ||
end | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1 @@ | ||
<a href="http://www.google.com" onClick="window.open('https://calendar.google.com/calendar/embed?src=o3uckm13gkcc5tu4u3846ik0pc%40group.calendar.google.com&ctz=America/Los_Angeles','Team Calendar','')"> | ||
<a href="http://www.google.com" onClick="window.open('https://calendar.google.com/calendar/embed?src=o3uckm13gkcc5tu4u3846ik0pc%40group.calendar.google.com&ctz=America/Los_Angeles','Team Calendar','')"></a> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters