Class: BootstrapEmail::Converter::EnsureDoctype

Inherits:
Base
  • Object
show all
Defined in:
lib/bootstrap-email/converters/ensure_doctype.rb

Instance Attribute Summary

Attributes inherited from Base

#doc

Class Method Summary collapse

Methods inherited from Base

build, #initialize

Constructor Details

This class inherits a constructor from BootstrapEmail::Converter::Base

Class Method Details

.replace(html) ⇒ Object



6
7
8
9
10
11
12
13
# File 'lib/bootstrap-email/converters/ensure_doctype.rb', line 6

def self.replace(html)
  # ensure the proper XHTML doctype which ensures best compatibility in email clients
  # https://github.com/bootstrap-email/bootstrap-email/discussions/168
  html.gsub!(
    /<!DOCTYPE.*(\[[\s\S]*?\])?>/,
    '<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">'
  )
end