zetaben-Html2Feedbooks 0.4.2 → 0.4.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/lib/app.rb +9 -1
- metadata +1 -1
data/lib/app.rb
CHANGED
@@ -50,7 +50,7 @@ class AtomPost
|
|
50
50
|
|
51
51
|
req.body = '<?xml version="1.0"?>'+"\n"
|
52
52
|
req.body +='<entry xmlns="http://www.w3.org/2005/Atom">'+"\n"
|
53
|
-
req.body +='<title>'+
|
53
|
+
req.body +='<title>'+decode_text(title)+'</title>'+"\n"
|
54
54
|
req.body +='<id>'+Digest::MD5.hexdigest(title+content)+'</id>'+"\n"
|
55
55
|
req.body +='<updated>'+date.xmlschema+'</updated>'+"\n"
|
56
56
|
req.body +='<author><name>'+author+'</name></author>'+"\n"
|
@@ -82,4 +82,12 @@ class AtomPost
|
|
82
82
|
def force_decimal_entities(txt)
|
83
83
|
HTMLENCODER.encode(HTMLENCODER.decode(txt),:decimal)
|
84
84
|
end
|
85
|
+
|
86
|
+
def decode_text(txt)
|
87
|
+
return txt if txt.blank?
|
88
|
+
m=Hpricot(txt)
|
89
|
+
m.traverse_text{|t| HTMLENCODER.decode(t.content)}
|
90
|
+
m.to_html
|
91
|
+
end
|
92
|
+
|
85
93
|
end
|