tdiary-contrib 3.2.2.20130518

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
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,109 @@
1
+ # -*- coding: utf-8 -*-
2
+ #
3
+ # search-yahoo.rb - site search plugin sample using Yahoo! Search BOSS API.
4
+ #
5
+ # Copyright (C) 2009, TADA Tadashi <t@tdtds.jp>
6
+ # You can redistribute it and/or modify it under GPL.
7
+ #
8
+ # Needed these options below:
9
+ #
10
+ # @options['search-yahoo.appid'] : Your BOSS APPID
11
+ # @options['search-yahoo.result_filter'] : your dialy's URL format of DAY mode into Regexp.
12
+ #
13
+
14
+ require 'timeout'
15
+ require 'rexml/document'
16
+ require 'net/http'
17
+ Net::HTTP.version_1_2
18
+
19
+ def search_title
20
+ '全文検索 by Yahoo! Search BOSS'
21
+ end
22
+
23
+ def search_input_form( q )
24
+ r = <<-HTML
25
+ <form method="GET" action="#{@conf.index}"><div>
26
+ 検索キーワード:
27
+ <input name="q" value="#{h q}">
28
+ <input type="submit" value="OK">
29
+ </div></form>
30
+ HTML
31
+ end
32
+
33
+ def search_boss_api( q, start = 0 )
34
+ url = 'http://boss.yahooapis.com/ysearch/web/v1/'
35
+ appid = @conf['search-yahoo.appid']
36
+
37
+ url << "#{q}?appid=#{appid}&format=xml&count=20&start=#{start}"
38
+
39
+ proxy = @conf['proxy']
40
+ proxy = 'http://' + proxy if proxy
41
+
42
+ proxy_host, proxy_port = nil
43
+ if proxy
44
+ proxy_host = proxy_uri.host
45
+ proxy_port = proxy_uri.port
46
+ end
47
+ proxy_class = Net::HTTP::Proxy(proxy_host, proxy_port)
48
+
49
+ query = URI.parse(url)
50
+ req = Net::HTTP::Get.new(query.request_uri)
51
+ http = proxy_class.new(query.host, query.port)
52
+ http.open_timeout = 20
53
+ http.read_timeout = 20
54
+ res = http.start do
55
+ http.request(req)
56
+ end
57
+ res.body
58
+ end
59
+
60
+ def search_to_html( str )
61
+ (str || '').gsub( /(?:<wbr(?:[ \t\r\n][^>]*)?>)+/, '' ).gsub( %r{<(/?)b[ \t\n\r]*>}, '<\\1strong>' )
62
+ end
63
+
64
+ def search_result
65
+ query = CGI::unescape( @cgi.params['q'][0] )
66
+ start = CGI::unescape( @cgi.params['start'][0] || '0' ).to_i
67
+
68
+ begin
69
+ uri = URI::parse( @conf.base_url )
70
+ q = "#{query} site:#{uri.host}"
71
+ q << %Q| inurl:"#{uri.path}"| unless uri.path == '/'
72
+ xml = search_boss_api( u( q.untaint ), start )
73
+ doc = REXML::Document::new( REXML::Source.new( xml ) ).root
74
+ res = doc.elements.to_a( '/ysearchresponse' )[0]
75
+ unless res.attribute( 'responsecode' ).value == '200' then
76
+ return '<p class="message">ERROR</p>'
77
+ end
78
+ rescue OpenURI::HTTPError
79
+ return %Q|<p class="message">#$!</p>|
80
+ end
81
+
82
+ r = search_input_form( query )
83
+ r << '<dl class="search-result autopagerize_page_element">'
84
+ doc.elements.to_a( '*/result' ).each do |elem|
85
+ url = elem.elements.to_a( 'url' )[0].text
86
+ next unless url =~ @conf['search-yahoo.result_filter']
87
+ title = elem.elements.to_a( 'title' )[0].text
88
+ abstract = elem.elements.to_a( 'abstract' )[0].text
89
+ r << %Q|<dt><a href="#{h url}">#{search_to_html title}</a></dt>|
90
+ r << %Q|<dd>#{search_to_html abstract}</dd>|
91
+ end
92
+ r << '</dl>'
93
+
94
+ r << '<div class="search-navi">'
95
+ doc.elements.to_a( '/ysearchresponse/prevpage' ).each do |p|
96
+ if /start=\d+/ =~ p.text then
97
+ r << %Q|<a href="#{@conf.index}?q=#{u query}&amp;#$&" rel="prev">&lt;前の20件</a>&nbsp;|
98
+ end
99
+ end
100
+
101
+ doc.elements.to_a( '/ysearchresponse/nextpage' ).each do |n|
102
+ if /start=\d+/ =~ n.text then
103
+ r << %Q|<a href="#{@conf.index}?q=#{u query}&amp;#$&" rel="next">次の20件&gt;</a>|
104
+ end
105
+ end
106
+ r << '</div>'
107
+
108
+ r
109
+ end
@@ -0,0 +1,195 @@
1
+ # -*- coding: utf-8 -*-
2
+ # section_footer.rb
3
+ #
4
+ # Copyright (c) 2005 SHIBATA Hiroshi <h-sbt@nifty.com>
5
+ # You can redistribute it and/or modify it under GPL2.
6
+ #
7
+
8
+ require 'digest/md5'
9
+ require 'open-uri'
10
+ require 'timeout'
11
+
12
+ def permalink( date, index, escape = true )
13
+ ymd = date.strftime( "%Y%m%d" )
14
+ uri = @conf.index.dup
15
+ uri.sub!( %r|\A(?!https?://)|i, @conf.base_url )
16
+ uri.gsub!( %r|/\.(?=/)|, "" ) # /././ -> /
17
+ link = uri + anchor( "#{ymd}p%02d" % index )
18
+ link.sub!( "#", "%23" ) if escape
19
+ link
20
+ end
21
+
22
+ add_header_proc do
23
+ <<-SCRIPT
24
+ <link rel="stylesheet" href="theme/hatena_bookmark.css" type="text/css" media="all">
25
+ <script type="text/javascript" src="http://b.hatena.ne.jp/js/BookmarkCommentViewerAllInOne.1.2.js" charset="utf-8"></script>
26
+ <script type="text/javascript">
27
+ initCreateRelAfterIcon();
28
+ BookmarkCommentViewer.options['dateFormat'] = '%y-%m-%d';
29
+ // BookmarkCommentViewer.options['blankCommentHide'] = true;
30
+ BookmarkCommentViewer.options['tags'] = false;
31
+ </script>
32
+ SCRIPT
33
+ end
34
+
35
+ add_section_enter_proc do |date, index|
36
+ @category_to_tag_list = {}
37
+ end
38
+
39
+ alias subtitle_link_original subtitle_link
40
+ def subtitle_link( date, index, subtitle )
41
+ s = ''
42
+ if subtitle then
43
+ s = subtitle.sub( /^(\[([^\[]+?)\])+/ ) do
44
+ $&.scan( /\[(.*?)\]/ ) do |tag|
45
+ @category_to_tag_list[tag] = false # false when diary
46
+ end
47
+ ''
48
+ end
49
+ end
50
+ subtitle_link_original( date, index, s.strip )
51
+ end
52
+
53
+ add_section_leave_proc do |date, index|
54
+ r = '<div class="tags">'
55
+
56
+ unless @conf.mobile_agent? then
57
+ # カテゴリタグの追加
58
+ if @category_to_tag_list and not @category_to_tag_list.empty? then
59
+ r << "Tags: "
60
+ @category_to_tag_list.each do |tag, blog|
61
+ if blog
62
+ r << %Q|<a href="#{@index}?blogcategory=#{h tag}">#{tag}</a> |
63
+ else
64
+ r << category_anchor( "#{tag}" ).sub( /^\[/, '' ).sub( /\]$/, '' ) << ' '
65
+ end
66
+ end
67
+ end
68
+
69
+ # 「このエントリの Delicious history (JSON)」
70
+ r << add_delicious_json(date, index)
71
+
72
+ # 「このエントリを含む Delicious (画像API)」
73
+ # r << add_delicious(date, index)
74
+
75
+ # 「このエントリを含むはてなブックーク」
76
+ r << add_hatenabm(date, index)
77
+
78
+ # 「このエントリを含む livedoor クリップ」
79
+ r << add_ldclip(date, index)
80
+
81
+ # 「このエントリを含む Buzzurl」
82
+ r << add_buzzurl(date, index)
83
+
84
+ # 「このエントリを含む Yahoo!ブックマーク」
85
+ r << add_yahoobm(date, index)
86
+
87
+ # Permalinkの追加
88
+ r << add_permalink(date, index)
89
+ end
90
+
91
+ r << "</div>\n"
92
+ end
93
+
94
+ def add_permalink(date, index)
95
+ r = " | "
96
+ r << %Q|<a href="#{permalink(date, index, false)}">Permalink</a> |
97
+ return r
98
+ end
99
+
100
+ def add_hatenabm(date, index)
101
+ r = " | "
102
+ r << %Q|<a href="http://b.hatena.ne.jp/entry/#{permalink(date, index)}"><img src="http://d.hatena.ne.jp/images/b_entry.gif" style="border: 0 none;vertical-align: middle;" title="#{@section_footer_hatenabm_label}" alt="#{@section_footer_hatenabm_label}" width="16" height="12"> <img src="http://b.hatena.ne.jp/entry/image/normal/#{permalink(date, index)}" style="border: 0 none;vertical-align: middle;"></a> <img src="http://r.hatena.ne.jp/images/popup.gif" style="border: 0 none;vertical-align: middle;" onclick="iconImageClickHandler(this, '#{permalink(date, index, false)}', event);" alt="">|
103
+ return r
104
+ end
105
+
106
+ def add_ldclip(date, index)
107
+ r = " | "
108
+ r << %Q|<a href="http://clip.livedoor.com/page/#{permalink(date, index)}"><img src="http://parts.blog.livedoor.jp/img/cmn/clip_16_16_w.gif" width="16" height="16" style="border: 0 none;vertical-align: middle;" alt="#{@section_footer_ldclip_label}" title="#{@section_footer_ldclip_label}"> <img src="http://image.clip.livedoor.com/counter/#{permalink(date, index)}" style="border: 0 none;vertical-align: middle;"></a>|
109
+ return r
110
+ end
111
+
112
+ def add_buzzurl(date, index)
113
+ r = " | "
114
+ r << %Q|<a href="http://buzzurl.jp/entry/#{permalink(date, index)}"><img src="http://buzzurl.jp/static/image/api/icon/add_icon_mini_10.gif" style="border: 0 none;vertical-align: middle;" title="#{@section_footer_buzzurl_label}" alt="#{@section_footer_buzzurl_label}" width="16" height="12" class="icon"> <img src="http://buzzurl.jp/api/counter/#{permalink(date, index)}" style="border: 0 none;vertical-align: middle;"></a>|
115
+ return r
116
+ end
117
+
118
+ def add_delicious(date, index)
119
+ url_md5 = Digest::MD5.hexdigest(permalink(date, index, false))
120
+
121
+ r = " | "
122
+ r << %Q|<a href="http://delicious.com/url/#{url_md5}"><img src="http://static.delicious.com/img/delicious.small.gif" width="10" height="10" style="border: 0 none;vertical-align: middle;" alt="#{@section_footer_delicious_label}" title="#{@section_footer_delicious_label}"> <img src="http://del.icio.us/feeds/img/savedcount/#{url_md5}?aggregate" style="border: 0 none;margin: 0;"></a>|
123
+ return r
124
+ end
125
+
126
+ def add_delicious_json(date, index)
127
+ require 'fileutils'
128
+ begin
129
+ require 'json'
130
+ rescue
131
+ retry if require 'rubygems'
132
+ end
133
+
134
+ url_md5 = Digest::MD5.hexdigest(permalink(date, index, false))
135
+ cache_dir = "#{@cache_path}/delicious/#{date.strftime( "%Y%m" )}/"
136
+ file_name = "#{cache_dir}/#{url_md5}.json"
137
+ cache_time = 8 * 60 * 60 # 8 hour
138
+ update = false
139
+ count = 0
140
+
141
+ r = " | "
142
+ r << %Q|<a href="http://delicious.com/url/#{url_md5}"><img src="http://static.delicious.com/img/delicious.small.gif" width="10" height="10" style="border: 0 none;vertical-align: middle;" alt="#{@section_footer_delicious_label}" title="#{@section_footer_delicious_label}">|
143
+
144
+ begin
145
+ FileUtils.mkdir_p( cache_dir ) unless File::directory?( cache_dir )
146
+ cached_time = nil
147
+ cached_time = File::mtime( file_name ) if File::exist?( file_name )
148
+
149
+ unless cached_time.nil?
150
+ if Time.now > cached_time + cache_time
151
+ update = true
152
+ end
153
+ end
154
+
155
+ if cached_time.nil? or update
156
+ begin
157
+ timeout(10) do
158
+ open( "http://feeds.delicious.com/v2/json/urlinfo/#{url_md5}") do |file|
159
+ File::open( file_name, 'wb' ) do |f|
160
+ f.write( file.read )
161
+ end
162
+ end
163
+ end
164
+ rescue => e
165
+ @logger.debug( e )
166
+ end
167
+ end
168
+ rescue
169
+ end
170
+
171
+ begin
172
+ File::open( file_name ) do |f|
173
+ data = JSON.parse(@conf.to_native( f.read, 'utf-8' ))
174
+ unless data[0].nil?
175
+ count = data[0]["total_posts"].to_i
176
+ end
177
+ end
178
+ rescue
179
+ end
180
+
181
+ if count > 0
182
+ r << %Q| #{count} users</a>|
183
+ else
184
+ r << %Q|</a>|
185
+ end
186
+
187
+ return r
188
+ end
189
+
190
+ def add_yahoobm(date, index)
191
+ r = " | "
192
+ r << %Q|<a href="http://bookmarks.yahoo.co.jp/url?url=#{permalink(date, index)}&amp;opener=bm&amp;ei=UTF-8"><img src="http://i.yimg.jp/images/sicons/ybm16.gif" style="border: 0 none;vertical-align: middle;" title="#{@section_footer_yahoobm_label}" alt="#{@section_footer_yahoobm_label}" width="16" height="16" class="icon"></a>|
193
+ return r
194
+ end
195
+
@@ -0,0 +1,278 @@
1
+ # section_footer2.rb
2
+ #
3
+ # Copyright (c) 2008 SHIBATA Hiroshi <shibata.hiroshi@gmail.com>
4
+ # You can redistribute it and/or modify it under GPL2.
5
+ #
6
+
7
+ require 'digest/md5'
8
+ require 'timeout'
9
+ require 'open-uri'
10
+ require 'yaml'
11
+ require 'pathname'
12
+
13
+ begin
14
+ require 'json'
15
+ rescue LoadError
16
+ retry if require 'rubygems'
17
+ end
18
+
19
+
20
+ def permalink( date, index, escape = true )
21
+ ymd = date.strftime( "%Y%m%d" )
22
+ uri = @conf.index.dup
23
+ uri.sub!( %r|\A(?!https?://)|i, @conf.base_url )
24
+ uri.gsub!( %r|/\.(?=/)|, "" ) # /././ -> /
25
+ link = uri + anchor( "#{ymd}p%02d" % index )
26
+ link.sub!( "#", "%23" ) if escape
27
+ link
28
+ end
29
+
30
+ unless defined?(subtitle)
31
+ def subtitle( date, index, escape = true )
32
+ diary = @diaries[date.strftime( "%Y%m%d" )]
33
+ return "" unless diary
34
+ sn = 1
35
+ diary.each_section do |section|
36
+ if sn == index
37
+ old_apply_plugin = @options["apply_plugin"]
38
+ @options["apply_plugin"] = true
39
+ title = apply_plugin( section.subtitle_to_html, true )
40
+ @options["apply_plugin"] = old_apply_plugin
41
+ title.gsub!( /(?=")/, "\\" ) if escape
42
+ return title
43
+ end
44
+ sn += 1
45
+ end
46
+ ''
47
+ end
48
+ end
49
+
50
+ def init_buttons_status
51
+ @installed_buttons = ['yaml', 'delicious', 'hatena', 'facebook', 'twitter', 'plusone']
52
+ if @conf['section_footer2.isDisplay'].nil?
53
+ @conf['section_footer2.isDisplay'] = ''
54
+ end
55
+ end
56
+
57
+ add_header_proc do
58
+ <<-"EOS"
59
+ <script type="text/javascript" src="http://b.st-hatena.com/js/bookmark_button_wo_al.js" charset="utf-8" async="async"></script>
60
+ <style type="text/css">iframe.hatena-bookmark-button-frame {margin-bottom: -7px; }</style>
61
+ <script src="http://platform.twitter.com/widgets.js" type="text/javascript"></script>
62
+ <style type="text/css">iframe.twitter-share-button.twitter-count-horizontal {margin-bottom: -6px; }</style>
63
+ <script src="http://connect.facebook.net/#{@section_footer2_locale}/all.js"></script>
64
+ <script>
65
+ FB.init({
66
+ appId : '',
67
+ status : true, // check login status
68
+ cookie : true, // enable cookies to allow the server to access the session
69
+ xfbml : true // parse XFBML
70
+ });
71
+ </script>
72
+ <style type="text/css">iframe.fb_ltr {margin-bottom: -2px; margin-right: 4px;}</style>
73
+ <script type="text/javascript" src="http://apis.google.com/js/plusone.js">
74
+ {lang: '#{@section_footer2_locale}'}
75
+ </script>
76
+ <style type="text/css">.tags > div > iframe {margin-bottom: -6px !important; }</style>
77
+ EOS
78
+ end
79
+
80
+ add_section_enter_proc do |date, index|
81
+ @category_to_tag_list = {}
82
+ init_buttons_status
83
+ ''
84
+ end
85
+
86
+ alias section_footer2_subtitle_link_original subtitle_link unless defined?( section_footer2_subtitle_link_original )
87
+ def subtitle_link( date, index, subtitle )
88
+ s = ''
89
+ @subtitle = subtitle
90
+ if subtitle then
91
+ s = subtitle.sub( /^(?:\[[^\[]+?\])+/ ) do
92
+ $&.scan( /\[(.*?)\]/ ) do |tag|
93
+ @category_to_tag_list[tag.shift] = false # false when diary
94
+ end
95
+ ''
96
+ end
97
+ end
98
+ section_footer2_subtitle_link_original( date, index, s.strip )
99
+ end
100
+
101
+ add_section_leave_proc do |date, index|
102
+ unless @conf.mobile_agent? or @conf.iphone? or feed? or bot?
103
+ r = '<div class="tags">'
104
+ # add category_tag
105
+ if @category_to_tag_list and not @category_to_tag_list.empty? then
106
+ r << "Tags: "
107
+ @category_to_tag_list.each do |tag, blog|
108
+ r << category_anchor( "#{tag}" ).sub( /^\[/, '' ).sub( /\]$/, '' ) << ' '
109
+ end
110
+ r << ' | '
111
+ end
112
+
113
+ # add button
114
+ r << add_button_by_service(date, index)
115
+
116
+ # add Permalink
117
+ r << %Q|<a href="#{permalink(date, index, false)}">Permalink</a> |
118
+
119
+ r << "</div>\n"
120
+ end
121
+ end
122
+
123
+ def call_delicious_json( url_md5 )
124
+ json = nil
125
+ begin
126
+ timeout(10) do
127
+ open( "http://feeds.delicious.com/v2/json/urlinfo/#{url_md5}" ) do |f|
128
+ json = JSON.parse( f.read )
129
+ end
130
+ end
131
+ rescue => e
132
+ @logger.debug( e )
133
+ end
134
+ return json
135
+ end
136
+
137
+ def add_delicious( date, index )
138
+ url_md5 = Digest::MD5.hexdigest(permalink(date, index, false))
139
+ db_file = "#{@cache_path}/delicious.cache"
140
+
141
+ r = ''
142
+ r << %Q|<a href="http://delicious.com/url/#{url_md5}"><img src="http://static.delicious.com/img/delicious.small.gif" style="border: none;vertical-align: middle;" alt="#{@section_footer2_delicious_label}" title="#{@section_footer2_delicious_label}">|
143
+
144
+ begin
145
+ cache_time = 8 * 60 * 60 # 12 hour
146
+
147
+ PStore.new(db_file).transaction do |db|
148
+ entry = db[url_md5]
149
+ entry = { :count => 0, :update=> Time.at(0) } if entry.nil?
150
+
151
+ if Time.now > entry[:update] + cache_time
152
+ json = call_delicious_json( url_md5 )
153
+ entry[:count] = json[0]["total_posts"].to_i unless json[0].nil?
154
+ entry[:update] = Time.now
155
+ db[url_md5] = entry
156
+ end
157
+
158
+ if entry[:count] > 0
159
+ r << %Q| #{entry[:count]} user|
160
+ r << 's' if entry[:count] > 1
161
+ end
162
+ end
163
+ rescue => e
164
+ @logger.debug( e )
165
+ end
166
+
167
+ r << '</a>'
168
+ r << ' | '
169
+
170
+ return r
171
+ end
172
+
173
+ def add_hatena( date, index )
174
+ %Q!<a href="http://b.hatena.ne.jp/entry/#{permalink( date, index )}" class="hatena-bookmark-button" data-hatena-bookmark-layout="standard"><img src="http://b.st-hatena.com/images/entry-button/button-only.gif" width="20" height="20" style="border: none;" /></a> | !
175
+ end
176
+
177
+ def add_facebook(date, index)
178
+ # add Facebook Like!
179
+ r = ''
180
+ r << %Q!<fb:like href="#{permalink(date, index, false)}" layout="button_count"></fb:like> | !
181
+ end
182
+
183
+ def add_twitter(date, index)
184
+ r = <<-"EOS"
185
+ <a href="http://twitter.com/share" class="twitter-share-button"
186
+ data-url="#{permalink(date, index, false).gsub(/#.*$/, '')}"
187
+ data-text="#{CGI.escapeHTML(subtitle(date, index))}"
188
+ data-via="#{@conf['twitter.user']}"
189
+ >tweet</a> |
190
+ EOS
191
+ end
192
+
193
+ def add_plusone(date, index)
194
+ %Q!<g:plusone size="medium" href="#{permalink(date, index, false)}"></g:plusone> | !
195
+ end
196
+
197
+ def add_yaml(date, index)
198
+ r = ''
199
+ yaml_dir = "#{@cache_path}/yaml/"
200
+ Dir.glob( yaml_dir + "*.yaml" ) do |file|
201
+ r << parse_sbm_yaml(file, date, index)
202
+ end
203
+ return r
204
+ end
205
+
206
+ def add_button_by_service(date, index)
207
+
208
+ r = ''
209
+
210
+ @installed_buttons.each do |button|
211
+ if @conf['section_footer2.isDisplay'].include?(button) then
212
+ method = "add_" + button + "(date, index)"
213
+ unless method.nil? then
214
+ r << instance_eval(method)
215
+ end
216
+ end
217
+ end
218
+ return r
219
+ end
220
+
221
+ def parse_sbm_yaml(file, date, index)
222
+ config = YAML.load( Pathname.new( file ).expand_path.read )
223
+ r = ""
224
+
225
+ unless config.nil?
226
+
227
+ url = config["url"]
228
+ unless config['usesubtitle'].nil?
229
+ sub = (@subtitle || '').sub( /\A(?:\[[^\]]*\])+ */, '' )
230
+ sub = apply_plugin( sub, true ).strip
231
+ regexp = config["usesubtitle"]
232
+ url.gsub!(regexp, sub)
233
+ char_space = ' '
234
+ end
235
+
236
+ title = config["title"][@conf.lang]
237
+ r << %Q|<a href="#{url}#{char_space}#{permalink(date, index)}">|
238
+ r << %Q|<img src="#{config["src"]}" style="border: none;vertical-align: middle;" |
239
+ r << %Q|title="#{title}" |
240
+ r << %Q|alt="#{title}">|
241
+ r << %Q| <img src="#{config["counter"]}#{permalink(date, index)}" style="border: none;vertical-align: middle;">| unless config["counter"].nil?
242
+ r << '</a>'
243
+ r << ' | '
244
+ end
245
+
246
+ return r
247
+ end
248
+
249
+ add_conf_proc('section_footer2', 'Section Footer Button') do
250
+
251
+ if @mode == 'saveconf' then
252
+ @conf['section_footer2.isDisplay'] = ''
253
+ @cgi.params['section_footer2.isDisplay'].each do |item|
254
+ @conf['section_footer2.isDisplay'] << item + '\n'
255
+ end
256
+ end
257
+
258
+ r = '<h3>表示するボタンをチェックしてください(YAMLをチェックすると各自でインストールしたYAMLのボタンをすべて表示します)</h3>'
259
+ r << '<p>'
260
+ init_buttons_status
261
+ @installed_buttons.each do |button|
262
+ if @conf['section_footer2.isDisplay'].include?(button) then
263
+ item_checked = "checked"
264
+ else
265
+ item_checked = ''
266
+ end
267
+ r << %Q|<input name="section_footer2.isDisplay" value="#{button}" #{item_checked} type="checkbox" />#{button}|
268
+ end
269
+ r << '</p>'
270
+ end
271
+
272
+ # Local Variables:
273
+ # mode: ruby
274
+ # indent-tabs-mode: t
275
+ # tab-width: 3
276
+ # ruby-indent-level: 3
277
+ # End:
278
+ # vim: ts=3
@@ -0,0 +1,73 @@
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
+ # section_permalink.rb
6
+ # - enables section permalink and shows section title
7
+
8
+ def section_mode?
9
+ @mode == 'day' and @cgi.params['p'][0].to_s != ""
10
+ end
11
+
12
+ # Change permalink
13
+ def anchor( s )
14
+ if /^([\-\d]+)#?([pct]\d*)?$/ =~ s then
15
+ if $2 then
16
+ s1 = $1
17
+ s2 = $2
18
+ if $2 =~ /^p/
19
+ "?date=#{s1}&amp;p=#{s2.gsub(/p/, '')}"
20
+ else
21
+ "?date=#{s1}.html##{s2}"
22
+ end
23
+ else
24
+ "?date=#$1"
25
+ end
26
+ else
27
+ ""
28
+ end
29
+ end
30
+
31
+ # Change HTML title to section name
32
+ alias :_orig_title_tag :title_tag
33
+ def title_tag
34
+ if section_mode? and diary = @diaries[@date.strftime('%Y%m%d')]
35
+ sections = diary.instance_variable_get(:@sections)
36
+
37
+ title = "<title>"
38
+ section = sections[@cgi.params['p'][0].to_i - 1].stripped_subtitle_to_html
39
+ title << apply_plugin(section, true).chomp
40
+ title << " - #{h @html_title}"
41
+ title << "(#{@date.strftime( '%Y-%m-%d' )})" if @date
42
+ title << "</title>"
43
+ return title
44
+ else
45
+ _orig_title_tag
46
+ end
47
+ rescue
48
+ _orig_title_tag
49
+ end
50
+
51
+ add_header_proc do
52
+ if section_mode? and diary = @diaries[@date.strftime('%Y%m%d')]
53
+ index = @cgi.params['p'][0]
54
+ <<-EOS
55
+ <script type="text/javascript">
56
+ $(document).ready(function() {
57
+ var anc = $("a[name=p#{h(index)}]");
58
+ anc.parent().css("background-color", "yellow");
59
+ var dest = anc.offset().top;
60
+ $("body").animate({scrollTop: dest});
61
+ });
62
+ </script>
63
+ EOS
64
+ end
65
+ end
66
+
67
+ # Local Variables:
68
+ # mode: ruby
69
+ # indent-tabs-mode: t
70
+ # tab-width: 3
71
+ # ruby-indent-level: 3
72
+ # End:
73
+ # vim: ts=3
@@ -0,0 +1,39 @@
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
+ # section_permalink_anchor.rb
6
+ # - enables section permalink with mod_rewrite
7
+ # - depends on section_permalink.rb
8
+ #
9
+ # sample .htaccess:
10
+ # <IfModule mod_rewrite.c>
11
+ # RewriteEngine on
12
+ # RewriteRule ^([0-9\-]+)p?([0-9]*)\.html$ ?date=$1&p=$2 [L]
13
+ # </IfModule>
14
+
15
+ def anchor( s )
16
+ if /^([\-\d]+)#?([pct]\d*)?$/ =~ s then
17
+ if $2 then
18
+ s1 = $1
19
+ s2 = $2
20
+ if $2 =~ /^p/
21
+ "#{s1}#{s2}.html"
22
+ else
23
+ "#{s1}.html##{s2}"
24
+ end
25
+ else
26
+ "#$1.html"
27
+ end
28
+ else
29
+ ""
30
+ end
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:
39
+ # vim: ts=3