<commit_before># Premailer by <NAME> (d<EMAIL>, e-mail 'code' at the same domain), 2008-10
#
# Premailer processes HTML and CSS to improve e-mail deliverability.
#
# Premailer's main function is to render all CSS as inline <tt>style</tt>
# attributes. It also converts relative links to absolute links and checks
# the 'safety' of CSS properties against a CSS support chart.
#
# = Example
#  premailer = Premailer.new('http://example.com/myfile.html', :warn_level => Premailer::Warnings::SAFE)
#
#  # Write the HTML output
#  fout = File.open("output.html", "w")
#  fout.puts premailer.to_inline_css
#  fout.close
#
#  # Write the plain-text output
#  fout = File.open("ouput.txt", "w")
#  fout.puts premailer.to_plain_text
#  fout.close
#
#  # List any CSS warnings
#  puts premailer.warnings.length.to_s + ' warnings found'
#  premailer.warnings.each do |w|
#    puts "#{w[:message]} (#{w[:level]}) may not render properly in #{w[:clients]}"
#  end
#
#  premailer = Premailer.new(html_file, :warn_level => Premailer::Warnings::SAFE)
#  puts premailer.to_inline_css
class Premailer
  include HtmlToPlainText
  include CssParser

  VERSION = '1.7.1'

  CLIENT_SUPPORT_FILE = File.dirname(__FILE__) + '/../../misc/client_support.yaml'

  RE_UNMERGABLE_SELECTORS = /(\:(visited|active|hover|focus|after|before|selection|target|first\-(line|letter))|^\@)/i

  # list of CSS attributes that can be rendered as HTML attributes
  #
  # TODO: too much repetition
  # TODO: background=""
  RELATED_ATTRIBUTES = {
    'h1' => {'text-align' => 'align'},
    'h2' => {'text-align' => 'align'},
    'h3' => {'text-align' => 'align'},
    'h4' => {'text-align' => 'align'},
    'h5' => {'text-align' => 'align'},
    'h6' => {'text-align' => 'align'},
    'p' => {'text-align' => 'align'},
    'div' => {'text-align' => 'align'},
    'blockquote' => {'text-align' => 'align'},
    'body' => {'background-color' => 'bgcolor'},
    'table' => {
      'background-color' => 'bgcolor',
      '-premailer-width' => 'width',
      '-premailer-height' => 'height',
      '-premailer-cellpadding' => 'cellpadding',
      '-premailer-cellspacing' => 'cellspacing',
    },
    'tr' => {
      'text-align' => 'align',
      'background-color' => 'bgcolor',
      '-premailer-height' => 'height'
    },
    'th' => {
      'text-align' => 'align',
      'background-color' => 'bgcolor',
      'vertical-align' => 'valign',
      '-premailer-width' => 'width',
      '-premailer-height' => 'height'
    },
    'td' => {
      'text-align' => 'align',
      'background-color' => 'bgcolor',
      'vertical-align' => 'valign',
      '-premailer-width' => 'width',
      '-premailer-height' => 'height',
      '-premailer-colspan' => 'colspan'
    },
    'img' => {'float' => 'align'}
  }

  # URI of the HTML file used
  attr_reader   :html_file<commit_msg>Removed colspan from vendor-specific attributes. See https://github.com/alexdunae/premailer/pull/75#issuecomment-2114272<commit_after># Premailer by <NAME> (dunae.ca, e-mail 'code' at the same domain), 2008-10
#
# Premailer processes HTML and CSS to improve e-mail deliverability.
#
# Premailer's main function is to render all CSS as inline <tt>style</tt>
# attributes. It also converts relative links to absolute links and checks
# the 'safety' of CSS properties against a CSS support chart.
#
# = Example
#  premailer = Premailer.new('http://example.com/myfile.html', :warn_level => Premailer::Warnings::SAFE)
#
#  # Write the HTML output
#  fout = File.open("output.html", "w")
#  fout.puts premailer.to_inline_css
#  fout.close
#
#  # Write the plain-text output
#  fout = File.open("ouput.txt", "w")
#  fout.puts premailer.to_plain_text
#  fout.close
#
#  # List any CSS warnings
#  puts premailer.warnings.length.to_s + ' warnings found'
#  premailer.warnings.each do |w|
#    puts "#{w[:message]} (#{w[:level]}) may not render properly in #{w[:clients]}"
#  end
#
#  premailer = Premailer.new(html_file, :warn_level => Premailer::Warnings::SAFE)
#  puts premailer.to_inline_css
class Premailer
  include HtmlToPlainText
  include CssParser

  VERSION = '1.7.1'

  CLIENT_SUPPORT_FILE = File.dirname(__FILE__) + '/../../misc/client_support.yaml'

  RE_UNMERGABLE_SELECTORS = /(\:(visited|active|hover|focus|after|before|selection|target|first\-(line|letter))|^\@)/i

  # list of CSS attributes that can be rendered as HTML attributes
  #
  # TODO: too much repetition
  # TODO: background=""
  RELATED_ATTRIBUTES = {
    'h1' => {'text-align' => 'align'},
    'h2' => {'text-align' => 'align'},
    'h3' => {'text-align' => 'align'},
    'h4' => {'text-align' => 'align'},
    'h5' => {'text-align' => 'align'},
    'h6' => {'text-align' => 'align'},
    'p' => {'text-align' => 'align'},
    'div' => {'text-align' => 'align'},
    'blockquote' => {'text-align' => 'align'},
    'body' => {'background-color' => 'bgcolor'},
    'table' => {
      'background-color' => 'bgcolor',
      '-premailer-width' => 'width',
      '-premailer-height' => 'height',
      '-premailer-cellpadding' => 'cellpadding',
      '-premailer-cellspacing' => 'cellspacing',
    },
    'tr' => {
      'text-align' => 'align',
      'background-color' => 'bgcolor',
      '-premailer-height' => 'height'
    },
    'th' => {
      'text-align' => 'align',
      'background-color' => 'bgcolor',
      'vertical-align' => 'valign',
      '-premailer-width' => 'width',
      '-premailer-height' => 'height'
    },
    'td' => {
      'text-align' => 'align',
      'background-color' => 'bgcolor',
      'vertical-align' => 'valign',
      '-premailer-width' => 'width',
      '-premailer-height' => 'height'
    },
    'img' => {'float' => 'align'}
  }

  # URI of the HTML file used
  attr_reader   :html_file
{'fraction_non_alphanumeric': 0.19308659217877094, 'fraction_numerical': 0.006808659217877095, 'mean_word_length': 3.369946605644546, 'pattern_counts': {'":': 0, '<': 10, '<?xml version=': 0, '>': 103, 'https://': 1, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '1330202', 'n_tokens_mistral': 2092, 'n_tokens_neox': 2034, 'n_words': 441}