tdiary 3.2.2.20130507

Sign up to get free protection for your applications and to get access to all the features.
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,83 @@
1
+ =begin
2
+ = emptDiaryスタイル((-$Id: README.rd,v 1.6 2008-03-02 09:01:20 kazuhiko Exp $-))
3
+
4
+ == 概要
5
+ ((:emptDiaryスタイル:))((-emptDiaryは'empty line permitted tDiary style'
6
+ を省略したものです。長いねぇ。-))は、((:tDiaryス タイル:))に加えて、プラ
7
+ グインの引数に空白行を許すスタイルです。このスタイルを使うと、日記をセク
8
+ ションに分ける際に、<%と%>の間の空白行を無視してもらえます。
9
+
10
+ 日記にプログラムリストなどを書く場合に、リストが空白行を含むと、
11
+ ((:tDiaryス タイル:))ではリストの途中から次のセクションになってしまいま
12
+ す。((:emptDiaryスタイル:))では、プラグインの引数の中の空白を無視するの
13
+ で、例えばpre.rbプラグインのヒアドキュメントとしてプログラムリストを記述
14
+ することで、プログラムリストに何の変更もなく、日記にリストを書くことがで
15
+ きます。
16
+
17
+ ((:emptDiaryスタイル:))の最新版は、
18
+ ((<URL:http://zunda.freeshell.org/d/misc/style/emptdiary/emptdiary_style.rb>))から、
19
+ このファイルの最新版は、
20
+ ((<URL:http://zunda.freeshell.org/d/misc/style/emptdiary/README.rd>))か
21
+ ら、 入手できるでしょう。
22
+
23
+ また、pre.rbの最新版は、
24
+ ((<URL:http://zunda.freeshell.org/d/plugin/pre.rb>))から入手できるはずで
25
+ す。
26
+
27
+ == Usage
28
+ このスタイルを使うには、
29
+ (1) emptdiary_style.rb ファイルを、tdiary/ ディレクトリにコピーしてくだ
30
+ さい。tdiary/ ディレクトリは、tdiary.rb ファイルのあるトップディレク
31
+ トリの下にあります。
32
+ (2) tdiary.confに以下の行を書いてください。
33
+ @style = 'emptDiary'
34
+
35
+ 日記は、((:tDiaryスタイル:))とほとんど同じように書くことができます。
36
+ HOWTO-write-tDiary.htmlに書かれている通り、
37
+ * 空白無しで始まる行は、((:セクションタイトル:))になります。この行には、
38
+ ((:セクションアンカー:))が付きます。
39
+ * ((:セクションタイトル:))に続く行は、その((:セクション:))の内容になりま
40
+ す。
41
+ * 空白行によって、次の((:セクション:))と分かれます。
42
+ * ((:セクション:))の最初の行を空白や<で始めることによって、
43
+ ((:セクションタイトル:))の無い((:セクション:))を作ることができます。
44
+
45
+ ((:emptDiaryスタイル:))では、上記のルールに加えて、
46
+ * <%と%>に囲まれた空白行は、セクションを分割する際に無視されます。つまり、
47
+ あるセクションに、<%と%>に囲まれた空白行を含めることができます。
48
+ * 副作用として、日記には、<%と%>が同数、それぞれペアになって含まれていな
49
+ いといけません。
50
+
51
+ つまり、pre.rbを使って、
52
+ セクションタイトル
53
+ <p>セクションの内容</p>
54
+ <%=pre <<'_PRE'
55
+ #include <stdio.h>
56
+
57
+ /* 上記は空白行 */
58
+ int
59
+ main (int argc, char *argv[])
60
+ {
61
+ puts ("Hello world.");
62
+ }
63
+ _PRE
64
+ %>
65
+ などというセクションを作ることができます。不等号やアンパーサンドの実体参
66
+ 照への変換は、pre.rbで行われることに注意してください。
67
+
68
+ == 謝辞
69
+ このスタイルは、((:tDiaryスタイル:))のTdiarySectionとTdiaryDiaryをsuper
70
+ classとして実装されています。このようなフレキシブルなクラスを提供されて
71
+ いる、tdiary_style.rbの著者の方々に感謝します。
72
+
73
+ == 著作権
74
+ Copyright 2003 zunda <zunda at freeshell.org>
75
+
76
+ Permission is granted for use, copying, modification, distribution,
77
+ and distribution of modified versions of this work under the terms
78
+ of GPL version 2 or later.
79
+ =end
80
+ =begin ChangeLog
81
+ * Mon Feb 17, 2003 zunda <zunda at freeshell.org>
82
+ - first draft
83
+ =end
@@ -0,0 +1,78 @@
1
+ =begin
2
+ = emptDiary style((-$Id: README.rd.en,v 1.5 2003-11-06 09:43:46 zunda Exp $-))
3
+
4
+ == Summary
5
+ ((:emptDiary style:))((-emptDiary is an abbreviation for 'empty line
6
+ permitted tDiary style'. Very long, isn't it?-)) is an extension to the
7
+ ((:tDiary style:)) which allows plug-in arguments to have empty lines.
8
+ In short, this style preserves empty lines between <% and %> when
9
+ splltting the input into sections.
10
+
11
+ Sometimes, you would want to include your program list in your diary. In
12
+ the case, the ((:tDiary style:)) rule gets in the way: an empty line in
13
+ the program list makes a second section. ((:emptDiary style:)) permits
14
+ empty lines in the arguments of plug-ins. Thus, using e.g. pre.rb
15
+ plugin, you can show your program list without modifying your it.
16
+
17
+
18
+ The latest version of this style can be downloaded from
19
+ ((<URL:http://zunda.freeshell.org/d/misc/style/emptdiary/emptdiary_style.rb>)),
20
+ and the latest version of this document can be downloaded from
21
+ ((<URL:http://zunda.freeshell.org/d/misc/style/emptdiary/README.rd.en>)).
22
+
23
+ == Usage
24
+ If you want to use this style
25
+ (1) copy the file emptdiary_style.rb into the tdiary/ directory under
26
+ the top directory where tdiary.rb sits.
27
+ (2) add the following line into tdiary.conf:
28
+ @style = 'emptDiary'
29
+
30
+ You can write your diaries in almost the same manner as you have done
31
+ with the tDiary style as described in the file HOWTO-write-tDiary.html.
32
+ In short:
33
+ * A line beginning without a space becomes a ((:section title:)) with a
34
+ ((:section anchor:)),
35
+ * Lines following the ((:section title:)) become the body of the
36
+ ((:section:)),
37
+ * An empty line changes ((:section:))s, but
38
+ * You can create a ((:section:)) with a ((:section anchor:)) but a
39
+ ((:section title:)) with the first line beginning with a space.
40
+
41
+ ((:emptDiary style:)) adds the follwing rules:
42
+ * Empty lines between <% and %> are ignored when parsing your text into
43
+ sections. Thus, you can include empty lines between <% and %>.
44
+ As a side effect
45
+ * You have to keep <% and %>'s in the pairs.
46
+
47
+ Thus, using pre.rb plugin, you can write ((*A*)) section like:
48
+ title of the section
49
+ <p>Descriptino of the program</p>
50
+ <%=pre <<'_PRE'
51
+ #include <stdio.h>
52
+
53
+ /* above is an empty line */
54
+ int
55
+ main (int argc, char *argv[])
56
+ {
57
+ puts ("Hello world.");
58
+ }
59
+ _PRE
60
+ %>
61
+ Please note that the <, >, and & charactors are escaped by the pre plugin.
62
+
63
+ == Acknowledgements
64
+ This style is realized using TdiarySection and TdiaryDiary as
65
+ super-classes. I thank the authors of tdiary_style.rb for providing such
66
+ flexible classes.
67
+
68
+ == Copyright
69
+ Copyright 2003 zunda <zunda at freeshell.org>
70
+
71
+ Permission is granted for use, copying, modification, distribution,
72
+ and distribution of modified versions of this work under the terms
73
+ of GPL version 2 or later.
74
+ =end
75
+ =begin ChangeLog
76
+ * Mon Feb 17, 2003 zunda <zunda at freeshell.org>
77
+ - first draft
78
+ =end
@@ -0,0 +1,199 @@
1
+ # -*- coding: utf-8; -*-
2
+ =begin
3
+ = emptDiary style((-$Id: emptdiary_style.rb,v 1.11 2008-03-02 09:01:20 kazuhiko Exp $-))
4
+
5
+ == Summary
6
+ This style is an extension to the tDiary style which allows plug-in
7
+ arguments to have empty lines. In short, this style preserves empty
8
+ lines between <% and %> when splltting the input into sections.
9
+
10
+ The latest version of this file can be downloaded from
11
+ ((<URL:http://zunda.freeshell.org/d/misc/style/emptdiary/emptdiary_style.rb>)).
12
+
13
+ == Usage
14
+ if you want to use this style, add the following line into tdiary.conf:
15
+ @style = 'emptdiary'
16
+ Please see README.rd or README.rd.en for further explanation.
17
+
18
+ == Acknowledgements
19
+ This style is realized using TdiarySection and TdiaryDiary as
20
+ super-classes. I thank the authors of tdiary_style.rb for providing such
21
+ flexible classes.
22
+
23
+ EmptdiaryDiary::to_html4 and EmptdiaryDiary::to_chtml are copied from
24
+ tdiary_style.rb and slightly edited as follows:
25
+ * split_unless_plugin() is inserted before each collect()
26
+ * Regexp is chanegd from ^ to \A
27
+
28
+ == Copyright
29
+ Copyright 2003 zunda <zunda at freeshell.org>
30
+
31
+ Permission is granted for use, copying, modification, distribution,
32
+ and distribution of modified versions of this work under the terms
33
+ of GPL version 2 or later.
34
+ =end
35
+ =begin ChangeLog
36
+ * Mon Feb 17, 2003 zunda <zunda at freeshell.org>
37
+ - copied from zunda_style.rb, with which I used for preliminary tests.
38
+ * Wed Feb 26, 2003 zunda <zunda at freeshell.org>
39
+ - TDiary::Emptdiary::String class to handle strings better
40
+ (Thanks to Mitsuru Shimamura <mitsuru at diana.dti.ne.jp> for the
41
+ error report)
42
+ * Wed Dec 22, 2004 zunda <zunda at freeshell.org>
43
+ - override body_to_html
44
+ =end
45
+
46
+ require 'tdiary/style/tdiary_style'
47
+
48
+ =begin
49
+ == Classes and methods defined in this style
50
+ Please note that not all are documented.
51
+ =end
52
+
53
+ module TDiary
54
+ =begin
55
+ === TDiary::Emptdiary::EmptdiaryString < String
56
+ Extended String class not to divide things between <% and %>.
57
+
58
+ --- TDiary::Emptdiary::EmptdiaryString.split_unless_plugin ( delimiter = "\n\n" )
59
+ Returns an array of EmptdiaryString splitted at ((|delimiter|))
60
+ which is outside of <% and %> pairs. Specify ((|delimiter|)) as a
61
+ String showing a fragment of Regexp. This will be combined in a
62
+ Regexp like: /(#{delimiter)|<%|%>)/.
63
+ =end
64
+ class Emptdiary
65
+ class EmptdiaryString < String
66
+ def split_unless_plugin( delimiter = "\n\n+" )
67
+ result = Array.new
68
+ fragment = ''
69
+ nest = 0
70
+ remain = self.gsub(/.*?(#{delimiter}|<%|%>)/m) do
71
+ fragment += $&
72
+ case $1
73
+ when '<%'
74
+ nest += 1
75
+ when '%>'
76
+ nest -= 1
77
+ else
78
+ if nest == 0 then
79
+ fragment.sub!( /#{delimiter}\z/, '' )
80
+ result << Emptdiary::EmptdiaryString.new( fragment ) unless fragment.empty?
81
+ fragment = ''
82
+ end
83
+ end
84
+ ''
85
+ end
86
+ fragment += remain
87
+ fragment.sub!( /#{delimiter}\z/, '' )
88
+ result << Emptdiary::EmptdiaryString.new( fragment ) unless fragment.empty?
89
+ result
90
+ end
91
+ end
92
+ end
93
+
94
+ =begin
95
+ === TDiary::EmptdiartySection < TdiarySection
96
+ Almost the same as TdiarySection but usess split_unless_plugin instead
97
+ of split. initialize method is overrideen.
98
+ =end
99
+ class EmptdiarySection < TdiarySection
100
+ def initialize( fragment, author = nil )
101
+ @author = author
102
+ lines = fragment.split_unless_plugin( "\n+" )
103
+ if lines.size > 1 then
104
+ if /\A<</ =~ lines[0]
105
+ @subtitle = lines.shift.chomp.sub( /\A</, '' )
106
+ elsif /\A[  <]/u !~ lines[0]
107
+ @subtitle = lines.shift.chomp
108
+ end
109
+ end
110
+ @body = Emptdiary::EmptdiaryString.new( lines.join( "\n" ) )
111
+ @categories = get_categories
112
+ @stripped_subtitle = strip_subtitle
113
+ end
114
+
115
+ def body_to_html
116
+ html = ""
117
+ @body.split_unless_plugin( "\n" ).each do |p|
118
+ if /\A</ =~ p then
119
+ html << p
120
+ else
121
+ html << "<p>#{p}</p>"
122
+ end
123
+ end
124
+ html
125
+ end
126
+ end
127
+
128
+ =begin
129
+ === TDiary::EmptdiaryDiary < TdiaryDiary
130
+ Almost the same as TdiarySection but usess split_unless_plugin instead
131
+ of split. append method is overriden and makes EmptdiarySection with
132
+ body being an EmptdiaryString. Also, to_html4 and to_chtml methods are
133
+ overridden to split_unless_plugin before collect'ing the body of the
134
+ sections.
135
+ =end
136
+ class EmptdiaryDiary < TdiaryDiary
137
+ def style
138
+ 'emptdiary'
139
+ end
140
+
141
+ def append( body, author = nil )
142
+ Emptdiary::EmptdiaryString.new(body.gsub( /\r/, '' )).split_unless_plugin( "\n\n+" ).each do |fragment|
143
+ section = EmptdiarySection::new( fragment, author )
144
+ @sections << section if section
145
+ end
146
+ @last_modified = Time::now
147
+ self
148
+ end
149
+
150
+ def to_html4( opt )
151
+ r = ''
152
+ each_section do |section|
153
+ r << %Q[<div class="section">\n]
154
+ r << %Q[<%=section_enter_proc( Time::at( #{date.to_i} ) )%>\n]
155
+ if section.subtitle then
156
+ r << %Q[<h3><%= subtitle_proc( Time::at( #{date.to_i} ), #{section.subtitle.dump.gsub( /%/, '\\\\045' )} ) %></h3>\n]
157
+ end
158
+ if /\A</ =~ section.body then
159
+ r << %Q[#{section.body}]
160
+ elsif section.subtitle
161
+ r << %Q[<p>#{section.body.split_unless_plugin( "\n+" ).collect{|l|l.chomp.sub( /\A[  ]/u, '')}.join( "</p>\n<p>" )}</p>]
162
+ else
163
+ r << %Q[<p><%= subtitle_proc( Time::at( #{date.to_i} ), nil ) %>]
164
+ r << %Q[#{section.body.split_unless_plugin( "\n+" ).collect{|l|l.chomp.sub( /\A[  ]/u, '' )}.join( "</p>\n<p>" )}</p>]
165
+ end
166
+ r << %Q[<%=section_leave_proc( Time::at( #{date.to_i} ) )%>\n]
167
+ r << %Q[</div>]
168
+ end
169
+ r
170
+ end
171
+
172
+ def to_chtml( opt )
173
+ r = ''
174
+ each_section do |section|
175
+ r << %Q[<%=section_enter_proc( Time::at( #{date.to_i} ) )%>\n]
176
+ if section.subtitle then
177
+ r << %Q[<H3><%= subtitle_proc( Time::at( #{date.to_i} ), #{section.subtitle.dump.gsub( /%/, '\\\\045' )} ) %></H3>\n]
178
+ end
179
+ if /\A</ =~ section.body then
180
+ r << section.body
181
+ elsif section.subtitle
182
+ r << %Q[<P>#{section.body.split_unless_plugin( "\n+" ).collect{|l|l.chomp.sub( /\A[  ]/u, '' )}.join( "</P>\n<P>" )}</P>]
183
+ else
184
+ r << %Q[<P><%= subtitle_proc( Time::at( #{date.to_i} ), nil ) %>]
185
+ r << %Q[#{section.body.split_unless_plugin( "\n+" ).collect{|l|l.chomp.sub( /\A[  ]/u, '' )}.join( "</P>\n<P>" )}</P>]
186
+ end
187
+ r << %Q[<%=section_leave_proc( Time::at( #{date.to_i} ) )%>\n]
188
+ end
189
+ r
190
+ end
191
+ end
192
+ end
193
+
194
+ # Local Variables:
195
+ # mode: ruby
196
+ # indent-tabs-mode: t
197
+ # tab-width: 3
198
+ # ruby-indent-level: 3
199
+ # End:
@@ -0,0 +1,83 @@
1
+ =begin
2
+ = etDiaryスタイル
3
+
4
+ == etDiaryスタイルとは
5
+ ((<tDiary|URL:http://www.tdiary.org/>)) の変種である((<etDiary|URL:http://www.enbug.org/etdiary.html>)) の書式をtDiary本体で利用するためのスタイルです.
6
+
7
+ 基本的にはtDiaryスタイルと同じくHTMLをベースとした書式ですが, HTMLタグを意識せずとも
8
+ だいたい見た目の通りになる
9
+ という違いがあります.
10
+
11
+ == 使用準備
12
+ このスタイルを使うには,
13
+
14
+ (1) etdiary_style.rb ファイルを、tdiary/ ディレクトリにコピーしてくだ
15
+ さい。tdiary/ ディレクトリは、tdiary.rb ファイルのあるトップディレク
16
+ トリの下にあります。
17
+ (2) tdiary.confに以下の行を書いてください。
18
+ @style = 'etdiary'
19
+
20
+ 正しく設定されると, 更新フォームに
21
+ 本文(etdiaryスタイル):
22
+ と表示されます.
23
+
24
+ == etDiaryスタイルの使い方
25
+ etDiaryスタイルは, 行という単位はあまり意味がありません. つまり, 任意の個所に改行が入れられます. 空行(連続した改行)が段落の境界になります. たとえば
26
+
27
+ ほげほげ
28
+ ふがふが
29
+
30
+ ふがほげ
31
+ ほげら
32
+
33
+ は,
34
+
35
+ <p>
36
+ ほげほげ
37
+ ふがふが
38
+ </p>
39
+
40
+ <p>
41
+ ふがほげ
42
+ ほげら
43
+ </p>
44
+
45
+ と変換されます.
46
+
47
+ サブタイトルは明示的に「<<」と「>>」で囲みます. たとえば
48
+
49
+ <<サブタイトル>>
50
+ 本文
51
+
52
+ は,
53
+
54
+ <h3>サブタイトル</h3>
55
+ <p>
56
+ 本文
57
+ </p>
58
+
59
+ と変換されます.
60
+
61
+ == 書式のルール
62
+
63
+ * サブタイトルは「<<」と「>>」で囲む.
64
+ * <h3>ではなく<h4>で囲みたいときは「<<<>」と「>>」で囲む.
65
+ * サブタイトルの中身がない場合, つまり, 「<<>>」と書かれた場合, サブタイトルなしで新しいセクションを開始する.
66
+ * 「<<<>>>」と書かれた場合もサブタイトルなしで新しいセクションを開始する. ただし, アンカーリンクは生成しない.
67
+ * 二つ以上の改行は段落の区切りとなる.
68
+ * 段落の初めが「<」の場合, その段落は整形対象外となる. 終了タグがその段落内に含まれない場合, 終了タグが存在する段落まで, 空行を残したまま処理される. これが嫌なら, スペースを先頭に入れると良い.
69
+ * 一般的なHTML同様, "<", ">", "&" はそれぞれ "&lt;", "&gt;", "&amp;" と書く必要がある. ただし, 「<pre>」ではじめた段落に関してはこの限りではない.
70
+
71
+ == 謝辞
72
+ ただただしさんをはじめとする, tDiaryおよびスタイル変更機能を実装いただきました皆様に感謝致します.
73
+
74
+ Yoshinori K. Okuji さんが tDiary-1.4.3 をベースに etDiary を実装され, etDiary フォーマットを考案されることがなかったならば, このスタイルが実装されることはありませんでした. また, 当文書も, Okuji さんのページをほぼそのまま写させていただきました. この文書を書けるのも, ひとえに Okuji さんのおかげです. ここに感謝の意を表します.
75
+
76
+ その他, etDiary スタイルを利用してくださっている皆様, ご意見頂戴しました皆様に, 御礼申し上げます.
77
+
78
+ == 著作権
79
+ Copyright 2003 simm <simm at fan.jp>
80
+
81
+ Permission is granted for use, copying, modification, distribution, and distribution of modified versions of this work under the terms of GPL version 2 or later.
82
+
83
+ =end
@@ -0,0 +1,446 @@
1
+ # -*- coding: utf-8; -*-
2
+ #
3
+ # etdiary_style.rb: tDiary style class for etDiary format.
4
+ # $Id: etdiary_style.rb,v 1.20 2008-03-02 09:01:20 kazuhiko Exp $
5
+ #
6
+ # if you want to use this style, add @style into tdiary.conf below:
7
+ #
8
+ # @style = 'etDiary'
9
+ #
10
+ module TDiary
11
+ class EtdiarySection
12
+ attr_reader :subtitle, :bodies, :author, :anchor_type
13
+ attr_reader :categories, :stripped_subtitle
14
+
15
+ alias :subtitle_to_html :subtitle
16
+ alias :stripped_subtitle_to_html :stripped_subtitle
17
+
18
+ def initialize( title, author = nil )
19
+ @subtitle = title
20
+ if @subtitle then
21
+ if "" == @subtitle then
22
+ @subtitle = nil
23
+ @anchor_type = :P
24
+ elsif "<>" == @subtitle then
25
+ @subtitle = nil
26
+ @anchor_type = :A
27
+ elsif /^<>/ =~ @subtitle then
28
+ @subtitle = @subtitle[2..-1]
29
+ @anchor_type = :H4
30
+ else
31
+ @anchor_type = :H3
32
+ end
33
+ else
34
+ @subtitle = nil
35
+ @anchor_type = nil
36
+ end
37
+ @bodies = []
38
+ @categories = get_categories
39
+ @stripped_subtitle = strip_subtitle
40
+ end
41
+
42
+ def subtitle=(subtitle)
43
+ cat_str = ""
44
+ @categories.each {|cat|
45
+ cat_str << "[#{cat}]"
46
+ }
47
+ cat_str << " " unless cat_str.empty?
48
+ @subtitle = subtitle
49
+ if @subtitle then
50
+ if "" == @subtitle then
51
+ @subtitle = nil
52
+ @anchor_type = :P
53
+ elsif "<>" == @subtitle then
54
+ @subtitle = nil
55
+ @anchor_type = :A
56
+ elsif /^<>/ =~ @subtitle then
57
+ @subtitle = @subtitle[2..-1]
58
+ @anchor_type = :H4
59
+ else
60
+ @subtitle = cat_str + subtitle
61
+ @anchor_type = :H3
62
+ end
63
+ else
64
+ @subtitle = nil
65
+ @anchor_type = nil
66
+ end
67
+ @stripped_subtitle = strip_subtitle
68
+ end
69
+
70
+ def body=(str)
71
+ @bodies = str.split(/\n/)
72
+ end
73
+
74
+ def categories=(categories)
75
+ @categories = categories
76
+ cat_str = ""
77
+ categories.each {|cat|
78
+ cat_str << "[#{cat}]"
79
+ }
80
+ @subtitle = @subtitle ? (cat_str + @stripped_subtitle) : nil
81
+ @stripped_subtitle = strip_subtitle
82
+ end
83
+
84
+ def set_body( bodies )
85
+ @bodies = bodies
86
+ end
87
+
88
+ def body
89
+ if @bodies then
90
+ @bodies.join('')
91
+ else
92
+ ''
93
+ end
94
+ end
95
+
96
+ def body_to_html
97
+ if @bodies then
98
+ r = ''
99
+ in_p = false
100
+ @bodies.join('').each_line("\n\n") do |p|
101
+ if /\A</ !~ p then
102
+ r << "<p>#{p.chomp}</p>\n"
103
+ else
104
+ r << p
105
+ end
106
+ end
107
+ r
108
+ else
109
+ ''
110
+ end
111
+ end
112
+
113
+ def << (string)
114
+ @bodies << string
115
+ end
116
+
117
+ def to_src
118
+ s = ''
119
+ case @anchor_type
120
+ when :A
121
+ s << "<<<>>>\n"
122
+ when :P
123
+ s << "<<>>\n"
124
+ when :H4
125
+ s << "[#{@author}]" if @author
126
+ s << "<<<>" + @subtitle + ">>\n"
127
+ when :H3
128
+ s << "[#{@author}]" if @author
129
+ s << "<<" + @subtitle + ">>\n"
130
+ end
131
+ s + ( if "" != body then body else "\n" end )
132
+ end
133
+
134
+ def to_s
135
+ "subtitle=#{@subtitle}, body=#{body}"
136
+ end
137
+
138
+ def get_categories
139
+ return [] unless @subtitle
140
+ cat = /^(\[(.*?)\])+/.match(@subtitle).to_a[0]
141
+ return [] unless cat
142
+ cat.scan(/\[(.*?)\]/).collect do |c|
143
+ c[0].split(/,/)
144
+ end.flatten
145
+ end
146
+
147
+ def categorized_subtitle
148
+ return "" unless @subtitle
149
+ cat = /^(\[(.*?)\])+/.match(@subtitle).to_a[0]
150
+ return @stripped_subtitle unless cat
151
+ cat.gsub(/\[(.*?)\]/) do
152
+ $1.split(/,/).collect do |c|
153
+ %Q|<%= category_anchor("#{c}") %>|
154
+ end.join
155
+ end + @stripped_subtitle
156
+ end
157
+
158
+ def strip_subtitle
159
+ return nil unless @subtitle
160
+ @subtitle.sub(/^(\[(.*?)\])+\s*/,'')
161
+ end
162
+ end
163
+
164
+ class EtHtml4Factory
165
+ def initialize( opt, idx = 1 )
166
+ @opt = opt
167
+ @idx = idx
168
+ end
169
+ def title( date, fragment )
170
+ return nil if nil == fragment.anchor_type
171
+ name = 'p%02d' % @idx
172
+ @idx += 1
173
+ if :A == fragment.anchor_type then
174
+ if @opt['anchor'] then
175
+ return "<a name=\"#{name}\"></a>"
176
+ else
177
+ return nil
178
+ end
179
+ end
180
+
181
+ r = ''
182
+ if @opt['index']
183
+ if fragment.subtitle
184
+ r << %Q[<%= subtitle_proc( Time::at( #{date.to_i} ), #{fragment.subtitle.dump.gsub( /%/, '\\\\045' )} ) %>]
185
+ else
186
+ r << %Q[<%= subtitle_proc( Time::at( #{date.to_i} ), nil ) %>]
187
+ end
188
+ end
189
+
190
+ case fragment.anchor_type
191
+ when :P
192
+ r
193
+ when :H4
194
+ "<h4>" + r + ":</h4>\n"
195
+ when :H3
196
+ "<h3>" + r + "</h3>\n"
197
+ end
198
+ end
199
+ def section_start( date )
200
+ %Q[<div class="section">\n<%=section_enter_proc( Time::at( #{date.to_i} ) )%>\n]
201
+ end
202
+ def section_end( date )
203
+ "<%=section_leave_proc( Time::at( #{date.to_i} ) )%>\n</div>\n"
204
+ end
205
+ def block_title?( fragment )
206
+ case fragment.anchor_type
207
+ when :H3, :H4
208
+ true
209
+ else
210
+ false
211
+ end
212
+ end
213
+ def p_start
214
+ "<p>"
215
+ end
216
+ def p_end
217
+ "</p>"
218
+ end
219
+ def pre_start
220
+ "<pre>"
221
+ end
222
+ def pre_end
223
+ "</pre>"
224
+ end
225
+ end
226
+
227
+ class EtCHtmlFactory
228
+ def initialize( opt, idx = 1 )
229
+ @opt = opt
230
+ @idx = idx
231
+ end
232
+ def title( date, fragment )
233
+ return nil if nil == fragment.anchor_type
234
+ name = 'p%02d' % @idx
235
+ return "<A NAME=\"#{name}\"></A>" if :A == fragment.anchor_type
236
+ r = ""
237
+ if fragment.subtitle
238
+ r << %Q[<%= subtitle_proc( Time::at( #{date.to_i} ), #{fragment.subtitle.dump.gsub( /%/, '\\\\045' )} ) %>]
239
+ else
240
+ r << %Q[<%= subtitle_proc( Time::at( #{date.to_i} ), nil ) %>]
241
+ end
242
+ @idx += 1
243
+ case fragment.anchor_type
244
+ when :P
245
+ r
246
+ when :H4
247
+ r + ": "
248
+ when :H3
249
+ "<H3>" + r + "</H3>\n"
250
+ end
251
+ end
252
+ def section_start( date )
253
+ "<%=section_enter_proc( Time::at( #{date.to_i} ) )%>\n"
254
+ end
255
+ def section_end( date )
256
+ "<%=section_leave_proc( Time::at( #{date.to_i} ) )%>\n"
257
+ end
258
+ def block_title?( fragment )
259
+ case fragment.anchor_type
260
+ when :H3
261
+ true
262
+ else
263
+ false
264
+ end
265
+ end
266
+ def p_start
267
+ "<P>"
268
+ end
269
+ def p_end
270
+ "</P>"
271
+ end
272
+ def pre_start
273
+ "<PRE>"
274
+ end
275
+ def pre_end
276
+ "</PRE>"
277
+ end
278
+ end
279
+
280
+ class EtdiaryDiary
281
+ include DiaryBase
282
+ include CategorizableDiary
283
+
284
+ TAG_BEG_REGEXP = /\A<([A-Za-z][0-9A-Za-z]*)([^>]*)>([^\r]*)\z/
285
+ TAG_END_REGEXP = /\A([^\r]*)<\/([A-Za-z][0-9A-Za-z]*)>\n*\z/
286
+ PRE_REGEXP = /\A<[Pp][Rr][Ee][^>]*>([^\r]*)<\/[Pp][Rr][Ee]>\n*\z/
287
+ TITLE_REGEXP = /\A<<([^\r]*?)>>[^>]/
288
+
289
+ def initialize( date, title, body, modified = Time::now )
290
+ init_diary
291
+ set_date( date )
292
+ set_title( title )
293
+ @sections = []
294
+ if body != '' then
295
+ append( body )
296
+ end
297
+ @last_modified = modified
298
+ end
299
+
300
+ def style
301
+ 'etDiary'
302
+ end
303
+
304
+ def replace( date, title, body )
305
+ set_date( date )
306
+ set_title( title )
307
+ @sections = []
308
+ append( body )
309
+ end
310
+
311
+ def append( body, author = nil )
312
+ section = nil
313
+ buffer = nil
314
+ tag_kind = nil
315
+ body.gsub(/\r/,'').sub(/\A\n*/,'').sub(/\n*\z/,"\n\n").each_line('') do |fragment|
316
+ if buffer and TAG_END_REGEXP =~ fragment and $2.downcase == tag_kind then
317
+ section << buffer + fragment.sub(/\n*\z/,"\n\n")
318
+ tag_kind = nil
319
+ buffer = nil
320
+ elsif buffer then
321
+ buffer << fragment
322
+ else
323
+ if section
324
+ @sections << section
325
+ end
326
+ title = TITLE_REGEXP.match(fragment+"\n").to_a[1]
327
+ section = EtdiarySection::new( title, author )
328
+ fragment = fragment[ title.length + 4 .. -1 ].sub(/\A\n/,'') if title
329
+ if TAG_BEG_REGEXP =~ fragment then
330
+ tag_kind = $1.downcase
331
+ if TAG_END_REGEXP =~ fragment and $2.downcase == tag_kind then
332
+ section << fragment.sub(/\n*\z/,"\n\n")
333
+ tag_kind = nil
334
+ else
335
+ buffer = fragment
336
+ end
337
+ else
338
+ section << fragment
339
+ end
340
+ end
341
+ end
342
+ if buffer
343
+ section << buffer << "</#{tag_kind}>(tDiary warning: tag &lt;#{tag_kind}&gt; is not terminated.)"
344
+ end
345
+ if section
346
+ @sections << section
347
+ end
348
+ @last_modified = Time::now
349
+ self
350
+ end
351
+
352
+ def each_paragraph
353
+ @sections.each do |fragment|
354
+ yield fragment
355
+ end
356
+ end
357
+
358
+ def each_section
359
+ section = nil
360
+ each_paragraph do |fragment|
361
+ if section and nil == fragment.anchor_type then
362
+ section << fragment.body
363
+ else
364
+ yield section if section and section.anchor_type
365
+ section = fragment.dup
366
+ section.set_body( [ fragment.body ] )
367
+ end
368
+ end
369
+ yield section if section
370
+ end
371
+
372
+ def add_section(subtitle, body)
373
+ sec = EtdiarySection::new( '' )
374
+ sec.subtitle = subtitle
375
+ sec.body = body
376
+ @sections << sec
377
+ @sections.size
378
+ end
379
+
380
+ def delete_section(index)
381
+ @sections.delete_at(index - 1)
382
+ end
383
+
384
+ def to_src
385
+ src = ''
386
+ each_paragraph do |fragment|
387
+ src << fragment.to_src
388
+ end
389
+ src.sub(/\n*\z/,"\n")
390
+ end
391
+
392
+ def to_html_section(section, factory)
393
+ r = ''
394
+ s = if section.bodies then section.body else nil end
395
+ t = factory.title( date, section )
396
+ if factory.block_title?(section) then
397
+ r << t if t
398
+ t = nil
399
+ end
400
+ if s && PRE_REGEXP =~ s then
401
+ r << factory.p_start << t << factory.p_end << "\n" if t
402
+ r << factory.pre_start
403
+ r << $1.gsub(/&/,"&amp;").gsub(/</,"&lt;").gsub(/>/,"&gt;")
404
+ r << factory.pre_end << "\n"
405
+ elsif s && /\A</ =~ s then
406
+ r << factory.p_start << t << factory.p_end << "\n" if t
407
+ r << s.sub( /\n*\z/, "\n" )
408
+ else
409
+ r << factory.p_start if t || s
410
+ r << t if t
411
+ r << s.sub(/\A\n*/,"\n").sub(/\n*\z/, "\n") if s
412
+ r << factory.p_end << "\n" if t || s
413
+ end
414
+ r
415
+ end
416
+
417
+ def to_html( opt = {'anchor' => true, 'index' => true}, mode = :HTML )
418
+ case mode
419
+ when :CHTML
420
+ f = EtCHtmlFactory::new(opt)
421
+ else
422
+ f = EtHtml4Factory::new(opt)
423
+ end
424
+ r = f.section_start( date )
425
+ each_paragraph do |fragment|
426
+ if :H3 == fragment.anchor_type and r != f.section_start( date ) then
427
+ r << f.section_end( date ) << "\n" << f.section_start( date )
428
+ end
429
+ r << to_html_section(fragment,f)
430
+ end
431
+ r + f.section_end( date )
432
+ end
433
+
434
+ def to_s
435
+ "date=#{date.strftime('%Y%m%d')}, title=#{title}, " \
436
+ + "body=[#{@sections.join('][')}]"
437
+ end
438
+ end
439
+ end
440
+
441
+ # Local Variables:
442
+ # mode: ruby
443
+ # indent-tabs-mode: t
444
+ # tab-width: 3
445
+ # ruby-indent-level: 3
446
+ # End: