qwik2md 0.1.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (335) hide show
  1. checksums.yaml +7 -0
  2. data/.gitignore +9 -0
  3. data/.travis.yml +4 -0
  4. data/Gemfile +4 -0
  5. data/README.md +36 -0
  6. data/Rakefile +10 -0
  7. data/bin/console +14 -0
  8. data/bin/setup +8 -0
  9. data/exe/qwik2md +17 -0
  10. data/lib/qwik2md/version.rb +3 -0
  11. data/lib/qwik2md.rb +39 -0
  12. data/qwik2md.gemspec +30 -0
  13. data/vendor/qwik/AUTHORS +10 -0
  14. data/vendor/qwik/COPYING +340 -0
  15. data/vendor/qwik/COPYRIGHT +346 -0
  16. data/vendor/qwik/lib/qwik/Makefile +63 -0
  17. data/vendor/qwik/lib/qwik/Rakefile +17 -0
  18. data/vendor/qwik/lib/qwik/act-aa.rb +83 -0
  19. data/vendor/qwik/lib/qwik/act-archive.rb +386 -0
  20. data/vendor/qwik/lib/qwik/act-attach.rb +304 -0
  21. data/vendor/qwik/lib/qwik/act-backup.rb +236 -0
  22. data/vendor/qwik/lib/qwik/act-basic.rb +325 -0
  23. data/vendor/qwik/lib/qwik/act-book.rb +161 -0
  24. data/vendor/qwik/lib/qwik/act-calc.rb +371 -0
  25. data/vendor/qwik/lib/qwik/act-charset.rb +251 -0
  26. data/vendor/qwik/lib/qwik/act-christel.rb +112 -0
  27. data/vendor/qwik/lib/qwik/act-chronology.rb +149 -0
  28. data/vendor/qwik/lib/qwik/act-code.rb +155 -0
  29. data/vendor/qwik/lib/qwik/act-comment.rb +554 -0
  30. data/vendor/qwik/lib/qwik/act-config.rb +49 -0
  31. data/vendor/qwik/lib/qwik/act-counter.rb +125 -0
  32. data/vendor/qwik/lib/qwik/act-day.rb +96 -0
  33. data/vendor/qwik/lib/qwik/act-describe.rb +135 -0
  34. data/vendor/qwik/lib/qwik/act-diary.rb +109 -0
  35. data/vendor/qwik/lib/qwik/act-edit.rb +317 -0
  36. data/vendor/qwik/lib/qwik/act-embed-html.rb +296 -0
  37. data/vendor/qwik/lib/qwik/act-emode.rb +150 -0
  38. data/vendor/qwik/lib/qwik/act-event.rb +187 -0
  39. data/vendor/qwik/lib/qwik/act-file.rb +303 -0
  40. data/vendor/qwik/lib/qwik/act-files.rb +771 -0
  41. data/vendor/qwik/lib/qwik/act-getpass.rb +295 -0
  42. data/vendor/qwik/lib/qwik/act-history.rb +136 -0
  43. data/vendor/qwik/lib/qwik/act-html.rb +204 -0
  44. data/vendor/qwik/lib/qwik/act-httpauth.rb +147 -0
  45. data/vendor/qwik/lib/qwik/act-include.rb +142 -0
  46. data/vendor/qwik/lib/qwik/act-interwiki.rb +189 -0
  47. data/vendor/qwik/lib/qwik/act-isearch.rb +109 -0
  48. data/vendor/qwik/lib/qwik/act-keywords.rb +137 -0
  49. data/vendor/qwik/lib/qwik/act-lang.rb +81 -0
  50. data/vendor/qwik/lib/qwik/act-license.rb +63 -0
  51. data/vendor/qwik/lib/qwik/act-list.rb +287 -0
  52. data/vendor/qwik/lib/qwik/act-login.rb +410 -0
  53. data/vendor/qwik/lib/qwik/act-logout.rb +60 -0
  54. data/vendor/qwik/lib/qwik/act-mail.rb +159 -0
  55. data/vendor/qwik/lib/qwik/act-map.rb +292 -0
  56. data/vendor/qwik/lib/qwik/act-md5.rb +42 -0
  57. data/vendor/qwik/lib/qwik/act-mdlb.rb +741 -0
  58. data/vendor/qwik/lib/qwik/act-media.rb +416 -0
  59. data/vendor/qwik/lib/qwik/act-member.rb +157 -0
  60. data/vendor/qwik/lib/qwik/act-menu.rb +142 -0
  61. data/vendor/qwik/lib/qwik/act-metadata.rb +323 -0
  62. data/vendor/qwik/lib/qwik/act-mlsubmitform.rb +49 -0
  63. data/vendor/qwik/lib/qwik/act-monitor.rb +167 -0
  64. data/vendor/qwik/lib/qwik/act-new.rb +418 -0
  65. data/vendor/qwik/lib/qwik/act-pagelist.rb +248 -0
  66. data/vendor/qwik/lib/qwik/act-password.rb +145 -0
  67. data/vendor/qwik/lib/qwik/act-plan.rb +210 -0
  68. data/vendor/qwik/lib/qwik/act-povray.rb +230 -0
  69. data/vendor/qwik/lib/qwik/act-presen.rb +380 -0
  70. data/vendor/qwik/lib/qwik/act-redirect.rb +133 -0
  71. data/vendor/qwik/lib/qwik/act-ring.rb +1071 -0
  72. data/vendor/qwik/lib/qwik/act-rrefs.rb +255 -0
  73. data/vendor/qwik/lib/qwik/act-ruby.rb +116 -0
  74. data/vendor/qwik/lib/qwik/act-sample.rb +170 -0
  75. data/vendor/qwik/lib/qwik/act-save.rb +295 -0
  76. data/vendor/qwik/lib/qwik/act-schedule.rb +374 -0
  77. data/vendor/qwik/lib/qwik/act-search.rb +180 -0
  78. data/vendor/qwik/lib/qwik/act-searchwords.rb +51 -0
  79. data/vendor/qwik/lib/qwik/act-sendpass.rb +83 -0
  80. data/vendor/qwik/lib/qwik/act-site.rb +89 -0
  81. data/vendor/qwik/lib/qwik/act-sitebackup.rb +419 -0
  82. data/vendor/qwik/lib/qwik/act-sitelog.rb +118 -0
  83. data/vendor/qwik/lib/qwik/act-smil.rb +299 -0
  84. data/vendor/qwik/lib/qwik/act-status.rb +220 -0
  85. data/vendor/qwik/lib/qwik/act-style.rb +608 -0
  86. data/vendor/qwik/lib/qwik/act-table.rb +263 -0
  87. data/vendor/qwik/lib/qwik/act-tableform.rb +241 -0
  88. data/vendor/qwik/lib/qwik/act-tag.rb +103 -0
  89. data/vendor/qwik/lib/qwik/act-text.rb +70 -0
  90. data/vendor/qwik/lib/qwik/act-textarea.rb +164 -0
  91. data/vendor/qwik/lib/qwik/act-theme.rb +346 -0
  92. data/vendor/qwik/lib/qwik/act-toc.rb +112 -0
  93. data/vendor/qwik/lib/qwik/act-typekey.rb +198 -0
  94. data/vendor/qwik/lib/qwik/act-under-const.rb +94 -0
  95. data/vendor/qwik/lib/qwik/act-webservice.rb +321 -0
  96. data/vendor/qwik/lib/qwik/act-wema.rb +558 -0
  97. data/vendor/qwik/lib/qwik/act-wysiwyg.rb +238 -0
  98. data/vendor/qwik/lib/qwik/action.rb +325 -0
  99. data/vendor/qwik/lib/qwik/autoreload.rb +98 -0
  100. data/vendor/qwik/lib/qwik/bench-bench.rb +28 -0
  101. data/vendor/qwik/lib/qwik/bench-emode.rb +47 -0
  102. data/vendor/qwik/lib/qwik/bench-format-xml.rb +70 -0
  103. data/vendor/qwik/lib/qwik/bench-large-table.rb +62 -0
  104. data/vendor/qwik/lib/qwik/bench-md5.rb +14 -0
  105. data/vendor/qwik/lib/qwik/bench-module-session.rb +19 -0
  106. data/vendor/qwik/lib/qwik/bench-page.rb +50 -0
  107. data/vendor/qwik/lib/qwik/bench-s-md5.rb +28 -0
  108. data/vendor/qwik/lib/qwik/bench-session.rb +25 -0
  109. data/vendor/qwik/lib/qwik/bench-textformat.rb +31 -0
  110. data/vendor/qwik/lib/qwik/catalog-factory.rb +91 -0
  111. data/vendor/qwik/lib/qwik/catalog-ja.rb +479 -0
  112. data/vendor/qwik/lib/qwik/catalog-ml-ja.rb +145 -0
  113. data/vendor/qwik/lib/qwik/check-act-monitor.rb +112 -0
  114. data/vendor/qwik/lib/qwik/check-act-monitor2.rb +46 -0
  115. data/vendor/qwik/lib/qwik/check-act-theme.rb +27 -0
  116. data/vendor/qwik/lib/qwik/check-event.rb +112 -0
  117. data/vendor/qwik/lib/qwik/check-event2.rb +55 -0
  118. data/vendor/qwik/lib/qwik/check-htree-rexml.rb +77 -0
  119. data/vendor/qwik/lib/qwik/check-htree.rb +51 -0
  120. data/vendor/qwik/lib/qwik/check-libxml.rb +135 -0
  121. data/vendor/qwik/lib/qwik/check-many-pages.rb +47 -0
  122. data/vendor/qwik/lib/qwik/check-monitor.rb +33 -0
  123. data/vendor/qwik/lib/qwik/check-observer.rb +67 -0
  124. data/vendor/qwik/lib/qwik/check-server.rb +61 -0
  125. data/vendor/qwik/lib/qwik/check-uuencode.rb +33 -0
  126. data/vendor/qwik/lib/qwik/check-webdav.rb +65 -0
  127. data/vendor/qwik/lib/qwik/check-xml-xpath.rb +27 -0
  128. data/vendor/qwik/lib/qwik/common-backtrace.rb +94 -0
  129. data/vendor/qwik/lib/qwik/common-basic.rb +111 -0
  130. data/vendor/qwik/lib/qwik/common-condition.rb +142 -0
  131. data/vendor/qwik/lib/qwik/common-error.rb +48 -0
  132. data/vendor/qwik/lib/qwik/common-gettext.rb +50 -0
  133. data/vendor/qwik/lib/qwik/common-javascript.rb +45 -0
  134. data/vendor/qwik/lib/qwik/common-notice.rb +132 -0
  135. data/vendor/qwik/lib/qwik/common-plain.rb +105 -0
  136. data/vendor/qwik/lib/qwik/common-plugin.rb +111 -0
  137. data/vendor/qwik/lib/qwik/common-res.rb +76 -0
  138. data/vendor/qwik/lib/qwik/common-resolve.rb +92 -0
  139. data/vendor/qwik/lib/qwik/common-send.rb +171 -0
  140. data/vendor/qwik/lib/qwik/common-session.rb +139 -0
  141. data/vendor/qwik/lib/qwik/common-surface.rb +261 -0
  142. data/vendor/qwik/lib/qwik/common-url.rb +90 -0
  143. data/vendor/qwik/lib/qwik/compat/Makefile +12 -0
  144. data/vendor/qwik/lib/qwik/compat/add_load_path.rb +1 -0
  145. data/vendor/qwik/lib/qwik/config.rb +299 -0
  146. data/vendor/qwik/lib/qwik/db-b-backup.rb +142 -0
  147. data/vendor/qwik/lib/qwik/db-backup.rb +184 -0
  148. data/vendor/qwik/lib/qwik/db-berkeley.rb +306 -0
  149. data/vendor/qwik/lib/qwik/db-filesystem.rb +305 -0
  150. data/vendor/qwik/lib/qwik/db-indexer.rb +154 -0
  151. data/vendor/qwik/lib/qwik/db-searchwords.rb +238 -0
  152. data/vendor/qwik/lib/qwik/description-ja.rb +267 -0
  153. data/vendor/qwik/lib/qwik/description.rb +256 -0
  154. data/vendor/qwik/lib/qwik/dev-add-copyright.rb +23 -0
  155. data/vendor/qwik/lib/qwik/dev-backup.rb +24 -0
  156. data/vendor/qwik/lib/qwik/dev-bench.rb +175 -0
  157. data/vendor/qwik/lib/qwik/dev-calctime.rb +52 -0
  158. data/vendor/qwik/lib/qwik/dev-css-compressor.rb +60 -0
  159. data/vendor/qwik/lib/qwik/dev-extract-catalog.rb +102 -0
  160. data/vendor/qwik/lib/qwik/dev-js-compressor.rb +73 -0
  161. data/vendor/qwik/lib/qwik/dev-release.rb +235 -0
  162. data/vendor/qwik/lib/qwik/dev-replace.rb +353 -0
  163. data/vendor/qwik/lib/qwik/dev-sendmail.rb +25 -0
  164. data/vendor/qwik/lib/qwik/farm.rb +283 -0
  165. data/vendor/qwik/lib/qwik/gettext.rb +56 -0
  166. data/vendor/qwik/lib/qwik/group-cond.rb +157 -0
  167. data/vendor/qwik/lib/qwik/group-config.rb +247 -0
  168. data/vendor/qwik/lib/qwik/group-confirm.rb +147 -0
  169. data/vendor/qwik/lib/qwik/group-db.rb +326 -0
  170. data/vendor/qwik/lib/qwik/group-mail.rb +195 -0
  171. data/vendor/qwik/lib/qwik/group-member.rb +307 -0
  172. data/vendor/qwik/lib/qwik/group-sendmail.rb +231 -0
  173. data/vendor/qwik/lib/qwik/group-site.rb +374 -0
  174. data/vendor/qwik/lib/qwik/group-sweep.rb +63 -0
  175. data/vendor/qwik/lib/qwik/group.rb +157 -0
  176. data/vendor/qwik/lib/qwik/helper.rb +6 -0
  177. data/vendor/qwik/lib/qwik/html-generator.rb +104 -0
  178. data/vendor/qwik/lib/qwik/html-to-wabisabi.rb +148 -0
  179. data/vendor/qwik/lib/qwik/htree-diff.rb +87 -0
  180. data/vendor/qwik/lib/qwik/htree-format-xml.rb +57 -0
  181. data/vendor/qwik/lib/qwik/htree-generator.rb +144 -0
  182. data/vendor/qwik/lib/qwik/htree-get.rb +251 -0
  183. data/vendor/qwik/lib/qwik/htree-html-generator.rb +179 -0
  184. data/vendor/qwik/lib/qwik/htree-template.rb +263 -0
  185. data/vendor/qwik/lib/qwik/htree-to-wabisabi.rb +171 -0
  186. data/vendor/qwik/lib/qwik/loadlib.rb +79 -0
  187. data/vendor/qwik/lib/qwik/logger.rb +115 -0
  188. data/vendor/qwik/lib/qwik/mail-body.rb +171 -0
  189. data/vendor/qwik/lib/qwik/mail-header.rb +474 -0
  190. data/vendor/qwik/lib/qwik/mail-multipart.rb +193 -0
  191. data/vendor/qwik/lib/qwik/mail-parse.rb +147 -0
  192. data/vendor/qwik/lib/qwik/mail.rb +341 -0
  193. data/vendor/qwik/lib/qwik/mailaddress.rb +83 -0
  194. data/vendor/qwik/lib/qwik/mdlb-model.rb +81 -0
  195. data/vendor/qwik/lib/qwik/mdlb-sample.rb +324 -0
  196. data/vendor/qwik/lib/qwik/ml-catalog-factory.rb +27 -0
  197. data/vendor/qwik/lib/qwik/ml-exception.rb +15 -0
  198. data/vendor/qwik/lib/qwik/ml-generator.rb +28 -0
  199. data/vendor/qwik/lib/qwik/ml-gettext.rb +137 -0
  200. data/vendor/qwik/lib/qwik/ml-logger.rb +82 -0
  201. data/vendor/qwik/lib/qwik/ml-memory.rb +65 -0
  202. data/vendor/qwik/lib/qwik/ml-msg-validator.rb +86 -0
  203. data/vendor/qwik/lib/qwik/ml-processor.rb +609 -0
  204. data/vendor/qwik/lib/qwik/ml-quickml-server.rb +122 -0
  205. data/vendor/qwik/lib/qwik/ml-sendmail.rb +0 -0
  206. data/vendor/qwik/lib/qwik/ml-server.rb +107 -0
  207. data/vendor/qwik/lib/qwik/ml-session.rb +348 -0
  208. data/vendor/qwik/lib/qwik/ml-sweeper.rb +101 -0
  209. data/vendor/qwik/lib/qwik/mock-logger.rb +65 -0
  210. data/vendor/qwik/lib/qwik/mock-sendmail.rb +78 -0
  211. data/vendor/qwik/lib/qwik/mock-socket.rb +82 -0
  212. data/vendor/qwik/lib/qwik/modulobe.rb +406 -0
  213. data/vendor/qwik/lib/qwik/mongrel-server.rb +72 -0
  214. data/vendor/qwik/lib/qwik/page-files.rb +249 -0
  215. data/vendor/qwik/lib/qwik/page-generate.rb +82 -0
  216. data/vendor/qwik/lib/qwik/page-get.rb +262 -0
  217. data/vendor/qwik/lib/qwik/page-images.rb +168 -0
  218. data/vendor/qwik/lib/qwik/page-put.rb +128 -0
  219. data/vendor/qwik/lib/qwik/page-rrefs.rb +154 -0
  220. data/vendor/qwik/lib/qwik/page-title.rb +0 -0
  221. data/vendor/qwik/lib/qwik/page-wikidb.rb +234 -0
  222. data/vendor/qwik/lib/qwik/page.rb +67 -0
  223. data/vendor/qwik/lib/qwik/pages.rb +444 -0
  224. data/vendor/qwik/lib/qwik/parse-plugin.rb +249 -0
  225. data/vendor/qwik/lib/qwik/parser-emode.rb +116 -0
  226. data/vendor/qwik/lib/qwik/parser-inline.rb +272 -0
  227. data/vendor/qwik/lib/qwik/parser.rb +349 -0
  228. data/vendor/qwik/lib/qwik/password.rb +183 -0
  229. data/vendor/qwik/lib/qwik/periodic.rb +79 -0
  230. data/vendor/qwik/lib/qwik/qp.rb +56 -0
  231. data/vendor/qwik/lib/qwik/qwik-service.rb +341 -0
  232. data/vendor/qwik/lib/qwik/qwik.rb +5 -0
  233. data/vendor/qwik/lib/qwik/qwikweb-adduser.rb +34 -0
  234. data/vendor/qwik/lib/qwik/qwikweb-catalog-validator.rb +110 -0
  235. data/vendor/qwik/lib/qwik/qwikweb-incgen.rb +28 -0
  236. data/vendor/qwik/lib/qwik/qwikweb-makesite.rb +41 -0
  237. data/vendor/qwik/lib/qwik/qwikweb-server.rb +44 -0
  238. data/vendor/qwik/lib/qwik/qwikweb-showpassword.rb +26 -0
  239. data/vendor/qwik/lib/qwik/qwikweb-watchlog.rb +67 -0
  240. data/vendor/qwik/lib/qwik/request-path.rb +304 -0
  241. data/vendor/qwik/lib/qwik/request-ua.rb +76 -0
  242. data/vendor/qwik/lib/qwik/request-webrick.rb +81 -0
  243. data/vendor/qwik/lib/qwik/request.rb +91 -0
  244. data/vendor/qwik/lib/qwik/resolve-tdiary.rb +292 -0
  245. data/vendor/qwik/lib/qwik/resolve.rb +121 -0
  246. data/vendor/qwik/lib/qwik/response.rb +228 -0
  247. data/vendor/qwik/lib/qwik/server-memory.rb +57 -0
  248. data/vendor/qwik/lib/qwik/server-webrick.rb +102 -0
  249. data/vendor/qwik/lib/qwik/server.rb +252 -0
  250. data/vendor/qwik/lib/qwik/site-config.rb +149 -0
  251. data/vendor/qwik/lib/qwik/site-db.rb +136 -0
  252. data/vendor/qwik/lib/qwik/site-event.rb +162 -0
  253. data/vendor/qwik/lib/qwik/site-files.rb +86 -0
  254. data/vendor/qwik/lib/qwik/site-group.rb +103 -0
  255. data/vendor/qwik/lib/qwik/site-index.rb +47 -0
  256. data/vendor/qwik/lib/qwik/site-log.rb +64 -0
  257. data/vendor/qwik/lib/qwik/site-member.rb +230 -0
  258. data/vendor/qwik/lib/qwik/site-monitor.rb +97 -0
  259. data/vendor/qwik/lib/qwik/site-pages.rb +62 -0
  260. data/vendor/qwik/lib/qwik/site-plan.rb +139 -0
  261. data/vendor/qwik/lib/qwik/site-report.rb +282 -0
  262. data/vendor/qwik/lib/qwik/site-resolve.rb +230 -0
  263. data/vendor/qwik/lib/qwik/site-rrefs.rb +18 -0
  264. data/vendor/qwik/lib/qwik/site-search.rb +180 -0
  265. data/vendor/qwik/lib/qwik/site-timeline.rb +153 -0
  266. data/vendor/qwik/lib/qwik/site-url.rb +189 -0
  267. data/vendor/qwik/lib/qwik/site.rb +76 -0
  268. data/vendor/qwik/lib/qwik/smil-time.rb +105 -0
  269. data/vendor/qwik/lib/qwik/smtp-session.rb +331 -0
  270. data/vendor/qwik/lib/qwik/template-generator.rb +149 -0
  271. data/vendor/qwik/lib/qwik/template.rb +85 -0
  272. data/vendor/qwik/lib/qwik/test-common.rb +10 -0
  273. data/vendor/qwik/lib/qwik/test-ml-info.rb +225 -0
  274. data/vendor/qwik/lib/qwik/test-module-ml.rb +142 -0
  275. data/vendor/qwik/lib/qwik/test-module-path.rb +110 -0
  276. data/vendor/qwik/lib/qwik/test-module-public.rb +70 -0
  277. data/vendor/qwik/lib/qwik/test-module-server.rb +98 -0
  278. data/vendor/qwik/lib/qwik/test-module-session.rb +264 -0
  279. data/vendor/qwik/lib/qwik/test-module-suite.rb +91 -0
  280. data/vendor/qwik/lib/qwik/test-ms-applemail.rb +59 -0
  281. data/vendor/qwik/lib/qwik/test-ms-attach.rb +174 -0
  282. data/vendor/qwik/lib/qwik/test-ms-basic.rb +40 -0
  283. data/vendor/qwik/lib/qwik/test-ms-close.rb +35 -0
  284. data/vendor/qwik/lib/qwik/test-ms-confirm.rb +75 -0
  285. data/vendor/qwik/lib/qwik/test-ms-ignore-spam.rb +57 -0
  286. data/vendor/qwik/lib/qwik/test-ms-japanese.rb +97 -0
  287. data/vendor/qwik/lib/qwik/test-ms-jfilename.rb +82 -0
  288. data/vendor/qwik/lib/qwik/test-ms-large.rb +58 -0
  289. data/vendor/qwik/lib/qwik/test-ms-member.rb +103 -0
  290. data/vendor/qwik/lib/qwik/test-ms-multipart.rb +84 -0
  291. data/vendor/qwik/lib/qwik/test-ms-org.rb +129 -0
  292. data/vendor/qwik/lib/qwik/test-ms-plan.rb +130 -0
  293. data/vendor/qwik/lib/qwik/test-ms-post.rb +53 -0
  294. data/vendor/qwik/lib/qwik/test-ms-quopri.rb +76 -0
  295. data/vendor/qwik/lib/qwik/test-sub-quopri.rb +45 -0
  296. data/vendor/qwik/lib/qwik/test-submit-base64.rb +59 -0
  297. data/vendor/qwik/lib/qwik/test-submit-forward.rb +61 -0
  298. data/vendor/qwik/lib/qwik/test-submit-html-mail.rb +52 -0
  299. data/vendor/qwik/lib/qwik/test-submit-japanese.rb +135 -0
  300. data/vendor/qwik/lib/qwik/test-submit-jfilename.rb +144 -0
  301. data/vendor/qwik/lib/qwik/test-submit-uuencode.rb +71 -0
  302. data/vendor/qwik/lib/qwik/test-suite-all.rb +8 -0
  303. data/vendor/qwik/lib/qwik/test-suite-basic.rb +9 -0
  304. data/vendor/qwik/lib/qwik/test-suite-ml.rb +9 -0
  305. data/vendor/qwik/lib/qwik/test-typekey.rb +64 -0
  306. data/vendor/qwik/lib/qwik/testunit.rb +45 -0
  307. data/vendor/qwik/lib/qwik/tokenizer-inline.rb +288 -0
  308. data/vendor/qwik/lib/qwik/tokenizer.rb +331 -0
  309. data/vendor/qwik/lib/qwik/typekey.rb +160 -0
  310. data/vendor/qwik/lib/qwik/util-basic.rb +135 -0
  311. data/vendor/qwik/lib/qwik/util-charset.rb +331 -0
  312. data/vendor/qwik/lib/qwik/util-css.rb +56 -0
  313. data/vendor/qwik/lib/qwik/util-csv-tokenizer.rb +113 -0
  314. data/vendor/qwik/lib/qwik/util-filename.rb +112 -0
  315. data/vendor/qwik/lib/qwik/util-pathname.rb +202 -0
  316. data/vendor/qwik/lib/qwik/util-pid.rb +58 -0
  317. data/vendor/qwik/lib/qwik/util-safe.rb +67 -0
  318. data/vendor/qwik/lib/qwik/util-sendmail.rb +273 -0
  319. data/vendor/qwik/lib/qwik/util-string.rb +202 -0
  320. data/vendor/qwik/lib/qwik/util-time.rb +125 -0
  321. data/vendor/qwik/lib/qwik/util-webrick.rb +176 -0
  322. data/vendor/qwik/lib/qwik/version.rb +11 -0
  323. data/vendor/qwik/lib/qwik/wabisabi-basic.rb +163 -0
  324. data/vendor/qwik/lib/qwik/wabisabi-diff.rb +130 -0
  325. data/vendor/qwik/lib/qwik/wabisabi-format-xml.rb +310 -0
  326. data/vendor/qwik/lib/qwik/wabisabi-generator.rb +262 -0
  327. data/vendor/qwik/lib/qwik/wabisabi-index.rb +174 -0
  328. data/vendor/qwik/lib/qwik/wabisabi-table.rb +212 -0
  329. data/vendor/qwik/lib/qwik/wabisabi-template.rb +295 -0
  330. data/vendor/qwik/lib/qwik/wabisabi-to-htree.rb +111 -0
  331. data/vendor/qwik/lib/qwik/wabisabi-to-wiki.rb +690 -0
  332. data/vendor/qwik/lib/qwik/wabisabi-traverse.rb +207 -0
  333. data/vendor/qwik/lib/qwik/wabisabi-validator.rb +116 -0
  334. data/vendor/qwik/lib/qwik/wabisabi.rb +5 -0
  335. metadata +492 -0
@@ -0,0 +1,418 @@
1
+ # -*- coding: shift_jis -*-
2
+ # Copyright (C) 2003-2006 Kouichirou Eto, All rights reserved.
3
+ # This is free software with ABSOLUTELY NO WARRANTY.
4
+ # You can redistribute it and/or modify it under the terms of the GNU GPL 2.
5
+
6
+ $LOAD_PATH.unshift '..' unless $LOAD_PATH.include? '..'
7
+ require 'qwik/act-monitor'
8
+ #require 'qwik/act-rrefs'
9
+ require 'qwik/page-title'
10
+
11
+ module Qwik
12
+ class Action
13
+ def act_new
14
+ c_require_login
15
+
16
+ # Check if the title is specified.
17
+ title = @req.query['t']
18
+ return new_input_title if title.nil? || title.empty?
19
+
20
+ # Parse page title.
21
+ page_title, tags = Page.parse_title(title)
22
+
23
+ # Check if the page title is here.
24
+ return new_input_title if page_title.nil? || page_title.empty?
25
+
26
+ # Check if the title is already exist.
27
+ page = @site.get_by_title(page_title)
28
+ return new_already_exist(page_title, page.key) if page
29
+
30
+ # Check if the request is GET.
31
+ return new_confirm(title) if ! @req.is_post?
32
+
33
+ if Page.valid_as_pagekey?(page_title)
34
+ key = page_title
35
+ else
36
+ key = @site.get_new_id
37
+ end
38
+
39
+ begin
40
+ page = @site.create(key) # CREATE
41
+ rescue PageExistError
42
+ # FIXME: should retry?
43
+ return new_already_exist(page_title, key)
44
+ end
45
+
46
+ c_make_log('create', key) # CREATE
47
+ c_monitor("create#{key}") # CREATE
48
+
49
+ page.store("* #{title}\n") # with tag
50
+
51
+ url = "#{key}.edit"
52
+
53
+ # create_rrefs(key)
54
+ site_updated
55
+
56
+ return c_notice(_('New page'), url, 201) { # 201, Created
57
+ [[:h2, _('Created.')],
58
+ [:p, [:a, {:href=>url}, _('Edit new page')]]]
59
+ }
60
+ end
61
+
62
+ def new_input_title
63
+ ar = []
64
+ form = new_form
65
+ return new_tail(ar, form)
66
+ end
67
+
68
+ def new_already_exist(title, key)
69
+ ar = []
70
+ ar << [:h2, _('Already exists')]
71
+ form = new_form(title) {
72
+ [:p, [:a, {:href=>key+'.html'}, [:strong, title]],
73
+ _(' already exists.'), [:br],
74
+ _('Please specify another title.')]
75
+ }
76
+ return new_tail(ar, form)
77
+ end
78
+
79
+ def new_confirm(title)
80
+ ar = []
81
+ ar << [:h2, _('Confirm')]
82
+ form = new_form(title) {
83
+ [:p, _('Push create.')]
84
+ }
85
+ return new_tail(ar, form)
86
+ end
87
+
88
+ def new_form(title=nil)
89
+ form = [:form, {:action=>'.new', :method=>'POST'},
90
+ [:dl, [:dt, _('Title')],
91
+ [:dd, [:input, {:name=>'t', :value=>title, :class=>'focus'}]]]]
92
+ form << yield if block_given?
93
+ form << [:p, [:input, {:type=>'submit', :value=>_("New page")}]]
94
+ end
95
+
96
+ def new_tail(ar, form)
97
+ ar << [:div, {:class=>'form'}, form]
98
+ ar << [:hr]
99
+ ar << [:p, [:a, {:href=>"FrontPage.html"}, _("Go back")]]
100
+ return c_notice(_('New page')) { ar }
101
+ end
102
+
103
+ def action_page_not_found
104
+ # Assert that the title is encoded in UTF8.
105
+ # @req.base.charset is already set to 'UTF-8' in request-path.rb
106
+ title = @req.base.to_page_charset
107
+ c_notfound(_('Page not found.')) {
108
+ [[:h2, _('Page not found.')],
109
+ [:p, [:a, {:href=>'FrontPage.html'}, _('Go back')]],
110
+ [:hr],
111
+ new_form(title) {
112
+ [:p, _('Push create if you would like to create the page.')]
113
+ }
114
+ ]
115
+ }
116
+ end
117
+ end
118
+ end
119
+
120
+ if $0 == __FILE__
121
+ require 'qwik/test-common'
122
+ $test = true
123
+ end
124
+
125
+ if defined?($test) && $test
126
+ class TestActNew < Test::Unit::TestCase
127
+ include TestSession
128
+
129
+ def test_create_new
130
+ t_add_user
131
+
132
+ # See .new page
133
+ res = session('/test/.new')
134
+ assert_attr({:action=>'.new', :method=>'POST'}, 'form')
135
+ ok_xp([:input, {:value=>nil, :class=>'focus', :name=>'t'}], '//input')
136
+ ok_xp([:input, {:value=>'New page', :type=>'submit'}], "//input[2]")
137
+
138
+ # Create a new page.
139
+ res = session("POST /test/.new?t=FirstPage")
140
+ ok_title('New page')
141
+ ok_in(['Edit new page'], "//div[@class='section']//a")
142
+ ok_xp([:a, {:href=>'FirstPage.edit'}, 'Edit new page'],
143
+ "//div[@class='section']//a")
144
+ end
145
+
146
+ def test_with_tag
147
+ t_add_user
148
+
149
+ res = session("POST /test/.new?t=[tag] t")
150
+ ok_xp([:a, {:href=>'t.edit'}, 'Edit new page'],
151
+ "//div[@class='section']//a")
152
+ page = @site['t']
153
+ ok_eq("* [tag] t\n", page.load)
154
+ end
155
+
156
+ def test_opensite_new
157
+ t_add_user
158
+ t_site_open # OPEN site
159
+
160
+ res = session('/test/') {|req|
161
+ req.cookies.clear
162
+ }
163
+ ok_title('FrontPage') # You can see the FrontPage.
164
+ ok_in(['Login'], "//div[@class='adminmenu']//a") # But, not logged in.
165
+
166
+ # Try to see the .new page
167
+ res = session('/test/.new') {|req|
168
+ req.cookies.clear
169
+ }
170
+ ok_title('Please log in.') # You can't see the form.
171
+ ok_in(['You need to log in to use this function.'], 'p')
172
+ end
173
+ end
174
+
175
+ class TestActNewWithEmbed < Test::Unit::TestCase
176
+ include TestSession
177
+
178
+ def test_embeded_new
179
+ t_add_user
180
+ page = @site['FrontPage']
181
+ page.store("[[FirstPage]]")
182
+
183
+ # See FrontPage
184
+ res = session('/test/')
185
+ ok_title('FrontPage')
186
+ ok_in([:span, {:class=>'new'}, 'FirstPage',
187
+ [:a, {:href=>".new?t=FirstPage"},
188
+ [:img, {:src=>'.theme/i/new.png', :alt=>'create'}]]],
189
+ "//div[@class='section']/p")
190
+
191
+ # To confirm
192
+ res = session("/test/.new?t=FirstPage")
193
+ ok_title('New page')
194
+ ok_in(['New page'], 'h1')
195
+ ok_in(['Confirm'], 'h2')
196
+ assert_attr({:action=>'.new', :method=>'POST'}, 'form')
197
+ ok_xp([:input, {:value=>'FirstPage', :class=>'focus', :name=>'t'}],
198
+ '//input')
199
+ ok_xp([:input, {:value=>'New page', :type=>'submit'}],
200
+ "//input[2]")
201
+
202
+ # Create a new page.
203
+ res = session("POST /test/.new?t=FirstPage")
204
+ ok_in(['Edit new page'], "//div[@class='section']//a")
205
+ ok_xp([:a, {:href=>'FirstPage.edit'}, 'Edit new page'],
206
+ "//div[@class='section']//a")
207
+
208
+ # Check the new page
209
+ ok_eq("* FirstPage\n", @site['FirstPage'].load)
210
+
211
+ # Try to create with the same key.
212
+ res = session("/test/.new?t=FirstPage")
213
+ ok_in(['Already exists'], '//h2')
214
+ ok_xp([:a, {:href=>'FirstPage.html'}, [:strong, 'FirstPage']],
215
+ "//div[@class='section']/a")
216
+
217
+ # Try to create with the same key.
218
+ res = session("POST /test/.new?t=FirstPage")
219
+ ok_in(['Already exists'], '//h2')
220
+ ok_xp([:a, {:href=>'FirstPage.html'}, [:strong, 'FirstPage']],
221
+ "//div[@class='section']/a")
222
+ end
223
+
224
+ def test_embeded_new_with_space
225
+ t_add_user
226
+ page = @site['FrontPage']
227
+ page.store("[[First Page]]")
228
+ ok_eq('FrontPage', page.get_title)
229
+
230
+ # see a page
231
+ res = session('/test/')
232
+ ok_in(['First Page', [:a, {:href=>".new?t=First+Page"},
233
+ [:img, {:src=>'.theme/i/new.png', :alt=>'create'}]]],
234
+ "//span[@class='new']")
235
+
236
+ # Please input corresponding page key
237
+ res = session("/test/.new?t=First+Page")
238
+ ok_in(['New page'], 'h1')
239
+ ok_in(['Confirm'], 'h2')
240
+ assert_attr({:action=>'.new', :method=>'POST'}, 'form')
241
+ ok_xp([:input, {:value=>'First Page',
242
+ :class=>'focus', :name=>'t'}], '//input')
243
+ ok_xp([:input, {:value=>'New page', :type=>'submit'}], "//input[2]")
244
+
245
+ # POST
246
+ res = session("POST /test/.new?t=First Page")
247
+ ok_in(['New page'], 'h1')
248
+ ok_in(['Edit new page'], "//div[@class='section']//a")
249
+ ok_xp([:a, {:href=>'1.edit'}, 'Edit new page'],
250
+ "//div[@class='section']//a")
251
+
252
+ # check the new page
253
+ ok_eq("* First Page\n", @site['1'].load)
254
+ page = @site.get_by_title('First Page')
255
+ ok_eq('1', page.key)
256
+
257
+ # check title
258
+ page = @site['1']
259
+ ok_eq('First Page', page.get_title)
260
+ ok_eq('1', @site.get_by_title('First Page').key.to_s)
261
+ ok_eq(false, @site.exist?('First Page'))
262
+ ok_eq(true, @site.exist?('1'))
263
+
264
+ # check the source page
265
+ res = session('/test/')
266
+ ok_in(['First Page'], "//div[@class='section']//a")
267
+ ok_xp([:a, {:href=>'1.html'}, 'First Page'],
268
+ "//div[@class='section']//a")
269
+ ok_eq("[[First Page]]", @site['FrontPage'].load)
270
+
271
+ # Try to create with the same key.
272
+ res = session("/test/.new?t=First+Page")
273
+ ok_in(['Already exists'], '//h2')
274
+ ok_xp([:a, {:href=>'1.html'}, [:strong, 'First Page']],
275
+ "//div[@class='section']/a")
276
+
277
+ # Try to create with the same key.
278
+ res = session("POST /test/.new?t=First+Page")
279
+ ok_in(['Already exists'], '//h2')
280
+ ok_xp([:a, {:href=>'1.html'}, [:strong, 'First Page']],
281
+ "//div[@class='section']/a")
282
+
283
+ # Let's create a page again. At the first, embed the title.
284
+ page = @site['FrontPage']
285
+ page.store("[[2nd Page]]")
286
+
287
+ # See the page
288
+ res = session('/test/')
289
+ ok_in(['2nd Page', [:a, {:href=>".new?t=2nd+Page"},
290
+ [:img, {:src=>'.theme/i/new.png', :alt=>'create'}]]],
291
+ "//div[@class='section']//span")
292
+
293
+ # please input a corresponding page key
294
+ res = session("/test/.new?t=2nd+Page")
295
+ ok_xp([:input, {:value=>'2nd Page', :class=>'focus', :name=>'t'}],
296
+ '//input')
297
+
298
+ # try again
299
+ res = session("POST /test/.new?t=2nd+Page")
300
+ ok_in(['Edit new page'], "//div[@class='section']//a")
301
+ ok_xp([:a, {:href=>'2.edit'}, 'Edit new page'],
302
+ "//div[@class='section']//a")
303
+
304
+ page = @site['2']
305
+ ok_eq("* 2nd Page\n", page.load)
306
+
307
+ # check the source page again
308
+ res = session('/test/')
309
+ ok_in(['2nd Page'], "//div[@class='section']//a")
310
+ ok_xp([:a, {:href=>'2.html'}, '2nd Page'],
311
+ "//div[@class='section']//a")
312
+ ok_eq("[[2nd Page]]", @site['FrontPage'].load)
313
+ end
314
+
315
+ def test_new_sjis
316
+ t_add_user
317
+ page = @site['FrontPage']
318
+ page.store("[[ポス]]")
319
+
320
+ # See FrontPage
321
+ res = session('/test/')
322
+ ok_title('FrontPage')
323
+ ok_in([:span, {:class=>'new'}, "ポス",
324
+ [:a, {:href=>".new?t=%83%7C%83X"},
325
+ [:img, {:src=>'.theme/i/new.png', :alt=>'create'}]]],
326
+ "//div[@class='section']/p")
327
+ end
328
+
329
+ def test_embeded_new_with_japanese_name
330
+ t_add_user
331
+
332
+ page = @site['FrontPage']
333
+ page.store("[[最初のページ]]")
334
+ ok_eq('FrontPage', page.get_title)
335
+
336
+ # See a page
337
+ res = session('/test/')
338
+ ok_in(["最初のページ",
339
+ [:a, {:href=>".new?t=%8D%C5%8F%89%82%CC%83y%81%5B%83W"},
340
+ [:img, {:src=>'.theme/i/new.png', :alt=>'create'}]]],
341
+ "//span[@class='new']")
342
+
343
+ # Please input corresponding page key
344
+ res = session("/test/.new?t=最初のページ")
345
+ ok_in(['New page'], 'h1')
346
+ ok_in(['Confirm'], 'h2')
347
+ assert_attr({:action=>'.new', :method=>'POST'}, 'form')
348
+ ok_xp([:input, {:value=>"最初のページ",
349
+ :class=>'focus', :name=>'t'}], '//input')
350
+ ok_xp([:input, {:value=>'New page', :type=>'submit'}],
351
+ "//input[2]")
352
+
353
+ # POST
354
+ res = session("POST /test/.new?t=最初のページ")
355
+ ok_in(['New page'], 'h1')
356
+ ok_in(['Edit new page'], "//div[@class='section']//a")
357
+ ok_xp([:a, {:href=>'1.edit'}, 'Edit new page'],
358
+ "//div[@class='section']//a")
359
+
360
+ # Check the new page.
361
+ ok_eq("* 最初のページ\n", @site['1'].load)
362
+ page = @site.get_by_title("最初のページ")
363
+ ok_eq('1', page.key)
364
+
365
+ # Check title.
366
+ page = @site['1']
367
+ ok_eq("最初のページ", page.get_title)
368
+ ok_eq('1', @site.get_by_title("最初のページ").key.to_s)
369
+ ok_eq(false, @site.exist?("最初のページ"))
370
+ ok_eq(true, @site.exist?('1'))
371
+
372
+ # Check the source page.
373
+ res = session('/test/')
374
+ ok_in(["最初のページ"], "//div[@class='section']//a")
375
+ ok_xp([:a, {:href=>'1.html'}, "最初のページ"],
376
+ "//div[@class='section']//a")
377
+ ok_eq("[[最初のページ]]", @site['FrontPage'].load)
378
+
379
+ # Try to create with the same key.
380
+ res = session("/test/.new?t=最初のページ")
381
+
382
+ # Try to create with the same key.
383
+ res = session("POST /test/.new?t=最初のページ")
384
+ ok_in(['Already exists'], '//h2')
385
+
386
+ # Let's create a page again. At the first, embed the title.
387
+ page = @site['FrontPage']
388
+ page.store("[[二頁]]")
389
+
390
+ # See the page
391
+ res = session('/test/')
392
+ ok_in(["二頁",
393
+ [:a, {:href=>".new?t=%93%F1%95%C5"},
394
+ [:img, {:src=>'.theme/i/new.png', :alt=>'create'}]]],
395
+ "//div[@class='section']//span")
396
+
397
+ # please input a corresponding page key
398
+ res = session("/test/.new?t=二頁")
399
+ ok_xp([:input, {:value=>"二頁", :class=>'focus', :name=>'t'}], '//input')
400
+
401
+ # try again
402
+ res = session("POST /test/.new?t=二頁")
403
+ ok_in(['Edit new page'], "//div[@class='section']//a")
404
+ ok_xp([:a, {:href=>'2.edit'}, 'Edit new page'],
405
+ "//div[@class='section']//a")
406
+
407
+ page = @site['2']
408
+ ok_eq("* 二頁\n", page.load)
409
+
410
+ # check the source page again
411
+ res = session('/test/')
412
+ ok_in(["二頁"], "//div[@class='section']//a")
413
+ ok_xp([:a, {:href=>'2.html'}, "二頁"],
414
+ "//div[@class='section']//a")
415
+ ok_eq("[[二頁]]", @site['FrontPage'].load)
416
+ end
417
+ end
418
+ end
@@ -0,0 +1,248 @@
1
+ # Copyright (C) 2003-2006 Kouichirou Eto, All rights reserved.
2
+ # This is free software with ABSOLUTELY NO WARRANTY.
3
+ # You can redistribute it and/or modify it under the terms of the GNU GPL 2.
4
+
5
+ $LOAD_PATH.unshift '..' unless $LOAD_PATH.include? '..'
6
+
7
+ module Qwik
8
+ class Action
9
+ def pagelist_update
10
+ running_path = @site.cache_path + "pagelist.dat.running"
11
+ pagelist_path = @site.cache_path + "pagelist.dat"
12
+
13
+ return if running_path.exist?
14
+
15
+ Thread.new {
16
+ running_path.write("running")
17
+
18
+ ar = []
19
+ list = @site.date_list
20
+ list.reverse.each {|page|
21
+ key = page.key
22
+ time = page.mtime.to_i
23
+ title = page.get_title
24
+ ar << [key, time, title]
25
+ }
26
+ dat = Marshal.dump(ar)
27
+ pagelist_path.write(dat)
28
+
29
+ running_path.unlink if running_path.exist?
30
+ }
31
+ end
32
+
33
+ def pagelist_get
34
+ pagelist_path = @site.cache_path + "pagelist.dat"
35
+
36
+ unless pagelist_path.exist?
37
+ pagelist_update
38
+ return []
39
+ end
40
+
41
+ dat = pagelist_path.read
42
+ ar = Marshal.load(dat)
43
+ return ar
44
+ end
45
+
46
+ def act_list
47
+ c_surface(_('Page List'), true) {
48
+ [:div, {:class=>'day'},
49
+ [:div, {:class=>'section'},
50
+ plg_title_list]]
51
+ }
52
+ end
53
+
54
+ def plg_title_list
55
+ str = @site.title_list.map {|page|
56
+ "- #{page.mtime.ymd} : [[#{page.key}]]"
57
+ }.join("\n")
58
+ return c_res(str)
59
+ end
60
+
61
+ def act_recent(max = -1)
62
+ str = recent_str(max)
63
+ c_surface(_('Recent Changes'), true) {
64
+ [:div, {:class=>'day'},
65
+ [:div, {:class=>'section'}, c_res(str)]]
66
+ }
67
+ end
68
+
69
+ def plg_recent_list(max = -1)
70
+ return c_res(recent_str(max))
71
+ end
72
+ alias :plg_recent :plg_recent_list
73
+
74
+ def plg_side_recent(*a)
75
+ return [
76
+ [:h2, _('Recent change')],
77
+ plg_srecent(*a)
78
+ ]
79
+ end
80
+
81
+ def plg_srecent(max = -1)
82
+ max = max.to_i
83
+ ar = []
84
+
85
+ now = @req.start_time
86
+
87
+ list = pagelist_get
88
+ overflow = nil
89
+ list.each_with_index {|a, i|
90
+ if 0 <= max && max < (i += 1)
91
+ overflow = [:p,{:class=>'recent'},
92
+ [:a, {:href=>'RecentList.html'}, [:em, _('more...')]]]
93
+ break
94
+ end
95
+
96
+ key, t, title = a
97
+ time = Time.at(t)
98
+ difftime = now.to_i - time.to_i
99
+ timestr = time.ymdx.to_s
100
+ li = [:li,
101
+ [:a, {:href=>"#{key}.html", :title=>timestr}, title]]
102
+ if @req.user
103
+ li += [' ', [:span, {:class=>'ago'},
104
+ int_to_time(difftime)+_(' ago')]]
105
+ end
106
+ ar << li
107
+ }
108
+ div = [:div, {:class=>'recent'}, [:ul, ar]]
109
+ div << overflow if overflow
110
+ return div
111
+ end
112
+
113
+ def nu_plg_srecent(max = -1)
114
+ max = max.to_i
115
+ ar = []
116
+ now = @req.start_time
117
+ list = @site.date_list
118
+ overflow = nil
119
+ list.reverse.each_with_index {|page, i|
120
+ if 0 <= max && max < (i += 1)
121
+ overflow = [:p,{:class=>'recent'},
122
+ [:a, {:href=>'RecentList.html'}, [:em, _('more...')]]]
123
+ break
124
+ end
125
+ time = page.mtime
126
+ difftime = now.to_i - time.to_i
127
+ timestr = time.ymdx.to_s
128
+ li = [:li,
129
+ [:a, {:href=>"#{page.key}.html", :title=>timestr}, page.get_title]]
130
+ if @req.user
131
+ li += [' ', [:span, {:class=>'ago'},
132
+ int_to_time(difftime)+_(' ago')]]
133
+ end
134
+ ar << li
135
+ }
136
+ div = [:div, {:class=>'recent'}, [:ul, ar]]
137
+ div << overflow if overflow
138
+ return div
139
+ end
140
+
141
+ def recent_str(max = -1)
142
+ max = max.to_i
143
+ ar = []
144
+ last_day = nil
145
+ add_day = true
146
+ @site.date_list.reverse.each_with_index {|page, i|
147
+ break if 0 <= max && max < (i += 1)
148
+ if add_day
149
+ day = page.mtime.ymd.to_s
150
+ if last_day.nil? || day != last_day
151
+ ar << "** #{day}"
152
+ last_day = day
153
+ end
154
+ end
155
+ ar << "- [[#{page.key}]]"
156
+ }
157
+ ar.join("\n")
158
+ end
159
+
160
+ def int_to_time(n)
161
+ return n.to_s+_('sec.') if n < 60 # under 1 min
162
+ return (n/60).to_s+_('min.') if n < 60*60 # under 1 hour
163
+ return (n/(60*60)).to_s+_('hour') if n < 60*60*24 # under 1 day
164
+ return (n/(60*60*24)).to_s+_('day') if n < 60*60*24*30 # under 1 month
165
+ return (n/(60*60*24*30)).to_s+_('month') if n < 60*60*24*365 # under 1 year
166
+ return (n/(60*60*24*365)).to_s+_('year') if n < 60*60*24*365*100 # under 1 century
167
+ return (n/(60*60*24*365*100)).to_s+_('century')
168
+ end
169
+ end
170
+ end
171
+
172
+ if $0 == __FILE__
173
+ require 'qwik/test-common'
174
+ $test = true
175
+ end
176
+
177
+ if defined?($test) && $test
178
+ class TestActList < Test::Unit::TestCase
179
+ include TestSession
180
+
181
+ def test_title_list
182
+ t_add_user
183
+ res = session('/test/.list')
184
+ ok_title('Page List')
185
+ ok_wi(/<ul><li>/, "{{title_list}}")
186
+ ok_wi(%r| : <a href="1.html">1</a></li>|, "{{title_list}}")
187
+ end
188
+
189
+ def test_recent_list
190
+ t_add_user
191
+ res = session('/test/.recent')
192
+ ok_title('Recent Changes')
193
+ ok_wi(/<h3>/, "{{recent_list}}")
194
+ ok_wi(%r|<li><a href=\"1.html\">1</a></li>|, "{{recent}}")
195
+ ok_wi(/<h3>/, "{{recent_list(1)}}")
196
+ end
197
+
198
+ def test_srecent
199
+ t_add_user
200
+
201
+ # test with no pages.
202
+ ok_wi [:div, {:class=>"recent"}, [:ul, []]], "{{srecent}}"
203
+
204
+ # test with a page.
205
+ page = @site["1"]
206
+ page.put_with_time("* t1", 1)
207
+ @action.pagelist_update
208
+ ok_wi [:div, {:class=>"recent"},
209
+ [:ul,
210
+ [[:li,
211
+ [:a, {:href=>"1.html", :title=>"1970-01-01 09:00:01"}, "t1"],
212
+ " ",
213
+ [:span, {:class=>"ago"}, "-1sec. ago"]]]]], "{{srecent}}"
214
+
215
+ # test with two pages.
216
+ page = @site.create("2")
217
+ page.put_with_time("* t2", 2)
218
+ @action.pagelist_update
219
+ =begin
220
+ ok_wi [:div, {:class=>"recent"},
221
+ [:ul,
222
+ [[:li,
223
+ [:a, {:href=>"1.html", :title=>"2009-09-04 10:16:25"}, "1"],
224
+ " ",
225
+ [:span, {:class=>"ago"}, "-1252026985sec. ago"]],
226
+ [:li,
227
+ [:a, {:href=>"2.html", :title=>"1970-01-01 09:00:02"}, "t2"],
228
+ " ",
229
+ [:span, {:class=>"ago"}, "-2sec. ago"]]]]], "{{srecent}}"
230
+ =end
231
+ end
232
+
233
+ def ok_time(e, n)
234
+ eq e, @action.int_to_time(n)
235
+ end
236
+
237
+ def test_time
238
+ res = session
239
+ ok_time '1sec.', 1
240
+ ok_time '1min.', 60
241
+ ok_time '1hour', 60*60
242
+ ok_time '1day', 60*60*24
243
+ ok_time '1month', 60*60*24*30
244
+ ok_time '1year', 60*60*24*365
245
+ ok_time '1century', 60*60*24*365*100
246
+ end
247
+ end
248
+ end