Sha256: f6cb7694016f9425ea5e61b32579c776149bfafe63a4c68aad35ee2ea00772c2
Contents?: true
Size: 1.06 KB
Versions: 2
Compression:
Stored size: 1.06 KB
Contents
module EPUB module ContentDocument class XHTML attr_accessor :item # @return [String] Returns the content string. def read item.read end alias raw_document read # @return [true|false] Whether referenced directly from spine or not. def top_level? !! item.itemref end # @return [String] Returns the value of title element. # If none, returns empty string def title title_elem = nokogiri.search('title').first if title_elem title_elem.text else warn 'title element not found' '' end end # @return [REXML::Document] content as REXML::Document object def rexml require 'rexml/document' @rexml ||= REXML::Document.new(raw_document) end # @return [Nokogiri::XML::Document] content as Nokogiri::XML::Document object def nokogiri require 'nokogumbo' unless Nokogiri.respond_to? :HTML5 @nokogiri ||= Nokogiri.HTML5(raw_document) end end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
epub-parser-0.2.2 | lib/epub/content_document/xhtml.rb |
epub-parser-0.2.1 | lib/epub/content_document/xhtml.rb |