class Htmltoooxml::Document

Public Class Methods

new() click to toggle source
# File lib/htmltoooxml/document.rb, line 9
def initialize()
  @replaceable_files = {}
end

Public Instance Methods

transform_doc_xml(source, extras = false) click to toggle source
# File lib/htmltoooxml/document.rb, line 13
def transform_doc_xml(source, extras = false)
  transformed_source = xslt(stylesheet_name: 'cleanup').transform(source)
  transformed_source = xslt(stylesheet_name: 'inline_elements').transform(transformed_source)
  transform_and_replace(transformed_source, document_xslt(extras), extras)
end

Private Instance Methods

transform_and_replace(source, stylesheet_path, remove_ns = false) click to toggle source
# File lib/htmltoooxml/document.rb, line 21
def transform_and_replace(source, stylesheet_path, remove_ns = false)
  stylesheet = xslt(stylesheet_path: stylesheet_path)
  content = stylesheet.apply_to(source)
  content.gsub!(/\s*xmlns:(\w+)="(.*?)\s*"/, '') if remove_ns
  content
end