zetaben-Html2Feedbooks 0.4.2 → 0.4.3
Sign up to get free protection for your applications and to get access to all the features.
- 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
|