class SiteHealth::W3CHTML
Checks for various HTML errors and warnings (backed by the excellent W3CValidations gem)
Protected Instance Methods
check()
click to toggle source
# File lib/site_health/checkers/w3c_html.rb, line 14 def check result = check_content # TODO: Add issues add_data( errors: result.errors.map { |e| W3CJournalBuilder.build(e) }, warnings: result.warnings.map { |e| W3CJournalBuilder.build(e) } ) end
check_content()
click to toggle source
@return [W3CValidators::Results] @raise [W3CValidators::ValidatorUnavailable]
service is offline or returns 400 Bad Request (which usually means being hit by rate limits)
# File lib/site_health/checkers/w3c_html.rb, line 27 def check_content # NOTE: We really want to use #validate_text instead of #validate_uri but due # to the linked (below) issue thats not possible # https://github.com/w3c-validators/w3c_validators/issues/39 validator = W3CValidators::NuValidator.new(SiteHealth.config.w3c.html_config) validator.validate_text(page.body) end