roadie-3.1.1/ 0000755 0001750 0001750 00000000000 12650430563 013175 5 ustar terceiro terceiro roadie-3.1.1/MIT-LICENSE 0000644 0001750 0001750 00000002046 12650430563 014633 0 ustar terceiro terceiro Copyright (c) 2009 Jim Neath / Purify Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. roadie-3.1.1/metadata.yml 0000644 0001750 0001750 00000014721 12650430563 015505 0 ustar terceiro terceiro --- !ruby/object:Gem::Specification name: roadie version: !ruby/object:Gem::Version version: 3.1.1 platform: ruby authors: - Magnus Bergmark autorequire: bindir: bin cert_chain: [] date: 2015-12-11 00:00:00.000000000 Z dependencies: - !ruby/object:Gem::Dependency name: nokogiri requirement: !ruby/object:Gem::Requirement requirements: - - ">=" - !ruby/object:Gem::Version version: 1.5.0 - - "<" - !ruby/object:Gem::Version version: 1.7.0 type: :runtime prerelease: false version_requirements: !ruby/object:Gem::Requirement requirements: - - ">=" - !ruby/object:Gem::Version version: 1.5.0 - - "<" - !ruby/object:Gem::Version version: 1.7.0 - !ruby/object:Gem::Dependency name: css_parser requirement: !ruby/object:Gem::Requirement requirements: - - "~>" - !ruby/object:Gem::Version version: 1.3.4 type: :runtime prerelease: false version_requirements: !ruby/object:Gem::Requirement requirements: - - "~>" - !ruby/object:Gem::Version version: 1.3.4 - !ruby/object:Gem::Dependency name: rspec requirement: !ruby/object:Gem::Requirement requirements: - - "~>" - !ruby/object:Gem::Version version: '3.0' type: :development prerelease: false version_requirements: !ruby/object:Gem::Requirement requirements: - - "~>" - !ruby/object:Gem::Version version: '3.0' - !ruby/object:Gem::Dependency name: rspec-collection_matchers requirement: !ruby/object:Gem::Requirement requirements: - - "~>" - !ruby/object:Gem::Version version: '1.0' type: :development prerelease: false version_requirements: !ruby/object:Gem::Requirement requirements: - - "~>" - !ruby/object:Gem::Version version: '1.0' - !ruby/object:Gem::Dependency name: webmock requirement: !ruby/object:Gem::Requirement requirements: - - "~>" - !ruby/object:Gem::Version version: 1.21.0 type: :development prerelease: false version_requirements: !ruby/object:Gem::Requirement requirements: - - "~>" - !ruby/object:Gem::Version version: 1.21.0 description: Roadie tries to make sending HTML emails a little less painful by inlining stylesheets and rewriting relative URLs for you. email: - magnus.bergmark@gmail.com executables: [] extensions: [] extra_rdoc_files: - README.md - Changelog.md files: - ".autotest" - ".gitignore" - ".travis.yml" - ".yardopts" - Changelog.md - Gemfile - Guardfile - MIT-LICENSE - README.md - Rakefile - autotest/discover.rb - lib/roadie.rb - lib/roadie/asset_provider.rb - lib/roadie/asset_scanner.rb - lib/roadie/cached_provider.rb - lib/roadie/deduplicator.rb - lib/roadie/document.rb - lib/roadie/errors.rb - lib/roadie/filesystem_provider.rb - lib/roadie/inliner.rb - lib/roadie/markup_improver.rb - lib/roadie/net_http_provider.rb - lib/roadie/null_provider.rb - lib/roadie/null_url_rewriter.rb - lib/roadie/path_rewriter_provider.rb - lib/roadie/provider_list.rb - lib/roadie/rspec.rb - lib/roadie/rspec/asset_provider.rb - lib/roadie/rspec/cache_store.rb - lib/roadie/selector.rb - lib/roadie/style_attribute_builder.rb - lib/roadie/style_block.rb - lib/roadie/style_property.rb - lib/roadie/stylesheet.rb - lib/roadie/url_generator.rb - lib/roadie/url_rewriter.rb - lib/roadie/utils.rb - lib/roadie/version.rb - roadie.gemspec - spec/fixtures/big_em.css - spec/fixtures/stylesheets/green.css - spec/hash_as_cache_store_spec.rb - spec/integration_spec.rb - spec/lib/roadie/asset_scanner_spec.rb - spec/lib/roadie/cached_provider_spec.rb - spec/lib/roadie/css_not_found_spec.rb - spec/lib/roadie/deduplicator_spec.rb - spec/lib/roadie/document_spec.rb - spec/lib/roadie/filesystem_provider_spec.rb - spec/lib/roadie/inliner_spec.rb - spec/lib/roadie/markup_improver_spec.rb - spec/lib/roadie/net_http_provider_spec.rb - spec/lib/roadie/null_provider_spec.rb - spec/lib/roadie/null_url_rewriter_spec.rb - spec/lib/roadie/path_rewriter_provider_spec.rb - spec/lib/roadie/provider_list_spec.rb - spec/lib/roadie/selector_spec.rb - spec/lib/roadie/style_attribute_builder_spec.rb - spec/lib/roadie/style_block_spec.rb - spec/lib/roadie/style_property_spec.rb - spec/lib/roadie/stylesheet_spec.rb - spec/lib/roadie/test_provider_spec.rb - spec/lib/roadie/url_generator_spec.rb - spec/lib/roadie/url_rewriter_spec.rb - spec/lib/roadie/utils_spec.rb - spec/shared_examples/asset_provider.rb - spec/shared_examples/url_rewriter.rb - spec/spec_helper.rb - spec/support/have_attribute_matcher.rb - spec/support/have_node_matcher.rb - spec/support/have_selector_matcher.rb - spec/support/have_styling_matcher.rb - spec/support/test_provider.rb homepage: http://github.com/Mange/roadie licenses: - MIT metadata: {} post_install_message: rdoc_options: [] require_paths: - lib required_ruby_version: !ruby/object:Gem::Requirement requirements: - - ">=" - !ruby/object:Gem::Version version: '1.9' required_rubygems_version: !ruby/object:Gem::Requirement requirements: - - ">=" - !ruby/object:Gem::Version version: '0' requirements: [] rubyforge_project: rubygems_version: 2.4.6 signing_key: specification_version: 4 summary: Making HTML emails comfortable for the Ruby rockstars test_files: - spec/fixtures/big_em.css - spec/fixtures/stylesheets/green.css - spec/hash_as_cache_store_spec.rb - spec/integration_spec.rb - spec/lib/roadie/asset_scanner_spec.rb - spec/lib/roadie/cached_provider_spec.rb - spec/lib/roadie/css_not_found_spec.rb - spec/lib/roadie/deduplicator_spec.rb - spec/lib/roadie/document_spec.rb - spec/lib/roadie/filesystem_provider_spec.rb - spec/lib/roadie/inliner_spec.rb - spec/lib/roadie/markup_improver_spec.rb - spec/lib/roadie/net_http_provider_spec.rb - spec/lib/roadie/null_provider_spec.rb - spec/lib/roadie/null_url_rewriter_spec.rb - spec/lib/roadie/path_rewriter_provider_spec.rb - spec/lib/roadie/provider_list_spec.rb - spec/lib/roadie/selector_spec.rb - spec/lib/roadie/style_attribute_builder_spec.rb - spec/lib/roadie/style_block_spec.rb - spec/lib/roadie/style_property_spec.rb - spec/lib/roadie/stylesheet_spec.rb - spec/lib/roadie/test_provider_spec.rb - spec/lib/roadie/url_generator_spec.rb - spec/lib/roadie/url_rewriter_spec.rb - spec/lib/roadie/utils_spec.rb - spec/shared_examples/asset_provider.rb - spec/shared_examples/url_rewriter.rb - spec/spec_helper.rb - spec/support/have_attribute_matcher.rb - spec/support/have_node_matcher.rb - spec/support/have_selector_matcher.rb - spec/support/have_styling_matcher.rb - spec/support/test_provider.rb roadie-3.1.1/roadie.gemspec 0000644 0001750 0001750 00000002145 12650430563 016007 0 ustar terceiro terceiro # roadie.gemspec # -*- encoding: utf-8 -*- $:.push File.expand_path("../lib", __FILE__) require 'roadie/version' Gem::Specification.new do |s| s.name = 'roadie' s.version = Roadie::VERSION s.platform = Gem::Platform::RUBY s.authors = ['Magnus Bergmark'] s.email = ['magnus.bergmark@gmail.com'] s.homepage = 'http://github.com/Mange/roadie' s.summary = %q{Making HTML emails comfortable for the Ruby rockstars} s.description = %q{Roadie tries to make sending HTML emails a little less painful by inlining stylesheets and rewriting relative URLs for you.} s.license = "MIT" s.required_ruby_version = ">= 1.9" s.add_dependency 'nokogiri', '>= 1.5.0', '< 1.7.0' s.add_dependency 'css_parser', '~> 1.3.4' s.add_development_dependency 'rspec', '~> 3.0' s.add_development_dependency 'rspec-collection_matchers', '~> 1.0' s.add_development_dependency 'webmock', '~> 1.21.0' s.extra_rdoc_files = %w[README.md Changelog.md] s.require_paths = %w[lib] s.files = `git ls-files`.split("\n") s.test_files = `git ls-files -- spec/*`.split("\n") end roadie-3.1.1/.travis.yml 0000644 0001750 0001750 00000000544 12650430563 015311 0 ustar terceiro terceiro sudo: false language: ruby rvm: - 1.9.3 - 2.0 - 2.1 - 2.2 - jruby - rbx cache: bundler bundler_args: --without guard script: "rake" env: # Setup Coveralls secure: "D1Uvi+a7W89k91zXVVwuuvv8O8qbDdyJ4g9i+3bGaSYySHxD8YuuG1QiQ4G/S2KLp/r3VPRpa8Wb1mSwb81tEBzXpzoZC7zSvgntPxRPhMg4zpodZ0O0AkK8/t1yZSkIe0V5sejFOQ1a5LJa3OorKBBjrqM5kPDOygTXtO3bQ6E=" roadie-3.1.1/Changelog.md 0000644 0001750 0001750 00000025555 12650430563 015422 0 ustar terceiro terceiro ### dev [full changelog](https://github.com/Mange/roadie/compare/v3.1.1...master) ### 3.1.1 [full changelog](https://github.com/Mange/roadie/compare/v3.1.0...v3.1.1) * Enhancements: * Duplicate style properties are now removed when inlining. * This means that `color: green; color: red; color: green` will now be `color: red; color: green`. * The size of your emails should be the same, or smaller. ### 3.1.0 [full changelog](https://github.com/Mange/roadie/compare/v3.1.0.rc1...v3.1.0) * Enchancements: * `NetHttpProvider` validates the whitelist hostnames; passing an invalid hostname will raise `ArgumentError`. * `NetHttpProvider` supports scheme-less URLs (`//foo.com/`), defaulting to `https`. ### 3.1.0.rc1 [full changelog](https://github.com/Mange/roadie/compare/v3.0.5...v3.1.0.rc1) * Enhancements: * Allow user to specify asset providers for referenced assets with full URLs and inline them (#107) * Pass `Document` instance to transformation callbacks (#86) * Made `nokogiri` dependency more forgiving. * Supports `1.5.0`...`1.7.0` now instead of `1.6.0`...`1.7.0`. Some people out there are stuck on this older version of Nokogiri, and I don't want to leave them out. * Output better errors when no assets can be found. * The error will now show which providers were tried and in which order, along with the error message from the specific providers. * `Roadie::FilesystemProvider` shows the given path when inspected. * `data-roadie-ignore` attributes will now be removed from markup; hiding "development markers" in the final email. * Add a `Roadie::CachedProvider` asset provider that wraps other providers and cache them. * Add a `Roadie::PathRewriterProvider` asset provider that rewrites asset names for other providers. * This saves you from having to create custom providers if you require small tweaks to the lookup in order to use an official provider. * **Deprecations:** * `Roadie::Stylesheet#each_inlinable_block` is now deprecated. You can iterate and filter the `blocks` at your own discresion. ### 3.0.5 [full changelog](https://github.com/Mange/roadie/compare/v3.0.4...v3.0.5) * Bug fixes: * Don't try to inline external stylesheets. (#106) * Don't generate absolute URLs for anchor links. (Mange/roadie-rails#40) ### 3.0.4 [full changelog](https://github.com/Mange/roadie/compare/v3.0.3...v3.0.4) * Bug fixes: * Schemeless URLs was accepted as-is, which isn't supported in a lot of email clients. (#104) ### 3.0.3 [full changelog](https://github.com/Mange/roadie/compare/v3.0.2...v3.0.3) * Bug fixes: * CSS was mutated when parsed, breaking caches and memoized sources - [Brendan Mulholland (bmulholland)](https://github.com/bmulholland) (Mange/roadie-rails#32) ### 3.0.2 [full changelog](https://github.com/Mange/roadie/compare/v3.0.1...v3.0.2) * Bug fixes: * Some `data:` URLs could cause exceptions. (#97) * Correctly parse properties with semicolons in their values - [Aidan Feldman (afeld)](https://github.com/afeld) (#100) ### 3.0.1 [full changelog](https://github.com/Mange/roadie/compare/v3.0.0...v3.0.1) * Enhancements: * `CssNotFound` can take a provider which will be shown in error messages. * Bug fixes: * URL rewriter no longer raises on absolute URLs that cannot be parsed by `URI`. Absolute URLs are completely ignored. * URL rewriter supports urls without a scheme (like `//assets.myapp.com/foo`). * URL rewriter no longer crashes on absolute URLs without a path (like `myapp://`). ### 3.0.0 [full changelog](https://github.com/Mange/roadie/compare/v3.0.0.pre1...v3.0.0) * Enhancements: * `Roadie::ProviderList` responds to `#empty?` and `#last` * `Roadie::FilesystemProvider` ignores query string in filename. Older versions of Rails generated `` tags with query strings in their URLs, like such: `/stylesheets/email.css?1380694096` * Blacklist `:enabled`, `:disabled` and `:checked` pseudo functions - [Tyler Hunt (tylerhunt)](https://github.com/tylerhunt). * Add MRI 2.1.2 to Travis build matrix - [Grey Baker (greysteil)](https://github.com/greysteil). * Try to detect an upgrade from Roadie 2 and mention how to make it work with the new version. * Styles emitted in the `style` attribute should now be ordered as they were in the source CSS. ### 3.0.0.pre1 [full changelog](https://github.com/Mange/roadie/compare/v2.4.2...v3.0.0.pre1) Complete rewrite of most of the code and a new direction for the gem. * Breaking changes: * Removed Rails support into a separate Gem (`roadie-rails`). * Removed Sprockets dependency and AssetPipelineProvider. * Changed the entire public API. * Changed the API of custom providers. * Dropped support for Ruby 1.8.7. * Change `data-immutable` to `data-roadie-ignore`. * New features: * Rewriting the URLs of `img[src]`. * A way to inject stylesheets without having to adjust template. * A before callback to compliment the after callback. * Enhancements: * Better support for stylesheets using CSS fallbacks. This means that styles like this is now inlined: `width: 5em; width: 3rem;`, while Roadie would previously remove the first of the two. This sadly means that the HTML file will be much larger than before if you're using a non-optimized stylesheet (for example including your application stylesheet to the email). This was a bad idea even before this change, and this might get you to change. * Using HTML5 doctype instead of XHTML * Full support for JRuby * Experimental support for Rubinius ### 2.4.2 [full changelog](https://github.com/Mange/roadie/compare/v2.4.1...v2.4.2) * Bug fixes: * Fix Nokogiri version to allow only 1.5.x on ruby 1.8.7 * Blacklist :before, :after, :-ms-input-placeholder, :-moz-placeholder selectors – [Brian Bauer (bbauer)][https://github.com/bbauer]. * Build failed on 1.8.7 due to a change in `css_parser` ### 2.4.1 [full changelog](https://github.com/Mange/roadie/compare/v2.4.0...v2.4.1) * Bug fixes: * Allow Nokogiri 1.5.x again; 1.6.x is unsupported in Ruby 1.8.7. ### 2.4.0 [full changelog](https://github.com/Mange/roadie/compare/v2.3.4...v2.4.0) * Enhancements: * Support Rails 4.0, with the help of: * [Ryunosuke SATO (tricknotes)](https://github.com/tricknotes) * [Dylan Markow](https://github.com/dmarkow) * Keep `!important` when outputting styles to help combat web mail styles being `!important` * Support `:nth-child`, `:last-child`, etc. * To make this work, Roadie have to catch errors from Nokogiri and ignore them. A warning will be printed when this happens so users can open issues with the project and tests can be expanded. * Support for custom inliner (#58) — [Harish Shetty (kandadaboggu)](https://github.com/kandadaboggu) with friends * Bug fixes: * Don't crash when URL options have protocols with "://" in them (#52). * Other: * Be more specific on which versions are required; require newer `css_parser` * Officially support MRI 2.0.0 * Add experimental support for JRuby * Remove documentation that talks about passing CSS filenames as symbols; unsupported in Rails 4. (Thanks to [PikachuEXE](https://github.com/PikachuEXE)) ### 2.3.4 [full changelog](https://github.com/Mange/roadie/compare/v2.3.3...v2.3.4) * Enhancements: * Add `config.roadie.enabled` that can be set to `false` to disable Roadie completely. * Bug fixes: * Proc objects to the `:css` option is now run in the context of the mailer instance, mirroring similar options from ActionMailer. * Fix some tests that would always pass * Improve JRuby compatibility * Update Gemfile.lock and fix issues with newer gem versions ### 2.3.3 [full changelog](https://github.com/Mange/roadie/compare/v2.3.2...v2.3.3) * Enhancements: * Allow proc objects to the `:css` option * Bug fixes: * Ignore HTML comments and CDATA sections in CSS (support TinyMCE) ### 2.3.2 [full changelog](https://github.com/Mange/roadie/compare/v2.3.1...v2.3.2) * Bug fixes: * Don't fail on selectors which start with @ (#28) — [Roman Shterenzon (romanbsd)](https://github.com/romanbsd) ### 2.3.1 [full changelog](https://github.com/Mange/roadie/compare/v2.3.0...v2.3.1) * Bug fixes: * Does not work with Rails 3.0 unless provider set specifically (#23) ### 2.3.0 [full changelog](https://github.com/Mange/roadie/compare/v2.3.0.pre1...v2.3.0) * Nothing, really ### 2.3.0.pre1 [full changelog](https://github.com/Mange/roadie/compare/v2.2.0...v2.3.0.pre1) * Enhancements: * Support Rails 3.2.pre1 - [Morton Jonuschat (yabawock)](https://github.com/yabawock) * Sped up the Travis builds * Official support for Rails 3.0 again * Dependencies allow 3.0 * Travis builds 3.0 among the others ### 2.2.0 [full changelog](https://github.com/Mange/roadie/compare/v2.1.0...v2.2.0) * Enhancements: * Support for the `url_options` method inside mailer instances * You can now dynamically alter the URL options on a per-email basis ### 2.1.0 [full changelog](https://github.com/Mange/roadie/compare/v2.1.0.pre2...v2.1.0) * Full release! ### 2.1.0.pre2 [full changelog](https://github.com/Mange/roadie/compare/v2.1.0.pre1...v2.1.0.pre2) * Bug: Roadie broke `url_for` inside mailer views ### 2.1.0.pre1 [full changelog](https://github.com/Mange/roadie/compare/v2.0.0...v2.1.0.pre1) * Enhancements: * Support normal filesystem instead of only Asset pipeline * Enable users to create their own way of fetching CSS * Improve test coverage a bit * Use a railtie to hook into Rails * Use real Rails for testing integration ### 2.0.0 [full changelog](https://github.com/Mange/roadie/compare/v1.1.3...v2.0.0) * Enhancements: * Support the Asset pipeline - [Arttu Tervo (arttu)](https://github.com/arttu) * Dependencies: * Requires Rails 3.1 to work. You can keep on using the 1.x series in Rails 3.0 ### 1.1.3 [full changelog](https://github.com/Mange/roadie/compare/v1.1.2...v1.1.3) * Do not add another ".css" to filenames if already present - [Aliaxandr (saks)](https://github.com/saks) ### 1.1.2 [full changelog](https://github.com/Mange/roadie/compare/v1.1.1...v1.1.2) * Support for Rails 3.1.0 and later inside gemspec ### 1.1.1 [full changelog](https://github.com/Mange/roadie/compare/v1.1.0...v1.1.1) * Support for Rails 3.1.x (up to and including RC4) * Rails 3.0.x is still supported * Added CI via [Travis CI](http://travis-ci.org) ### 1.1.0 [full changelog](https://github.com/Mange/roadie/compare/v1.0.1...v1.1.0) * Enhancements: * Support for inlining `` elements (thanks to [aliix](https://github.com/aliix)) ### 1.0.1 [full changelog](https://github.com/Mange/roadie/compare/v1.0.0...v1.0.1) * Enhancements: * Full, official support for Ruby 1.9.2 (in addition to 1.8.7) * Dependencies: * Explicilty depend on nokogiri >= 1.4.4 ### 1.0.0 [full changelog](https://github.com/Mange/roadie/compare/legacy...v1.0.0) Roadie fork! * Enhancements: * Support for Rails 3.0 * Code cleanup * Support `!important` * Tests * + some other enhancements * Deprecations: * Removed support for Rails 2.x roadie-3.1.1/.autotest 0000644 0001750 0001750 00000000364 12650430563 015051 0 ustar terceiro terceiro # Override autotest default magic to rerun all tests every time a # change is detected on the file system. class Autotest def get_to_green begin rerun_all_tests wait_for_changes unless all_good end until all_good end end roadie-3.1.1/Guardfile 0000644 0001750 0001750 00000001010 12650430563 015012 0 ustar terceiro terceiro rspec_options = { cmd: 'rspec -f documentation', failed_mode: :keep, all_after_pass: true, all_on_start: true, run_all: {cmd: 'rspec -f progress'} } guard 'rspec', rspec_options do watch(%r{^spec/.+_spec\.rb$}) watch(%r{^lib/(.+)\.rb$}) { |m| "spec/lib/#{m[1]}_spec.rb" } watch('lib/roadie.rb') { "spec" } watch('lib/roadie/errors.rb') { "spec" } watch(%r{lib/roadie/rspec/.*\.rb}) { "spec" } watch(%r{spec/support/.*\.rb}) { "spec" } watch('spec/spec_helper.rb') { "spec" } end roadie-3.1.1/autotest/ 0000755 0001750 0001750 00000000000 12650430563 015045 5 ustar terceiro terceiro roadie-3.1.1/autotest/discover.rb 0000644 0001750 0001750 00000000044 12650430563 017206 0 ustar terceiro terceiro Autotest.add_discovery { 'rspec2' } roadie-3.1.1/lib/ 0000755 0001750 0001750 00000000000 12650430563 013743 5 ustar terceiro terceiro roadie-3.1.1/lib/roadie/ 0000755 0001750 0001750 00000000000 12650430563 015206 5 ustar terceiro terceiro roadie-3.1.1/lib/roadie/markup_improver.rb 0000644 0001750 0001750 00000005360 12650430563 020761 0 ustar terceiro terceiro module Roadie # @api private # Class that improves the markup of a HTML DOM tree # # This class will improve the following aspects of the DOM: # * A HTML5 doctype will be added if missing, other doctypes will be left as-is. # * Basic HTML elements will be added if missing. # * ++ # * +
+ # * ++ # * ++ declaring charset and content-type (text/html) # # @note Due to a Nokogiri bug, the HTML5 doctype cannot be added under JRuby. No doctype is outputted under JRuby. # See https://github.com/sparklemotion/nokogiri/issues/984 class MarkupImprover # The original HTML must also be passed in in order to handle the doctypes # since a +Nokogiri::HTML::Document+ will always have a doctype, no matter if # the original source had it or not. Reading the raw HTML is the only way to # determine if we want to add a HTML5 doctype or not. def initialize(dom, original_html) @dom = dom @html = original_html end # @return [nil] passed DOM will be mutated def improve ensure_doctype_present head = ensure_head_element_present ensure_declared_charset head end protected attr_reader :dom private def ensure_doctype_present return if uses_buggy_jruby? return if @html.include?('