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,73 @@
1
+ <?xml version="1.0" encoding="UTF-8"?>
2
+ <user>
3
+ <id>65589541</id>
4
+ <name>tDiary.org</name>
5
+ <screen_name>tDiary</screen_name>
6
+ <location></location>
7
+ <description>tDiary&#12458;&#12501;&#12451;&#12471;&#12515;&#12523;&#12450;&#12459;&#12454;&#12531;&#12488;</description>
8
+ <profile_image_url>http://a0.twimg.com/profile_images/379668735/square_logo_normal.png</profile_image_url>
9
+ <profile_image_url_https>https://si0.twimg.com/profile_images/379668735/square_logo_normal.png</profile_image_url_https>
10
+ <url>http://www.tdiary.org/</url>
11
+ <protected>false</protected>
12
+ <followers_count>286</followers_count>
13
+ <profile_background_color>FFFFFF</profile_background_color>
14
+ <profile_text_color>333333</profile_text_color>
15
+ <profile_link_color>0084B4</profile_link_color>
16
+ <profile_sidebar_fill_color>D0FFD0</profile_sidebar_fill_color>
17
+ <profile_sidebar_border_color>D0FFD0</profile_sidebar_border_color>
18
+ <friends_count>261</friends_count>
19
+ <created_at>Fri Aug 14 07:50:23 +0000 2009</created_at>
20
+ <favourites_count>3</favourites_count>
21
+ <utc_offset>32400</utc_offset>
22
+ <time_zone>Tokyo</time_zone>
23
+ <profile_background_image_url>http://a0.twimg.com/images/themes/theme1/bg.png</profile_background_image_url>
24
+ <profile_background_image_url_https>https://si0.twimg.com/images/themes/theme1/bg.png</profile_background_image_url_https>
25
+ <profile_background_tile>false</profile_background_tile>
26
+ <profile_use_background_image>false</profile_use_background_image>
27
+ <notifications></notifications>
28
+ <geo_enabled>false</geo_enabled>
29
+ <verified>false</verified>
30
+ <following></following>
31
+ <statuses_count>313</statuses_count>
32
+ <lang>ja</lang>
33
+ <contributors_enabled>false</contributors_enabled>
34
+ <follow_request_sent></follow_request_sent>
35
+ <listed_count>31</listed_count>
36
+ <default_profile>false</default_profile>
37
+ <default_profile_image>false</default_profile_image>
38
+ <is_translator>false</is_translator>
39
+ <status>
40
+ <created_at>Mon Sep 17 00:04:52 +0000 2012</created_at>
41
+ <id>247486242491604992</id>
42
+ <text>RT @hsbt: DefaultIO &#12363;&#12425; RdbIO &#12408;&#12398;&#12452;&#12531;&#12509;&#12540;&#12479;&#12391;&#12365;&#12383; #tdiary</text>
43
+ <source>&lt;a href=&quot;http://www.crowy.net/&quot; rel=&quot;nofollow&quot;&gt;Crowy&lt;/a&gt;</source>
44
+ <truncated>false</truncated>
45
+ <favorited>false</favorited>
46
+ <in_reply_to_status_id></in_reply_to_status_id>
47
+ <in_reply_to_user_id></in_reply_to_user_id>
48
+ <in_reply_to_screen_name></in_reply_to_screen_name>
49
+ <retweet_count>2</retweet_count>
50
+ <retweeted>false</retweeted>
51
+ <retweeted_status>
52
+ <created_at>Mon Sep 17 00:01:16 +0000 2012</created_at>
53
+ <id>247485333179101185</id>
54
+ <text>DefaultIO &#12363;&#12425; RdbIO &#12408;&#12398;&#12452;&#12531;&#12509;&#12540;&#12479;&#12391;&#12365;&#12383; #tdiary</text>
55
+ <source>&lt;a href=&quot;http://mzp.github.com/atig/&quot; rel=&quot;nofollow&quot;&gt;atig.rb&lt;/a&gt;</source>
56
+ <truncated>false</truncated>
57
+ <favorited>false</favorited>
58
+ <in_reply_to_status_id></in_reply_to_status_id>
59
+ <in_reply_to_user_id></in_reply_to_user_id>
60
+ <in_reply_to_screen_name></in_reply_to_screen_name>
61
+ <retweet_count>2</retweet_count>
62
+ <retweeted>false</retweeted>
63
+ <geo/>
64
+ <coordinates/>
65
+ <place/>
66
+ <contributors/>
67
+ </retweeted_status>
68
+ <geo/>
69
+ <coordinates/>
70
+ <place/>
71
+ <contributors/>
72
+ </status>
73
+ </user>
data/spec/gist_spec.rb ADDED
@@ -0,0 +1,16 @@
1
+ $:.unshift(File.dirname(__FILE__))
2
+ require 'spec_helper'
3
+
4
+ describe "gist plugin" do
5
+ DUMMY_GIST_ID = 1234567890
6
+
7
+ it 'should render javascript tag with specified gist-id' do
8
+ plugin = fake_plugin(:gist)
9
+ snippet = plugin.gist(DUMMY_GIST_ID)
10
+ expected = (<<-EOS).chomp
11
+ <div class="gist_plugin"><script src="http://gist.github.com/1234567890.js"></script>
12
+ <noscript><a href="http://gist.github.com/1234567890">gist:1234567890</a></noscript></div>
13
+ EOS
14
+ snippet.should == expected
15
+ end
16
+ end
@@ -0,0 +1,39 @@
1
+ $:.unshift(File.dirname(__FILE__))
2
+ require 'spec_helper'
3
+
4
+ describe "github link plugin" do
5
+ let(:plugin) { fake_plugin(:github_link) }
6
+ subject { plugin.gh_link(*args) }
7
+
8
+ describe 'repository page' do
9
+ let(:args) { ['tdiary/tdiary-contrib'] }
10
+
11
+ it 'should render repository a tag' do
12
+ should == %(<a href='https://github.com/tdiary/tdiary-contrib'>tdiary-contrib</a>)
13
+ end
14
+ end
15
+
16
+ describe 'issues page' do
17
+ let(:args) { ['tdiary/tdiary-contrib#100'] }
18
+
19
+ it 'should render issues a tag' do
20
+ should == %(<a href='https://github.com/tdiary/tdiary-contrib/issues/100'>tdiary-contrib#100</a>)
21
+ end
22
+ end
23
+ context "When given altenative text" do
24
+ let(:text) { 'This project' }
25
+ let(:github_identifier) { 'tdiary/tdiary-contrib' }
26
+ let(:args) { [github_identifier, text] }
27
+
28
+ it 'should render repository a tag with the specified text' do
29
+ should == %(<a href='https://github.com/#{github_identifier}'>#{text}</a>)
30
+ end
31
+ context "but the text is including <script>" do
32
+ let(:text) { '<script>alert("hoge");</script>' }
33
+
34
+ it 'should render a link text after sanitizing.' do
35
+ should_not == %(<a href='https://github.com/#{github_identifier}'>#{text}</a>)
36
+ end
37
+ end
38
+ end
39
+ end
@@ -0,0 +1,60 @@
1
+ $:.unshift(File.dirname(__FILE__))
2
+ require 'spec_helper'
3
+
4
+ describe "google_analytics plugin" do
5
+ def setup_google_analytics_plugin(profile_id, mode)
6
+ fake_plugin(:google_analytics) { |plugin|
7
+ plugin.mode = mode
8
+ plugin.conf['google_analytics.profile'] = profile_id
9
+ }
10
+ end
11
+
12
+ describe "should render javascript" do
13
+ before do
14
+ @plugin = setup_google_analytics_plugin('53836-1', 'latest')
15
+ end
16
+
17
+ it "for footer" do
18
+ snippet = @plugin.footer_proc
19
+ snippet.should == expected_html_footer_snippet
20
+ end
21
+ end
22
+
23
+ describe "should render javascript" do
24
+ before do
25
+ @plugin = setup_google_analytics_plugin('53836-1', 'conf')
26
+ end
27
+
28
+ it "for footer" do
29
+ snippet = @plugin.footer_proc
30
+ snippet.should be_empty
31
+ end
32
+ end
33
+
34
+ describe "should not render when profile_id is empty" do
35
+ before do
36
+ @plugin = setup_google_analytics_plugin(nil, 'latest')
37
+ end
38
+
39
+ it "for footer" do
40
+ snippet = @plugin.footer_proc
41
+ snippet.should be_empty
42
+ end
43
+ end
44
+
45
+ def expected_html_footer_snippet
46
+ expected = <<-SCRIPT
47
+ <script type="text/javascript"><!--
48
+ var gaJsHost = (("https:" == document.location.protocol) ? "https://ssl." : "http://www.");
49
+ document.write(unescape('%3Cscript src="' + gaJsHost + 'google-analytics.com/ga.js" type="text/javascript"%3E%3C/script%3E'));
50
+ // --></script>
51
+ <script type="text/javascript"><!--
52
+ try {
53
+ var pageTracker = _gat._getTracker("UA-53836-1");
54
+ pageTracker._trackPageview();
55
+ } catch (err) {}
56
+ // --></script>
57
+ SCRIPT
58
+ expected.gsub( /^\t/, '' ).chomp
59
+ end
60
+ end
@@ -0,0 +1,23 @@
1
+ # -*- coding: utf-8 -*-
2
+
3
+ $:.unshift(File.dirname(__FILE__))
4
+ require 'spec_helper'
5
+ require 'time'
6
+
7
+ describe "jdate plugin" do
8
+ {
9
+ '20080121' => '月',
10
+ '20080122' => '火',
11
+ '20080123' => '水',
12
+ '20080124' => '木',
13
+ '20080125' => '金',
14
+ '20080126' => '土',
15
+ '20080127' => '日',
16
+ }.each do |k,v|
17
+ it { setup_jdate_plugin(Time.parse(k)).date.strftime('%J').should == v }
18
+ end
19
+
20
+ def setup_jdate_plugin(date)
21
+ fake_plugin(:jdate) {|plugin| plugin.date = date}
22
+ end
23
+ end
@@ -0,0 +1,28 @@
1
+ # -*- coding: utf-8 -*-
2
+
3
+ $:.unshift(File.dirname(__FILE__))
4
+ require 'spec_helper'
5
+ require 'time'
6
+
7
+ describe "jmonth plugin" do
8
+ {
9
+ '2007/01/01' => '睦月',
10
+ '2007/02/01' => '如月',
11
+ '2007/03/01' => '弥生',
12
+ '2007/04/01' => '卯月',
13
+ '2007/05/01' => '皐月',
14
+ '2007/06/01' => '水無月',
15
+ '2007/07/01' => '文月',
16
+ '2007/08/01' => '葉月',
17
+ '2007/09/01' => '長月',
18
+ '2007/10/01' => '神無月',
19
+ '2007/11/01' => '霜月',
20
+ '2007/12/01' => '師走'
21
+ }.each do |k,v|
22
+ it { setup_jmonth_plugin(Time.parse(k)).date.strftime('%i').should == v }
23
+ end
24
+
25
+ def setup_jmonth_plugin(date)
26
+ fake_plugin(:jmonth) { |plugin| plugin.date = date }
27
+ end
28
+ end
@@ -0,0 +1,21 @@
1
+ # -*- coding: utf-8 -*-
2
+
3
+ $:.unshift(File.dirname(__FILE__))
4
+ require 'spec_helper'
5
+ require 'time'
6
+
7
+ describe "jyear plugin" do
8
+ {
9
+ '1925/01/01' => '昔々',
10
+ '1926/12/25' => '昭和元年',
11
+ '1927/01/01' => '昭和2',
12
+ '1989/01/08' => '平成元年',
13
+ '1990/01/01' => '平成2',
14
+ }.each do |k,v|
15
+ it { setup_jyear_plugin(Time.parse(k)).date.strftime('%K').should == v }
16
+ end
17
+
18
+ def setup_jyear_plugin(date)
19
+ fake_plugin(:jyear) { |plugin| plugin.date = date }
20
+ end
21
+ end
@@ -0,0 +1,78 @@
1
+ # -*- coding: utf-8 -*-
2
+
3
+ $:.unshift(File.dirname(__FILE__))
4
+ require 'spec_helper'
5
+ require 'tmpdir'
6
+ require 'fileutils'
7
+
8
+ describe "MyHotEntry" do
9
+ def cache_filename
10
+ "#{File.basename(__FILE__, ".rb")}-#{$$}"
11
+ end
12
+ before(:each) do
13
+ fake_plugin(:my_hotentry)
14
+ @cache_path = File.join(Dir.tmpdir, cache_filename)
15
+ Dir.mkdir(@cache_path)
16
+ @dbfile = "#{@cache_path}/my_hotentry.dat"
17
+ @base_url = 'http://d.hatena.ne.jp/'
18
+ @hotentry = MyHotEntry.new(@dbfile)
19
+ end
20
+
21
+ after(:each) do
22
+ FileUtils.rmtree(@cache_path)
23
+ end
24
+
25
+ describe "#update" do
26
+ before do
27
+ @hotentry.update(@base_url)
28
+ @entries = @hotentry.entries
29
+ end
30
+
31
+ it "キャッシュファイルが生成されていること" do
32
+ File.should be_file(@dbfile)
33
+ end
34
+
35
+ it "人気の日記が取得できていること" do
36
+ @entries.size.should > 0
37
+ end
38
+
39
+ it "取得したエントリにbase_urlとタイトルが含まれていること" do
40
+ @entries.each do |entry|
41
+ entry[:url].should be_include(@base_url)
42
+ entry[:title].size.should > 0
43
+ end
44
+ end
45
+ end
46
+
47
+ describe "何度もupdateした場合" do
48
+ before do
49
+ @hotentry.update(@base_url)
50
+ @original_entry_size = @hotentry.entries.size
51
+ @hotentry.update(@base_url)
52
+ @entry_size = @hotentry.entries.size
53
+ end
54
+
55
+ it "キャッシュサイズが大きくならないこと" do
56
+ @entry_size.should == @original_entry_size
57
+ end
58
+ end
59
+
60
+ describe "取得結果が空の場合" do
61
+ before do
62
+ @exist_url = 'http://d.hatena.ne.jp/'
63
+ @empty_url = 'http://empty-url.example.com/'
64
+ end
65
+
66
+ it "キャッシュをクリアしないこと" do
67
+ @hotentry.update(@empty_url)
68
+ @hotentry.entries.size.should == 0
69
+
70
+ @hotentry.update(@exist_url)
71
+ @hotentry.entries.size.should > 0
72
+ exist_size = @hotentry.entries.size
73
+
74
+ @hotentry.update(@empty_url)
75
+ @hotentry.entries.size.should == exist_size
76
+ end
77
+ end
78
+ end
@@ -0,0 +1,246 @@
1
+ $:.unshift(File.dirname(__FILE__))
2
+ require 'spec_helper'
3
+
4
+ describe "openid plugin w/" do
5
+ def setup_open_id_plugin(service, userid)
6
+ fake_plugin(:openid) { |plugin|
7
+ plugin.mode = 'latest'
8
+ plugin.conf['openid.service'] = service
9
+ plugin.conf['openid.id'] = userid
10
+ }
11
+ end
12
+
13
+ describe "Hatena" do
14
+ before do
15
+ plugin = setup_open_id_plugin('Hatena', 'tdtds')
16
+ @header_snippet = plugin.header_proc
17
+ end
18
+
19
+ it { @header_snippet.should include_link_tag_with(
20
+ :rel => 'openid.server',
21
+ :href => 'https://www.hatena.ne.jp/openid/server')}
22
+
23
+ it { @header_snippet.should include_link_tag_with(
24
+ :rel => 'openid.delegate',
25
+ :href => 'http://www.hatena.ne.jp/tdtds/')}
26
+ end
27
+
28
+ describe "livedoor" do
29
+ before do
30
+ plugin = setup_open_id_plugin('livedoor', 'tdtds')
31
+ @header_snippet = plugin.header_proc
32
+ end
33
+
34
+ it { @header_snippet.should include_link_tag_with(
35
+ :rel => 'openid.server',
36
+ :href => 'http://auth.livedoor.com/openid/server')}
37
+
38
+ it { @header_snippet.should include_link_tag_with(
39
+ :rel => 'openid.delegate',
40
+ :href => 'http://profile.livedoor.com/tdtds')}
41
+ end
42
+
43
+ describe "LiveJournal" do
44
+ before do
45
+ plugin = setup_open_id_plugin('LiveJournal', 'tdtds')
46
+ @header_snippet = plugin.header_proc
47
+ end
48
+
49
+ it { @header_snippet.should include_link_tag_with(
50
+ :rel => 'openid.server',
51
+ :href => 'http://www.livejournal.com/openid/server.bml')}
52
+
53
+ it { @header_snippet.should include_link_tag_with(
54
+ :rel => 'openid.delegate',
55
+ :href => 'http://tdtds.livejournal.com/')}
56
+
57
+ end
58
+
59
+ describe "OpenID.ne.jp" do
60
+ before do
61
+ plugin = setup_open_id_plugin('OpenID.ne.jp', 'tdtds')
62
+ @header_snippet = plugin.header_proc
63
+ end
64
+
65
+ it { @header_snippet.should include_link_tag_with(
66
+ :rel => 'openid.server',
67
+ :href => 'http://www.openid.ne.jp/user/auth')}
68
+
69
+ it { @header_snippet.should include_link_tag_with(
70
+ :rel => 'openid.delegate',
71
+ :href => 'http://tdtds.openid.ne.jp')}
72
+
73
+ it { @header_snippet.should include_xrds_meta_tag_with(
74
+ :content => 'http://tdtds.openid.ne.jp/user/xrds')}
75
+
76
+ end
77
+
78
+ describe "TypeKey" do
79
+ before do
80
+ plugin = setup_open_id_plugin('TypeKey', 'tdtds')
81
+ @header_snippet = plugin.header_proc
82
+ end
83
+
84
+ it { @header_snippet.should include_link_tag_with(
85
+ :rel => 'openid.server',
86
+ :href => 'http://www.typekey.com/t/openid/')}
87
+
88
+ it { @header_snippet.should include_link_tag_with(
89
+ :rel => 'openid.delegate',
90
+ :href => 'http://profile.typekey.com/tdtds/')}
91
+
92
+ end
93
+
94
+ describe "Vox" do
95
+ before do
96
+ plugin = setup_open_id_plugin('Vox', 'tdtds')
97
+ @header_snippet = plugin.header_proc
98
+ end
99
+
100
+ it { @header_snippet.should include_link_tag_with(
101
+ :rel => 'openid.server',
102
+ :href => 'http://www.vox.com/services/openid/server')}
103
+
104
+ it { @header_snippet.should include_link_tag_with(
105
+ :rel => 'openid.delegate',
106
+ :href => 'http://tdtds.vox.com/')}
107
+ end
108
+
109
+ describe "myopenid.com" do
110
+ before do
111
+ @plugin = setup_open_id_plugin('myopenid.com', 'tdtds')
112
+ @header_snippet = @plugin.header_proc
113
+ end
114
+
115
+ it { @header_snippet.should include_xrds_meta_tag_with(
116
+ :content => "http://www.myopenid.com/xrds?username=tdtds")}
117
+
118
+ it { @header_snippet.should include_link_tag_with(
119
+ :rel => "openid.server",
120
+ :href => "http://www.myopenid.com/server")}
121
+
122
+ it { @header_snippet.should include_link_tag_with(
123
+ :rel => "openid.delegate",
124
+ :href => "http://tdtds.myopenid.com")}
125
+
126
+ it { @header_snippet.should include_link_tag_with(
127
+ :rel => "openid2.provider",
128
+ :href => "http://www.myopenid.com/server")}
129
+
130
+ it { @header_snippet.should include_link_tag_with(
131
+ :rel => "openid2.local_id",
132
+ :href => "http://tdtds.myopenid.com")}
133
+ end
134
+
135
+ describe "claimID.com" do
136
+ before do
137
+ @plugin = setup_open_id_plugin('claimID.com', 'tdtds')
138
+ @header_snippet = @plugin.header_proc
139
+ end
140
+
141
+ it { @header_snippet.should include_xrds_meta_tag_with(
142
+ :content => "http://claimid.com/tdtds/xrds")}
143
+
144
+ it { @header_snippet.should include_link_tag_with(
145
+ :rel => "openid.server",
146
+ :href => "http://openid.claimid.com/server")}
147
+
148
+ it { @header_snippet.should include_link_tag_with(
149
+ :rel => "openid.delegate",
150
+ :href => "http://openid.claimid.com/tdtds")}
151
+ end
152
+
153
+ describe "Personal Identity Provider (PIP)" do
154
+ before do
155
+ @plugin = setup_open_id_plugin('Personal Identity Provider (PIP)', 'tdtds')
156
+ @header_snippet = @plugin.header_proc
157
+ end
158
+
159
+ it { @header_snippet.should include_xrds_meta_tag_with(
160
+ :content => "http://pip.verisignlabs.com/user/tdtds/yadisxrds")}
161
+
162
+ it { @header_snippet.should include_link_tag_with(
163
+ :rel => "openid.server",
164
+ :href => "http://pip.verisignlabs.com/server")}
165
+
166
+ it { @header_snippet.should include_link_tag_with(
167
+ :rel => "openid.delegate",
168
+ :href => "http://tdtds.pip.verisignlabs.com/")}
169
+
170
+ it { @header_snippet.should include_link_tag_with(
171
+ :rel => "openid2.provider",
172
+ :href => "http://pip.verisignlabs.com/server")}
173
+
174
+ it { @header_snippet.should include_link_tag_with(
175
+ :rel => "openid2.local_id",
176
+ :href => "http://tdtds.pip.verisignlabs.com/")}
177
+ end
178
+
179
+ describe "Yahoo! Japan" do
180
+ before do
181
+ plugin = setup_open_id_plugin('Yahoo! Japan', 'tdtds')
182
+ @header_snippet = plugin.header_proc
183
+ end
184
+
185
+ it { @header_snippet.should include_link_tag_with(
186
+ :rel => 'openid2.provider',
187
+ :href => 'https://open.login.yahooapis.jp/openid/op/auth')}
188
+
189
+ it { @header_snippet.should include_link_tag_with(
190
+ :rel => 'openid2.local_id',
191
+ :href => 'https://me.yahoo.co.jp/a/tdtds')}
192
+
193
+ it { @header_snippet.should_not include_link_tag_with(
194
+ :rel => "openid.server")}
195
+
196
+ it { @header_snippet.should_not include_link_tag_with(
197
+ :rel => "openid.delegate")}
198
+
199
+ end
200
+
201
+ describe "Yahoo!" do
202
+ before do
203
+ plugin = setup_open_id_plugin('Yahoo!', 'tdtds')
204
+ @header_snippet = plugin.header_proc
205
+ end
206
+
207
+ it { @header_snippet.should include_link_tag_with(
208
+ :rel => 'openid2.provider',
209
+ :href => 'https://open.login.yahooapis.com/openid/op/auth')}
210
+
211
+ it { @header_snippet.should include_link_tag_with(
212
+ :rel => 'openid2.local_id',
213
+ :href => 'https://me.yahoo.com/a/tdtds')}
214
+
215
+ it { @header_snippet.should_not include_link_tag_with(
216
+ :rel => "openid.server")}
217
+
218
+ it { @header_snippet.should_not include_link_tag_with(
219
+ :rel => "openid.delegate")}
220
+ end
221
+
222
+ RSpec::Matchers.define :include_link_tag_with do |options|
223
+ description do
224
+ "include #{options[:rel]} link tag"
225
+ end
226
+
227
+ match do |actual|
228
+ expected = %|<link rel="#{options[:rel]}"| if options[:rel]
229
+ expected <<= %| href="#{options[:href]}">| if options[:href]
230
+ actual.include?( expected )
231
+ end
232
+ end
233
+
234
+ RSpec::Matchers.define :include_xrds_meta_tag_with do |options|
235
+ description do
236
+ "include XRDS meta tag"
237
+ end
238
+
239
+ match do |actual|
240
+ expected = (<<-"EOS").chomp
241
+ <meta http-equiv="X-XRDS-Location" content="#{options[:content]}">
242
+ EOS
243
+ actual.include?( expected )
244
+ end
245
+ end
246
+ end
@@ -0,0 +1,50 @@
1
+ $:.unshift(File.dirname(__FILE__))
2
+ require 'spec_helper'
3
+
4
+ describe "opensearch_ad plugin w/" do
5
+ def setup_opensearch_ad_plugin(title, xml, mode)
6
+ fake_plugin(:opensearch_ad) { |plugin|
7
+ plugin.mode = mode
8
+ plugin.conf['opensearch.title'] = title
9
+ plugin.conf['opensearch.xml'] = xml
10
+ }
11
+ end
12
+
13
+ describe "in day mode" do
14
+ before do
15
+ plugin = setup_opensearch_ad_plugin('OpenSearch', 'http://example.com/opensearch.xml', 'day')
16
+ @header_snippet = plugin.header_proc
17
+ end
18
+
19
+ it { @header_snippet.should == expected_link_tag_with(
20
+ :title => 'OpenSearch',
21
+ :xml => 'http://example.com/opensearch.xml')}
22
+ end
23
+
24
+ describe "in latest mode" do
25
+ before do
26
+ plugin = setup_opensearch_ad_plugin('OpenSearch', 'http://example.com/opensearch.xml', 'latest')
27
+ @header_snippet = plugin.header_proc
28
+ end
29
+
30
+ it { @header_snippet.should == expected_link_tag_with(
31
+ :title => 'OpenSearch',
32
+ :xml => 'http://example.com/opensearch.xml')}
33
+ end
34
+
35
+ describe "in edit mode" do
36
+ before do
37
+ plugin = setup_opensearch_ad_plugin('OpenSearch', 'http://example.com/opensearch.xml', 'edit')
38
+ @header_snippet = plugin.header_proc
39
+ end
40
+
41
+ it { @header_snippet.should be_empty }
42
+ end
43
+
44
+ def expected_link_tag_with(options)
45
+ result = <<-HTML
46
+ <link type="application/opensearchdescription+xml" rel="search" title="#{options[:title]}" href="#{options[:xml]}">
47
+ HTML
48
+ result.gsub( /^\t/, '' ).chomp
49
+ end
50
+ end