Sha256: 9ff172452d4d672cf32df56e64f9cdab81bff14aef43661d919f8cf37c0e821a
Contents?: true
Size: 1.11 KB
Versions: 1
Compression:
Stored size: 1.11 KB
Contents
module SiteHealth module Checkers class HTMLPage def self.check(page) new(page).check end attr_reader :page, :url # @param [Spidr::Page] the crawled page def initialize(page) @page = page @url = page.url end def check result = check_content HTMLJournal.new( url: url, page: page, missing_title: missing_title?, errors: result.errors.map { |e| W3CJournalBuilder.build(e) }, warnings: result.warnings.map { |e| W3CJournalBuilder.build(e) } ) end def missing_title? page.title.to_s.strip.empty? end # @return [W3CValidators::Results] # @raise [W3CValidators::ValidatorUnavailable] the service is offline or returns 400 Bad Request # @see https://github.com/w3c-validators/w3c_validators/issues/39 we really want to use #validate_text instead of #validate_uri but due to the linked issue thats not possible def check_content validator = W3CValidators::NuValidator.new validator.validate_uri(url) end end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
site_health-0.1.0 | lib/site_health/checkers/html_page.rb |