class Translatomatic::ResourceFile::HTML
HTML
resource file
Public Class Methods
extensions()
click to toggle source
(see Base.extensions
)
# File lib/translatomatic/resource_file/html.rb, line 6 def self.extensions %w[html htm shtml] end
Public Instance Methods
save(target = path, options = {})
click to toggle source
(see Base#save
)
# File lib/translatomatic/resource_file/html.rb, line 11 def save(target = path, options = {}) return unless @doc add_created_by unless options[:no_created_by] target.write(@doc.to_html) end
Private Instance Methods
empty_doc()
click to toggle source
# File lib/translatomatic/resource_file/html.rb, line 25 def empty_doc Nokogiri::HTML('<html><body></body></html>') end
read_doc()
click to toggle source
# File lib/translatomatic/resource_file/html.rb, line 19 def read_doc doc = Nokogiri::HTML(@path.open, &:noblanks) parse_error(doc.errors[0]) if doc.errors.present? doc end
text_nodes_xpath()
click to toggle source
# File lib/translatomatic/resource_file/html.rb, line 29 def text_nodes_xpath '//*[not(self::code)]/text()|//comment()' end