OSDN Git Service

modified to_html function.
[feedblog/feedgenerator.git] / feedgenerator.rb
index 1bf1008..a3be364 100644 (file)
@@ -40,6 +40,11 @@ REPLACEBRTAG = false
 # ファイルの書き込み時にENTRYのIDおよびURLを、FEEDオブジェクトから自動生成した値に置換するか否か
 REPLACEENTRYIDANDURL = false
 
+# EXPERIMENTAL AREA START
+TO_HTML_ENTRYTEMPLATE = 'htmltemp/diary.html.erb'
+TO_HTML_MAINTEMPLATE = 'htmltemp/main.html.erb'
+# EXPERIMENTAL AREA END
+
 # バージョン情報を示す文字列です
 APPVERSION = "- FeedGenerator for Ruby version 2.0.0.0 -<br>Copyright(c) 2009 Kureha.H (<a href=\"http://lunardial.sakura.ne.jp/\" target=\"_blank\">http://lunardial.sakura.ne.jp/</a>) & Yui Naruse (<a href=\"http://airemix.com/\" target=\"_blank\">http://airemix.com/</a>)"
 # タイトル領域に表示される文字列です
@@ -422,10 +427,10 @@ class Entry < AbstractEntry
     # XML読み込み
     entrylist = Entry.readxml(xmlpath)
     
-    content = ''
+    body = ''
     entrylist.each { |e|
       # Entry毎のHTML表示部分を生成
-      content << e.to_template(entry_temppath)
+      body << e.to_template(entry_temppath)
     }
     
     # HTML全体のテンプレートを生成
@@ -439,7 +444,10 @@ class Entry < AbstractEntry
   
   # Entryをテンプレートに沿って変形するメソッド
   def to_template(temppath)
-    erb = HtmlWriter.new(temppath)
+    erb = HtmlWriter.new(temppath, binding)
+    title = CGI.escapeHTML(@attr[:title])
+    date = @attr[:published]
+    content = CGI.unescapeHTML(@attr[:content])
     erb.to_code
   end