Class: HTML2FB::Text

Inherits:
Object
  • Object
show all
Defined in:
lib/Html2Feedbooks/document.rb,
lib/Html2Feedbooks/feedbooks.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(c = '') ⇒ Text

Returns a new instance of Text.



55
56
57
# File 'lib/Html2Feedbooks/document.rb', line 55

def initialize(c='')
	@content=c
end

Instance Attribute Details

#contentObject

Returns the value of attribute content.



53
54
55
# File 'lib/Html2Feedbooks/document.rb', line 53

def content
  @content
end

Instance Method Details

#titlesObject



67
68
69
# File 'lib/Html2Feedbooks/document.rb', line 67

def titles
	return ['#text']
end

#to_feedbooks(conf, path = nil) ⇒ Object



105
106
107
108
109
110
111
112
113
114
115
# File 'lib/Html2Feedbooks/feedbooks.rb', line 105

def to_feedbooks(conf,path=nil)
	stxt=to_html
	return unless stxt.strip.size > 0
	doc=Nokogiri::XML('<div xmlns:xhtml="http://www.w3.org/1999/xhtml">'+stxt+'</div>')
	doc.traverse do |e|
		if e.element?
			e.name='xhtml:'+e.name
		end
	end
	FBPost.push(conf,'',doc.to_html,"Text",path) 
end

#to_htmlObject



59
60
61
# File 'lib/Html2Feedbooks/document.rb', line 59

def to_html
	@content
end

#to_sObject



63
64
65
# File 'lib/Html2Feedbooks/document.rb', line 63

def to_s
	@content
end