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,386 @@
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 << 'compat' unless $LOAD_PATH.include? 'compat'
7
+ begin
8
+ require 'zip/zip'
9
+ $have_zip = true
10
+ rescue LoadError
11
+ $have_zip = false
12
+ end
13
+
14
+ $LOAD_PATH.unshift '..' unless $LOAD_PATH.include? '..'
15
+ require 'qwik/act-presen'
16
+ require 'qwik/act-theme'
17
+
18
+ module Qwik
19
+ class Action
20
+ D_ExtArchive = {
21
+ :dt => 'Site archive',
22
+ :dd => 'You can get a zip archive of the site.',
23
+ :dc => "* Example
24
+ {{zip}}
25
+
26
+ You can get a zip archive with all text data of the Wiki site.
27
+
28
+ The archive also contains static HTML files of the site.
29
+ Thus, you can unzip the package and place them on your web site
30
+ as the static Web pages.
31
+ "
32
+ }
33
+
34
+ D_ExtArchive_ja = {
35
+ :dt => 'サイト・アーカイブ',
36
+ :dd => 'サイト・アーカイブを取得できます。',
37
+ :dc => '* 使い方
38
+ {{zip}}
39
+
40
+ このリンクから、サイトの内容まるごと全部を一つのアーカイブにして
41
+ ダウンロードできます。
42
+
43
+ ファイルには、元となるテキストファイルと共に、静的なHTMLページも含まれ
44
+ ており、解凍してWebサイトに置けば、そのまま普通のWebページとして公開で
45
+ きます。
46
+ '
47
+ }
48
+
49
+ def plg_zip
50
+ return page_attribute('zip', _('Site archive'), @site.sitename)
51
+ end
52
+
53
+ def archive_path
54
+ return @site.cache_path + "#{@site.sitename}.zip"
55
+ end
56
+
57
+ def archive_running_path
58
+ return @site.cache_path + "#{@site.sitename}.zip.running"
59
+ end
60
+
61
+ def archive_clear_cache
62
+ path = archive_path
63
+ path.unlink if path.exist?
64
+ path = archive_running_path
65
+ path.unlink if path.exist?
66
+ end
67
+
68
+ def ext_zip
69
+ c_require_member
70
+ c_require_base_is_sitename
71
+
72
+ if archive_running_path.exist?
73
+ return c_notice(_('Running.')) {
74
+ [:div,
75
+ [:p, _("The process is working now.")],
76
+ [:p, _("Pleae wait for a while.")],
77
+ [:p, [:a, {:href=>"#{@req.base}.zip"}, _('Again')]]]
78
+ }
79
+ end
80
+
81
+ if archive_path.exist?
82
+ return c_simple_send(archive_path, 'application/zip')
83
+ end
84
+
85
+ # Start New thread.
86
+ Thread.new {
87
+ archive_running_path.write("running")
88
+ SiteArchive.generate(@config, @site, self)
89
+ archive_running_path.unlink
90
+ }
91
+
92
+ return c_notice(_('Start.')) {
93
+ [:div,
94
+ [:p, _("The archive process sgtarted.")],
95
+ [:p, _("Pleae wait for a while.")],
96
+ [:p, [:a, {:href=>"#{@req.base}.zip"}, _('Again')]]]
97
+ }
98
+ end
99
+ end
100
+
101
+ class SiteArchive
102
+ def self.generate(config, site, action)
103
+ sitename = site.sitename
104
+ site_cache_path = site.cache_path
105
+ site_cache_path.check_directory
106
+
107
+ zip_filename = "#{sitename}.zip"
108
+ zip_file = site_cache_path + zip_filename
109
+
110
+ Zip::ZipOutputStream.open(zip_file.to_s) {|zos|
111
+ site.each_all {|page|
112
+ add_page(site, action, zos, site_cache_path, page)
113
+ }
114
+ add_theme(site, action, zos, config.theme_dir)
115
+ }
116
+
117
+ return zip_file
118
+ end
119
+
120
+ private
121
+
122
+ def self.add_page(site, action, zos, site_cache_path, page)
123
+ base = "#{site.sitename}/#{page.key}"
124
+
125
+ # Add original txt file.
126
+ add_entry(zos, "#{base}.txt", page.load, page.mtime)
127
+
128
+ # Generate a html file.
129
+ html_path = site_cache_path+"#{page.key}.html"
130
+ # Call act-html.
131
+ #action.view_page_cache_generate(page.key) if ! html_path.exist?
132
+ # Force create static HTML file.
133
+ action.view_page_cache_generate(page.key)
134
+ raise "Unknown error for '#{page.key}'" if ! html_path.exist? # What?
135
+ filename = "#{base}.html"
136
+ add_entry(zos, filename, html_path.read)
137
+
138
+ # Generate a presen file if the page is related to presen.
139
+ if /\Apresen/i =~ page.key || /\{\{presen/ =~ page.load
140
+ html_path = site_cache_path+"#{page.key}-presen.html"
141
+ wabisabi = action.c_page_res(page.key)
142
+ w = PresenGenerator.generate(site, page.key, wabisabi)
143
+ add_entry(zos, "#{base}-presen.html", w.format_xml)
144
+ end
145
+ end
146
+
147
+ def self.add_entry(zos, filename, content, mtime = Time.new)
148
+ e = Zip::ZipEntry.new('', filename, '', '', 0,0,
149
+ Zip::ZipEntry::DEFLATED, 0, mtime)
150
+ zos.put_next_entry(e)
151
+ zos.write(content)
152
+ end
153
+
154
+ def self.add_theme(site, action, zos, theme_dir)
155
+ ar = []
156
+
157
+ # FIXME: Collect this file list from the directory.
158
+ ar << 'css/base.css'
159
+ ar << 'css/wema.css'
160
+ ar << 'js/base.js'
161
+ ar << 'js/debugwindow.js'
162
+ ar << 'js/niftypp.js'
163
+ ar << 'js/wema.js'
164
+ ar << 'i/external.png'
165
+ ar << 'i/new.png'
166
+
167
+ t = action.site_theme
168
+ list = action.theme_files(t)
169
+ list.each {|f|
170
+ ar << "#{t}/#{f}"
171
+ }
172
+
173
+ ar << 's5/qwikworld/slides.css'
174
+ ar << 's5/qwikworld/s5-core.css'
175
+ ar << 's5/qwikworld/framing.css'
176
+ ar << 's5/qwikworld/pretty.css'
177
+ ar << 's5/qwikworld/bg-shade.png'
178
+ ar << 's5/qwikworld/bg-slide.jpg'
179
+
180
+ ar << 's5/default/opera.css'
181
+ ar << 's5/default/outline.css'
182
+ ar << 's5/default/print.css'
183
+ ar << 's5/default/slides.js'
184
+
185
+ ar.each {|b|
186
+ add_entry(zos, "#{site.sitename}/.theme/#{b}",
187
+ "#{theme_dir}/#{b}".path.read)
188
+ }
189
+ end
190
+ end
191
+ end
192
+
193
+ if $0 == __FILE__
194
+ require 'qwik/test-common'
195
+ require 'qwik/util-pathname'
196
+ $test = true
197
+ end
198
+
199
+ if defined?($test) && $test
200
+ class TestActArchive < Test::Unit::TestCase
201
+ include TestSession
202
+
203
+ def test_plg_zip
204
+ ok_wi [:p, [:a, {:href=>'test.zip'}, 'test.zip']], '[[test.zip]]'
205
+ ok_wi [:span, {:class=>'attribute'},
206
+ [:a, {:href=>'test.zip'}, 'Site archive']], '{{zip}}'
207
+ end
208
+ end
209
+
210
+ class TestActArchive < Test::Unit::TestCase
211
+ include TestSession
212
+
213
+ def test_act_zip
214
+ t_add_user
215
+
216
+ page = @site['_SiteConfig']
217
+ page.store ':theme:qwikborder'
218
+
219
+ page = @site.create_new
220
+ page.store '* あ'
221
+
222
+ page = @site.create_new
223
+ page.store '* A Presentation Page
224
+ {{presen}}
225
+ * Header 2
226
+ '
227
+ mtime = {}
228
+ mtime[page.key] = page.mtime
229
+
230
+ sleep(1) # let mtime be odd value
231
+
232
+ page = @site.create('PresenTest')
233
+ page.store '* A presentation test page'
234
+ mtime[page.key] = page.mtime
235
+
236
+ res = session '/test/test.zip'
237
+ ok_title "Start."
238
+
239
+ res = session '/test/test.zip'
240
+ ok_title "Running."
241
+
242
+ sleep(1) # I hope this might work...
243
+
244
+ res = session '/test/test.zip'
245
+ ok_eq 'application/zip', res['Content-Type']
246
+ str = res.body
247
+ assert_match(/\APK/, str)
248
+
249
+ 'testtemp.zip'.path.write(str)
250
+
251
+ list = []
252
+ Zip::ZipInputStream.open('testtemp.zip') {|zis|
253
+ while e = zis.get_next_entry
254
+ list << e.name
255
+ end
256
+ }
257
+
258
+ files = %w(
259
+ test/1.txt
260
+ test/1.html
261
+ test/2.txt
262
+ test/2.html
263
+ test/2-presen.html
264
+ test/PresenTest.txt
265
+ test/PresenTest.html
266
+ test/PresenTest-presen.html
267
+ test/_SiteConfig.txt
268
+ test/_SiteConfig.html
269
+ test/_SiteMember.txt
270
+ test/_SiteMember.html
271
+ test/.theme/css/base.css
272
+ test/.theme/css/wema.css
273
+ test/.theme/js/base.js
274
+ test/.theme/js/debugwindow.js
275
+ test/.theme/js/niftypp.js
276
+ test/.theme/js/wema.js
277
+ test/.theme/i/external.png
278
+ test/.theme/i/new.png
279
+ test/.theme/qwikborder/qwikborder_h2.png
280
+ test/.theme/qwikborder/qwikborder_li.png
281
+ test/.theme/qwikborder/qwikborder_ball.png
282
+ test/.theme/qwikborder/qwikborder.css
283
+ test/.theme/s5/qwikworld/slides.css
284
+ test/.theme/s5/qwikworld/s5-core.css
285
+ test/.theme/s5/qwikworld/framing.css
286
+ test/.theme/s5/qwikworld/pretty.css
287
+ test/.theme/s5/qwikworld/bg-shade.png
288
+ test/.theme/s5/qwikworld/bg-slide.jpg
289
+ test/.theme/s5/default/opera.css
290
+ test/.theme/s5/default/outline.css
291
+ test/.theme/s5/default/print.css
292
+ test/.theme/s5/default/slides.js
293
+ )
294
+
295
+ not_included_files = %w(
296
+ test/1-presen.html
297
+ )
298
+
299
+ files.each {|file|
300
+ eq true, list.include?(file)
301
+ }
302
+
303
+ not_included_files.each {|file|
304
+ eq false, list.include?(file)
305
+ }
306
+
307
+ Zip::ZipInputStream.open('testtemp.zip') {|zis|
308
+ while e = zis.get_next_entry
309
+ e_name = File.basename(e.name,'.txt')
310
+ if mtime.has_key? e_name
311
+ expected = mtime[e_name].to_i / 2 * 2
312
+ actual = e.time.to_i / 2 * 2
313
+ ok_eq(expected, actual)
314
+ end
315
+ end
316
+ }
317
+
318
+ 'testtemp.zip'.path.unlink
319
+ end
320
+ end
321
+
322
+ class TestSiteArchive < Test::Unit::TestCase
323
+ include TestSession
324
+
325
+ def test_zip
326
+ res = session
327
+
328
+ page = @site.create_new
329
+ page.store('* あ')
330
+
331
+ zip = Qwik::SiteArchive.generate(@config, @site, @action)
332
+ assert_match(/test.zip\Z/, zip.to_s)
333
+ end
334
+ end
335
+
336
+ class CheckZip < Test::Unit::TestCase
337
+ def test_all
338
+ return if $0 != __FILE__ # Only for separated test.
339
+
340
+ file = 'test.zip'
341
+ time = Time.now - (60*60*24) # yesterday
342
+ Zip::ZipOutputStream.open(file) {|zos|
343
+ zos.put_next_entry('test/test.txt')
344
+ zos.print('test')
345
+
346
+ # Signature of Zip::ZipEntry.new()
347
+ # new(zipfile = "", name = "", comment = "", extra = "",
348
+ # compressed_size = 0, crc = 0,
349
+ # compression_method = ZipEntry::DEFLATED, size = 0,
350
+ # time = Time.now)
351
+
352
+ e = Zip::ZipEntry.new('', 'test2.txt', '', '',
353
+ 0, 0,
354
+ Zip::ZipEntry::DEFLATED, 0, time)
355
+ zos.put_next_entry(e)
356
+ zos.print('test2')
357
+ }
358
+
359
+ zip = file.path.open {|f| f.read }
360
+ assert_match(/\APK/, zip)
361
+ assert_match(/test.txt/, zip)
362
+
363
+ Zip::ZipInputStream.open(file) {|zis|
364
+ e = zis.get_next_entry
365
+ ok_eq('test/test.txt', e.name)
366
+ ok_eq('test', zis.read)
367
+
368
+ e = zis.get_next_entry
369
+ ok_eq('test2.txt', e.name)
370
+ ok_eq('test2', zis.read)
371
+
372
+ # at parse_binary_dos_format() in zip/stdrubyext.rb,
373
+ # 'second' should not be odd value
374
+ # 86: second = 2 * ( 0b11111 & binaryDosTime)
375
+ time_i = time.to_i / 2 * 2
376
+ e_time_i = e.time.to_i / 2 * 2
377
+ ok_eq(time_i, e_time_i)
378
+
379
+ e = zis.get_next_entry
380
+ ok_eq(nil, e)
381
+ }
382
+
383
+ file.path.unlink
384
+ end
385
+ end
386
+ end
@@ -0,0 +1,304 @@
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
+ require 'qwik/act-file'
7
+
8
+ module Qwik
9
+ class Action
10
+ def act_attach
11
+ if @req.query['c'] == 'del'
12
+ c_require_member
13
+ filename = @req.query['f']
14
+ return attach_delete(filename) if @req.is_post? # delete it
15
+ return attach_delete_confirm(filename) # confirm before delete
16
+ end
17
+
18
+ args = @req.path_args
19
+ if 0 < args.length # has target file
20
+ filename = args.join('/')
21
+ filename.set_url_charset
22
+ filename = Filename.decode(filename)
23
+ if ! @site.attach.exist?(filename)
24
+ return c_notfound(_('No such file'))
25
+ end
26
+ return attach_send_file(filename) # send it
27
+ end
28
+
29
+ content = @req.query['content']
30
+ return attach_put_file(filename, content) if content
31
+
32
+ # show attach form and the list of files
33
+ return attach_form_and_list
34
+ end
35
+ alias ext_attach act_attach
36
+
37
+ def attach_send_file(filename)
38
+ @res.set_content_type(Filename.extname(filename))
39
+ file = @site.attach.path(filename)
40
+ return c_simple_send(file.to_s)
41
+ end
42
+
43
+ def attach_put_file(filename, content)
44
+ c_require_member
45
+ c_require_post
46
+
47
+ filename = content.filename
48
+ basename = Action.get_basename(filename)
49
+ basename.set_url_charset
50
+ basename = Filename.decode(basename)
51
+ res = basename
52
+ res = @site.attach.fput(basename, content)
53
+
54
+ attach_rewrite_page(res)
55
+
56
+ backpage = '.attach'
57
+
58
+ return c_notice(_('File attachment completed')) {
59
+ [[:p, [:strong, res], ' : ', _('The file is saved.')],
60
+ [:p, [:a, {:href=>backpage}, _('Go back')]]]
61
+ }
62
+ end
63
+
64
+ def self.get_basename(filename)
65
+ basename = filename.sub(/\A.*[\/\\]([^\/\\]+)\z/) { $1 }
66
+ return basename
67
+ end
68
+
69
+ def attach_rewrite_page(basename)
70
+ page = @site[@req.base]
71
+ v = page.load
72
+ if /\{\{ref\}\}/ =~ v
73
+ v.sub!(/\{\{ref\}\}/){ "{{ref(#{basename})}}" } # only once
74
+ page.store(v)
75
+ end
76
+ end
77
+
78
+ def attach_form_and_list
79
+ c_require_member
80
+
81
+ div = []
82
+ div << [:div, {:class=>'msg'},
83
+ [:p, _('Attach a file')],
84
+ attach_form]
85
+
86
+ list = attach_file_list
87
+
88
+ if list
89
+ div << [:br]
90
+ div << [:div, {:class=>'msg'},
91
+ [:p, _('File list')],
92
+ [:ul, list]]
93
+ end
94
+
95
+ return c_notice(_('Attach file')) { div }
96
+ end
97
+
98
+ def attach_form(a=nil)
99
+ return [:form, {:action=>a, :method=>'post',
100
+ :enctype=>'multipart/form-data'},
101
+ [:input, {:type=>'file', :name=>'content'}],
102
+ [:br],
103
+ [:input, {:type=>'submit', :value=>'attach'}]]
104
+ end
105
+
106
+ def attach_file_list
107
+ base = c_relative_to_root('.attach')
108
+ list = []
109
+ @site.attach.each {|file|
110
+ encoded = Filename.encode(file)
111
+ list << [:li, [:a, {:href=>"#{base}/#{encoded}"}, file.to_page_charset],
112
+ [:span, {:class=>'delete'},
113
+ ' (', [:a, {:href=>"#{base}?c=del&f=#{encoded}"}, _('Delete')], ')']]
114
+ }
115
+ return nil if list.length == 0
116
+ return list
117
+ end
118
+
119
+ def attach_delete_confirm(filename)
120
+ return c_notice(_('Confirm file deletion')) {
121
+ [:form, {:method=>'POST', :action=>'.attach'},
122
+ [:p, _("Push 'Delete' to delete a file")],
123
+ [:input, {:type=>'hidden', :name=>'c', :value=>'del'}],
124
+ [:input, {:type=>'hidden', :name=>'f', :value=>filename}],
125
+ [:p, [:input, {:type=>'submit', :value=>_('Delete')}]]]
126
+ }
127
+ end
128
+
129
+ def attach_delete(filename)
130
+ c_require_post
131
+ url = '.attach'
132
+ begin
133
+ filename.set_url_charset
134
+ filename = Filename.decode(filename)
135
+ @site.attach.delete(filename)
136
+ rescue FileNotExist
137
+ return c_nerror(_('Already deleted.'), url)
138
+ rescue FailedToDelete
139
+ return c_nerror(_('Failed to delete.'), url)
140
+ end
141
+ return c_notice(_('The file has been deleted.')) {
142
+ [:p, [:a, {:href=>url}, _('Go back')]]
143
+ }
144
+ end
145
+ end
146
+ end
147
+
148
+ if $0 == __FILE__
149
+ require 'qwik/test-common'
150
+ $test = true
151
+ end
152
+
153
+ if defined?($test) && $test
154
+ class TestActAttach < Test::Unit::TestCase
155
+ include TestSession
156
+
157
+ def test_attach
158
+ # Only member can access attach form.
159
+ res = session('/test/.attach')
160
+ ok_title('Members Only')
161
+
162
+ t_add_user
163
+
164
+ # Check directory.
165
+ ok_eq('.test/data/test', @site.path.to_s)
166
+ attach_path = @site.path+'.attach'
167
+ ok_eq('.test/data/test/.attach', attach_path.to_s)
168
+
169
+ filename = 't.txt'
170
+ file = attach_path+filename
171
+ file.unlink if file.exist?
172
+
173
+ # See form.
174
+ res = session('/test/.attach')
175
+ ok_title('Attach file')
176
+ ok_xp([:form, {:method=>'post', :action=>nil,
177
+ :enctype=>'multipart/form-data'},
178
+ [:input, {:type=>'file', :name=>'content'}],
179
+ [:br],
180
+ [:input, {:value=>'attach', :type=>'submit'}]],
181
+ "//div[@class='msg']/form")
182
+
183
+ # Try to get a file. But there is no file yet.
184
+ res = session('/test/.attach/t.txt')
185
+ ok_title('No such file')
186
+
187
+ d = @dir+'.attach'
188
+ d.erase_all_for_test if d.exist?
189
+
190
+ # Put a file.
191
+ res = session('POST /test/.attach') {|req|
192
+ req.query.update('content'=>t_make_content('t.txt', 't'))
193
+ }
194
+ ok_title('File attachment completed')
195
+
196
+ # Get the file.
197
+ res = session('/test/.attach/t.txt')
198
+ ok_eq('text/plain', res['Content-Type'])
199
+ ok_eq('t', res.body)
200
+
201
+ # Put a file with same file name again.
202
+ # The file is saved as another filename.
203
+ res = session('POST /test/.attach') {|req|
204
+ req.query.update('content'=>t_make_content('t.txt', 't2'))
205
+ }
206
+ ok_title('File attachment completed')
207
+
208
+ # Show the list of attached files.
209
+ res = session('/test/.attach')
210
+ ok_title('Attach file')
211
+ ok_xp([:form, {:method=>'post', :action=>nil,
212
+ :enctype=>'multipart/form-data'},
213
+ [:input, {:type=>'file', :name=>'content'}],
214
+ [:br],
215
+ [:input, {:value=>'attach', :type=>'submit'}]],
216
+ "//div[@class='msg']/form")
217
+ ok_xp([:a, {:href=>'/test/.attach/1-t.txt'}, '1-t.txt'], '//ul/li/a[1]')
218
+ ok_xp([:a, {:href=>'/test/.attach?c=del&f=1-t.txt'}, 'Delete'],
219
+ '//ul/li/a[2]')
220
+ ok_xp([:a, {:href=>'/test/.attach/t.txt'}, 't.txt'], '//ul/li[2]/a[1]')
221
+ ok_xp([:a, {:href=>'/test/.attach?c=del&f=t.txt'}, 'Delete'],
222
+ '//ul/li[2]/a[2]')
223
+
224
+ # Show a form to delete the file.
225
+ res = session('/test/.attach?c=del&f=t.txt')
226
+ ok_title('Confirm file deletion')
227
+
228
+ # Delete it.
229
+ res = session('POST /test/.attach?c=del&f=t.txt')
230
+ ok_title('The file has been deleted.')
231
+
232
+ # Try to delete it again. But the file is already deleted.
233
+ res = session('POST /test/.attach?c=del&f=t.txt')
234
+ ok_title('Already deleted.')
235
+
236
+ # Try to get file agin. But the file is already deleted.
237
+ res = session('/test/.attach/t.txt')
238
+ ok_title('No such file')
239
+ end
240
+
241
+ def test_attach_with_rewrite
242
+ t_add_user
243
+
244
+ file = @site.attach.path('t.txt')
245
+ file.unlink if file.exist?
246
+
247
+ # See the page.
248
+ ok_wi([], '{{ref}}')
249
+
250
+ page = @site['1']
251
+ ok_eq('{{ref}}', page.load)
252
+
253
+ # Put a file.
254
+ res = session('POST /test/1.attach') {|req|
255
+ req.query.update('content'=>t_make_content('t.txt', 't'))
256
+ }
257
+ ok_title('File attachment completed')
258
+ ok_eq('{{ref(t.txt)}}', page.load)
259
+
260
+ res = session('/test/1.html')
261
+ ok_xp([:div, {:class=>"section"},
262
+ [[:div, {:class=>'ref'},
263
+ [:a, {:href=>'.attach/t.txt'}, 't.txt']]]],
264
+ "//div[@class='section']")
265
+ end
266
+
267
+ def test_attach_with_dir
268
+ t_add_user
269
+
270
+ d = @dir+'.attach'
271
+ d.erase_all_for_test if d.exist?
272
+
273
+ # Try to get a file.
274
+ res = session('/test/.attach/.thumb/t.jpg')
275
+ ok_title('No such file')
276
+
277
+ thumb_dir = d+'.thumb'
278
+ thumb_dir.check_directory
279
+ thumb = thumb_dir+'t.jpg'
280
+ thumb.put('dummy')
281
+
282
+ res = session('/test/.attach/.thumb/t.jpg')
283
+ ok_eq('dummy', res.body)
284
+ ok_eq('image/jpeg', @res['Content-Type'])
285
+ end
286
+
287
+ def test_attach_to_page
288
+ t_add_user
289
+
290
+ page = @site.create_new
291
+ page.store('t')
292
+
293
+ # See form.
294
+ res = session('/test/1.attach')
295
+ ok_title('Attach file')
296
+ ok_xp([:form, {:method=>'post', :action=>nil,
297
+ :enctype=>'multipart/form-data'},
298
+ [:input, {:type=>'file', :name=>'content'}],
299
+ [:br],
300
+ [:input, {:value=>'attach', :type=>'submit'}]],
301
+ "//div[@class='msg']/form")
302
+ end
303
+ end
304
+ end