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.
Files changed (2) hide show
  1. data/lib/app.rb +9 -1
  2. 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>'+recode_text(title)+'</title>'+"\n"
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
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: zetaben-Html2Feedbooks
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.4.2
4
+ version: 0.4.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Benoit Larroque