|
Revision 1057, 382 bytes
(checked in by cho45, 6 years ago)
|
|
lang/ruby/ekfloras/plugins/paging.rb,
lang/ruby/ekfloras/site-plugins,
lang/ruby/ekfloras/site-plugins/markdown.rb,
lang/ruby/ekfloras/site-plugins/text_hatena.rb,
lang/ruby/ekfloras/ekfloras.rb,
lang/ruby/ekfloras/template.html:
フォーマッタ系プラグインを追加
そのた微修正
|
-
Property svn:executable set to
*
|
| Line | |
|---|
| 1 | |
|---|
| 2 | require "enumerator" |
|---|
| 3 | |
|---|
| 4 | class Ekfloras::Plugin::Paging < Ekfloras::Plugin |
|---|
| 5 | |
|---|
| 6 | @@entry_per_page = 7 |
|---|
| 7 | |
|---|
| 8 | def priority |
|---|
| 9 | 50 |
|---|
| 10 | end |
|---|
| 11 | |
|---|
| 12 | def filter(entries) |
|---|
| 13 | page = @ekfloras.cgi["page"].to_i |
|---|
| 14 | page = 1 if page.zero? |
|---|
| 15 | |
|---|
| 16 | ret = [] |
|---|
| 17 | entries.each_slice(@@entry_per_page) {|a| ret << a} |
|---|
| 18 | |
|---|
| 19 | @ekfloras.stash.page = page |
|---|
| 20 | @ekfloras.stash.page_slices = ret |
|---|
| 21 | |
|---|
| 22 | ret[page-1] || entries |
|---|
| 23 | end |
|---|
| 24 | |
|---|
| 25 | end |
|---|
| 26 | |
|---|
| 27 | |
|---|