tdiary-contrib 3.2.2.20130518

Sign up to get free protection for your applications and to get access to all the features.
Files changed (393) hide show
  1. checksums.yaml +7 -0
  2. data/.gitignore +1 -0
  3. data/.travis.yml +7 -0
  4. data/Gemfile +13 -0
  5. data/Gemfile.lock +35 -0
  6. data/README.en.md +12 -0
  7. data/README.md +13 -0
  8. data/Rakefile +41 -0
  9. data/doc/en/filter/spambayes.txt +3 -0
  10. data/doc/en/plugin.txt +1 -0
  11. data/doc/en/style/hatena.txt +10 -0
  12. data/doc/en/style/markdown.txt +16 -0
  13. data/doc/en/util.txt +1 -0
  14. data/doc/ja/filter/antirefspam.history.txt +59 -0
  15. data/doc/ja/filter/antirefspam.txt +86 -0
  16. data/doc/ja/filter/comment_key.ja.html +182 -0
  17. data/doc/ja/filter/spambayes.txt +3 -0
  18. data/doc/ja/plugin/add_bookmark.txt +50 -0
  19. data/doc/ja/plugin/category_to_tag.txt +21 -0
  20. data/doc/ja/plugin/cocoment.txt +31 -0
  21. data/doc/ja/plugin/google_adsense.txt +25 -0
  22. data/doc/ja/plugin/google_analytics.txt +7 -0
  23. data/doc/ja/plugin/image_detail.txt +69 -0
  24. data/doc/ja/plugin/image_gps.txt +36 -0
  25. data/doc/ja/plugin/image_gps2.txt +41 -0
  26. data/doc/ja/plugin/livedoor_weather.txt +105 -0
  27. data/doc/ja/plugin/opensearch_ad.txt +16 -0
  28. data/doc/ja/plugin/section_footer.txt +84 -0
  29. data/doc/ja/plugin/select_theme.txt +1 -0
  30. data/doc/ja/plugin.txt +13 -0
  31. data/doc/ja/style/hatena.txt +10 -0
  32. data/doc/ja/style/markdown.txt +13 -0
  33. data/doc/ja/util.txt +12 -0
  34. data/filter/antirefspam.rb +263 -0
  35. data/filter/commentkey.rb +29 -0
  36. data/filter/commentsize.rb +18 -0
  37. data/filter/hidecomment.rb +13 -0
  38. data/filter/iplookup.rb +55 -0
  39. data/filter/plugin/antirefspam.rb +59 -0
  40. data/filter/plugin/commentkey.rb +58 -0
  41. data/filter/plugin/commentsize.rb +12 -0
  42. data/filter/plugin/en/iplookup.rb +9 -0
  43. data/filter/plugin/en/spambayes.rb +123 -0
  44. data/filter/plugin/iplookup.rb +39 -0
  45. data/filter/plugin/ja/antirefspam.rb +91 -0
  46. data/filter/plugin/ja/commentkey.rb +17 -0
  47. data/filter/plugin/ja/commentsize.rb +6 -0
  48. data/filter/plugin/ja/iplookup.rb +9 -0
  49. data/filter/plugin/ja/spambayes.rb +124 -0
  50. data/filter/plugin/spambayes.rb +501 -0
  51. data/filter/plugin/zh/iplookup.rb +9 -0
  52. data/filter/rblcheck.rb +36 -0
  53. data/filter/spambayes.rb +535 -0
  54. data/filter/spamlookup.rb +37 -0
  55. data/io/dbi_io/ChangeLog +19 -0
  56. data/io/dbi_io/README.ja +39 -0
  57. data/io/dbi_io/dbi_io.rb +181 -0
  58. data/io/dbi_io/plugin/refererDbiIO.rb +76 -0
  59. data/io/dbi_io/tdiary_table.sql +42 -0
  60. data/js/appstore.js +109 -0
  61. data/js/datepicker.js +69 -0
  62. data/js/editor.js +82 -0
  63. data/js/flickr.js +157 -0
  64. data/js/image_ex.js +79 -0
  65. data/js/jquery.socialbutton.js +842 -0
  66. data/js/nicovideo.js +17 -0
  67. data/js/picasa.js +322 -0
  68. data/js/plugin_checker.js +71 -0
  69. data/js/prettify/lang-apollo.js +2 -0
  70. data/js/prettify/lang-clj.js +18 -0
  71. data/js/prettify/lang-css.js +2 -0
  72. data/js/prettify/lang-go.js +1 -0
  73. data/js/prettify/lang-hs.js +2 -0
  74. data/js/prettify/lang-lisp.js +3 -0
  75. data/js/prettify/lang-lua.js +2 -0
  76. data/js/prettify/lang-ml.js +2 -0
  77. data/js/prettify/lang-n.js +4 -0
  78. data/js/prettify/lang-proto.js +1 -0
  79. data/js/prettify/lang-scala.js +2 -0
  80. data/js/prettify/lang-sql.js +2 -0
  81. data/js/prettify/lang-tex.js +1 -0
  82. data/js/prettify/lang-vb.js +2 -0
  83. data/js/prettify/lang-vhdl.js +3 -0
  84. data/js/prettify/lang-wiki.js +2 -0
  85. data/js/prettify/lang-xq.js +3 -0
  86. data/js/prettify/lang-yaml.js +2 -0
  87. data/js/prettify/prettify.css +1 -0
  88. data/js/prettify/prettify.js +28 -0
  89. data/js/referer.js +17 -0
  90. data/js/show_and_hide.js +39 -0
  91. data/js/socialbutton.js +126 -0
  92. data/js/twitter_anywhere.js +28 -0
  93. data/js/yahoo_kousei.js +21 -0
  94. data/lib/bayes/convert.rb +34 -0
  95. data/lib/bayes.rb +232 -0
  96. data/lib/exifparser/BUGS +1 -0
  97. data/lib/exifparser/ChangeLog +169 -0
  98. data/lib/exifparser/README +15 -0
  99. data/lib/exifparser/install.rb +1015 -0
  100. data/lib/exifparser/lib/exifparser/makernote/canon.rb +502 -0
  101. data/lib/exifparser/lib/exifparser/makernote/fujifilm.rb +415 -0
  102. data/lib/exifparser/lib/exifparser/makernote/minolta.rb +84 -0
  103. data/lib/exifparser/lib/exifparser/makernote/mk_nikonflensname.rb +39 -0
  104. data/lib/exifparser/lib/exifparser/makernote/nikon.rb +267 -0
  105. data/lib/exifparser/lib/exifparser/makernote/nikon2.rb +581 -0
  106. data/lib/exifparser/lib/exifparser/makernote/nikonflensname.rb +438 -0
  107. data/lib/exifparser/lib/exifparser/makernote/olympus.rb +225 -0
  108. data/lib/exifparser/lib/exifparser/makernote/prove.rb +84 -0
  109. data/lib/exifparser/lib/exifparser/makernote/sigma.rb +237 -0
  110. data/lib/exifparser/lib/exifparser/pre-setup.rb +1 -0
  111. data/lib/exifparser/lib/exifparser/scan.rb +278 -0
  112. data/lib/exifparser/lib/exifparser/tag.rb +2298 -0
  113. data/lib/exifparser/lib/exifparser/thumbnail.rb +76 -0
  114. data/lib/exifparser/lib/exifparser/utils.rb +88 -0
  115. data/lib/exifparser/lib/exifparser.rb +265 -0
  116. data/lib/exifparser/sample/exifview.rb +279 -0
  117. data/lib/tdiary-contrib.rb +19 -0
  118. data/lib/wgs2tky.rb +93 -0
  119. data/misc/section_footer2/buzzurl.yaml +6 -0
  120. data/misc/section_footer2/fc2.yaml +6 -0
  121. data/misc/section_footer2/ldc.yaml +6 -0
  122. data/misc/section_footer2/retweet.yaml +7 -0
  123. data/misc/section_footer2/twitter.yaml +7 -0
  124. data/misc/section_footer2/yahoo.yaml +6 -0
  125. data/misc/tdiarygraph/tdiarygraph120x90e.swf +0 -0
  126. data/misc/tdiarygraph/tdiarygraph125x125e.swf +0 -0
  127. data/misc/tdiarygraph/tdiarygraph240x180e.swf +0 -0
  128. data/misc/tdiarygraph/tdiarygraph468x60e.swf +0 -0
  129. data/misc/tdiarygraph/tdiarygraph728x90e.swf +0 -0
  130. data/misc/tdiarytimes/tdiarytimes125x125r.swf +0 -0
  131. data/misc/tdiarytimes/tdiarytimes125x125r7.swf +0 -0
  132. data/misc/tdiarytimes/tdiarytimes125x125s.swf +0 -0
  133. data/misc/tdiarytimes/tdiarytimes125x30.swf +0 -0
  134. data/misc/tdiarytimes/tdiarytimes234x30.swf +0 -0
  135. data/misc/tdiarytimes/tdiarytimes468x30.swf +0 -0
  136. data/plugin/add_bookmark.rb +89 -0
  137. data/plugin/apple_webclip.rb +26 -0
  138. data/plugin/appstore.rb +47 -0
  139. data/plugin/bigpresen.rb +86 -0
  140. data/plugin/bitly.rb +39 -0
  141. data/plugin/bootstrap-navi.rb +54 -0
  142. data/plugin/canonical.rb +9 -0
  143. data/plugin/category_similar.rb +73 -0
  144. data/plugin/category_to_tag.rb +60 -0
  145. data/plugin/category_to_tagcloud.rb +172 -0
  146. data/plugin/cocomment.rb +37 -0
  147. data/plugin/code-prettify.rb +23 -0
  148. data/plugin/coderwall.rb +34 -0
  149. data/plugin/datepicker.rb +28 -0
  150. data/plugin/day2section.rb +20 -0
  151. data/plugin/del_footer.rb +111 -0
  152. data/plugin/description_from_body.rb +23 -0
  153. data/plugin/development.rb +16 -0
  154. data/plugin/editor.rb +11 -0
  155. data/plugin/en/add_bookmark.rb +20 -0
  156. data/plugin/en/del_footer.rb +10 -0
  157. data/plugin/en/git-register.rb +3 -0
  158. data/plugin/en/livedoor_weather.rb +25 -0
  159. data/plugin/en/microsummary.rb +18 -0
  160. data/plugin/en/nicovideo.rb +38 -0
  161. data/plugin/en/openid.rb +8 -0
  162. data/plugin/en/section_footer.rb +6 -0
  163. data/plugin/en/section_footer2.rb +3 -0
  164. data/plugin/en/socialbutton.rb +5 -0
  165. data/plugin/everytrail.rb +39 -0
  166. data/plugin/facebook_comments.rb +59 -0
  167. data/plugin/flickr.rb +209 -0
  168. data/plugin/gist.rb +16 -0
  169. data/plugin/git-register.rb +240 -0
  170. data/plugin/github_badge.rb +27 -0
  171. data/plugin/github_link.rb +9 -0
  172. data/plugin/goo_gl.rb +42 -0
  173. data/plugin/google_adsense.rb +132 -0
  174. data/plugin/google_analytics.rb +39 -0
  175. data/plugin/google_map.rb +168 -0
  176. data/plugin/google_sitemaps.rb +60 -0
  177. data/plugin/google_webmaster.rb +22 -0
  178. data/plugin/hatena_bookmark_nocomment.rb +9 -0
  179. data/plugin/hatena_star.rb +66 -0
  180. data/plugin/hb_footer.rb +255 -0
  181. data/plugin/hb_footer4sec.rb +244 -0
  182. data/plugin/hb_footer4sec_js.rb +30 -0
  183. data/plugin/hide_comment_form.rb +4 -0
  184. data/plugin/hide_sidebar_iphone.rb +21 -0
  185. data/plugin/iddy.rb +81 -0
  186. data/plugin/image_detail.rb +143 -0
  187. data/plugin/image_ex.rb +462 -0
  188. data/plugin/image_gps.rb +128 -0
  189. data/plugin/inline_wiki.rb +6 -0
  190. data/plugin/instagr.rb +64 -0
  191. data/plugin/ja/add_bookmark.rb +20 -0
  192. data/plugin/ja/del_footer.rb +10 -0
  193. data/plugin/ja/flickr.rb +62 -0
  194. data/plugin/ja/git-register.rb +3 -0
  195. data/plugin/ja/google_sitemaps.rb +35 -0
  196. data/plugin/ja/livedoor_weather.rb +25 -0
  197. data/plugin/ja/microsummary.rb +18 -0
  198. data/plugin/ja/nicovideo.rb +41 -0
  199. data/plugin/ja/openid.rb +7 -0
  200. data/plugin/ja/section_footer.rb +6 -0
  201. data/plugin/ja/section_footer2.rb +4 -0
  202. data/plugin/ja/socialbutton.rb +6 -0
  203. data/plugin/jdate.rb +20 -0
  204. data/plugin/jholiday.rb +16 -0
  205. data/plugin/jmonth.rb +20 -0
  206. data/plugin/jquery_ui_theme.rb +55 -0
  207. data/plugin/jroku.rb +28 -0
  208. data/plugin/jyear.rb +37 -0
  209. data/plugin/latlonglab_route.rb +25 -0
  210. data/plugin/lazy_referer.rb +38 -0
  211. data/plugin/livedoor_weather.rb +180 -0
  212. data/plugin/make_link.rb +44 -0
  213. data/plugin/makerss_category.rb +43 -0
  214. data/plugin/makerss_comment.rb +35 -0
  215. data/plugin/microsummary.rb +62 -0
  216. data/plugin/mm_footer.rb +215 -0
  217. data/plugin/monthly_autopagerize.rb +67 -0
  218. data/plugin/my_hotentry.rb +132 -0
  219. data/plugin/navi_day.rb +118 -0
  220. data/plugin/navi_this_month.rb +15 -0
  221. data/plugin/nicovideo.rb +115 -0
  222. data/plugin/notify_miniblog.rb +134 -0
  223. data/plugin/ogp.rb +55 -0
  224. data/plugin/ohmsha_estore.rb +71 -0
  225. data/plugin/openid.rb +90 -0
  226. data/plugin/opensearch_ad.rb +33 -0
  227. data/plugin/picasa.rb +56 -0
  228. data/plugin/plugin_checker.rb +41 -0
  229. data/plugin/popit.rb +22 -0
  230. data/plugin/prettify.rb +19 -0
  231. data/plugin/prezi.rb +10 -0
  232. data/plugin/profile.rb +222 -0
  233. data/plugin/puboo.rb +93 -0
  234. data/plugin/pygments_css.rb +76 -0
  235. data/plugin/rating.rb +419 -0
  236. data/plugin/recent_estraier.rb +50 -0
  237. data/plugin/recent_tweet.rb +71 -0
  238. data/plugin/retweet.rb +86 -0
  239. data/plugin/rubykaigi.rb +99 -0
  240. data/plugin/search-bing.rb +87 -0
  241. data/plugin/search-default.rb +264 -0
  242. data/plugin/search-google-custom.rb +60 -0
  243. data/plugin/search-yahoo-websearch.rb +121 -0
  244. data/plugin/search-yahoo.rb +109 -0
  245. data/plugin/section_footer.rb +195 -0
  246. data/plugin/section_footer2.rb +278 -0
  247. data/plugin/section_permalink.rb +73 -0
  248. data/plugin/section_permalink_anchor.rb +39 -0
  249. data/plugin/select_style.rb +42 -0
  250. data/plugin/select_theme.rb +90 -0
  251. data/plugin/show_and_hide.rb +77 -0
  252. data/plugin/slideshare.rb +10 -0
  253. data/plugin/socialbutton.rb +60 -0
  254. data/plugin/tatsu_zine.rb +93 -0
  255. data/plugin/tdiarygraph_flashstyle.rb +296 -0
  256. data/plugin/tdiarytimes.rb +166 -0
  257. data/plugin/tdiarytimes2.rb +406 -0
  258. data/plugin/tdiarytimes_flashstyle.rb +263 -0
  259. data/plugin/tdiarytimes_textstyle.rb +290 -0
  260. data/plugin/title_anchor.rb +16 -0
  261. data/plugin/tweet_quote.rb +106 -0
  262. data/plugin/twitpic.rb +10 -0
  263. data/plugin/twitter.rb +46 -0
  264. data/plugin/twitter_anywhere.rb +209 -0
  265. data/plugin/twitter_badge.rb +42 -0
  266. data/plugin/twitter_js.rb +59 -0
  267. data/plugin/ustream.rb +19 -0
  268. data/plugin/vimeo.rb +14 -0
  269. data/plugin/volatile.rb +89 -0
  270. data/plugin/vote.rb +100 -0
  271. data/plugin/wikiloc.rb +27 -0
  272. data/plugin/windex.rb +512 -0
  273. data/plugin/yahoo_kousei.rb +79 -0
  274. data/plugin/yahoo_map.rb +97 -0
  275. data/plugin/youtube.rb +33 -0
  276. data/plugin/yshop.rb +189 -0
  277. data/plugin/zenback.rb +46 -0
  278. data/spec/apple_webclip_spec.rb +46 -0
  279. data/spec/fixtures/friendfeed.xml +2 -0
  280. data/spec/fixtures/github.json +1 -0
  281. data/spec/fixtures/twitter.xml +73 -0
  282. data/spec/gist_spec.rb +16 -0
  283. data/spec/github_link_spec.rb +39 -0
  284. data/spec/google_analytics_spec.rb +60 -0
  285. data/spec/jdate_spec.rb +23 -0
  286. data/spec/jmonth_spec.rb +28 -0
  287. data/spec/jyear_spec.rb +21 -0
  288. data/spec/my_hotentry_spec.rb +78 -0
  289. data/spec/openid_spec.rb +246 -0
  290. data/spec/opensearch_ad_spec.rb +50 -0
  291. data/spec/profile_spec.rb +88 -0
  292. data/spec/rcov.opts +2 -0
  293. data/spec/spec_helper.rb +223 -0
  294. data/spec/title_anchor_spec.rb +39 -0
  295. data/spec/twitter_js_spec.rb +116 -0
  296. data/spec/youtube_spec.rb +20 -0
  297. data/style/hatena_style.rb +1011 -0
  298. data/style/markdown_style.rb +239 -0
  299. data/style/wikiext_style.rb +21 -0
  300. data/tdiary-contrib.gemspec +25 -0
  301. data/util/clean-spam/README.ja +1 -0
  302. data/util/clean-spam/tdiary-comment-clean +46 -0
  303. data/util/clean-spam/tdiary-comment-clean2 +81 -0
  304. data/util/clean-spam/tdiary-referer-clean +46 -0
  305. data/util/convert_pstore.rb +82 -0
  306. data/util/estraier-search/ChangeLog +36 -0
  307. data/util/estraier-search/README.ja +114 -0
  308. data/util/estraier-search/en/estraier-register.rb +3 -0
  309. data/util/estraier-search/estraier-register.rb +298 -0
  310. data/util/estraier-search/estraier-search.rb +273 -0
  311. data/util/estraier-search/estraier.rhtml +73 -0
  312. data/util/estraier-search/estraier.rxml +23 -0
  313. data/util/estraier-search/i.estraier.rhtml +31 -0
  314. data/util/estraier-search/ja/estraier-register.rb +3 -0
  315. data/util/image-gallery/README.ja +27 -0
  316. data/util/image-gallery/image-gallery.rb +523 -0
  317. data/util/image-gallery/image-gallery.rb.euc-jp +523 -0
  318. data/util/image-gallery/js/SmoothGallery/Changelog +52 -0
  319. data/util/image-gallery/js/SmoothGallery/css/ReMooz.css +186 -0
  320. data/util/image-gallery/js/SmoothGallery/css/img/carrow1.gif +0 -0
  321. data/util/image-gallery/js/SmoothGallery/css/img/carrow2.gif +0 -0
  322. data/util/image-gallery/js/SmoothGallery/css/img/closebox.gif +0 -0
  323. data/util/image-gallery/js/SmoothGallery/css/img/closebox.png +0 -0
  324. data/util/image-gallery/js/SmoothGallery/css/img/fleche1.gif +0 -0
  325. data/util/image-gallery/js/SmoothGallery/css/img/fleche1.png +0 -0
  326. data/util/image-gallery/js/SmoothGallery/css/img/fleche2.gif +0 -0
  327. data/util/image-gallery/js/SmoothGallery/css/img/fleche2.png +0 -0
  328. data/util/image-gallery/js/SmoothGallery/css/img/loading-bar-black.gif +0 -0
  329. data/util/image-gallery/js/SmoothGallery/css/img/open.gif +0 -0
  330. data/util/image-gallery/js/SmoothGallery/css/img/open.png +0 -0
  331. data/util/image-gallery/js/SmoothGallery/css/img/remo_bg_e.png +0 -0
  332. data/util/image-gallery/js/SmoothGallery/css/img/remo_bg_n.png +0 -0
  333. data/util/image-gallery/js/SmoothGallery/css/img/remo_bg_ne.png +0 -0
  334. data/util/image-gallery/js/SmoothGallery/css/img/remo_bg_nw.png +0 -0
  335. data/util/image-gallery/js/SmoothGallery/css/img/remo_bg_s.png +0 -0
  336. data/util/image-gallery/js/SmoothGallery/css/img/remo_bg_se.png +0 -0
  337. data/util/image-gallery/js/SmoothGallery/css/img/remo_bg_sw.png +0 -0
  338. data/util/image-gallery/js/SmoothGallery/css/img/remo_bg_w.png +0 -0
  339. data/util/image-gallery/js/SmoothGallery/css/img/spinner.gif +0 -0
  340. data/util/image-gallery/js/SmoothGallery/css/jd.gallery.css +371 -0
  341. data/util/image-gallery/js/SmoothGallery/css/layout.css +91 -0
  342. data/util/image-gallery/js/SmoothGallery/license.txt +621 -0
  343. data/util/image-gallery/js/SmoothGallery/resizer.php +113 -0
  344. data/util/image-gallery/js/SmoothGallery/scripts/Changelog +52 -0
  345. data/util/image-gallery/js/SmoothGallery/scripts/History.Routing.js +126 -0
  346. data/util/image-gallery/js/SmoothGallery/scripts/History.js +109 -0
  347. data/util/image-gallery/js/SmoothGallery/scripts/ReMooz.js +364 -0
  348. data/util/image-gallery/js/SmoothGallery/scripts/jd.gallery.js +843 -0
  349. data/util/image-gallery/js/SmoothGallery/scripts/jd.gallery.set.js +183 -0
  350. data/util/image-gallery/js/SmoothGallery/scripts/jd.gallery.transitions.js +90 -0
  351. data/util/image-gallery/js/SmoothGallery/scripts/jdgalleryresize.js +828 -0
  352. data/util/image-gallery/js/SmoothGallery/scripts/license.txt +621 -0
  353. data/util/image-gallery/js/SmoothGallery/scripts/mootools-1.2-more.js +103 -0
  354. data/util/image-gallery/js/SmoothGallery/scripts/mootools-1.2.1-core-yc.js +349 -0
  355. data/util/image-gallery/js/SmoothGallery/scripts/resizer.php +113 -0
  356. data/util/image-gallery/misc/plugin/recent_image.rb +406 -0
  357. data/util/image-gallery/skel/gallery.rhtml +154 -0
  358. data/util/image-gallery/skel/gallery.rhtml.euc-jp +154 -0
  359. data/util/image-gallery/tdiary.conf.igsample +8 -0
  360. data/util/image-gallery/theme/image-gallery.css +85 -0
  361. data/util/image2flickr.rb +282 -0
  362. data/util/posttdiary/README.ja +12 -0
  363. data/util/posttdiary/posttdiary-ex.rb +1155 -0
  364. data/util/posttdiary/posttdiary.rb +245 -0
  365. data/util/rast-search/ChangeLog +55 -0
  366. data/util/rast-search/README.ja +99 -0
  367. data/util/rast-search/en/rast-register.rb +3 -0
  368. data/util/rast-search/i.rast.rhtml +33 -0
  369. data/util/rast-search/ja/rast-register.rb +3 -0
  370. data/util/rast-search/rast-register.rb +326 -0
  371. data/util/rast-search/rast-search.rb +249 -0
  372. data/util/rast-search/rast.rhtml +66 -0
  373. data/util/rast-search/rast.rxml +21 -0
  374. data/util/section_link/README +11 -0
  375. data/util/section_link/misc/plugin/section_link.rb +68 -0
  376. data/util/section_link/misc/plugin/section_link_anchor.rb +38 -0
  377. data/util/section_link/tdiary/tdiary_day_ext.rb +21 -0
  378. data/util/section_link/tdiary/tdiaryext_style.rb +36 -0
  379. data/util/section_link/tdiary/wikiext_style.rb +36 -0
  380. data/util/tdiary-for-ruby1.9/compatible.rb +97 -0
  381. data/util/tdiary-for-ruby1.9/tdiary-2.2.0.patch +98 -0
  382. data/util/tdiary-for-ruby1.9/tdiary-2.3.1.patch +212 -0
  383. data/util/tdiary-grep/README +4 -0
  384. data/util/tdiary-grep/grep.rb +445 -0
  385. data/util/tdiary-mode/http.el +130 -0
  386. data/util/tdiary-mode/tdiary-mode.el +613 -0
  387. data/util/tdiary-vim/ChangeLog +25 -0
  388. data/util/tdiary-vim/README +60 -0
  389. data/util/tdiary-vim/tdiary.vim +350 -0
  390. data/util/tdiarysearch/README.en +53 -0
  391. data/util/tdiarysearch/README.ja +99 -0
  392. data/util/tdiarysearch/search.rb +504 -0
  393. metadata +497 -0
@@ -0,0 +1,38 @@
1
+ # -*- coding: utf-8; -*-
2
+ #
3
+ # lazy_referer.rb: lazy loading referer
4
+ #
5
+ # Copyright (C) 2013 by MATSUOKA Kohei <kmachu@gmail.com>
6
+ # You can distribute it under GPL.
7
+ #
8
+ if /^(day|form|edit)$/ =~ @mode and not bot? then
9
+ enable_js('referer.js')
10
+
11
+ #
12
+ # overwrite method: draw only referer area (content will feach with ajax)
13
+ #
14
+ def referer_of_today_long( diary, limit )
15
+ return if limit == 0
16
+ return unless diary
17
+ date = diary.date.strftime('%Y%m%d')
18
+ # FIXME: endpoint is should created by TDiary::Plugin, because easy customize routing
19
+ endpoint = "#{@conf.index}?plugin=referer&date=#{date}"
20
+ %Q[<button class="lazy_referer" style="padding: 0.5em; width: 20em;" data-endpoint="#{h endpoint}">#{referer_today}</button>\n]
21
+ end
22
+ end
23
+
24
+ #
25
+ # return referer of date as is (html)
26
+ #
27
+ add_content_proc('referer') do |date|
28
+ diary = @diaries[date]
29
+ referer_load_current( diary )
30
+ referer_of_today_long( diary, 100 )
31
+ end
32
+
33
+ # Local Variables:
34
+ # mode: ruby
35
+ # indent-tabs-mode: t
36
+ # tab-width: 3
37
+ # ruby-indent-level: 3
38
+ # End:
@@ -0,0 +1,180 @@
1
+ # -*- coding: utf-8 -*-
2
+ # livedoor_weather.rb
3
+ #
4
+ # insert weather information using livedoor weather web service.
5
+ #
6
+ # Copyright (C) 2007 SHIBATA Hiroshi <shibata.hiroshi@gmail.com>
7
+ # You can redistribute it and/or modify it under GPL2.
8
+ #
9
+
10
+ require 'open-uri'
11
+ require 'timeout'
12
+ require 'time'
13
+
14
+ @lwws_rest_url = 'http://weather.livedoor.com/forecast/webservice/json/v1'
15
+
16
+ def lwws_init
17
+ @conf['lwws.city_id'] ||= 130010
18
+ @conf['lwws.icon.disp'] ||= ""
19
+ @conf['lwws.max_temp.disp'] ||= ""
20
+ @conf['lwws.min_temp.disp'] ||= ""
21
+ @conf['lwws.cache'] ||= ""
22
+ @conf['lwws.cache_time'] ||= 6
23
+ end
24
+
25
+ def lwws_request( city_id )
26
+ url = @lwws_rest_url.dup
27
+ url << "?city=#{city_id}"
28
+
29
+ proxy = @conf['proxy']
30
+ proxy = 'http://' + proxy if proxy
31
+ timeout( 10 ) do
32
+ open( url, :proxy => proxy ) {|f| f.read }
33
+ end
34
+ end
35
+
36
+ def lwws_get
37
+ lwws_init
38
+
39
+ city_id = @conf['lwws.city_id']
40
+ cache_time = @conf['lwws.cache_time'] * 60 * 60
41
+ file_name = "#{@cache_path}/lwws/#{Time.now.strftime("%Y%m%d")}.json"
42
+
43
+ begin
44
+ Dir.mkdir("#{@cache_path}/lwws") unless File.directory?("#{@cache_path}/lwws")
45
+
46
+ cached_time = if File.exist?( file_name )
47
+ File.mtime( file_name )
48
+ else
49
+ nil
50
+ end
51
+
52
+ update = true if @conf['lwws.cache'] == "t" && cached_time && Time.now > cached_time + cache_time
53
+
54
+ if cached_time.nil? || update
55
+ json = lwws_request(city_id)
56
+ File.open(file_name, 'wb') {|f| f.write(json)}
57
+ end
58
+ rescue => e
59
+ @logger.error( e )
60
+ end
61
+ end
62
+
63
+ def lwws_to_html(date)
64
+ lwws_init
65
+
66
+ file_name = "#{@cache_path}/lwws/#{date.strftime("%Y%m%d")}.xml"
67
+
68
+ begin
69
+ # http://weather.livedoor.com/help/restapi_close
70
+ if Time.parse('20130331') < date
71
+ file_name.sub!(/xml/, 'json')
72
+ require 'json'
73
+ doc = JSON.parse(File.read(file_name))
74
+
75
+ telop = @conf.to_native( doc["forecasts"][0]["telop"], 'utf-8' )
76
+ # 「今日」のデータに気温は含まれない場合がある
77
+ max_temp = doc["forecasts"][0]["temperature"]["max"]["celsius"] rescue nil
78
+ min_temp = doc["forecasts"][0]["temperature"]["min"]["celsius"] rescue nil
79
+ detail_url = doc["link"]
80
+ title = @conf.to_native( doc["forecasts"][0]["image"]["title"], 'utf-8' )
81
+ url = doc["forecasts"][0]["image"]["url"]
82
+ width = doc["forecasts"][0]["image"]["width"]
83
+ height = doc["forecasts"][0]["image"]["height"]
84
+ else
85
+ require 'rexml/document'
86
+ doc = REXML::Document.new(File.read(file_name)).root
87
+
88
+ telop = @conf.to_native( doc.elements["telop"].text, 'utf-8' )
89
+ max_temp = doc.elements["temperature/max/celsius"].text
90
+ min_temp = doc.elements["temperature/min/celsius"].text
91
+ detail_url = doc.elements["link"].text
92
+ title = @conf.to_native( doc.elements["image/title"].text, 'utf-8' )
93
+ url = doc.elements["image/url"].text
94
+ width = doc.elements["image/width"].text
95
+ height = doc.elements["image/height"].text
96
+ end
97
+
98
+ result = ""
99
+ result << %Q|<div class="lwws">|
100
+ if @conf['lwws.icon.disp'] != "t" or @conf.mobile_agent? then
101
+ result << %Q|<a href="#{h(detail_url)}">#{telop}</a>|
102
+ else
103
+ result << %Q|<a href="#{h(detail_url)}"><img src="#{url}" border="0" alt="#{title}" title="#{title}" width=#{width} height="#{height}"></a>|
104
+ end
105
+ if @conf['lwws.max_temp.disp'] == "t" and not max_temp.nil? then
106
+ result << %Q| #{@lwws_max_temp_label}:#{h(max_temp)}#{@celsius_label}|
107
+ end
108
+ if @conf['lwws.min_temp.disp'] == "t" and not min_temp.nil? then
109
+ result << %Q| #{@lwws_min_temp_label}:#{h(min_temp)}#{@celsius_label}|
110
+ end
111
+ result << %Q|</div>|
112
+
113
+ result
114
+ rescue StandardError, Errno::ENOENT => e
115
+ @logger.error( e )
116
+ ''
117
+ end
118
+ end
119
+
120
+ def lwws_conf_proc
121
+ lwws_init
122
+
123
+ if @mode == 'saveconf' then
124
+ @conf['lwws.city_id'] = @cgi.params['lwws.city_id'][0].to_i
125
+ @conf['lwws.icon.disp'] = @cgi.params['lwws.icon.disp'][0]
126
+ @conf['lwws.max_temp.disp'] = @cgi.params['lwws.max_temp.disp'][0]
127
+ @conf['lwws.min_temp.disp'] = @cgi.params['lwws.min_temp.disp'][0]
128
+ @conf['lwws.cache'] = @cgi.params['lwws.cache'][0]
129
+ @conf['lwws.cache_time'] = @cgi.params['lwws.cache_time'][0].to_i
130
+ end
131
+
132
+ result = ''
133
+
134
+ result << <<-HTML
135
+ <h3>#{@lwws_label_city_id}</h3>
136
+ <p>#{@lwws_desc_city_id}</p>
137
+ <p><input name="lwws.city_id" value="#{h(@conf['lwws.city_id'])}"></p>
138
+ HTML
139
+
140
+ result << %Q|<h3>#{@lwws_icon_label}</h3>|
141
+ checked = "t" == @conf['lwws.icon.disp'] ? ' checked' : ''
142
+ result << %Q|<p><label for="lwws.icon.disp"><input id="lwws.icon.disp" name="lwws.icon.disp" type="checkbox" value="t"#{checked}>#{@lwws_icon_desc}</label></p>|
143
+ result << %Q|<h3>#{@lwws_label_disp_item}</h3>|
144
+ result << %Q|<p>#{@lwws_desc_disp_item}</p>|
145
+ result << %Q|<ul>|
146
+ checked = "t" == @conf['lwws.max_temp.disp'] ? ' checked' : ''
147
+ result << %Q|<li><label for="lwws.max_temp.disp"><input id="lwws.max_temp.disp" name="lwws.max_temp.disp" type="checkbox" value="t"#{checked}>#{@lwws_max_temp_label}</label></li>|
148
+ checked = "t" == @conf['lwws.min_temp.disp'] ? ' checked' : ''
149
+ result << %Q|<li><label for="lwws.min_temp.disp"><input id="lwws.min_temp.disp" name="lwws.min_temp.disp" type="checkbox" value="t"#{checked}>#{@lwws_min_temp_label}</label></li>|
150
+ result << %Q|</ul>|
151
+ result << %Q|<h3>#{@lwws_label_cache}</h3>|
152
+ checked = "t" == @conf['lwws.cache'] ? ' checked' : ''
153
+ result << %Q|<p><label for="lwws.cache"><input id="lwws.cache" name="lwws.cache" type="checkbox" value="t"#{checked}>#{@lwws_desc_cache}</label></p>|
154
+ result << %Q|<p>#{@lwws_desc_cache_time}</p>|
155
+ result << %Q|<p><input name="lwws.cache_time" value="#{h(@conf['lwws.cache_time'])}"></p>|
156
+
157
+ result
158
+ end
159
+
160
+ add_body_enter_proc do |date|
161
+ unless @conf.mobile_agent? or @conf.iphone? or feed? or bot?
162
+ lwws_to_html(date)
163
+ end
164
+ end
165
+
166
+ add_update_proc do
167
+ lwws_get
168
+ end
169
+
170
+ add_conf_proc( 'lwws', @lwws_plugin_name ) do
171
+ lwws_conf_proc
172
+ end
173
+
174
+ # Local Variables:
175
+ # mode: ruby
176
+ # indent-tabs-mode: t
177
+ # tab-width: 3
178
+ # ruby-indent-level: 3
179
+ # End:
180
+ # vim: ts=3
@@ -0,0 +1,44 @@
1
+ # -*- coding: utf-8 -*-
2
+ # Copyright (C) 2011, KADO Masanori <kdmsnr@gmail.com>
3
+ # You can redistribute it and/or modify it under GPL.
4
+
5
+ # needs category.rb plugin
6
+
7
+ add_edit_proc do
8
+ <<-HTML
9
+ <div class="make-link">
10
+
11
+ Link URL: <input type="text" id="make-link-url" style="width:400px" />
12
+ <button id="make-link-button">Get Title and Link</button>
13
+
14
+ <script>
15
+ $('#make-link-button').click(function() {
16
+ var url = $('#make-link-url')[0].value;
17
+ var title = $.ajax({
18
+ url: "http://query.yahooapis.com/v1/public/yql",
19
+ type: "GET",
20
+ dataType: "json",
21
+ async: false,
22
+ data: {
23
+ q: 'select * from html where url = "' + url + '" and xpath = "//head/title"',
24
+ format: 'xml',
25
+ charset: 'utf-8'
26
+ }
27
+ }).responseXML.getElementsByTagName('title')[0].textContent
28
+ .replace(/\\n/g, ''); // FIXME: need to convert to UTF-8
29
+
30
+ var link = "[[" + title + "|" + url + "]]";
31
+
32
+ if (typeof(inj_c) == 'function') {
33
+ inj_c(link); // old category.rb
34
+ } else {
35
+ $('#body').insertAtCaret(link);
36
+ }
37
+
38
+ return false;
39
+ });
40
+ </script>
41
+
42
+ </div>
43
+ HTML
44
+ end
@@ -0,0 +1,43 @@
1
+ #
2
+ # makerss_category.rb: extension for makerss plugin.
3
+ #
4
+ # Copyright (C) 2007 by SHIBATA Hiroshi <h-sbt@nifty.com>
5
+ # Distributed under GPL2.
6
+ #
7
+ # Usage:
8
+ # @conf['makerss.category'] = ["mixi", "sns"]
9
+ #
10
+
11
+ class MakeRssCategory < MakeRssFull
12
+ def title
13
+ '(category only)'
14
+ end
15
+
16
+ def item( seq, body, rdfsec )
17
+ return unless rdfsec.section.respond_to?( :body_to_html )
18
+ return if rdfsec.section.categories.length == 0
19
+ rdfsec.section.categories.each do |category|
20
+ if @conf['makerss.category'].include?(category)
21
+ super
22
+ end
23
+ end
24
+ end
25
+
26
+ def file
27
+ f = @conf['makerss.category.file'] || 'category.rdf'
28
+ f = 'category.rdf' if f.length == 0
29
+ f
30
+ end
31
+
32
+ def write( encoder )
33
+ super( encoder )
34
+ end
35
+
36
+ def url
37
+ u = @conf['makerss.category.url'] || "#{@conf.base_url}category.rdf"
38
+ u = "#{@conf.base_url}category.rdf" if u.length == 0
39
+ u
40
+ end
41
+ end
42
+
43
+ @makerss_rsses << MakeRssCategory::new( @conf )
@@ -0,0 +1,35 @@
1
+ #
2
+ # makerss_comment.rb: extension for makerss plugin.
3
+ #
4
+ # Copyright (C) 2007 by SHIBATA Hiroshi <h-sbt@nifty.com>
5
+ # Distributed under GPL2.
6
+ #
7
+
8
+ class MakeRssComments < MakeRssFull
9
+ def title
10
+ '(comments only)'
11
+ end
12
+
13
+ def item( seq, body, rdfsec )
14
+ return if rdfsec.section.respond_to?( :body_to_html )
15
+ super
16
+ end
17
+
18
+ def file
19
+ f = @conf['makerss.no_comments.file'] || 'comments.rdf'
20
+ f = 'comments.rdf' if f.length == 0
21
+ f
22
+ end
23
+
24
+ def write( encoder )
25
+ super( encoder )
26
+ end
27
+
28
+ def url
29
+ u = @conf['makerss.no_comments.url'] || "#{@conf.base_url}comments.rdf"
30
+ u = "#{@conf.base_url}comments.rdf" if u.length == 0
31
+ u
32
+ end
33
+ end
34
+
35
+ @makerss_rsses << MakeRssComments::new( @conf )
@@ -0,0 +1,62 @@
1
+ # microsummary.rb
2
+ #
3
+ # Copyright (c) 2006 elytsllams <smallstyle@gmail.com>
4
+ # Distributed under the GPL
5
+ #
6
+
7
+ add_header_proc do
8
+ generator_xml = @conf['generator.xml']
9
+
10
+ if generator_xml != nil and @mode == 'latest' and !@cgi.valid?( 'date' )
11
+ %Q|\t<link rel="microsummary" href="#{generator_xml}" type="application/x.microsummary+xml">\n|
12
+ end
13
+ end
14
+
15
+ def create_xml file_name
16
+ xml = <<-XML
17
+ <?xml version="1.0" encoding="UTF-8"?>
18
+ <generator xmlns="http://www.mozilla.org/microsummaries/0.1"
19
+ name="tDiary Entry Title">
20
+ <template>
21
+ <transform xmlns="http://www.w3.org/1999/XSL/Transform" version="1.0">
22
+ <output method="text"/>
23
+ <template match="/">
24
+ <value-of select="html/head/title"/>
25
+ <choose>
26
+ <when test="boolean(descendant::div[attribute::class='body'][1]/div[attribute::class='section'][last()]/h3)">
27
+ <text> - </text>
28
+ <value-of select="descendant::div[attribute::class='body'][1]/div[attribute::class='section'][last()]/h3"/>
29
+ </when>
30
+ <when test="boolean(descendant::div[attribute::class='day'][1]/h2)">
31
+ <text> - </text>
32
+ <value-of select="descendant::div[attribute::class='day'][1]/h2"/>
33
+ </when>
34
+ </choose>
35
+ </template>
36
+ </transform>
37
+ </template>
38
+ <update interval="240"/>
39
+ <pages>
40
+ <include>^#{@conf.base_url.gsub(/\./, '\\.')}$</include>
41
+ </pages>
42
+ </generator>
43
+ XML
44
+
45
+ begin
46
+ File::open( file_name, 'w' ) do |f|
47
+ f.print to_utf8( xml )
48
+ end
49
+ rescue
50
+ end
51
+ end
52
+
53
+ def microsummary_init
54
+ @conf['generator.xml'] ||= ""
55
+ create_xml( @conf['generator.xml'] ) unless File::exists? @conf['generator.xml']
56
+ end
57
+
58
+ if @mode == 'saveconf'
59
+ def saveconf_microsummary
60
+ @conf['generator.xml'] = @cgi.params['generator.xml'][0]
61
+ end
62
+ end
@@ -0,0 +1,215 @@
1
+ #
2
+ # mm_footer.rb
3
+ #
4
+ # MM ( http://1470.net/mm/) のmylistを各日付に貼り付けるtDiaryプラグイン
5
+ #
6
+ # Licence: GPL
7
+ # Author: ishinao <ishinao@ishinao.net>
8
+ #
9
+
10
+ require 'nkf'
11
+
12
+ add_body_leave_proc(Proc.new do |date|
13
+
14
+ oldest_date = Time.local(2005, 1, 11)
15
+ if date > oldest_date
16
+ if @mode == 'day' or @mode == 'latest'
17
+ if date < Time.local(2006, 7, 6)
18
+ mm_user = 82 # your MM id
19
+ url = "http://1470.net/mm/mylist.html/#{mm_user}?date=#{date.strftime('%Y-%m-%d')}"
20
+ rssurl = "http://1470.net/mm/mylist.html/#{mm_user}?date=#{date.strftime('%Y-%m-%d')}&mode=rss"
21
+ template_list = '<li>#{content}</li>'
22
+ else
23
+ userName = 'hsbt' # your 1470.net id
24
+ url = "http://1470.net/user/#{userName}/#{date.strftime('%Y/%m/%d')}"
25
+ rssurl = "http://1470.net/user/#{userName}/#{date.strftime('%Y/%m/%d')}/feed"
26
+ template_list = '<li>#{content.gsub(/href="\//, "href=\"http://1470.net\/")}</li>'
27
+ end
28
+
29
+ template_head = %Q[<div class="section mm_footer">\n<h3><a href="#{CGI.escapeHTML(url)}">今日のメモ</a> powered by <a href="http://1470.net/">1470.net</a></h3>\n<ul class="mm_footer">\n]
30
+ template_foot = "</ul>\n</div>\n"
31
+
32
+ cache_time = 3600;
33
+ if date.strftime('%Y-%m-%d') != Time.now.strftime('%Y-%m-%d')
34
+ cache_time = 3600 * 12;
35
+ end
36
+ NKF.nkf('-e', mm_footer(rssurl, 50, cache_time, template_head, template_list, template_foot))
37
+ else
38
+ ''
39
+ end
40
+ end
41
+ end)
42
+
43
+ require "rss/rss"
44
+
45
+ MM_FOOTER_FIELD_SEPARATOR = "\0"
46
+ MM_FOOTER_ENTRY_SEPARATOR = "\1"
47
+ MM_FOOTER_VERSION = "0.0.5i"
48
+ MM_FOOTER_HTTP_HEADER = {
49
+ "User-Agent" => "tDiary RSS recent plugin version #{MM_FOOTER_VERSION}. " <<
50
+ "Using RSS parser version is #{::RSS::VERSION}.",
51
+ }
52
+
53
+ def mm_footer(url, max = 5, cache_time = 3600, \
54
+ template_head = "<ul>\n", \
55
+ template_list = '<li><span class="#{mm_footer_modified_class(time)}"><a href="#{CGI.escapeHTML(url)}" title="#{CGI.escapeHTML(title)}">#{CGI::escapeHTML(title)}</a></span></li>\n', \
56
+ template_foot = "</ul>\n")
57
+ url.untaint
58
+
59
+ cache_file = "#{@cache_path}/rss-recent/rss-recent.#{CGI.escape(url)}"
60
+
61
+ mm_footer_cache_rss(url, cache_file, cache_time.to_i)
62
+
63
+ return '' unless test(?r, cache_file)
64
+
65
+ rv = template_head
66
+
67
+ i = 0
68
+ mm_footer_read_from_cache(cache_file).each do |title, url, time, content|
69
+ break if i >= max
70
+ next if (url.nil? or title.nil?)
71
+ rv << eval('%Q[' + template_list + ']')
72
+ i += 1
73
+ end
74
+
75
+ rv << template_foot
76
+
77
+ if i > 0
78
+ rv
79
+ else
80
+ ''
81
+ end
82
+ end
83
+
84
+ class InvalidResourceError < StandardError; end
85
+
86
+ def mm_footer_cache_rss(url, cache_file, cache_time)
87
+
88
+ cached_time = nil
89
+ cached_time = File.mtime(cache_file) if File.exist?(cache_file)
90
+
91
+ if cached_time.nil? or Time.now > cached_time + cache_time
92
+ require 'time'
93
+ require 'open-uri'
94
+ require 'net/http'
95
+ require 'uri/generic'
96
+ require 'rss/parser'
97
+ require 'rss/1.0'
98
+ require 'rss/2.0'
99
+ require 'rss/dublincore'
100
+ require 'rss/content'
101
+
102
+ begin
103
+ uri = URI.parse(url)
104
+
105
+ raise URI::InvalidURIError if uri.scheme != "http"
106
+
107
+ rss_source = mm_footer_fetch_rss(uri, cached_time)
108
+
109
+ raise InvalidResourceError if rss_source.nil?
110
+
111
+ # parse RSS
112
+ rss = ::RSS::Parser.parse(rss_source, false)
113
+ raise ::RSS::Error if rss.nil?
114
+
115
+ # pre processing
116
+ begin
117
+ rss.output_encoding = @conf.charset || charset
118
+ rescue ::RSS::UnknownConversionMethodError
119
+ end
120
+
121
+ rss_infos = rss.items.collect do |item|
122
+ mm_footer_pubDate_to_dc_date(item)
123
+ [item.title, item.link, item.dc_date, item.content_encoded]
124
+ end
125
+ mm_footer_write_to_cache(cache_file, rss_infos)
126
+
127
+ rescue URI::InvalidURIError
128
+ mm_footer_write_to_cache(cache_file, [['Invalid URI', url]])
129
+ rescue InvalidResourceError, ::RSS::Error
130
+ # mm_footer_write_to_cache(cache_file, [['Invalid Resource', url]])
131
+ # when cannot get valid RSS, use old cache
132
+ end
133
+ end
134
+
135
+ end
136
+
137
+ def mm_footer_fetch_rss(uri, cache_time)
138
+ rss = nil
139
+ begin
140
+ uri.open(mm_footer_http_header(cache_time)) do |f|
141
+ case f.status.first
142
+ when "200"
143
+ rss = f.read
144
+ # STDERR.puts "Got RSS of #{uri}"
145
+ when "304"
146
+ # not modified
147
+ # STDERR.puts "#{uri} does not modified"
148
+ else
149
+ raise InvalidResourceError
150
+ end
151
+ end
152
+ rescue TimeoutError, SocketError, StandardError,
153
+ SecurityError # occured in redirect
154
+ raise InvalidResourceError
155
+ end
156
+ rss
157
+ end
158
+
159
+ def mm_footer_http_header(cache_time)
160
+ header = MM_FOOTER_HTTP_HEADER.dup
161
+ if cache_time.respond_to?(:rfc2822)
162
+ header["If-Modified-Since"] = cache_time.rfc2822
163
+ end
164
+ header
165
+ end
166
+
167
+ def mm_footer_write_to_cache(cache_file, rss_infos)
168
+ File.open(cache_file, 'w') do |f|
169
+ f.flock(File::LOCK_EX)
170
+ rss_infos.each do |info|
171
+ f << info.join(MM_FOOTER_FIELD_SEPARATOR)
172
+ f << MM_FOOTER_ENTRY_SEPARATOR
173
+ end
174
+ f.flock(File::LOCK_UN)
175
+ end
176
+ end
177
+
178
+ def mm_footer_read_from_cache(cache_file)
179
+ require 'time'
180
+ infos = []
181
+ File.open(cache_file) do |f|
182
+ while info = f.gets(MM_FOOTER_ENTRY_SEPARATOR)
183
+ info = info.chomp(MM_FOOTER_ENTRY_SEPARATOR)
184
+ infos << info.split(MM_FOOTER_FIELD_SEPARATOR)
185
+ end
186
+ end
187
+ infos.collect do |title, url, time, content|
188
+ [
189
+ mm_footer_convert(title),
190
+ mm_footer_convert(url),
191
+ mm_footer_convert(time) {|time| Time.parse(time)},
192
+ mm_footer_convert(content)
193
+ ]
194
+ end
195
+ end
196
+
197
+ def mm_footer_convert(str)
198
+ if str.nil? or str.empty?
199
+ nil
200
+ else
201
+ if block_given?
202
+ yield str
203
+ else
204
+ str
205
+ end
206
+ end
207
+ end
208
+
209
+ def mm_footer_pubDate_to_dc_date(target)
210
+ if target.respond_to?(:pubDate)
211
+ class << target
212
+ alias_method(:dc_date, :pubDate)
213
+ end
214
+ end
215
+ end
@@ -0,0 +1,67 @@
1
+ #
2
+ # monthly_autopagerize.rb - tDiary plugin
3
+ #
4
+ # add <link rel="prev"> and <link rel="next"> tags for AutoPagerize at monthly mode
5
+ #
6
+ # Copyright (C) 2009 MATSUI Shinsuke <poppen@karashi.org>
7
+ # You can redistribute it and/or modify it under GPL2.
8
+ #
9
+
10
+ if @mode == 'month' then
11
+ add_header_proc do
12
+ stream = @conf['monthly_autopagerize.stream'] || 0
13
+ result = String.new
14
+
15
+ ym = []
16
+ @years.keys.each do |y|
17
+ ym += @years[y].collect {|m| y + m}
18
+ end
19
+ ym.sort!
20
+ now = @date.strftime( '%Y%m' )
21
+ return '' unless ym.index( now )
22
+ prev_month = ym.index( now ) == 0 ? nil : ym[ym.index( now )-1]
23
+ next_month = ym[ym.index( now )+1]
24
+
25
+ case stream
26
+ #when 0
27
+ # rel_prev_month = 'next'
28
+ # rel_next_month = 'prev'
29
+ when 1
30
+ rel_prev_month = 'prev'
31
+ rel_next_month = 'next'
32
+ else
33
+ rel_prev_month = 'next'
34
+ rel_next_month = 'prev'
35
+ end
36
+
37
+ if prev_month then
38
+ result << %Q[<link rel="#{rel_prev_month}" title="#{h navi_prev_month}" href="#{h @index}#{anchor( prev_month )}">\n\t]
39
+ end
40
+ if next_month then
41
+ result << %Q[<link rel="#{rel_next_month}" title="#{h navi_next_month}" href="#{h @index}#{anchor( next_month )}">\n\t]
42
+ end
43
+
44
+ result.chop.chop
45
+ end
46
+ end
47
+
48
+ add_conf_proc( 'monthly_autopagerize', 'Monthly AutoPagerize' ) do
49
+ if @mode == 'saveconf' then
50
+ @conf['monthly_autopagerize.stream'] = @cgi.params['monthly_autopagerize.stream'][0].to_i
51
+ end
52
+ <<-HTML
53
+ <h3>Stream of Monthly AutoPagerize</h3>
54
+ <p><select name="monthly_autopagerize.stream">
55
+ <option value="0"#{' selected' if @conf['monthly_autopagerize.stream'] == 0}>To Past</option>
56
+ <option value="1"#{' selected' if @conf['monthly_autopagerize.stream'] == 1}>To Future</option>
57
+ </select></p>
58
+ HTML
59
+ end
60
+
61
+ # Local Variables:
62
+ # mode: ruby
63
+ # indent-tabs-mode: t
64
+ # tab-width: 3
65
+ # ruby-indent-level: 3
66
+ # End:
67
+ # vi: ts=3 sw=3