tdiary 3.2.2.20130507

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 (509) hide show
  1. checksums.yaml +7 -0
  2. data/.coveralls.yml +1 -0
  3. data/.gitignore +16 -0
  4. data/.travis.yml +29 -0
  5. data/Capfile +2 -0
  6. data/ChangeLog +3173 -0
  7. data/Gemfile +58 -0
  8. data/Gemfile.lock +201 -0
  9. data/LICENSE +340 -0
  10. data/Procfile +1 -0
  11. data/README.md +33 -0
  12. data/Rakefile +26 -0
  13. data/bin/tdiary +7 -0
  14. data/config.ru +61 -0
  15. data/data/.htaccess +2 -0
  16. data/doc/HOWTO-authenticate-in-rack.md +89 -0
  17. data/doc/HOWTO-make-io.md +305 -0
  18. data/doc/HOWTO-make-plugin.md +279 -0
  19. data/doc/HOWTO-make-theme.md +67 -0
  20. data/doc/HOWTO-testing-tDiary.md +44 -0
  21. data/doc/HOWTO-use-plugin.md +148 -0
  22. data/doc/HOWTO-write-tDiary.en.md +131 -0
  23. data/doc/HOWTO-write-tDiary.md +136 -0
  24. data/doc/INSTALL-paas.md +202 -0
  25. data/doc/INSTALL.md +160 -0
  26. data/doc/README.en.md +174 -0
  27. data/doc/README.md +56 -0
  28. data/doc/UPGRADE.md +164 -0
  29. data/doc/doc.css +115 -0
  30. data/dot.htaccess +27 -0
  31. data/index.fcgi +45 -0
  32. data/index.rb +57 -0
  33. data/js/00default.js +60 -0
  34. data/js/01conf.js +62 -0
  35. data/js/02edit.coffee +5 -0
  36. data/js/02edit.js +15 -0
  37. data/js/amazon.js +43 -0
  38. data/js/calendar3.js +130 -0
  39. data/js/caretposition.js +170 -0
  40. data/js/category.js +29 -0
  41. data/js/category_autocomplete.js +96 -0
  42. data/js/comment_ajax.js +27 -0
  43. data/js/draft.js +149 -0
  44. data/js/highlight.js +36 -0
  45. data/js/image.js +181 -0
  46. data/misc/convert2.rb +123 -0
  47. data/misc/filter/antispamservice.rb +101 -0
  48. data/misc/filter/limitdays.rb +40 -0
  49. data/misc/filter/linkcheck.rb +81 -0
  50. data/misc/filter/plugin/antispamservice.rb +82 -0
  51. data/misc/filter/plugin/en/antispamservice.rb +21 -0
  52. data/misc/filter/plugin/ja/antispamservice.rb +20 -0
  53. data/misc/lib/README +4 -0
  54. data/misc/lib/compatible.rb +1 -0
  55. data/misc/lib/fcgi_patch.rb +90 -0
  56. data/misc/migrate.rb +157 -0
  57. data/misc/paas/cloudfoundry/Gemfile +26 -0
  58. data/misc/paas/cloudfoundry/Gemfile.lock +85 -0
  59. data/misc/paas/heroku/Gemfile +22 -0
  60. data/misc/paas/heroku/Gemfile.lock +85 -0
  61. data/misc/paas/sqale/Gemfile +19 -0
  62. data/misc/paas/sqale/Gemfile.lock +85 -0
  63. data/misc/paas/sqale/Procfile +1 -0
  64. data/misc/paas/sqale/dot.env +1 -0
  65. data/misc/plugin/ChangeLog.DO_NOT_UPDATE +2333 -0
  66. data/misc/plugin/a.rb +211 -0
  67. data/misc/plugin/amazon.rb +403 -0
  68. data/misc/plugin/amazon/README.en +17 -0
  69. data/misc/plugin/amazon/README.ja +29 -0
  70. data/misc/plugin/amazon/amazonimg.rb +113 -0
  71. data/misc/plugin/amazon/large.png +0 -0
  72. data/misc/plugin/amazon/medium.png +0 -0
  73. data/misc/plugin/amazon/small.png +0 -0
  74. data/misc/plugin/append-css.rb +51 -0
  75. data/misc/plugin/bq.rb +48 -0
  76. data/misc/plugin/calendar2.rb +184 -0
  77. data/misc/plugin/calendar3.rb +256 -0
  78. data/misc/plugin/category.rb +779 -0
  79. data/misc/plugin/category_autocomplete.rb +33 -0
  80. data/misc/plugin/comment_ajax.rb +11 -0
  81. data/misc/plugin/comment_mail-qmail.rb +57 -0
  82. data/misc/plugin/comment_mail-sendmail.rb +56 -0
  83. data/misc/plugin/comment_mail-smtp.rb +59 -0
  84. data/misc/plugin/comment_rank.rb +36 -0
  85. data/misc/plugin/counter.rb +631 -0
  86. data/misc/plugin/daily_theme.rb +55 -0
  87. data/misc/plugin/disp_referrer.rb +1486 -0
  88. data/misc/plugin/doctype-html401tr.rb +16 -0
  89. data/misc/plugin/draft.rb +20 -0
  90. data/misc/plugin/dropdown_calendar.rb +32 -0
  91. data/misc/plugin/edit_today.rb +50 -0
  92. data/misc/plugin/en/a.rb +10 -0
  93. data/misc/plugin/en/amazon.rb +71 -0
  94. data/misc/plugin/en/append-css.rb +17 -0
  95. data/misc/plugin/en/bq.rb +12 -0
  96. data/misc/plugin/en/calendar2.rb +12 -0
  97. data/misc/plugin/en/category.rb +204 -0
  98. data/misc/plugin/en/counter.rb +48 -0
  99. data/misc/plugin/en/daily_theme.rb +14 -0
  100. data/misc/plugin/en/disp_referrer.rb +387 -0
  101. data/misc/plugin/en/dropdown_calendar.rb +14 -0
  102. data/misc/plugin/en/edit_today.rb +22 -0
  103. data/misc/plugin/en/hide-mail-field.rb +19 -0
  104. data/misc/plugin/en/highlight.rb +29 -0
  105. data/misc/plugin/en/image.rb +54 -0
  106. data/misc/plugin/en/kw.rb +22 -0
  107. data/misc/plugin/en/makerss.rb +47 -0
  108. data/misc/plugin/en/pb-show.rb +21 -0
  109. data/misc/plugin/en/ping.rb +16 -0
  110. data/misc/plugin/en/recent_comment.rb +44 -0
  111. data/misc/plugin/en/recent_comment3.rb +56 -0
  112. data/misc/plugin/en/recent_rss.rb +33 -0
  113. data/misc/plugin/en/referer_scheme.rb +48 -0
  114. data/misc/plugin/en/search_control.rb +74 -0
  115. data/misc/plugin/en/search_form.rb +22 -0
  116. data/misc/plugin/en/speed_comment.rb +19 -0
  117. data/misc/plugin/en/tb-show.rb +37 -0
  118. data/misc/plugin/en/todo.rb +43 -0
  119. data/misc/plugin/en/weather.rb +185 -0
  120. data/misc/plugin/en/xmlrpc.rb +14 -0
  121. data/misc/plugin/footnote.rb +92 -0
  122. data/misc/plugin/gradation.rb +39 -0
  123. data/misc/plugin/gradient.rb +36 -0
  124. data/misc/plugin/hide-mail-field.rb +50 -0
  125. data/misc/plugin/highlight.rb +22 -0
  126. data/misc/plugin/html_anchor.rb +34 -0
  127. data/misc/plugin/image.rb +290 -0
  128. data/misc/plugin/ja/amazon.rb +89 -0
  129. data/misc/plugin/ja/bq.rb +13 -0
  130. data/misc/plugin/ja/calendar2.rb +12 -0
  131. data/misc/plugin/ja/category.rb +212 -0
  132. data/misc/plugin/ja/daily_theme.rb +15 -0
  133. data/misc/plugin/ja/disp_referrer.rb +644 -0
  134. data/misc/plugin/ja/edit_today.rb +23 -0
  135. data/misc/plugin/ja/hide-mail-field.rb +20 -0
  136. data/misc/plugin/ja/highlight.rb +30 -0
  137. data/misc/plugin/ja/makerss.rb +44 -0
  138. data/misc/plugin/ja/my-sequel.rb +52 -0
  139. data/misc/plugin/ja/pb-show.rb +23 -0
  140. data/misc/plugin/ja/ping.rb +17 -0
  141. data/misc/plugin/ja/recent_comment.rb +45 -0
  142. data/misc/plugin/ja/recent_comment3.rb +57 -0
  143. data/misc/plugin/ja/recent_rss.rb +34 -0
  144. data/misc/plugin/ja/referer_scheme.rb +86 -0
  145. data/misc/plugin/ja/search_control.rb +75 -0
  146. data/misc/plugin/ja/search_form.rb +32 -0
  147. data/misc/plugin/ja/tb-show.rb +38 -0
  148. data/misc/plugin/ja/todo.rb +46 -0
  149. data/misc/plugin/ja/weather.rb +402 -0
  150. data/misc/plugin/ja/xmlrpc.rb +15 -0
  151. data/misc/plugin/kw.rb +150 -0
  152. data/misc/plugin/list.rb +40 -0
  153. data/misc/plugin/makelirs.rb +89 -0
  154. data/misc/plugin/makerss.rb +744 -0
  155. data/misc/plugin/my-ex.rb +68 -0
  156. data/misc/plugin/my-sequel.rb +539 -0
  157. data/misc/plugin/navi_user.rb +19 -0
  158. data/misc/plugin/number_anchor.rb +47 -0
  159. data/misc/plugin/pb-show.rb +165 -0
  160. data/misc/plugin/ping.rb +99 -0
  161. data/misc/plugin/pre_wrap.rb +19 -0
  162. data/misc/plugin/random_google.rb +165 -0
  163. data/misc/plugin/recent_comment.rb +82 -0
  164. data/misc/plugin/recent_comment3.rb +192 -0
  165. data/misc/plugin/recent_list.rb +91 -0
  166. data/misc/plugin/recent_namazu.rb +50 -0
  167. data/misc/plugin/recent_rss.rb +305 -0
  168. data/misc/plugin/referer-antibot.rb +53 -0
  169. data/misc/plugin/referer-utf8.rb +12 -0
  170. data/misc/plugin/referer_scheme.rb +87 -0
  171. data/misc/plugin/search_control.rb +227 -0
  172. data/misc/plugin/search_form.rb +53 -0
  173. data/misc/plugin/sn.rb +107 -0
  174. data/misc/plugin/speed_comment.rb +68 -0
  175. data/misc/plugin/squeeze.rb +272 -0
  176. data/misc/plugin/src.rb +30 -0
  177. data/misc/plugin/tb-show.rb +212 -0
  178. data/misc/plugin/title_list.rb +41 -0
  179. data/misc/plugin/title_tag.rb +80 -0
  180. data/misc/plugin/tlink.rb +163 -0
  181. data/misc/plugin/todo.rb +182 -0
  182. data/misc/plugin/weather.rb +505 -0
  183. data/misc/plugin/whatsnew.rb +100 -0
  184. data/misc/plugin/xmlrpc.rb +80 -0
  185. data/misc/plugin/xmlrpc/README +20 -0
  186. data/misc/plugin/xmlrpc/xmlrpc.rb +575 -0
  187. data/misc/style/emptdiary/README.rd +83 -0
  188. data/misc/style/emptdiary/README.rd.en +78 -0
  189. data/misc/style/emptdiary/emptdiary_style.rb +199 -0
  190. data/misc/style/etdiary/README.rd +83 -0
  191. data/misc/style/etdiary/etdiary_style.rb +446 -0
  192. data/misc/style/gfm/gfm_style.rb +194 -0
  193. data/misc/style/rd/README.rd +71 -0
  194. data/misc/style/rd/rd_style.rb +366 -0
  195. data/misc/style/wiki/README +116 -0
  196. data/misc/style/wiki/README.en +101 -0
  197. data/misc/style/wiki/wiki_parser.rb +273 -0
  198. data/misc/style/wiki/wiki_style.rb +478 -0
  199. data/misc/theme_convert/Readme.rd +21 -0
  200. data/misc/theme_convert/append.rcss +150 -0
  201. data/misc/theme_convert/theme_convert.rb +453 -0
  202. data/plugin/00default.rb +1015 -0
  203. data/plugin/05referer.rb +298 -0
  204. data/plugin/10spamfilter.rb +183 -0
  205. data/plugin/50sp.rb +146 -0
  206. data/plugin/60sf.rb +152 -0
  207. data/plugin/90migrate.rb +109 -0
  208. data/plugin/en/00default.rb +390 -0
  209. data/plugin/en/05referer.rb +49 -0
  210. data/plugin/en/10spamfilter.rb +81 -0
  211. data/plugin/en/50sp.rb +56 -0
  212. data/plugin/en/60sf.rb +60 -0
  213. data/plugin/ja/00default.rb +401 -0
  214. data/plugin/ja/05referer.rb +47 -0
  215. data/plugin/ja/10spamfilter.rb +79 -0
  216. data/plugin/ja/50sp.rb +66 -0
  217. data/plugin/ja/60sf.rb +73 -0
  218. data/public/.gitkeep +0 -0
  219. data/public/images/.gitkeep +0 -0
  220. data/public/javascripts/.gitkeep +0 -0
  221. data/public/stylesheets/.gitkeep +0 -0
  222. data/skel/category.rhtml +9 -0
  223. data/skel/conf.rhtml +23 -0
  224. data/skel/day.rhtml +33 -0
  225. data/skel/diary.rhtml +83 -0
  226. data/skel/footer.rhtml +8 -0
  227. data/skel/header.rhtml +10 -0
  228. data/skel/i.category.rhtml +6 -0
  229. data/skel/i.conf.rhtml +14 -0
  230. data/skel/i.day.rhtml +28 -0
  231. data/skel/i.diary.rhtml +17 -0
  232. data/skel/i.footer.rhtml +2 -0
  233. data/skel/i.header.rhtml +3 -0
  234. data/skel/i.latest.rhtml +24 -0
  235. data/skel/i.month.rhtml +39 -0
  236. data/skel/i.search.rhtml +5 -0
  237. data/skel/i.update.rhtml +40 -0
  238. data/skel/i.update.rhtml.en +40 -0
  239. data/skel/latest.rhtml +27 -0
  240. data/skel/mail.rtxt +18 -0
  241. data/skel/mail.rtxt.en +18 -0
  242. data/skel/month.rhtml +27 -0
  243. data/skel/plugin_error.rhtml +27 -0
  244. data/skel/preview.rhtml +85 -0
  245. data/skel/preview.rhtml.en +72 -0
  246. data/skel/referer.rhtml +24 -0
  247. data/skel/search.rhtml +14 -0
  248. data/skel/tdiary.rconf +76 -0
  249. data/skel/update.rhtml +103 -0
  250. data/skel/update.rhtml.en +83 -0
  251. data/spec/acceptance/append_comment_spec.rb +94 -0
  252. data/spec/acceptance/append_diary_spec.rb +98 -0
  253. data/spec/acceptance/bugfix/encoding_error_spec.rb +27 -0
  254. data/spec/acceptance/save_conf_comment_spec.rb +87 -0
  255. data/spec/acceptance/save_conf_default_spec.rb +169 -0
  256. data/spec/acceptance/save_conf_dnsbl_spec.rb +152 -0
  257. data/spec/acceptance/save_conf_filter_spec.rb +50 -0
  258. data/spec/acceptance/save_conf_plugin_spec.rb +69 -0
  259. data/spec/acceptance/save_conf_referer_spec.rb +60 -0
  260. data/spec/acceptance/save_conf_security_spec.rb +280 -0
  261. data/spec/acceptance/support/helpers.rb +49 -0
  262. data/spec/acceptance/support/paths.rb +7 -0
  263. data/spec/acceptance/update_diary_spec.rb +113 -0
  264. data/spec/acceptance/view_category_spec.rb +38 -0
  265. data/spec/acceptance/view_comment_spec.rb +67 -0
  266. data/spec/acceptance/view_diary_spec.rb +126 -0
  267. data/spec/acceptance/view_referer_spec.rb +31 -0
  268. data/spec/acceptance_helper.rb +101 -0
  269. data/spec/core/compatible_spec.rb +54 -0
  270. data/spec/core/core_ext_spec.rb +59 -0
  271. data/spec/core/plugin_spec.rb +389 -0
  272. data/spec/core/rack/assets/precompile_spec.rb +76 -0
  273. data/spec/core/rack/html_anchor_spec.rb +57 -0
  274. data/spec/core/rack/valid_request_path_spec.rb +67 -0
  275. data/spec/core/style/emptdiary_style_spec.rb +165 -0
  276. data/spec/core/style/etdiary_style_spec.rb +512 -0
  277. data/spec/core/style/gfm_style_spec.rb +334 -0
  278. data/spec/core/style/rd_style_spec.rb +202 -0
  279. data/spec/core/style/tdiary_style_spec.rb +240 -0
  280. data/spec/core/style/wiki_style_spec.rb +441 -0
  281. data/spec/fixtures/ascii8bit-pstore.db +0 -0
  282. data/spec/fixtures/invalid-sequence-volatile.tdr +9 -0
  283. data/spec/fixtures/just_installed.conf +1 -0
  284. data/spec/fixtures/plugin/ja/sample.rb +4 -0
  285. data/spec/fixtures/plugin/sample.rb +6 -0
  286. data/spec/fixtures/sample.rb +12 -0
  287. data/spec/fixtures/tdiary.conf.gem +212 -0
  288. data/spec/fixtures/tdiary.conf.rack +212 -0
  289. data/spec/fixtures/tdiary.conf.rdb +227 -0
  290. data/spec/fixtures/tdiary.conf.secure +204 -0
  291. data/spec/fixtures/tdiary.conf.webrick +212 -0
  292. data/spec/javascripts/00default_spec.js +35 -0
  293. data/spec/javascripts/fixtures/00default.html +1 -0
  294. data/spec/javascripts/support/jasmine.yml +76 -0
  295. data/spec/plugin/bq_spec.rb +24 -0
  296. data/spec/plugin/plugin_helper.rb +203 -0
  297. data/spec/spec_helper.rb +32 -0
  298. data/tdiary.conf.beginner +244 -0
  299. data/tdiary.conf.sample +345 -0
  300. data/tdiary.conf.sample-en +333 -0
  301. data/tdiary.gemspec +26 -0
  302. data/tdiary.rb +151 -0
  303. data/tdiary/admin.rb +236 -0
  304. data/tdiary/application.rb +57 -0
  305. data/tdiary/author_only_base.rb +171 -0
  306. data/tdiary/base.rb +220 -0
  307. data/tdiary/cli.rb +116 -0
  308. data/tdiary/comment.rb +40 -0
  309. data/tdiary/comment_manager.rb +94 -0
  310. data/tdiary/compatible.rb +72 -0
  311. data/tdiary/config.rb +270 -0
  312. data/tdiary/core_ext.rb +122 -0
  313. data/tdiary/deploy.rb +50 -0
  314. data/tdiary/dispatcher.rb +77 -0
  315. data/tdiary/dispatcher/index_main.rb +122 -0
  316. data/tdiary/dispatcher/update_main.rb +101 -0
  317. data/tdiary/environment.rb +15 -0
  318. data/tdiary/filter.rb +48 -0
  319. data/tdiary/filter/default.rb +54 -0
  320. data/tdiary/filter/spam.rb +304 -0
  321. data/tdiary/io/base.rb +70 -0
  322. data/tdiary/io/cache/file.rb +123 -0
  323. data/tdiary/io/cache/memcached.rb +88 -0
  324. data/tdiary/io/cache/redis.rb +100 -0
  325. data/tdiary/io/default.rb +297 -0
  326. data/tdiary/io/pstore.rb +252 -0
  327. data/tdiary/io/rdb.rb +213 -0
  328. data/tdiary/lang/en.rb +79 -0
  329. data/tdiary/lang/ja.rb +72 -0
  330. data/tdiary/plugin.rb +375 -0
  331. data/tdiary/rack/assets/precompile.rb +37 -0
  332. data/tdiary/rack/auth/basic.rb +38 -0
  333. data/tdiary/rack/auth/omniauth.rb +51 -0
  334. data/tdiary/rack/html_anchor.rb +31 -0
  335. data/tdiary/rack/valid_request_path.rb +36 -0
  336. data/tdiary/referer_manager.rb +80 -0
  337. data/tdiary/request.rb +217 -0
  338. data/tdiary/response.rb +29 -0
  339. data/tdiary/server.rb +85 -0
  340. data/tdiary/style.rb +194 -0
  341. data/tdiary/style/tdiary_style.rb +198 -0
  342. data/tdiary/style/wiki_style.rb +213 -0
  343. data/tdiary/tasks.rb +1 -0
  344. data/tdiary/tasks/assets.rake +31 -0
  345. data/tdiary/tasks/auth.rake +28 -0
  346. data/tdiary/tasks/db.rake +110 -0
  347. data/tdiary/tasks/doc.rake +31 -0
  348. data/tdiary/tasks/heroku.rake +37 -0
  349. data/tdiary/tasks/jasmine.rake +16 -0
  350. data/tdiary/tasks/rdoc.rake +24 -0
  351. data/tdiary/tasks/release.rake +122 -0
  352. data/tdiary/tasks/rspec.rake +51 -0
  353. data/tdiary/tasks/server.rake +33 -0
  354. data/tdiary/tasks/test.rake +17 -0
  355. data/tdiary/version.rb +3 -0
  356. data/tdiary/view.rb +468 -0
  357. data/tdiary/view_helper.rb +15 -0
  358. data/test/disp_referrer_test.rb +93 -0
  359. data/test/my-sequel_test.rb +238 -0
  360. data/test/test_helper.rb +7 -0
  361. data/test/test_plugin_helper.rb +64 -0
  362. data/test/test_plugin_helper_test.rb +28 -0
  363. data/test/weather_test.rb +33 -0
  364. data/theme/base.css +268 -0
  365. data/theme/conf.block.png +0 -0
  366. data/theme/conf.css +254 -0
  367. data/theme/default/README +11 -0
  368. data/theme/default/body.png +0 -0
  369. data/theme/default/default.css +743 -0
  370. data/theme/help.png +0 -0
  371. data/theme/loading.gif +0 -0
  372. data/theme/tdiary1/README +7 -0
  373. data/theme/tdiary1/tdiary1.css +394 -0
  374. data/theme/tdiary2/README +19 -0
  375. data/theme/tdiary2/tdiary2.css +624 -0
  376. data/update.fcgi +45 -0
  377. data/update.rb +57 -0
  378. data/vendor/hikidoc-0.0.6/COPYING +28 -0
  379. data/vendor/hikidoc-0.0.6/NEWS +30 -0
  380. data/vendor/hikidoc-0.0.6/NEWS.ja +30 -0
  381. data/vendor/hikidoc-0.0.6/README +86 -0
  382. data/vendor/hikidoc-0.0.6/README.ja +83 -0
  383. data/vendor/hikidoc-0.0.6/Rakefile +68 -0
  384. data/vendor/hikidoc-0.0.6/TextFormattingRules +320 -0
  385. data/vendor/hikidoc-0.0.6/TextFormattingRules.ja +318 -0
  386. data/vendor/hikidoc-0.0.6/bin/hikidoc +66 -0
  387. data/vendor/hikidoc-0.0.6/lib/hikidoc.rb +914 -0
  388. data/vendor/hikidoc-0.0.6/setup.rb +1360 -0
  389. data/vendor/hikidoc-0.0.6/test/run-test.rb +13 -0
  390. data/vendor/hikidoc-0.0.6/test/test_hikidoc.rb +506 -0
  391. data/vendor/imagesize-0.1.1/Manifest.txt +19 -0
  392. data/vendor/imagesize-0.1.1/README.txt +49 -0
  393. data/vendor/imagesize-0.1.1/lib/image_size.rb +305 -0
  394. data/vendor/imagesize-0.1.1/lib/image_size/version.rb +9 -0
  395. data/vendor/imagesize-0.1.1/setup.rb +1585 -0
  396. data/vendor/imagesize-0.1.1/test/2-4-7.png +0 -0
  397. data/vendor/imagesize-0.1.1/test/4_1_2.gif +0 -0
  398. data/vendor/imagesize-0.1.1/test/bmp.bmp +0 -0
  399. data/vendor/imagesize-0.1.1/test/cursor.xbm +6 -0
  400. data/vendor/imagesize-0.1.1/test/detect.swf +0 -0
  401. data/vendor/imagesize-0.1.1/test/pbm.pbm +0 -0
  402. data/vendor/imagesize-0.1.1/test/pcx.pcx +0 -0
  403. data/vendor/imagesize-0.1.1/test/pgm.pgm +5 -0
  404. data/vendor/imagesize-0.1.1/test/test.xpm +38 -0
  405. data/vendor/imagesize-0.1.1/test/test_helper.rb +2 -0
  406. data/vendor/imagesize-0.1.1/test/test_image_size.rb +71 -0
  407. data/vendor/imagesize-0.1.1/test/tiff.tiff +0 -0
  408. data/vendor/imagesize-0.1.1/test/tokyo_tower.jpg +0 -0
  409. data/vendor/imagesize-0.1.1/test/tower_e.gif.psd +0 -0
  410. data/vendor/jasmine-jquery-1.4.2/jasmine-jquery.js +548 -0
  411. data/vendor/jquery-1.8/jquery.js +9227 -0
  412. data/vendor/rdtool-0.6.38/COPYING.txt +339 -0
  413. data/vendor/rdtool-0.6.38/Gemfile +3 -0
  414. data/vendor/rdtool-0.6.38/HISTORY +318 -0
  415. data/vendor/rdtool-0.6.38/LGPL-2.1 +502 -0
  416. data/vendor/rdtool-0.6.38/LICENSE.txt +58 -0
  417. data/vendor/rdtool-0.6.38/README.html +66 -0
  418. data/vendor/rdtool-0.6.38/README.ja.html +73 -0
  419. data/vendor/rdtool-0.6.38/README.rd +76 -0
  420. data/vendor/rdtool-0.6.38/README.rd.ja +85 -0
  421. data/vendor/rdtool-0.6.38/Rakefile +152 -0
  422. data/vendor/rdtool-0.6.38/TODO +22 -0
  423. data/vendor/rdtool-0.6.38/bin/rd2 +283 -0
  424. data/vendor/rdtool-0.6.38/bin/rdswap.rb +207 -0
  425. data/vendor/rdtool-0.6.38/doc/rd-draft.html +456 -0
  426. data/vendor/rdtool-0.6.38/doc/rd-draft.ja.html +466 -0
  427. data/vendor/rdtool-0.6.38/doc/rd-draft.rd +479 -0
  428. data/vendor/rdtool-0.6.38/doc/rd-draft.rd.ja +487 -0
  429. data/vendor/rdtool-0.6.38/lib/rd/block-element.rb +114 -0
  430. data/vendor/rdtool-0.6.38/lib/rd/complex-list-item.rb +65 -0
  431. data/vendor/rdtool-0.6.38/lib/rd/desclist.rb +55 -0
  432. data/vendor/rdtool-0.6.38/lib/rd/document-struct.rb +46 -0
  433. data/vendor/rdtool-0.6.38/lib/rd/dot.rd2rc +18 -0
  434. data/vendor/rdtool-0.6.38/lib/rd/element.rb +160 -0
  435. data/vendor/rdtool-0.6.38/lib/rd/filter.rb +255 -0
  436. data/vendor/rdtool-0.6.38/lib/rd/head-filter.rb +14 -0
  437. data/vendor/rdtool-0.6.38/lib/rd/inline-element.rb +233 -0
  438. data/vendor/rdtool-0.6.38/lib/rd/labeled-element.rb +14 -0
  439. data/vendor/rdtool-0.6.38/lib/rd/list.rb +57 -0
  440. data/vendor/rdtool-0.6.38/lib/rd/loose-struct.rb +11 -0
  441. data/vendor/rdtool-0.6.38/lib/rd/methodlist.rb +57 -0
  442. data/vendor/rdtool-0.6.38/lib/rd/output-format-visitor.rb +30 -0
  443. data/vendor/rdtool-0.6.38/lib/rd/package.rb +4 -0
  444. data/vendor/rdtool-0.6.38/lib/rd/parser-util.rb +14 -0
  445. data/vendor/rdtool-0.6.38/lib/rd/post-install +1 -0
  446. data/vendor/rdtool-0.6.38/lib/rd/pre-setup.rb +18 -0
  447. data/vendor/rdtool-0.6.38/lib/rd/rbl-file.rb +69 -0
  448. data/vendor/rdtool-0.6.38/lib/rd/rbl-suite.rb +37 -0
  449. data/vendor/rdtool-0.6.38/lib/rd/rd-struct.rb +86 -0
  450. data/vendor/rdtool-0.6.38/lib/rd/rd2html-ext-lib.rb +266 -0
  451. data/vendor/rdtool-0.6.38/lib/rd/rd2html-ext-opt.rb +34 -0
  452. data/vendor/rdtool-0.6.38/lib/rd/rd2html-lib.rb +490 -0
  453. data/vendor/rdtool-0.6.38/lib/rd/rd2html-opt.rb +67 -0
  454. data/vendor/rdtool-0.6.38/lib/rd/rd2man-lib.rb +251 -0
  455. data/vendor/rdtool-0.6.38/lib/rd/rd2rdo-lib.rb +19 -0
  456. data/vendor/rdtool-0.6.38/lib/rd/rd2rmi-lib.rb +32 -0
  457. data/vendor/rdtool-0.6.38/lib/rd/rdblockparser.ry +518 -0
  458. data/vendor/rdtool-0.6.38/lib/rd/rdblockparser.tab.rb +1061 -0
  459. data/vendor/rdtool-0.6.38/lib/rd/rdfmt.rb +15 -0
  460. data/vendor/rdtool-0.6.38/lib/rd/rdinlineparser.ry +503 -0
  461. data/vendor/rdtool-0.6.38/lib/rd/rdinlineparser.tab.rb +1243 -0
  462. data/vendor/rdtool-0.6.38/lib/rd/rdvisitor.rb +214 -0
  463. data/vendor/rdtool-0.6.38/lib/rd/reference-resolver.rb +114 -0
  464. data/vendor/rdtool-0.6.38/lib/rd/search-file.rb +14 -0
  465. data/vendor/rdtool-0.6.38/lib/rd/tree.rb +103 -0
  466. data/vendor/rdtool-0.6.38/lib/rd/version.rb +41 -0
  467. data/vendor/rdtool-0.6.38/lib/rd/visitor.rb +86 -0
  468. data/vendor/rdtool-0.6.38/rdtool.gemspec +125 -0
  469. data/vendor/rdtool-0.6.38/setup.rb +1596 -0
  470. data/vendor/rdtool-0.6.38/test/data/includee1.html +1 -0
  471. data/vendor/rdtool-0.6.38/test/data/includee2.html +1 -0
  472. data/vendor/rdtool-0.6.38/test/data/includee3.nothtml +1 -0
  473. data/vendor/rdtool-0.6.38/test/data/includee4.xhtml +0 -0
  474. data/vendor/rdtool-0.6.38/test/data/label.rbl +2 -0
  475. data/vendor/rdtool-0.6.38/test/data/label2.rbl +2 -0
  476. data/vendor/rdtool-0.6.38/test/data/sub/includee2.html +1 -0
  477. data/vendor/rdtool-0.6.38/test/data/sub/includee4.html +0 -0
  478. data/vendor/rdtool-0.6.38/test/dummy-observer.rb +6 -0
  479. data/vendor/rdtool-0.6.38/test/dummy.rb +33 -0
  480. data/vendor/rdtool-0.6.38/test/temp-dir.rb +19 -0
  481. data/vendor/rdtool-0.6.38/test/test-block-parser.rb +46 -0
  482. data/vendor/rdtool-0.6.38/test/test-desclist-item.rb +219 -0
  483. data/vendor/rdtool-0.6.38/test/test-document-element.rb +46 -0
  484. data/vendor/rdtool-0.6.38/test/test-document-struct.rb +66 -0
  485. data/vendor/rdtool-0.6.38/test/test-element.rb +46 -0
  486. data/vendor/rdtool-0.6.38/test/test-headline.rb +80 -0
  487. data/vendor/rdtool-0.6.38/test/test-inline-parser.rb +46 -0
  488. data/vendor/rdtool-0.6.38/test/test-list-item.rb +54 -0
  489. data/vendor/rdtool-0.6.38/test/test-list.rb +53 -0
  490. data/vendor/rdtool-0.6.38/test/test-methodlist-item.rb +73 -0
  491. data/vendor/rdtool-0.6.38/test/test-nonterminal-element.rb +170 -0
  492. data/vendor/rdtool-0.6.38/test/test-nonterminal-inline.rb +33 -0
  493. data/vendor/rdtool-0.6.38/test/test-output-format-visitor.rb +48 -0
  494. data/vendor/rdtool-0.6.38/test/test-parser-util.rb +41 -0
  495. data/vendor/rdtool-0.6.38/test/test-rbl-file.rb +156 -0
  496. data/vendor/rdtool-0.6.38/test/test-rbl-suite.rb +43 -0
  497. data/vendor/rdtool-0.6.38/test/test-rd2html-lib.rb +496 -0
  498. data/vendor/rdtool-0.6.38/test/test-rdtree.rb +17 -0
  499. data/vendor/rdtool-0.6.38/test/test-rdvisitor.rb +29 -0
  500. data/vendor/rdtool-0.6.38/test/test-reference-resolver.rb +202 -0
  501. data/vendor/rdtool-0.6.38/test/test-reference.rb +132 -0
  502. data/vendor/rdtool-0.6.38/test/test-search-file.rb +22 -0
  503. data/vendor/rdtool-0.6.38/test/test-terminal-inline.rb +41 -0
  504. data/vendor/rdtool-0.6.38/test/test-textblock.rb +44 -0
  505. data/vendor/rdtool-0.6.38/test/test-tree.rb +82 -0
  506. data/vendor/rdtool-0.6.38/test/test-version.rb +57 -0
  507. data/vendor/rdtool-0.6.38/test/test-visitor.rb +230 -0
  508. data/vendor/rdtool-0.6.38/utils/rd-mode.el +464 -0
  509. metadata +666 -0
@@ -0,0 +1,55 @@
1
+ # daily_theme.rb
2
+ #
3
+ # Copyright (c) 2005 SHIBATA Hiroshi <h-sbt@nifty.com>
4
+ # Distributed under the GPL
5
+ #
6
+
7
+ def css_tag
8
+ theme_name = File::basename( @css, '.css' )
9
+ css_url = @css
10
+
11
+ if @mode =~ /conf$/
12
+ css_url = "#{h theme_url}/conf.css"
13
+ theme_name = 'conf'
14
+ elsif @conf.options.include?('daily_theme.list') && @conf.options['daily_theme.list'].size > 0
15
+ theme_list = @conf.options['daily_theme.list'].split(/\n/)
16
+ index = Time.now.yday % theme_list.size
17
+ theme_name = theme_list[index].strip
18
+ css_url = "#{h theme_url}/#{u theme_name}/#{u theme_name}.css"
19
+ end
20
+
21
+ <<-CSS
22
+ <link rel="stylesheet" href="#{h theme_url}/base.css" type="text/css" media="all">
23
+ <link rel="stylesheet" href="#{h css_url}" title="#{h theme_name}" type="text/css" media="all">
24
+ CSS
25
+ end
26
+
27
+ add_conf_proc( 'daily_theme', @daily_theme_label, 'theme' ) do
28
+ daily_theme_conf_proc
29
+ end
30
+
31
+ def daily_theme_conf_proc
32
+ if @mode == 'saveconf'
33
+ if @cgi.params['daily_theme.list'] && @cgi.params['daily_theme.list'][0]
34
+ @conf['daily_theme.list'] = @cgi.params['daily_theme.list'][0]
35
+ else
36
+ @conf['daily_theme.list'] = nil
37
+ end
38
+ end
39
+
40
+ # initialize Theme list
41
+ @conf['daily_theme.list'] = "default" unless @conf['daily_theme.list']
42
+
43
+ result = <<-HTML
44
+ <h3>#{@daily_theme_label}</h3>
45
+ <p>#{@daily_theme_label_desc}</p>
46
+ <p><textarea name="daily_theme.list" cols="70" rows="20">#{h( @conf['daily_theme.list'] )}</textarea></p>
47
+ HTML
48
+ end
49
+
50
+ # Local Variables:
51
+ # mode: ruby
52
+ # indent-tabs-mode: t
53
+ # tab-width: 3
54
+ # ruby-indent-level: 3
55
+ # End:
@@ -0,0 +1,1486 @@
1
+ # -*- coding: utf-8 -*-
2
+ =begin
3
+ = 本日のリンク元もうちょっとだけ強化プラグイン((-$Id: disp_referrer.rb,v 1.70 2008-03-02 09:01:45 kazuhiko Exp $-))
4
+
5
+ == 概要
6
+ アンテナからのリンク、サーチエンジンの検索結果を、通常のリンク元の下にま
7
+ とめて表示します。サーチエンジンの検索結果は、検索語毎にまとめられます。
8
+
9
+ 最新の日記の表示では、通常のリンク元以外のリンク元を隠します。
10
+
11
+ == Acknowledgements
12
+ This plugin uses
13
+ * Some of the search engine names and URLs
14
+ from disp_referrer.rb by MUTOH Masao.
15
+
16
+ Methods that parses URL is copied from cgi.rb distributed with Ruby and
17
+ edited.
18
+
19
+ The idea that categorize the URLs with [] delimited strings is from
20
+ kazuhiko.
21
+
22
+ The author of this plugin appreciates them.
23
+
24
+ == Copyright notice
25
+ Copyright (C) 2003-2005 zunda <zunda at freeshell.org>
26
+
27
+ Please note that some methods in this plugin are written by other
28
+ authors as written in the comments.
29
+
30
+ Permission is granted for use, copying, modification, distribution, and
31
+ distribution of modified versions of this work under the terms of GPL
32
+ version 2 or later.
33
+ =end
34
+
35
+ =begin ChangeLog
36
+ See ChangeLog for changes after this.
37
+
38
+ * Mon Sep 29, 2003 zunda <zunda at freeshell.org>
39
+ - forgot to change arguments after changing initialize()
40
+ * Thu Sep 25, 2003 zunda <zunda at freeshell.org>
41
+ - name.untaint to eval name
42
+ * Thu Sep 25, 2003 zunda <zunda at freeshell.org>
43
+ - use to_native instead of to_euc
44
+ * Mon Sep 19, 2003 zunda <zunda at freeshell.org>
45
+ - disp_referrer2.rb,v 1.1.2.104 commited as disp_referrer.rb
46
+ * Mon Sep 1, 2003 zunda <zunda at freeshell.org>
47
+ - more strcit check for infoseek search enigne
48
+ * Wed Aug 27, 2003 zunda <zunda at freeshell.org>
49
+ - rd.yahoo, Searchalot, Hotbot added
50
+ * Tue Aug 12, 2003 zunda <zunda at freeshell.org>
51
+ - search engine list cleaned up
52
+ * Mon Aug 11, 2003 zunda <zunda at freeshell.org>
53
+ - instance_eval for e[2] in the search engine list
54
+ * Wed Aug 7, 2003 zunda <zunda at freeshell.org>
55
+ - WWW browser configuration interface
56
+ - キャッシュの更新をより確実にするようにしました。WWWブラウザから置換
57
+ リストを作った場合にはリストの最初に追加されます。
58
+ - secure=trueな日記でその他のリンク元リストが表示できるようになりました。
59
+ - Regexp generation for Wiki sites
60
+ * Wed Aug 6, 2003 zunda <zunda at freeshell.org>
61
+ - WWW browser configuration interface
62
+ - 主なオプションとリンク元置換リストの効率的な編集がWWWブラウザからで
63
+ きるようになりました。secure=trueな日記では一部の機能は使えません。
64
+ * Sat Aug 2, 2003 zunda <zunda at freeshell.org>
65
+ - Second version
66
+ - basic functions re-implemented
67
+ - オプションを命名しなおしました。また不要なオプションを消しました。
68
+ tdiary.confを編集していた方は、お手数ですが設定をしなおしてください。
69
+ - Noraライブラリとキャッシュの利用で高速化しました。
70
+ - 検索エンジンのリストをプラグインで持つようになりました。&や;を含む検
71
+ 索文字列も期待通りに抽出できます。
72
+ * Mon Feb 17, 2003 zunda <zunda at freeshell.org>
73
+ - First version
74
+ =end
75
+ # to be visible from inside classes
76
+ Dispref2plugin = self
77
+ Dispref2plugin_cache_path = @cache_path
78
+ Dispref2plugin_cache_dir = @cache_dir
79
+ Dispref2plugin_secure = @conf.secure
80
+
81
+ # cache format
82
+ Root_DispRef2URL = 'dispref2url' # root for DispRef2URLs
83
+
84
+ =begin
85
+ === Tdiary::Plugin::DispRef2DummyPStore
86
+ PStoreと同じメソッドを提供しますがなにもしません。db[key]は全てnilを返す
87
+ ことに注意してください。
88
+ =end
89
+ # dummy PStore
90
+ class DispRef2DummyPStore
91
+ def initialize( file )
92
+ end
93
+ def transaction( read_only = false )
94
+ yield
95
+ end
96
+ def method_missing( name, *args )
97
+ nil
98
+ end
99
+ end
100
+
101
+ class DispRef2CachePathDummy
102
+ def initialize( setup )
103
+ @setup = setup
104
+ end
105
+ def size
106
+ 0
107
+ end
108
+ def caches( include_backup = true )
109
+ []
110
+ end
111
+ def method_missing( name, *args )
112
+ nil
113
+ end
114
+ end
115
+
116
+ =begin
117
+ === Tdiary::Plugin::DispRef2CachePath
118
+ DispRef2Storeのパスの管理をします。
119
+
120
+ --- DispRef2CachePath::new( setup )
121
+
122
+ --- DispRef2CachePath#cache( date )
123
+ その日の日記のためのキャッシュのパスを返します。
124
+
125
+ --- DispRef2CachePath#caches
126
+ 現在存在するそれぞれのキャッシュファイルのパスの配列を返します。
127
+
128
+ --- DispRef2CachePath#shrink
129
+ 最近使われていないキャッシュを削除することで、
130
+ キャッシュの大きさを設定値程度に抑えます。
131
+
132
+ === Tdiary::Plugin::DispRef2PStore
133
+ @secure=falseな日記ではPStoreと同等のメソッドを、@secure=trueな日記では
134
+ 何もしないメソッドを提供します。
135
+
136
+ --- DispRef2PSTore#transaction( read_only = false )
137
+ Ruby-1.7以降の場合は読み込み専用に開くこともできます。Ruby-1.6の場
138
+ 合はread_only = trueでも読み書き用に開きます。
139
+
140
+ --- DispRef2PSTore#real?
141
+ 本物のPSToreが使える時はtrue、そうでない時はfalseを返します。
142
+ =end
143
+
144
+ unless @conf and @conf.secure then
145
+ class DispRef2CachePath
146
+ def initialize( setup )
147
+ @setup = setup
148
+ end
149
+ def cache( date )
150
+ return File.join( @setup['cache_dir'], 'volatile.tdr2.cache' ) unless date
151
+ begin
152
+ Dir.mkdir( @setup['cache_dir'].untaint )
153
+ rescue Errno::EEXIST
154
+ end
155
+ File.join( @setup['cache_dir'], date.strftime( '%Y%m.tdr2.cache' ) )
156
+ end
157
+ def caches( include_backup = true )
158
+ if include_backup then
159
+ r = Dir.glob( File.join( @setup['cache_dir'], '??????.tdr2.cache*' ) )
160
+ else
161
+ r = Dir.glob( File.join( @setup['cache_dir'], '??????.tdr2.cache' ) )
162
+ end
163
+ r.collect{ |p| p.untaint }
164
+ end
165
+ def size
166
+ r = 0
167
+ caches.each do |path|
168
+ r += File.size( path )
169
+ end
170
+ r
171
+ end
172
+ def clear
173
+ # current version
174
+ caches.each do |path|
175
+ begin
176
+ File.unlink( path )
177
+ rescue Errno::ENOENT
178
+ end
179
+ end
180
+ # older version
181
+ if @setup['cache_path'] then
182
+ [ @setup['cache_path'], @setup['cache_path']+'~' ].each do |f|
183
+ File.unlink( f ) if FileTest::exist?( f )
184
+ end
185
+ end
186
+ end
187
+ def shrink
188
+ return if @setup['cache_max_size'] <= 0
189
+ size = 0
190
+ begin
191
+ caches.sort{ |a,b| File.atime( b ) <=> File.atime( a ) }.each do |path|
192
+ if size < @setup['cache_max_size'] then
193
+ size += File.size( path )
194
+ else
195
+ File.unlink( path )
196
+ end
197
+ end
198
+ rescue Errno::ENOENT
199
+ end
200
+ end
201
+ end
202
+
203
+ require 'pstore'
204
+ class DispRef2PStore < PStore
205
+ def real?
206
+ true
207
+ end
208
+ def transaction( read_only = false )
209
+ begin
210
+ super
211
+ rescue TypeError
212
+ File.unlink( self.path )
213
+ super
214
+ rescue ArgumentError
215
+ super()
216
+ end
217
+ end
218
+ end
219
+ else
220
+ class DispRef2PStore < DispRef2DummyPStore
221
+ def real?
222
+ false
223
+ end
224
+ end
225
+ class DispRef2CachePath < DispRef2CachePathDummy
226
+ end
227
+ end
228
+
229
+ =begin
230
+ === Tdiary::Plugin::DispRef2String
231
+ 文字コードの変換、URL、HTMLでの取り扱いに関するメソッド群です。インスタ
232
+ ンスは作りません。UconvライブラリやNoraライブラリがあればそれを使い、無
233
+ ければ無いなりに処理します。
234
+
235
+ --- DispRef2String::nora?
236
+ Noraが使える時にはtrue、そうでないときにはfalseを返します。
237
+
238
+ --- DispRef2String::normalize( str )
239
+ 続く空白を取り去ったりsite:...という文字列を消したりして、検索キー
240
+ ワードを規格化します。
241
+
242
+ --- DispRef2String::parse_query( str )
243
+ URLに含まれるquery部(key=value&...)を解析し、結果をkeyをキー、
244
+ valueの配列を値としたハッシュとして返します。値のアンエスケープは
245
+ しません。valueが無かった場合は空文字列が設定されます。
246
+
247
+ --- DispRef2String::separate_query( str )
248
+ URLをquery部より前と後に分けて配列として返します。query部が無い場
249
+ 合はnilを返します。
250
+
251
+ --- DispRef2String::hostname( str )
252
+ URLに含まれるホスト名あるいはIPアドレスを返します。ホスト名がみつ
253
+ からない場合は、((|str|))を返します。
254
+
255
+ --- DispRef2String::company_name( str, hash_list )
256
+ URLより、googleやbiglobeといった名前のうち((|hash_list|))のkeyに含
257
+ まれるものを返します。みつからない場合は、nilを返します。
258
+
259
+ --- DispRef2String::escapeHTML( str )
260
+ HTMLに含まれても安全なようにエスケープします。
261
+
262
+ --- DispRef2String::unescape( str )
263
+ URLをアンエスケープします。
264
+
265
+ --- DispRef2String::bytes( size )
266
+ バイト単位の大きさをMB KB Bの適切な単位に変換します。
267
+
268
+ --- DispRef2String::comma( integer )
269
+ 数字をカンマで3桁ずつに分けます。
270
+
271
+ --- DispRef2String::url_regexp( url )
272
+ ((|url|))から置換リスト用の正規表現文字列をつくります。
273
+
274
+ --- DispRef2String::url_match?( url, list )
275
+ ((|url|))が((|list|))のどれかにマッチするかどうか調べます。
276
+
277
+ =end
278
+ # string handling
279
+ class DispRef2String
280
+
281
+ # strips site:... portion (google), multiple spaces, and start/end spaces
282
+ def self::normalize( str )
283
+ str.sub( /\bsite:(\w+\.)*\w+\b/u, '' ).gsub( /[ \s\n]+/u, ' ' ).strip
284
+ end
285
+
286
+ # parse_query parses the not unescaped query in a URL
287
+ # copied from from CGI::parse in cgi.rb by
288
+ # Copyright (C) 2000 Network Applied Communication Laboratory, Inc.
289
+ # Copyright (C) 2000 Information-technology Promotion Agency, Japan
290
+ # Wakou Aoyama <wakou@ruby-lang.org>
291
+ # eand edited
292
+ def self::parse_query( str )
293
+ params = Hash.new
294
+ str.split( /[&;]/n ).each do |pair|
295
+ k, v = pair.split( '=', 2 )
296
+ ( params[k] ||= Array.new ) << ( v ? v : '' )
297
+ end
298
+ params
299
+ end
300
+
301
+ # separate the query part (or nil) from a URL
302
+ def self::separate_query( str )
303
+ base, query = str.split( /\?/, 2 )
304
+ if query then
305
+ [ base, query ]
306
+ else
307
+ [ base, nil ]
308
+ end
309
+ end
310
+
311
+ # get the host name (or nil) from a URL
312
+ @@hostname_match = %r!https?://([^/]+)/?!
313
+ def self::hostname( str )
314
+ @@hostname_match =~ str ? $1 : str
315
+ end
316
+
317
+ # get the `company name' included in keys of hash_table (or nil) from a URL
318
+ def self::company_name( str, hash_table )
319
+ hostname( str ).split( /\./ ).values_at( -2, -3, 0 ).each do |s|
320
+ return s if s and hash_table.has_key?( s.downcase )
321
+ end
322
+ nil
323
+ end
324
+
325
+ # escapeHTML: escape to be used in HTML
326
+ # unescape: unesape the URL
327
+ @@have_nora = false
328
+ begin
329
+ begin
330
+ require 'web/escape'
331
+ @@have_nora = true
332
+ rescue LoadError
333
+ require 'escape'
334
+ @@have_nora = true
335
+ end
336
+ def self::escapeHTML( str )
337
+ str ? Web::escapeHTML( str ) : ''
338
+ end
339
+ def self::unescape( str )
340
+ str ? Web::unescape( str ) : ''
341
+ end
342
+ rescue LoadError
343
+ def self::unescape( str )
344
+ if str then
345
+ # escape ruby 1.6 bug.
346
+ begin
347
+ str.gsub( /\+/, ' ').gsub(/((?:%[0-9a-fA-F]{2})+)/n) do
348
+ [$1.delete('%')].pack('H*')
349
+ end
350
+ rescue Encoding::CompatibilityError
351
+ ''
352
+ end
353
+ else
354
+ ''
355
+ end
356
+ end
357
+ begin
358
+ require 'erb'
359
+ extend ERB::Util
360
+ def DispRef2String::escapeHTML( str )
361
+ str ? h( str ) : ''
362
+ end
363
+ rescue LoadError
364
+ def DispRef2String::escapeHTML( str )
365
+ str ? CGI::escapeHTML( str ) : ''
366
+ end
367
+ end
368
+ end
369
+
370
+ # Nora?
371
+ def self::nora?
372
+ @@have_nora
373
+ end
374
+
375
+ # add K, M with 1024 divisions
376
+ def self::bytes( size )
377
+ s = size.to_f
378
+ t = s / 1024.0
379
+ return( '%.0f' % s ) if t < 1
380
+ s = t
381
+ t = s / 1024.0
382
+ return( '%.1f K' % s ) if t < 1
383
+ return( '%.1f M' % t )
384
+ end
385
+
386
+ # insert comma
387
+ def self::comma( integer )
388
+ integer.to_s.reverse.scan(/.{1,3}/).join(',').reverse
389
+ # [ruby-list:30144]
390
+ end
391
+
392
+ # make up a regexp from a url
393
+ def self::url_regexp( url )
394
+ r = url.dup
395
+ r.sub!( /\/\d{4,8}\.html$/, '/' ) # from a tDiary?
396
+ r.sub!( /\/(index\.(rb|cgi))?\?date=\d{4,8}$/, '/' ) # from a tDiary?
397
+ r.gsub!( /\./, '\\.' ) # dots in the FQDN
398
+ unless /(w|h)iki/i =~ r then
399
+ r.sub!( /\?.*/, '.*' )
400
+ else
401
+ r.sub!( /\?.*/, '\?(.*)' )
402
+ end
403
+ r.sub!( /\/(index\.html?)$/, '/' ) # directory index
404
+ r.sub!( /\/$/, '/?.*' ) # may be also from a lower level
405
+ "\\A#{r}" # always good to put a \A
406
+ end
407
+
408
+ # matchs to the regexp strings?
409
+ def self::url_match?( url, list )
410
+ list = list.split( /\n/ ) if String == list.class
411
+ list.each do |entry|
412
+ entry = entry[0] if Array == entry.class
413
+ return true if /#{entry}/i =~ url
414
+ end
415
+ false
416
+ end
417
+
418
+ end
419
+
420
+ =begin
421
+ === Tdiary::Plugin::DispRef2Setup
422
+ プラグインの動作を決めるパラメータを設定します。
423
+
424
+ --- DispRef2Setup::Last_parenthesis
425
+ 文字列の最後の()の中身が$1に設定される正規表現です。
426
+
427
+ --- DispRef2Setup::First_bracket
428
+ 文字列の最初の[]の中身が$1に、その後の文字列が$2に設定される正規表
429
+ 現です。
430
+
431
+ --- DispRef2Setup::Defaults
432
+ オプションのデフォルト値です。tDiary本体から@optionsで設定するには、
433
+ このハッシュのkeyの前に「disp_referrer2.」をつけたkeyを使ってくだ
434
+ さい。オプションの詳細はソースのコメントを参照してください。
435
+
436
+ --- DispRef2Setup::new( conf, limit = 100, is_long = true )
437
+ ((|conf|))にはtDiaryの@confを、((|limit|))には一項目あたりの表示リ
438
+ ンク元数を、((|is_long|))は一日分の表示の場合にはtrueを、最新の表
439
+ 示の場合にはfalseを設定してください。
440
+
441
+ --- DispRef2Setup#update!
442
+ tDiaryの@optionsにより自身を更新します。
443
+
444
+ --- DispRef2Setup#is_long
445
+ --- DispRef2Setup#referer_table
446
+ --- DispRef2Setup#no_referer
447
+ --- DispRef2Setup#secure
448
+ それぞれ、一日分の表示かどうか、tDiaryの置換テーブル、tDiaryのリン
449
+ ク元除外リスト、日記のセキュリティ設定を返します。
450
+
451
+ --- DIspRef2Setup#to_native( str )
452
+ tDiaryの言語リソースで定義されている文字コードを正規化するメソッド
453
+ です。
454
+
455
+ --- DispRef2Setup#[]
456
+ 設定されている値を返します。
457
+ =end
458
+ # configuration of this plugin
459
+ class DispRef2Setup < Hash
460
+ # useful regexps
461
+ Last_parenthesis = /\((.*?)\)\Z/m
462
+ First_bracket = /\A\[(.*?)\](.+)/m
463
+
464
+ # default options
465
+ Defaults = {
466
+ 'long.only_normal' => false,
467
+ # trueの場合、一日分の表示で、通常のリンク元以外を隠します。
468
+ 'short.only_normal' => true,
469
+ # trueの場合、最新の表示で、通常のリンク元以外を隠します。
470
+ # falseの場合は、プラグインの無い場合と全くおなじ表示になります。
471
+ 'antenna.url' => '(\/a\/|(?!.*\/diary\/)antenna[\/\.]|\/tama\/|\Ahttp:\/\/www\.tdiary\.net\/?(i\/)?(\?|$)|links?|\Ahttp:\/\/kitaj\.no-ip\.com\/iraira\/|\Ahttp:\/\/i-know\.jp\/|\Ahttp:\/\/(www\.)?bloglines\.com\/(myblogs|public)_display|\Ahttp:\/\/del\.icio\.us\/\w+|\Ahttp:\/\/reader\.livedoor\.com\/reader\/)',
472
+ # アンテナのURLに一致する正規表現の文字列です。
473
+ 'antenna.title' => '(アンテナ|links?|あんてな|antenna|entry|entries|リンク集|RSS|ブックマーク)',
474
+ # アンテナの置換後の文字列に一致する正規表現の文字列です。
475
+ 'normal.label' => Dispref2plugin.referer_today,
476
+ # 通常のリンク元のタイトルです。デフォルトでは、「本日のリンク元」です。
477
+ 'antenna.label' => Disp_referrer2_antenna_label,
478
+ # アンテナのリンク元のタイトルです。
479
+ 'unknown.label' => Disp_referrer2_unknown_label,
480
+ # その他のリンク元のタイトルです。
481
+ 'unknown.hide' => false,
482
+ # trueの場合はリンク元置換リストにないURLは表示しません
483
+ 'search.label' => Disp_referrer2_search_label,
484
+ # 検索エンジンからのリンク元のタイトルです。
485
+ 'unknown.divide' => true,
486
+ # trueの場合、置換リストに無いURLを通常のリンク元と分けて表示します。
487
+ # falseの場合、置換リストに無いURLを通常のリンク元と混ぜて表示します。
488
+ 'normal.group' => true,
489
+ # trueの場合、置換後の文字列で通常のリンク元をグループします。
490
+ # falseの場合、URL毎に別のリンク元として表示します。
491
+ 'normal.categorize' => true,
492
+ # trueの場合、置換後の文字列の最初の[]の文字列でカテゴリー分けします。
493
+ 'normal.ignore_parenthesis' => true,
494
+ # trueの場合、グループする際に置換後の文字列の最後の()を無視します。
495
+ 'antenna.group' => true,
496
+ # trueの場合、置換後の文字列で通常のリンク元をグループします。
497
+ # falseの場合、URL毎に別のリンク元として表示します。
498
+ 'antenna.ignore_parenthesis' => true,
499
+ # trueの場合、グループする際に置換後の文字列の最後の()を無視します。
500
+ 'search.expand' => false,
501
+ # trueの場合、検索キーワードとともに検索エンジン名を表示します。
502
+ # falseの場合、回数のみを表示します。
503
+ 'search.unknown_keyword' => Disp_referrer2_search_unknown_keyword,
504
+ # キーワードがわからない検索エンジンからのリンクに使う文字列です。
505
+ 'search_engines' => DispReferrer2_Engines,
506
+ # 検索エンジンのハッシュです。
507
+ 'cache_label' => Disp_referrer2_cache_label,
508
+ # 検索エンジンのキャッシュのURLを表示する文字列です。
509
+ 'cache_path' => "#{Dispref2plugin_cache_path}/disp_referrer2.cache",
510
+ # このプラグインで使うキャッシュファイルのパスです。
511
+ # このオプションは現在は使われていません。
512
+ 'cache_dir' => "#{Dispref2plugin_cache_path}/disp_referrer2.d",
513
+ # このプラグインで使うキャッシュファイルのディレクトリです。
514
+ 'cache_max_size' => 10485760, # 10MB
515
+ # キャッシュの合計量の制限(バイト)です。時々越えます。
516
+ # 0未満なら制限しません。
517
+ 'no_cache' => false,
518
+ # trueの場合、@secure=falseな日記でもキャッシュを使いません。
519
+ 'normal-unknown.title' => '\Ahttps?:\/\/',
520
+ # 置換された「その他」のリンク元のタイトル、あるいは置換されていな
521
+ # いリンク元のタイトルにマッチします。
522
+ 'configure.use_link' => true,
523
+ # リンク元置換リストの編集画面で、リンク元へのリンクを作ります。
524
+ 'reflist.ignore_urls' => '',
525
+ # 置換リストのリストアップの際に無視するURLの正規表現の文字列
526
+ # \n区切で並べます
527
+ }
528
+
529
+ attr_reader :is_long, :referer_table, :no_referer, :secure, :years, :conf
530
+
531
+ def initialize( conf, limit = 100, is_long = true, years = nil, mode = nil )
532
+ super()
533
+ @conf = conf
534
+ @years = years
535
+
536
+ # mode
537
+ @is_long = is_long
538
+ @limit = limit
539
+ @options = conf.options
540
+ @mode = mode
541
+
542
+ # URL tables
543
+ @referer_table = conf.referer_table
544
+ @no_referer = conf.no_referer
545
+
546
+ # security
547
+ @secure = Dispref2plugin_secure
548
+
549
+ # options from tDiary
550
+ update!
551
+ end
552
+
553
+ def to_native( str )
554
+ @conf.to_native( str )
555
+ end
556
+
557
+ # options from tDiary
558
+ def update!
559
+ # defaults
560
+ self.replace( DispRef2Setup::Defaults.dup )
561
+
562
+ # from tDiary
563
+ self.each_key do |key|
564
+ options_key = "disp_referrer2.#{key}"
565
+ self[key] = @options[options_key] if @options.has_key?( options_key )
566
+ end
567
+ self['no_cache'] = true if defined?(::TDiary::DefaultIO) && @conf.io_class == ::TDiary::DefaultIO
568
+
569
+ # additions
570
+ self['labels'] = {
571
+ DispRef2URL::Normal => self['normal.label'],
572
+ DispRef2URL::Antenna => self['antenna.label'],
573
+ DispRef2URL::Search => self['search.label'],
574
+ DispRef2URL::Unknown => self['unknown.label'],
575
+ }
576
+ self['antenna.url.regexp'] = /#{self['antenna.url']}/i
577
+ self['antenna.title.regexp'] = /#{self['antenna.title']}/i
578
+ self['normal-unknown.title.regexp'] = /#{self['normal-unknown.title']}/i
579
+
580
+ # limits
581
+ self['limit'] = Hash.new
582
+ self['limit'][DispRef2URL::Normal] = @limit || 0
583
+ if ( @is_long ? self['long.only_normal'] : self['short.only_normal'] ) then
584
+ [DispRef2URL::Antenna, DispRef2URL::Search, DispRef2URL::Unknown].each do
585
+ |c| self['limit'][c] = 0
586
+ end
587
+ else
588
+ [DispRef2URL::Antenna, DispRef2URL::Search, DispRef2URL::Unknown].each do |c|
589
+ self['limit'][c] = @limit || 0
590
+ end
591
+ end
592
+ if self['unknown.hide'] and not /\A(append|replace|edit)\Z/ =~ @mode then
593
+ self['limit'][DispRef2URL::Unknown] = 0
594
+ end
595
+ self
596
+ end
597
+
598
+ def open_cache( path )
599
+ if self['no_cache'] then
600
+ DispRef2DummyPStore::new( path )
601
+ else
602
+ DispRef2PStore::new( path )
603
+ end
604
+ end
605
+
606
+ def cache_path
607
+ if self['no_cache'] then
608
+ DispRef2CachePathDummy::new( self )
609
+ else
610
+ DispRef2CachePath::new( self )
611
+ end
612
+ end
613
+ end
614
+
615
+ =begin
616
+ === Tdiary::Plugin::DispRef2URL
617
+
618
+ --- DispRef2URL::new( unescaped_url, setup = nil )
619
+ 素のURLを元にしてインスタンスを生成します。((|setup|))がnilではない
620
+ 場合には、parse( ((|setup|)) ) もします。
621
+
622
+ --- DispRef2URL#restore( db )
623
+ キャッシュから自分のURLに対応する情報を取り出します。((|db|))は
624
+ DispRef2PStoreのインスタンスです。キャッシュされていなかった場合
625
+ にはnilを返します。
626
+
627
+ --- DispRef2URL#parse( setup )
628
+ DispRef2Setupのインスタンス((|setup|))にしたがって、自分を解析します。
629
+
630
+ --- DispRef2URL::Cached_options
631
+ DispRef2Setupで設定されるオプションのうち、キャッシュに影響を与え
632
+ るものの配列を返します。
633
+
634
+ --- DispRef2URL#store( db )
635
+ キャッシュに自分を記録します。((|db|))はDispRef2PStoreのインスタ
636
+ ンスです。記録に成功した場合は自分を、そうでない場合にはnilを返し
637
+ ます。
638
+
639
+ --- DispRef2URL#==( other )
640
+ 解析結果が等しい場合に真を返します。
641
+
642
+ --- DispRef2URL#url
643
+ --- DispRef2URL#category
644
+ --- DispRef2URL#category_label
645
+ --- DispRef2URL#title
646
+ --- DispRef2URL#title_ignored
647
+ --- DispRef2URL#title_group
648
+ --- DispRef2URL#key
649
+ それぞれ、URL、カテゴリー、カテゴリー名(ユーザーが設定しなければnil)、
650
+ タイトル、グループ化した時に無視されたタイトル(無ければnil)、グル
651
+ ープ化した後のタイトル、グループ化する際のキーを返します。parseあ
652
+ るいはrestoreしないと設定されません。
653
+
654
+ =end
655
+ # handling of a URL
656
+ class DispRef2URL
657
+ attr_reader :url, :category, :category_label, :title, :title_ignored, :title_group, :key
658
+
659
+ # category numbers
660
+ Normal = :normal
661
+ Antenna = :antenna
662
+ Search = :search
663
+ Unknown = :unknown
664
+ Categories = [Normal, Antenna, Search, Unknown]
665
+
666
+ # options which affects the cache
667
+ Cached_options = %w(
668
+ search_engines
669
+ cache_label
670
+ unknown.divide
671
+ antenna.url.regexp
672
+ antenna.url
673
+ antenna.title.regexp
674
+ antenna.title
675
+ antenna.group
676
+ antenna.ignore_parenthesis
677
+ normal.categorize
678
+ normal.group
679
+ normal.ignore_parenthesis
680
+ )
681
+
682
+ def initialize( unescaped_url, setup = nil )
683
+ @url = unescaped_url
684
+ @dbcopy = nil
685
+ parse( setup ) if setup
686
+ end
687
+
688
+ def restore( db )
689
+ if db.real? and (
690
+ begin
691
+ db[Root_DispRef2URL]
692
+ rescue PStore::Error
693
+ false
694
+ end
695
+ ) and db[Root_DispRef2URL][@url] then
696
+ @category, @category_label, @title, @title_ignored, @title_group, @key = db[Root_DispRef2URL][@url]
697
+ self
698
+ else
699
+ nil
700
+ end
701
+ end
702
+
703
+ def parse( setup )
704
+ parse_as_search( setup ) || parse_as_others( setup )
705
+ self
706
+ end
707
+
708
+ def store( db )
709
+ if db.real? and (
710
+ begin
711
+ db[Root_DispRef2URL] ||= Hash.new
712
+ rescue PStore::Error
713
+ db[Root_DispRef2URL] = Hash.new
714
+ end
715
+ ) then
716
+ db[Root_DispRef2URL]["#{@url}"] = [ @category, @category_label, @title, @title_ignored, @title_group, @key ]
717
+ self
718
+ else
719
+ nil
720
+ end
721
+ end
722
+
723
+ def ==(other)
724
+ return @url == other.url &&
725
+ @category == other.category &&
726
+ @category_label == other.category_label &&
727
+ @title == other.title &&
728
+ @title_ignored == other.title_ignored &&
729
+ @title_group == other.title_group &&
730
+ @key == other.key
731
+ end
732
+
733
+ def replace_with(other)
734
+ @category = other.category
735
+ @category_label = other.category_label
736
+ @title = other.title
737
+ @title_ignored = other.title_ignored
738
+ @title_group = other.title_group
739
+ @key = other.key
740
+ return self
741
+ end
742
+
743
+ private
744
+ def parse_as_search( setup )
745
+ # see which search engine is used
746
+ engine = DispRef2String::company_name( @url, setup['search_engines'] )
747
+ return nil unless engine
748
+
749
+ # url and query
750
+ urlbase, query = DispRef2String::separate_query( @url )
751
+
752
+ # get titles and keywords
753
+ title = nil
754
+ keyword = nil
755
+ cached_url = nil
756
+ catch( :done ) do
757
+ setup['search_engines'][engine].each do |re_url, title_code, keys, cache|
758
+ next unless re_url =~ urlbase
759
+
760
+ title = eval( title_code )
761
+ throw :done if keyword
762
+ if String == keys.class then # a Ruby code to extract key
763
+ re_url =~ urlbase
764
+ keyword, cached_url = (query || @url).instance_eval( keys )
765
+ throw :done
766
+ end
767
+ next unless query # below is to extract keyword from query
768
+ values = DispRef2String::parse_query( query )
769
+ # an Array of keys in which keywords or recursive URL are stored
770
+ keys.each do |key|
771
+ if Symbol === key then
772
+ k = key.to_s
773
+ if values[k] and not (encoded_uri = values[k][0]).empty? then
774
+ begin
775
+ original_uri = URI::parse( urlbase ) + URI::parse( URI::decode(encoded_uri) )
776
+ throw :done if original_uri == urlbase # denial of service?
777
+ self.replace_with( DispRef2URL.new( original_uri.to_s ).parse( setup ) )
778
+ return self
779
+ rescue URI::InvalidURIError
780
+ throw :done
781
+ end
782
+ end
783
+ elsif values[key] and not (value = values[key][0]).empty? then
784
+ unless cache and cache =~ value then
785
+ cached_url = nil
786
+ keyword = values[key][0]
787
+ throw :done
788
+ else
789
+ cached_url = $1
790
+ keyword = $` + $'
791
+ throw :done
792
+ end
793
+ end
794
+ next
795
+ end
796
+
797
+ end
798
+ return nil
799
+ end
800
+
801
+ # format
802
+ keyword ||= setup['search.unknown_keyword']
803
+ @category = Search
804
+ @category_label = nil
805
+ @title = DispRef2String::normalize( setup.to_native( DispRef2String::unescape( keyword ) ) )
806
+ @title_ignored = setup.to_native( title )
807
+ @title_ignored << sprintf( setup['cache_label'], setup.to_native( DispRef2String::unescape( cached_url ) ) ) if cached_url
808
+ @title_group = @title
809
+ @key = @title_group
810
+
811
+ return self
812
+ end
813
+
814
+ def parse_as_others( setup )
815
+ # try to convert with referer_table
816
+ matched = false
817
+ title = setup.to_native( DispRef2String::unescape( @url ) )
818
+ setup.referer_table.each do |url, name|
819
+ unless /\$\d/ =~ name then
820
+ if title.gsub!( /#{url}/iu, name ) then
821
+ matched = true
822
+ break
823
+ end
824
+ else
825
+ name.untaint unless setup.secure
826
+ if title.gsub!( /#{url}/iu ) { eval name } then
827
+ matched = true
828
+ break
829
+ end
830
+ end
831
+ end
832
+
833
+ if setup['antenna.url.regexp'] =~ @url or setup['antenna.title.regexp'] =~ title then
834
+ # antenna
835
+ @category = Antenna
836
+ @category_label = nil
837
+ grouping = setup['antenna.group']
838
+ ignoring = setup['antenna.ignore_parenthesis']
839
+ elsif matched and not setup['normal-unknown.title.regexp'] =~ title then
840
+ # normal
841
+ @category = Normal
842
+ if setup['normal.categorize'] and DispRef2Setup::First_bracket =~ title then
843
+ @category_label = $1
844
+ title = $2
845
+ else
846
+ @category_label = nil
847
+ end
848
+ grouping = setup['normal.group']
849
+ ignoring = setup['normal.ignore_parenthesis']
850
+ else
851
+ # unknown
852
+ @title = title
853
+ @title_ignored = nil
854
+ @title_group = title
855
+ @key = @url
856
+ if setup['unknown.divide'] then
857
+ @category = Unknown
858
+ @category_label = nil
859
+ else
860
+ @category = Normal
861
+ @category_label = nil
862
+ end
863
+ return self
864
+ end
865
+
866
+ # format the title
867
+ if not grouping then
868
+ @title = title
869
+ @title_group = title
870
+ @title_ignored = nil
871
+ @key = @url
872
+ elsif not ignoring then
873
+ @title = title
874
+ @title_group = title
875
+ @title_ignored = nil
876
+ @key = title_group
877
+ else
878
+ @title = title
879
+ @title_group = title.gsub( DispRef2Setup::Last_parenthesis, '' )
880
+ @title_ignored = $1
881
+ @key = title_group
882
+ end
883
+
884
+ self
885
+ end
886
+
887
+ # private
888
+ end
889
+
890
+ =begin
891
+ === Tdiary::Plugin::DispRef2Refs
892
+ --- DispRef2Refs::new( diary, setup )
893
+ 日記((|diary|))のリンク元を、DispRef2Setupのインスタンス((|setup|))
894
+ にしたがって解析します。
895
+
896
+ --- DispRef2Refs#special_categories
897
+ 置換文字列の最初に[]でかこったカテゴリ名ラベルを挿入することによっ
898
+ てユーザーによって定義されたカテゴリーの配列を返します。
899
+
900
+ --- DispRef2Refs#urls( category = nil )
901
+ リンク元のうち、カテゴリーが((|category|))に一致するものを、
902
+ DispRef2Cache#urlsと同様のフォーマットで返します。((|category|))
903
+ がnilの場合は全てのURLの情報を返します。
904
+
905
+ --- DispRef2Refs#to_long_html
906
+ --- DispRef2Refs#to_short_html
907
+ リンク元のリストをHTML断片にします。
908
+
909
+ =end
910
+ class DispRef2Refs
911
+ def initialize( diary, setup )
912
+ @setup = setup
913
+ @refs = Hash.new
914
+ @has_ref = false
915
+ return unless diary
916
+
917
+ done_flag = Hash.new
918
+ DispRef2URL::Categories.each do |c|
919
+ done_flag[c] = (@setup['limit'][c] < 1)
920
+ end
921
+
922
+ h = Hash.new
923
+ date = diary.respond_to?( :date ) ? diary.date : nil
924
+ db = setup.open_cache( setup.cache_path.cache( date ) )
925
+ db.transaction do
926
+ diary.each_referer( diary.count_referers ) do |count, url|
927
+ ref = DispRef2URL.new( url )
928
+ @has_ref = true
929
+ unless ref.restore( db ) then
930
+ ref.parse( @setup )
931
+ ref.store( db )
932
+ end
933
+ if @setup.is_long and @setup['normal.categorize'] then
934
+ cat_key = ref.category_label || ref.category
935
+ else
936
+ cat_key = ref.category
937
+ end
938
+ next if done_flag[cat_key]
939
+ h[cat_key] ||= Hash.new
940
+ unless h[cat_key][ref.key] then
941
+ h[cat_key][ref.key] = [count, ref.title_group, [[count, ref]]]
942
+ else
943
+ h[cat_key][ref.key][0] += count
944
+ h[cat_key][ref.key][2] << [count, ref] if h[cat_key][ref.key].size < @setup['limit'][ref.category]
945
+ end
946
+ if h[cat_key].size >= @setup['limit'][ref.category] then
947
+ done_flag[ref.category] = true
948
+ break unless done_flag.has_value?( false )
949
+ end
950
+ end
951
+ end
952
+ db = nil
953
+
954
+ h.each_pair do |cat_key, hash|
955
+ @refs[cat_key] = hash.values
956
+ @refs[cat_key].sort! { |a, b| b[0] <=> a[0] }
957
+ end
958
+ end
959
+
960
+ def special_categories
961
+ @refs.keys.reject!{ |c| DispRef2URL::Categories.include?( c ) }
962
+ end
963
+
964
+ # urls in the diary as a hash
965
+ def urls( category = nil )
966
+ if category then
967
+ category = [ category ] unless category.respond_to?( :each )
968
+ else
969
+ category = @refs.keys
970
+ end
971
+ h = Hash.new
972
+ category.each do |cat|
973
+ next unless @refs[cat]
974
+ @refs[cat].each do |a|
975
+ a[2].each do |b|
976
+ h[b[1].url] = [ b[1].category, b[1].category_label, b[1].title, b[1].title_ignored, b[1].title_group, b[1].key ]
977
+ end
978
+ end
979
+ end
980
+ h
981
+ end
982
+
983
+ def to_short_html
984
+ return '' if not @refs[DispRef2URL::Normal] or @refs[DispRef2URL::Normal].size < 1
985
+ result = DispRef2String::escapeHTML( @setup['labels'][DispRef2URL::Normal] ) + ' | '
986
+ @refs[DispRef2URL::Normal].each do |a|
987
+ result << %Q[<a rel="nofollow" href="#{DispRef2String::escapeHTML( a[2][0][1].url )}" title="#{DispRef2String::escapeHTML( a[2][0][1].title )}">#{a[0]}</a> | ]
988
+ end
989
+ result
990
+ end
991
+
992
+ def to_long_html( label )
993
+ return '' if not @has_ref
994
+ # we always need a caption
995
+ result = %Q[<div class="caption">#{DispRef2String::escapeHTML( label )}</div>\n]
996
+ result << others_to_long_html( DispRef2URL::Normal )
997
+ if( @setup['normal.categorize'] and special_categories ) then
998
+ special_categories.each do |cat|
999
+ result << others_to_long_html( cat )
1000
+ end
1001
+ end
1002
+ result << others_to_long_html( DispRef2URL::Antenna )
1003
+ result << others_to_long_html( DispRef2URL::Unknown )
1004
+ result << search_to_long_html
1005
+ result
1006
+ end
1007
+
1008
+ private
1009
+ def others_to_long_html( cat_key )
1010
+ return '' unless @refs[cat_key] and @refs[cat_key].size > 0
1011
+ result = ''
1012
+ unless DispRef2URL::Normal == cat_key then
1013
+ # to_long_html provides the catpion for normal links
1014
+ if @setup['labels'].has_key?( cat_key ) then
1015
+ result << %Q[<div class="caption">#{DispRef2String::escapeHTML( @setup['labels'][cat_key] )}</div>\n]
1016
+ else
1017
+ result << %Q[<div class="caption">#{DispRef2String::escapeHTML( cat_key )}</div>\n]
1018
+ end
1019
+ end
1020
+ result << '<ul>'
1021
+ @refs[cat_key].each do |a|
1022
+ begin
1023
+ if a[2].size == 1 then
1024
+ result << %Q[<li><a rel="nofollow" href="#{DispRef2String::escapeHTML( a[2][0][1].url )}">#{DispRef2String::escapeHTML( a[2][0][1].title )}</a> &times;#{a[0]}</li>\n]
1025
+ elsif not a[2][0][1].title_ignored then
1026
+ result << %Q[<li><a rel="nofollow" href="#{DispRef2String::escapeHTML( a[2][0][1].url )}">#{DispRef2String::escapeHTML( a[1] )}</a> &times;#{a[0]} : #{a[2][0][0]}]
1027
+ a[2][1..-1].each do |b|
1028
+ title = (b[1].title != a[1]) ? %Q[ title="#{DispRef2String::escapeHTML( b[1].title )}"] : ''
1029
+ result << %Q[, <a rel="nofollow" href="#{DispRef2String::escapeHTML( b[1].url )}"#{title}>#{b[0]}</a>]
1030
+ end
1031
+ result << "</li>\n"
1032
+ else
1033
+ result << %Q[<li>#{DispRef2String::escapeHTML( a[1] )} &times;#{a[0]} : ]
1034
+ comma = nil
1035
+ a[2][0..-1].each do |b|
1036
+ title = (b[1].title != a[1]) ? %Q[ title="#{DispRef2String::escapeHTML( b[1].title )}"] : ''
1037
+ result << comma if comma
1038
+ result << %Q[<a rel="nofollow" href="#{DispRef2String::escapeHTML( b[1].url )}"#{title}>#{b[0]}</a>]
1039
+ comma = ', '
1040
+ end
1041
+ result << "</li>\n"
1042
+ end
1043
+ rescue Encoding::CompatibilityError => e
1044
+ end
1045
+ end
1046
+ result << "</ul>\n"
1047
+ end
1048
+
1049
+ def search_to_long_html
1050
+ return '' unless @refs[DispRef2URL::Search] and @refs[DispRef2URL::Search].size > 0
1051
+ result = %Q[<div class="caption">#{DispRef2String::escapeHTML( @setup['labels'][DispRef2URL::Search] )}</div>\n]
1052
+ result << ( @setup['search.expand'] ? "<ul>\n" : '<ul><li>' )
1053
+ sep = nil
1054
+ @refs[DispRef2URL::Search].each do |a|
1055
+ result << sep if sep
1056
+ if @setup['search.expand'] then
1057
+ result << '<li>'
1058
+ result << DispRef2String::escapeHTML( a[1] )
1059
+ else
1060
+ result << %Q[<a rel="nofollow" href="#{DispRef2String::escapeHTML( a[2][0][1].url )}">#{DispRef2String::escapeHTML( a[1] )}</a>]
1061
+ end
1062
+ result << %Q[ &times;#{a[0]} ]
1063
+ if @setup['search.expand'] then
1064
+ result << ' : '
1065
+ if a[2].size < 2 then
1066
+ result << %Q[<a rel="nofollow" href="#{DispRef2String::escapeHTML( a[2][0][1].url )}">#{DispRef2String::escapeHTML( a[2][0][1].title_ignored )}</a>]
1067
+ else
1068
+ comma = nil
1069
+ a[2].each do |b|
1070
+ result << comma if comma
1071
+ result << %Q[<a rel="nofollow" href="#{DispRef2String::escapeHTML( b[1].url )}">#{DispRef2String::escapeHTML( b[1].title_ignored )}</a> &times;#{b[0]}]
1072
+ comma = ', ' unless comma
1073
+ end
1074
+ end
1075
+ end
1076
+ result << '</li>' if @setup['search.expand']
1077
+ sep = ( @setup['search.expand'] ? "\n" : ' / ' ) unless sep
1078
+ end
1079
+ result << ( @setup['search.expand'] ? "</ul>\n" : "</li></ul>\n" )
1080
+ end
1081
+
1082
+ # private
1083
+ end
1084
+
1085
+ =begin
1086
+ === Tdiary::Plugin::DispRef2Cache
1087
+ キャッシュの管理をするクラスです。
1088
+
1089
+ --- DispRef2Cache.new( setup )
1090
+ リンク元のキャッシュを、DispRef2Setupのインスタンス((|setup|))にした
1091
+ がって管理します。
1092
+
1093
+ --- DispRef2Cache#urls( category = nil, nmonth = 2 )
1094
+ キャッシュされているURLの情報のうち、カテゴリーが((|category|))に
1095
+ 一致するものを、URLをキー、下記の配列を値としたハッシュとして返し
1096
+ ます。((|category|))がnilの場合は全てのURLの情報を返します。
1097
+ ((|nmonth|))がnilではない場合は、最近NMONTH分のキャッシュだけから
1098
+ 検索します。
1099
+ * カテゴリー
1100
+ * カテゴリーのラベル(あるいはnil)
1101
+ * 置換後の文字列
1102
+ * グループする際に無視された文字列
1103
+ * グループ全体の文字列
1104
+ * グループする際のキー
1105
+
1106
+ =end
1107
+ # cache management
1108
+ class DispRef2Cache
1109
+ def initialize( setup )
1110
+ @setup = setup
1111
+ @cache = @setup.cache_path
1112
+ end
1113
+
1114
+ # cached urls as a hash
1115
+ def urls( category = nil, nmonth = 2 )
1116
+ h = Hash.new
1117
+ if nmonth then
1118
+ caches = @cache.caches( false ).sort{ |a,b| b<=>a }[0...nmonth]
1119
+ else
1120
+ caches = @cache.caches( false )
1121
+ end
1122
+ caches.each do |path|
1123
+ db = @setup.open_cache( path )
1124
+ db.transaction( true ) do
1125
+ begin
1126
+ db[Root_DispRef2URL].each_pair do |url, data|
1127
+ h[url] = data if not category or category == data[0]
1128
+ end
1129
+ rescue PStore::Error
1130
+ end
1131
+ end
1132
+ end
1133
+ h
1134
+ end
1135
+
1136
+ end
1137
+
1138
+ =begin
1139
+ === TDiary::Plugin::DispRef2SetupIF
1140
+ このプラグインの設定のためのHTMLを生成し、CGIリクエストを受け取ります。
1141
+
1142
+ --- DispRef2SetupIF::new( cgi, setup, conf, mode )
1143
+ CGIのインスタンス((|cgi|))とDispRef2Setupのインスタンス((|setup|))
1144
+ より、設定のためのインスタンスを生成します。TDiary::Pluginより、
1145
+ @confと@modeも引数に指定してください。
1146
+
1147
+ --- DispRef2SetupIF#show_html
1148
+ 設定の更新と必要ならキャッシュの更新をしてからHTMLを表示します。
1149
+
1150
+ --- DispRef2SetupIF#show_description
1151
+ このプラグインのHTML版の説明です。設定する項目も選べます。
1152
+
1153
+ --- DispRef2SetupIF#show_options
1154
+ このプラグインのオプションを設定するHTML断片を返します。
1155
+
1156
+ --- DispRef2SetupIF#show_unknown_list
1157
+ リンク元置換リストの編集のためのHTML断片を返します。
1158
+
1159
+ --- DispRef2SetupIF#update_options
1160
+ cgiからの入力に応じて、このプラグインのオプションを更新します。
1161
+ @setupも更新します。
1162
+
1163
+ --- DispRef2SetupIF#update_tables
1164
+ cgiからの入力に応じて、リンク元置換リストを更新します。
1165
+ =end
1166
+ # WWW Setup interface
1167
+ class DispRef2SetupIF
1168
+
1169
+ # setup mode
1170
+ Options = 'options'
1171
+ RefList = 'reflist'
1172
+
1173
+ def initialize( cgi, setup, conf, mode )
1174
+ @cgi = cgi
1175
+ @setup = setup
1176
+ @conf = conf
1177
+ @conf['disp_referrer2.reflist.ignore_urls'] ||= ''
1178
+ @mode = mode
1179
+ @need_cache_update = false
1180
+ if @cgi.params['dr2.change_mode'] and @cgi.params['dr2.change_mode'][0] then
1181
+ case @cgi.params['dr2.new_mode'][0]
1182
+ when Options
1183
+ @current_mode = Options
1184
+ when RefList
1185
+ @current_mode = RefList
1186
+ else
1187
+ @current_mode = Options
1188
+ end
1189
+ elsif @cgi.params['dr2.current_mode'] then
1190
+ case @cgi.params['dr2.current_mode'][0]
1191
+ when Options
1192
+ @current_mode = Options
1193
+ when RefList
1194
+ @current_mode = RefList
1195
+ else
1196
+ @current_mode = Options
1197
+ end
1198
+ else
1199
+ @current_mode = Options
1200
+ end
1201
+ if not @setup.secure and not @setup['no_cache'] then
1202
+ @cache = @setup.cache_path
1203
+ else
1204
+ @cache = nil
1205
+ end
1206
+ end
1207
+
1208
+ # do what to do and make html
1209
+ def show_html
1210
+ # things to be done
1211
+ if @mode == 'saveconf' then
1212
+ case @current_mode
1213
+ when Options
1214
+ update_options
1215
+ when RefList
1216
+ update_tables
1217
+ end
1218
+ end
1219
+
1220
+ # clear cache
1221
+ if @mode == 'saveconf' and not @setup.secure then
1222
+ if not @setup['no_cache'] then
1223
+ unless @cache then
1224
+ @need_cache_update = true
1225
+ @cache = @setup.cache_path
1226
+ end
1227
+ if not 'never' == @cgi.params['dr2.cache.update'][0] and ('force' == @cgi.params['dr2.cache.update'][0] or @need_cache_update) then
1228
+ @cache.clear
1229
+ end
1230
+ else
1231
+ if @setup['no_cache'] then
1232
+ @cache = nil
1233
+ end
1234
+ end
1235
+ end
1236
+
1237
+ # result
1238
+ r = show_description
1239
+ case @current_mode
1240
+ when Options
1241
+ r << show_options
1242
+ when RefList
1243
+ r << show_unknown_list
1244
+ end
1245
+ r
1246
+ end
1247
+
1248
+ # show description
1249
+ def show_description
1250
+ r = Disp_referrer2_abstract.dup
1251
+ if DispRef2String.nora? then
1252
+ r << Disp_referrer2_with_Nora
1253
+ else
1254
+ r << Disp_referrer2_without_Nora
1255
+ end
1256
+ if @cache then
1257
+ r << sprintf( Disp_referrer2_cache_info, DispRef2String::bytes( @cache.size ) )
1258
+ r << sprintf( Disp_referrer2_update_info, "#{DispRef2String::escapeHTML(@conf.update)}?conf=referer" )
1259
+ end
1260
+ r << "<p>\n"
1261
+ case @current_mode
1262
+ when Options
1263
+ r << sprintf( Disp_referrer2_move_to_refererlist, "#{DispRef2String::escapeHTML(@conf.update)}?conf=disp_referrer2;dr2.new_mode=#{RefList};dr2.change_mode=true" )
1264
+ when RefList
1265
+ r << sprintf( Disp_referrer2_move_to_config, "#{DispRef2String::escapeHTML(@conf.update)}?conf=disp_referrer2;dr2.new_mode=#{Options};dr2.change_mode=true" )
1266
+ end
1267
+ r << sprintf( Disp_referrer2_also_todayslink, "#{DispRef2String::escapeHTML(@conf.update)}?conf=referer" )
1268
+ r << %Q{<input type="hidden" name="saveconf" value="ok"></p><hr>\n}
1269
+ r
1270
+ end
1271
+
1272
+ # updates the options
1273
+ def update_options
1274
+ dirty = false
1275
+ # T/F options
1276
+ %w( antenna.group antenna.ignore_parenthesis antenna.search.expand
1277
+ normal.categorize normal.group normal.ignore_parenthesis
1278
+ search.expand long.only_normal short.only_normal no_cache unknown.divide
1279
+ unknown.hide
1280
+ ).each do |key|
1281
+ tdiarykey = 'disp_referrer2.' + key
1282
+ case @cgi.params['dr2.' + key][0]
1283
+ when 'true'
1284
+ unless @conf[tdiarykey] == true then
1285
+ @conf[tdiarykey] = true
1286
+ @need_cache_update = true if DispRef2URL::Cached_options.include?( key )
1287
+ dirty = true
1288
+ end
1289
+ when 'false'
1290
+ unless @conf[tdiarykey] == false then
1291
+ @conf[tdiarykey] = false
1292
+ @need_cache_update = true if DispRef2URL::Cached_options.include?( key )
1293
+ dirty = true
1294
+ end
1295
+ end
1296
+ end
1297
+
1298
+ # numeric options
1299
+ %w( cache_max_size ).each do |key|
1300
+ tdiarykey = 'disp_referrer2.' + key
1301
+ v = @cgi.params['dr2.' + key][0]
1302
+ next unless v
1303
+ f = 1
1304
+ if v.gsub!( /M\Z/, '' ) then
1305
+ f = 1024*1024
1306
+ elsif v.gsub!( /K\Z/, '' ) then
1307
+ f = 1024
1308
+ end
1309
+ if /\A\d+\Z/ =~ v then
1310
+ @conf[tdiarykey] = v.to_i * f
1311
+ @need_cache_update = true if DispRef2URL::Cached_options.include?( key )
1312
+ dirty = true
1313
+ end
1314
+ end
1315
+
1316
+ # update @setup
1317
+ @setup.update! if dirty
1318
+ end
1319
+
1320
+ # referer tables
1321
+ def update_tables
1322
+ dirty = false
1323
+
1324
+ if @cgi.params['dr2.urls'] and @cgi.params['dr2.urls'][0].to_i > 0
1325
+ @cgi.params['dr2.urls'][0].to_i.times do |i|
1326
+ if not @cgi.params["dr2.#{i}.reg"][0].empty? and not @cgi.params["dr2.#{i}.title"][0].empty? then
1327
+ a = [
1328
+ @setup.to_native( @cgi.params["dr2.#{i}.reg"][0] ).sub( /[\r\n]+/, '' ),
1329
+ @setup.to_native( @cgi.params["dr2.#{i}.title"][0] ).sub( /[\r\n]+/, '' )
1330
+ ]
1331
+ if not a[0].empty? and not a[1].empty? then
1332
+ @conf.referer_table2.unshift( a )
1333
+ @conf.referer_table.unshift( a )
1334
+ # to reflect the change in this requsest
1335
+ @need_cache_update = true
1336
+ dirty = true
1337
+ end
1338
+ end
1339
+ if 'true' == @cgi.params["dr2.#{i}.noref"][0] then
1340
+ unless @cgi.params["dr2.#{i}.reg"][0].empty? then
1341
+ reg = @setup.to_native( @cgi.params["dr2.#{i}.reg"][0] ).strip
1342
+ unless reg.empty? then
1343
+ @conf.no_referer2.unshift( reg )
1344
+ @conf.no_referer.unshift( reg )
1345
+ # to reflect the change in this requsest
1346
+ end
1347
+ end
1348
+ end
1349
+ if 'true' == @cgi.params["dr2.#{i}.ignore"][0] then
1350
+ unless @cgi.params["dr2.#{i}.reg"][0].empty? then
1351
+ reg = @setup.to_native( @cgi.params["dr2.#{i}.reg"][0] ).strip
1352
+ unless reg.empty? then
1353
+ @conf['disp_referrer2.reflist.ignore_urls'] = @conf['disp_referrer2.reflist.ignore_urls'].split( /\n/ ).push( reg ).uniq.join( "\n" )
1354
+ dirty = true
1355
+ end
1356
+ end
1357
+ end
1358
+ end
1359
+ end
1360
+
1361
+ if @cgi.params['dr2.clear_ignore_urls'] and 'true' == @cgi.params['dr2.clear_ignore_urls'][0] then
1362
+ @conf['disp_referrer2.reflist.ignore_urls'] = ''
1363
+ dirty = true
1364
+ end
1365
+
1366
+ %w( url title ).each do |cat|
1367
+ if 'true' == @cgi.params["dr2.antenna.#{cat}.default"][0] then
1368
+ @conf["disp_referrer2.antenna.#{cat}"] = DispRef2Setup::Defaults["antenna.#{cat}"]
1369
+ dirty = true
1370
+ @need_cache_update = true
1371
+ elsif @cgi.params["dr2.antenna.#{cat}"] and @cgi.params["dr2.antenna.#{cat}"][0] and @cgi.params["dr2.antenna.#{cat}"][0] != @conf["disp_referrer2.antenna.#{cat}"] then
1372
+ newval = @cgi.params["dr2.antenna.#{cat}"][0].strip
1373
+ unless newval.empty? then
1374
+ @conf["disp_referrer2.antenna.#{cat}"] = newval
1375
+ dirty = true
1376
+ @need_cache_update = true
1377
+ end
1378
+ end
1379
+ end
1380
+
1381
+ # update @setup
1382
+ @setup.update! if dirty
1383
+ end
1384
+
1385
+ end
1386
+
1387
+ =begin
1388
+ === TDiary::Plugin::DispRef2Latest
1389
+ キャッシュが無い場合に、設定プラグインで不明のリンク元を得るためのクラス
1390
+ です。
1391
+
1392
+ --- DispRef2Latest::new( cgi, skeltonfile, conf, setup )
1393
+ TDiary::TDiaryLatestの引数に加えて、DispRef2Setupのインスタンス
1394
+ ((|setup|))を引数にとります。
1395
+
1396
+ --- DispRef2Latest::unknown_urls
1397
+ 最新の日記のリンク元のうち、置換できなかったもののURLの配列を返し
1398
+ ます。置換できなかったURLが無い場合には空の配列を返します。
1399
+
1400
+ =end
1401
+ class DispRef2Latest < TDiary::TDiaryLatest
1402
+
1403
+ def initialize( cgi, rhtml, conf, setup )
1404
+ super( cgi, rhtml, conf )
1405
+ @setup = setup
1406
+ end
1407
+
1408
+ # collect unknown URLs from the newest diaries
1409
+ def unknown_urls
1410
+ r = Array.new
1411
+ self.latest( @conf.latest_limit ) do |diary|
1412
+ refs = DispRef2Refs.new( diary, @setup )
1413
+ h = refs.urls( DispRef2URL::Antenna )
1414
+ h.each_key do |url|
1415
+ next unless @setup['normal-unknown.title.regexp'] =~ h[url][2]
1416
+ next if DispRef2String::url_match?( url, @setup.no_referer )
1417
+ r << url
1418
+ end
1419
+ h = nil
1420
+ refs.urls( DispRef2URL::Unknown ).each_key do |url|
1421
+ next if DispRef2String::url_match?( url, @setup.no_referer )
1422
+ r << url
1423
+ end
1424
+ end
1425
+ r.uniq
1426
+ end
1427
+
1428
+ end
1429
+
1430
+ =begin
1431
+ === Tdiary::Plugin
1432
+ --- Tdiary::Plugin#configure_disp_referrer2
1433
+ このプラグインの設定のために使われるメソッドです。add_conf_procさ
1434
+ れます。
1435
+
1436
+ 以下は、このプラグインでオーバーライドされるtDiaryのメソッドです。
1437
+ --- Tdiary::Plugin#referer_of_today_long( diary, limit = 100 )
1438
+ --- Tdiary::Plugin#referer_of_today_short( diary, limit = 10 )
1439
+ =end
1440
+
1441
+ # for configuration interface
1442
+ add_conf_proc( 'disp_referrer2', Disp_referrer2_name, 'referer' ) do
1443
+ setup = DispRef2Setup.new( @conf, 100, true, @years, @mode )
1444
+ wwwif = DispRef2SetupIF.new( @cgi, setup, @conf, @mode )
1445
+ wwwif.show_html
1446
+ end
1447
+
1448
+ # for one-day diary
1449
+ def referer_of_today_long( diary, limit = 100 )
1450
+ return '' if bot?
1451
+ setup = DispRef2Setup.new( @conf, limit, true, nil, @mode )
1452
+ r = ''
1453
+ r << DispRef2Refs.new( diary, setup ).to_long_html( referer_today )
1454
+ r << DispRef2Refs.new( @referer_volatile, setup ).to_long_html( volatile_referer ) if @referer_volatile and latest_day?( diary )
1455
+ setup.cache_path.shrink
1456
+ r
1457
+ end
1458
+
1459
+ # for newest diary
1460
+ #alias dispref2_original_referer_of_today_short referer_of_today_short
1461
+ #def referer_of_today_short( diary, limit = 10 )
1462
+ # return '' if bot?
1463
+ # return dispref2_original_referer_of_today_short( diary, limit ) if @options.has_key?( 'disp_referrer2.short.only_normal' ) and not @options['disp_referrer2.short.only_normal']
1464
+ # setup = DispRef2Setup.new( @conf, limit, false, nil, @mode )
1465
+ # DispRef2Refs.new( diary, setup ).to_short_html
1466
+ #end
1467
+
1468
+ # we have to know the unknown urls at this moment in a secure diary
1469
+ if @conf.secure and (\
1470
+ ( @cgi.params['dr2.change_mode'] \
1471
+ and DispRef2SetupIF::RefList == @cgi.params['dr2.new_mode'][0] ) \
1472
+ or ( @cgi.params['dr2.current_mode'] \
1473
+ and DispRef2SetupIF::RefList == @cgi.params['dr2.current_mode'][0] ) )
1474
+ then
1475
+ setup = DispRef2Setup.new( @conf, 100, true, @mode )
1476
+ DispRef2Latest_cache = DispRef2Latest.new( @cgi, 'latest.rhtml', @conf, setup )
1477
+ else
1478
+ DispRef2Latest_cache = nil
1479
+ end
1480
+
1481
+ # Local Variables:
1482
+ # mode: ruby
1483
+ # indent-tabs-mode: t
1484
+ # tab-width: 3
1485
+ # ruby-indent-level: 3
1486
+ # End: