From fea2de9ed923272a09cdae5b82571e939a1a4f14 Mon Sep 17 00:00:00 2001 From: elixirel Date: Fri, 11 Dec 2009 02:58:22 +0900 Subject: [PATCH] modified to_html function. --- feedgenerator.rb | 14 +++++++++++--- htmltemp/diary.html.erb | 6 ++++++ htmltemp/main.html.erb | 10 ++++++++++ 3 files changed, 27 insertions(+), 3 deletions(-) create mode 100644 htmltemp/diary.html.erb create mode 100644 htmltemp/main.html.erb diff --git a/feedgenerator.rb b/feedgenerator.rb index 1bf1008..a3be364 100644 --- a/feedgenerator.rb +++ b/feedgenerator.rb @@ -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 -
Copyright(c) 2009 Kureha.H (http://lunardial.sakura.ne.jp/) & Yui Naruse (http://airemix.com/)" # タイトル領域に表示される文字列です @@ -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 diff --git a/htmltemp/diary.html.erb b/htmltemp/diary.html.erb new file mode 100644 index 0000000..2f144ca --- /dev/null +++ b/htmltemp/diary.html.erb @@ -0,0 +1,6 @@ + +<%= title %> / <%= date %> + + +<%= content %> + \ No newline at end of file diff --git a/htmltemp/main.html.erb b/htmltemp/main.html.erb new file mode 100644 index 0000000..d9479d1 --- /dev/null +++ b/htmltemp/main.html.erb @@ -0,0 +1,10 @@ + + + TESTING + + + + <%= body %> +
+ + \ No newline at end of file -- 2.11.0