Hikidashi - Hiki on Rack - atom Diff
- Added parts are displayed like this.
- Deleted parts are displayed
like this.
! Atomプラグイン
Hikiの最近の更新をAtomフィードで配信するプラグインです。
v0.8(2010年10月25日)から、ページ毎にAtom Entryも配信できるようになりました。もしHikiをAtomPub対応にしようという心意気のある方がいれば手間を省くのにどうぞ。
''Rackブランチではなく、オリジナルのHiki用です(バージョン0.8.8.1で動作確認済み)。''
Rackブランチ版のプラグインはRackPluginAtomをご覧ください。このHikidashiでもこれを使っています。
{{toc_here}}
!! ダウンロード
* {{attach_anchor(atom.tar.gz)}}
!! インストール
上のファイルをダウンロードして展開すると
* atom.rb
* en/atom.rb
* ja/atom.rb
の三ファイルが出てきます。
それぞれ
* misc/plugin
* misc/plugin/en
* misc/plugin/ja
ディレクトリーに入れてください。
プラグインを有効化すれば自動でAtomフィードが配信されます。
配信する内容(全文かダイジェストか、どんなフォーマットか)、Atom Entryを配信するかどうか、「Atom」「Atom Entry」という文字をページ内にも表示するかどうか、Atom Feedで何件の記事を配信するかは、管理画面から選択できます。
!! ソース
!!! atom.rb
{{attach_src('atom.rb')}}
!!! en/atom.rb
<<<
# en/atom.rb
def label_atom_recent
'Recent Changes'
end
def label_atom_config; 'Atom syndication'; end
def label_atom_mode_title; 'Select the format of the feed.' end
def label_atom_mode_candidate
{
:unidiff => 'unified diff',
:worddiff_digest => 'word diff(digest)',
:worddiff_full => 'word diff(full text)',
:html_full => 'HTML(full text)',
}
end
def label_atom_menu_title; 'Add Atom Feed menu'; end
def label_atom_menu_candidate
[ 'Yes', 'No' ]
end
def label_atom_count_title; 'The count of syndicated feeds'; end
def label_atom_count_unit; 'pages'; end
def label_atom_max_page_count; "#{atom_max_page_count} at a max"; end
def label_atom_entry_enable_title; 'Syndicate Atom Entry per page'; end
def label_atom_entry_enable; 'Yes'; end
def label_atom_entry_disable; 'No'; end
def label_atom_entry_menu_display_title; 'Add Atom Entry menu'; end
def label_atom_entry_menu_display; 'Yes'; end
def label_atom_entry_menu_hide; 'No'; end
>>>
!!! ja/atom.rb
<<<
# -*- coding: euc-jp -*-
# ja/atom.rb
def label_atom_recent
'更新日時順'
end
def label_atom_config; 'Atom の配信'; end
def label_atom_mode_title; 'Atom Feedのフォーマット'; end
def label_atom_mode_candidate
{
:unidiff => 'unified diff 形式',
:worddiff_digest => 'word diff 形式 (ダイジェスト)',
:worddiff_full => 'word diff 形式 (全文)',
:html_full => 'HTML 形式 (全文)',
}
end
def label_atom_menu_title; 'Atom Feedメニューの表示'; end
def label_atom_menu_candidate
[ 'する', 'しない' ]
end
def label_atom_count_title; 'Atom Feedで配信するページの数'; end
def label_atom_count_unit; '件'; end
def label_atom_max_page_count; "最大#{atom_max_page_count}件"; end
def label_atom_entry_enable_title; '各ページのAtom Entryの配信'; end
def label_atom_entry_enable; 'する'; end
def label_atom_entry_disable; 'しない'; end
def label_atom_entry_menu_display_title; '各ページのAtom Entryメニューの表示'; end
def label_atom_entry_menu_display; 'する'; end
def label_atom_entry_menu_hide; 'しない'; end
>>>
!! メモ
* エントリーごとにキャッシュを作って、古いページのキャッシュと新しいページから作ったエントリーとを組み合わせてフィードを構築するとちょっとパフォーマンスがいいかも知れない。
** Ruby標準添付のrssライブラリーを使っているが、特定のエントリーだけ構築済みのXML要素を使うってできるんだろうか。
** そう言えば、例えばrss-showプラグインなんかを使って動的にページを作るやつのキャッシュは考えなきゃいけない、よくある問題だけど。Ajaxで読み込んじゃうのがいいと思うんだよな。
* Atom Entry配信の際、毎回info.dbにアクセスしなければならないのが気に食わないが、HTTPのIf-Modified-Since付きのリクエストに対応する為には仕方が無い。大域幅を節約するかサーバー負荷を減らすかっていう問題だが。
** キャッシュファイルを作るんだったら、それを読み込んで解析してしまえばそのページのLast-Modifiedは出るから、info.dbに触らないでもIf-Modified-Sinceに対応できるかも知れない。その場合は勿論Atom Entryを解析する負荷がサーバーに掛かるが、とても壊れやすいinfo.dbに触るよりはましなんじゃないかという気がする。それに、Last-Modifiedとentry要素のペアでキャッシュしてもいいしね。
* キーワード毎の最新記事を配信できるようにしたい。
Hikiの最近の更新をAtomフィードで配信するプラグインです。
v0.8(2010年10月25日)から、ページ毎にAtom Entryも配信できるようになりました。もしHikiをAtomPub対応にしようという心意気のある方がいれば手間を省くのにどうぞ。
''Rackブランチではなく、オリジナルのHiki用です(バージョン0.8.8.1で動作確認済み)。''
Rackブランチ版のプラグインはRackPluginAtomをご覧ください。このHikidashiでもこれを使っています。
{{toc_here}}
!! ダウンロード
* {{attach_anchor(atom.tar.gz)}}
!! インストール
上のファイルをダウンロードして展開すると
* atom.rb
* en/atom.rb
* ja/atom.rb
の三ファイルが出てきます。
それぞれ
* misc/plugin
* misc/plugin/en
* misc/plugin/ja
ディレクトリーに入れてください。
プラグインを有効化すれば自動でAtomフィードが配信されます。
配信する内容(全文かダイジェストか、どんなフォーマットか)、Atom Entryを配信するかどうか、「Atom」「Atom Entry」という文字をページ内にも表示するかどうか、Atom Feedで何件の記事を配信するかは、管理画面から選択できます。
!! ソース
!!! atom.rb
{{attach_src('atom.rb')}}
!!! en/atom.rb
<<<
# en/atom.rb
def label_atom_recent
'Recent Changes'
end
def label_atom_config; 'Atom syndication'; end
def label_atom_mode_title; 'Select the format of the feed.' end
def label_atom_mode_candidate
{
:unidiff => 'unified diff',
:worddiff_digest => 'word diff(digest)',
:worddiff_full => 'word diff(full text)',
:html_full => 'HTML(full text)',
}
end
def label_atom_menu_title; 'Add Atom Feed menu'; end
def label_atom_menu_candidate
[ 'Yes', 'No' ]
end
def label_atom_count_title; 'The count of syndicated feeds'; end
def label_atom_count_unit; 'pages'; end
def label_atom_max_page_count; "#{atom_max_page_count} at a max"; end
def label_atom_entry_enable_title; 'Syndicate Atom Entry per page'; end
def label_atom_entry_enable; 'Yes'; end
def label_atom_entry_disable; 'No'; end
def label_atom_entry_menu_display_title; 'Add Atom Entry menu'; end
def label_atom_entry_menu_display; 'Yes'; end
def label_atom_entry_menu_hide; 'No'; end
>>>
!!! ja/atom.rb
<<<
# -*- coding: euc-jp -*-
# ja/atom.rb
def label_atom_recent
'更新日時順'
end
def label_atom_config; 'Atom の配信'; end
def label_atom_mode_title; 'Atom Feedのフォーマット'; end
def label_atom_mode_candidate
{
:unidiff => 'unified diff 形式',
:worddiff_digest => 'word diff 形式 (ダイジェスト)',
:worddiff_full => 'word diff 形式 (全文)',
:html_full => 'HTML 形式 (全文)',
}
end
def label_atom_menu_title; 'Atom Feedメニューの表示'; end
def label_atom_menu_candidate
[ 'する', 'しない' ]
end
def label_atom_count_title; 'Atom Feedで配信するページの数'; end
def label_atom_count_unit; '件'; end
def label_atom_max_page_count; "最大#{atom_max_page_count}件"; end
def label_atom_entry_enable_title; '各ページのAtom Entryの配信'; end
def label_atom_entry_enable; 'する'; end
def label_atom_entry_disable; 'しない'; end
def label_atom_entry_menu_display_title; '各ページのAtom Entryメニューの表示'; end
def label_atom_entry_menu_display; 'する'; end
def label_atom_entry_menu_hide; 'しない'; end
>>>
!! メモ
* エントリーごとにキャッシュを作って、古いページのキャッシュと新しいページから作ったエントリーとを組み合わせてフィードを構築するとちょっとパフォーマンスがいいかも知れない。
** Ruby標準添付のrssライブラリーを使っているが、特定のエントリーだけ構築済みのXML要素を使うってできるんだろうか。
** そう言えば、例えばrss-showプラグインなんかを使って動的にページを作るやつのキャッシュは考えなきゃいけない、よくある問題だけど。Ajaxで読み込んじゃうのがいいと思うんだよな。
* Atom Entry配信の際、毎回info.dbにアクセスしなければならないのが気に食わないが、HTTPのIf-Modified-Since付きのリクエストに対応する為には仕方が無い。大域幅を節約するかサーバー負荷を減らすかっていう問題だが。
** キャッシュファイルを作るんだったら、それを読み込んで解析してしまえばそのページのLast-Modifiedは出るから、info.dbに触らないでもIf-Modified-Sinceに対応できるかも知れない。その場合は勿論Atom Entryを解析する負荷がサーバーに掛かるが、とても壊れやすいinfo.dbに触るよりはましなんじゃないかという気がする。それに、Last-Modifiedとentry要素のペアでキャッシュしてもいいしね。
* キーワード毎の最新記事を配信できるようにしたい。