Class: HtmlCheck
- Inherits:
-
HTMLProofer::Check
- Object
- HTMLProofer::Check
- HtmlCheck
- Defined in:
- lib/html-proofer/check/html.rb
Constant Summary collapse
- SCRIPT_EMBEDS_MSG =
tags embedded in scripts are used in templating languages: git.io/vOovv
/Element script embeds close tag/.freeze
- INVALID_TAG_MSG =
/Tag ([\w\-:]+) invalid/.freeze
- INVALID_PREFIX =
/Namespace prefix/.freeze
- PARSE_ENTITY_REF =
/htmlParseEntityRef: no name/.freeze
- DOCTYPE_MSG =
/Expected a doctype token/.freeze
- EOF_IN_TAG =
/End of input in tag/.freeze
- MISMATCHED_TAGS =
/That tag isn't allowed here/.freeze
Instance Attribute Summary
Attributes inherited from HTMLProofer::Check
#element, #external_urls, #html, #issues, #node, #options, #path, #src
Instance Method Summary collapse
Methods inherited from HTMLProofer::Check
#add_issue, #add_path_for_url, #add_to_external_urls, #blank?, #create_element, #initialize, subchecks
Constructor Details
This class inherits a constructor from HTMLProofer::Check
Instance Method Details
#report?(message) ⇒ Boolean
19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 |
# File 'lib/html-proofer/check/html.rb', line 19 def report?() case when SCRIPT_EMBEDS_MSG [:validation][:report_script_embeds] when INVALID_TAG_MSG, INVALID_PREFIX [:validation][:report_invalid_tags] when PARSE_ENTITY_REF [:validation][:report_missing_names] when DOCTYPE_MSG [:validation][:report_missing_doctype] when EOF_IN_TAG [:validation][:report_eof_tags] when MISMATCHED_TAGS [:validation][:report_mismatched_tags] else true end end |
#run ⇒ Object
13 14 15 16 17 |
# File 'lib/html-proofer/check/html.rb', line 13 def run @html.errors.each do |error| add_issue(error., line: error.line) if report?(error.) end end |