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,292 @@
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 c_tdiary_resolve(w)
10
+ w = TDiaryResolver.resolve(@config, @site, self, w)
11
+ return w
12
+ end
13
+
14
+ def c_page_url
15
+ page = @site[@req.base]
16
+ return nil if page.nil?
17
+ return page.url
18
+ end
19
+ end
20
+
21
+ class TDiaryResolver
22
+ def initialize(config, site, action)
23
+ @config = config
24
+ @site = site
25
+ @action = action
26
+
27
+ @global_id = 0
28
+
29
+ t = @site.siteconfig['titlelink']
30
+ @titlelink = (t == 'true')
31
+
32
+ t = @site.siteconfig['emode_titlelink']
33
+ @emode_titlelink = (t == 'true')
34
+ end
35
+ attr_reader :titlelink, :emode_titlelink # for test
36
+
37
+ def self.resolve(config, site, action, wabisabi)
38
+ resolver = self.new(config, site, action)
39
+ w = resolver.resolve(wabisabi)
40
+ return w
41
+ end
42
+
43
+ def resolve(wabisabi)
44
+ days = []
45
+ section = []
46
+ days << section
47
+ wabisabi.each {|e|
48
+ if is_title?(e)
49
+ if 0 < section.size
50
+ section = []
51
+ days << section
52
+ end
53
+ end
54
+ section << e
55
+ }
56
+
57
+ @global_id = 0
58
+ ar = []
59
+ days.each {|section|
60
+ title = ''
61
+ title = section.shift if is_title?(section[0])
62
+ ar += tdiary_section(title, section)
63
+ }
64
+ ar
65
+ end
66
+
67
+ def encode_label(name) # used at act-toc.rb
68
+ if name.nil? || name.empty?
69
+ @global_id += 1
70
+ return @global_id.to_s
71
+ end
72
+
73
+ if /\A[A-Za-z0-9\-_:. ]+\z/ =~ name
74
+ name.gsub!(/[^A-Za-z0-9\-_]+/, '_')
75
+ name.squeeze!('_')
76
+ name.chomp!('_')
77
+ name.sub!(/\A_/, '')
78
+ name = 'a' + name if /\A[A-Za-z]/ !~ name
79
+ return name
80
+ end
81
+
82
+ if @emode_titlelink
83
+ name = name+'<span class="e"><br></span>' # adhoc
84
+ name = name.md5.base64
85
+ name.gsub!(/=/, '')
86
+ name.gsub!(/\+/, '-')
87
+ name.gsub!(/\//, '_')
88
+ return name
89
+ end
90
+
91
+ return name.md5hex
92
+ end
93
+
94
+ def self.get_title_name(e) # used at act-toc.rb
95
+ (1..e.length).each {|i|
96
+ if e[i].is_a?(String)
97
+ return e[i].to_s.strip
98
+ end
99
+ }
100
+ return ''
101
+ end
102
+
103
+ private
104
+
105
+ def is_title?(e)
106
+ e.is_a?(Array) && e[0] == :h2
107
+ end
108
+
109
+ def make_title_link(e)
110
+ return e if e.length < 2
111
+
112
+ name = TDiaryResolver.get_title_name(e)
113
+ label = encode_label(name)
114
+
115
+ url = @action.c_page_url
116
+ href = "#{url}#"+label
117
+
118
+ if (@titlelink || @emode_titlelink)
119
+ m = "■"
120
+ e.insert(1, [:a, {:class=>'label', :href=>href, :name=>label}, m])
121
+ return e
122
+ end
123
+
124
+ e.insert(1, {:id=>label})
125
+ e
126
+ end
127
+
128
+ def tdiary_section(title, section)
129
+ title = make_title_link(title)
130
+ return [
131
+ [:div, {:class=>'day'},
132
+ title,
133
+ [:div, {:class=>'body'},
134
+ [:div, {:class=>'section'},
135
+ section],
136
+ [:"!--", 'section']],
137
+ [:"!--", 'body']],
138
+ [:"!--", 'day']
139
+ ]
140
+ end
141
+ end
142
+ end
143
+
144
+ if $0 == __FILE__
145
+ require 'qwik/test-common'
146
+ $test = true
147
+ end
148
+
149
+ if defined?($test) && $test
150
+ class TestTDiaryResolver < Test::Unit::TestCase
151
+ include TestSession
152
+
153
+ def ok_t(e, s)
154
+ res = Qwik::TDiaryResolver.new(@config, @site, @action)
155
+ ok_eq(e, res.make_title_link(s))
156
+ end
157
+
158
+ def test_basic
159
+ res = session
160
+
161
+ res = Qwik::TDiaryResolver.new(@config, @site, @action)
162
+
163
+ Qwik::TDiaryResolver.instance_eval {
164
+ public :is_title?
165
+ public :encode_label
166
+ public :tdiary_section
167
+ public :make_title_link
168
+ }
169
+
170
+ # test_is_title?
171
+ ok_eq(true, res.is_title?([:h2, 't']))
172
+ ok_eq(false, res.is_title?([:h3, 't']))
173
+
174
+ # test_encode_label
175
+ ok_eq('1', res.encode_label(''))
176
+ ok_eq('2', res.encode_label(''))
177
+ ok_eq('t', res.encode_label('t'))
178
+ ok_eq('3', res.encode_label(''))
179
+
180
+ ok_eq('t_t', res.encode_label('t t'))
181
+ ok_eq('t_t', res.encode_label('t_t'))
182
+ ok_eq('t-t', res.encode_label('t-t'))
183
+ ok_eq('930149ca7573114b0341159c94380421', res.encode_label("t!"))
184
+
185
+ # test_tdiary_section
186
+ t = res.tdiary_section([:h2, 't'], 'section')
187
+ ok_eq([[:div, {:class=>'day'},
188
+ [:h2, {:id=>'t'}, 't'],
189
+ [:div, {:class=>'body'},
190
+ [:div, {:class=>'section'}, 'section'],
191
+ [:"!--", 'section']],
192
+ [:"!--", 'body']],
193
+ [:"!--", 'day']],
194
+ t)
195
+
196
+ ok_eq([:div, {:class=>'day'},
197
+ [:h2, {:id=>'t'}, 't'],
198
+ [:div, {:class=>'body'},
199
+ [:div, {:class=>'section'}, 'section']]],
200
+ t.remove_comment.get_single)
201
+
202
+ # test_make_title_link
203
+ res = session
204
+
205
+ ok_t([:h2, {:id=>'t'}, 't'], [:h2, 't'])
206
+
207
+ config = @site['_SiteConfig']
208
+ config.store(':titlelink:true')
209
+
210
+ ok_t([:h2, [:a, {:href=>"FrontPage.html#t", :name=>'t',
211
+ :class=>'label'}, "■"], 't'],
212
+ [:h2, 't'])
213
+
214
+ ok_t([:h2, [:a, {:name=>'8f03c3a6dbec1d0f1a5af60947b7b052',
215
+ :class=>'label',
216
+ :href=>"FrontPage.html#8f03c3a6dbec1d0f1a5af60947b7b052"},
217
+ "■"], "あ"],
218
+ [:h2, "あ"])
219
+ end
220
+
221
+ def test_emode
222
+ res = session
223
+
224
+ Qwik::TDiaryResolver.instance_eval {
225
+ public :encode_label
226
+ }
227
+
228
+ config = @site['_SiteConfig']
229
+ config.store(':emode_titlelink:true')
230
+ res = Qwik::TDiaryResolver.new(@config, @site, @action)
231
+ ok_eq('t', res.encode_label('t'))
232
+ ok_eq('zNC0vEuG7ZsGqzX0C5tyRQ', res.encode_label("t!"))
233
+ ok_eq('ZHQyWazgdpeYgxXBvfV-jA', res.encode_label("あ"))
234
+
235
+ ok_t([:h2, [:a, {:href=>"FrontPage.html#t", :name=>'t',
236
+ :class=>'label'}, "■"], 't'],
237
+ [:h2, 't'])
238
+ ok_t([:h2, [:a, {:name=>'ZHQyWazgdpeYgxXBvfV-jA',
239
+ :class=>'label',
240
+ :href=>"FrontPage.html#ZHQyWazgdpeYgxXBvfV-jA"},
241
+ "■"], "あ"],
242
+ [:h2, "あ"])
243
+ end
244
+
245
+ def ok_res(e, wabisabi)
246
+ res = Qwik::TDiaryResolver.new(@config, @site, @action)
247
+ w = res.resolve(wabisabi).remove_comment
248
+ ok_eq(e, w)
249
+ end
250
+
251
+ def test_tdiary_resolve
252
+ res = session
253
+ ok_res([[:div, {:class=>'day'}, '',
254
+ [:div, {:class=>'body'}, [:div, {:class=>'section'}, []]]]],
255
+ '')
256
+ ok_res([[:div, {:class=>'day'},
257
+ [:h2, {:id=>'t'}, 't'],
258
+ [:div, {:class=>'body'}, [:div, {:class=>'section'}, []]]]],
259
+ [[:h2, 't']])
260
+ ok_res([[:div, {:class=>'day'},
261
+ [:h2, {:id=>'h2'},'h2'],
262
+ [:div, {:class=>'body'},
263
+ [:div, {:class=>'section'},
264
+ [[:p, 'text of h2'], [:h3, 'h3'], [:p, 'text of h3']]]]]],
265
+ [[:h2, 'h2'],
266
+ [:p, 'text of h2'],
267
+ [:h3, 'h3'],
268
+ [:p, 'text of h3']])
269
+ ok_res([[:div, {:class=>'day'},
270
+ [:h2, {:id=>'h2'},'h2'],
271
+ [:div, {:class=>'body'},
272
+ [:div, {:class=>'section'}, [[:p, 'text of h2']]]]],
273
+ [:div, {:class=>'day'},
274
+ [:h2, {:id=>'h2_2'},'h2 2'],
275
+ [:div, {:class=>'body'},
276
+ [:div, {:class=>'section'}, [[:p, 'text of h2 2']]]]]],
277
+ [[:h2, 'h2'],
278
+ [:p, 'text of h2'],
279
+ [:h2, 'h2 2'],
280
+ [:p, 'text of h2 2']])
281
+
282
+ # test_tdiary_resolve_with_titlelink
283
+ config = @site['_SiteConfig']
284
+ config.store(':titlelink:true')
285
+ ok_res([[:div, {:class=>'day'},
286
+ [:h2, [:a, {:name=>'t', :class=>'label',
287
+ :href=>"FrontPage.html#t"}, "■"], 't'],
288
+ [:div, {:class=>'body'}, [:div, {:class=>'section'}, []]]]],
289
+ [[:h2, 't']])
290
+ end
291
+ end
292
+ end
@@ -0,0 +1,121 @@
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/resolve-tdiary'
7
+ require 'qwik/act-basic'
8
+ require 'qwik/common-resolve'
9
+ require 'qwik/site-resolve'
10
+
11
+ module Qwik
12
+ class Resolver
13
+ def self.resolve(site, action, wabisabi)
14
+ wabisabi ||= []
15
+ wabisabi = wabisabi.deep_copy
16
+ wabisabi.make_index
17
+ wabisabi = site.resolve_all_ref(wabisabi)
18
+ wabisabi = action.resolve_all_plugin(wabisabi)
19
+ return wabisabi
20
+ end
21
+ end
22
+ end
23
+
24
+ if $0 == __FILE__
25
+ require 'qwik/test-common'
26
+ $test = true
27
+ end
28
+
29
+ if defined?($test) && $test
30
+ require 'qwik/test-module-public'
31
+
32
+ class TestResolveEtc < Test::Unit::TestCase
33
+ include TestSession
34
+
35
+ def test_all
36
+ # test_br
37
+ ok_wi [:p, 't', [:br], 's'], "t~\ns\n"
38
+ eq "\342\200\276", '~'.set_sourcecode_charset.to_utf8 # test bug
39
+
40
+ # test_resolve_ref
41
+ ok_wi [:p, [:a, {:href=>'FrontPage.html'}, 'FrontPage']],
42
+ '[[FrontPage]]'
43
+ ok_wi [:p, [:a, {:href=>'FrontPage.html'}, 't']], '[[t|FrontPage]]'
44
+ page = @site.create_new
45
+ page.store '*あ'
46
+ ok_wi [:p, [:a, {:href=>'2.html'}, 'あ']], "[[2]]"
47
+ ok_wi [:p, [:a, {:href=>'2.html'}, 'あ']], '[[あ]]'
48
+
49
+ # test_resolve_plugin
50
+ ok_wi [:p, [:em, 't']], "''t''"
51
+ ok_wi [:p, [:em, '']], "''{{qwik_null}}''"
52
+ ok_wi [:p, [:strong, 't']], "'''t'''"
53
+ ok_wi [:p, [:strong, '']], "'''{{qwik_null}}'''"
54
+ ok_wi [:span, {:class=>"plg_error"}, "nosuch plugin | ",
55
+ [:strong, "nosuchplugin"]], '{{nosuchplugin}}'
56
+
57
+ ok_wi [:p, 'a ', ''], 'a {{qwik_null}}'
58
+ ok_wi [:p, 'a ', '', ' b'], 'a {{qwik_null}} b'
59
+ end
60
+ end
61
+
62
+ class TestFormatter < Test::Unit::TestCase
63
+ include TestSession
64
+
65
+
66
+ def test_all1b
67
+ res = session
68
+
69
+ # test_plugin_link
70
+ ok_wi [:p, [:a, {:href=>".recent"}, ".recent"]], '[[.recent]]'
71
+ ok_wi "<p><a href=\".recent\">RecentList</a></p>",
72
+ '[[RecentList|.recent]]'
73
+ ok_wi "<p><a href=\".rss\">.rss</a></p>", '[[.rss]]' # not use for now
74
+ ok_wi "<p><a href=\".attach\">.attach</a></p>", '[[.attach]]'
75
+ ok_wi "<p><a href=\".attach/t.txt\">.attach/t.txt</a></p>",
76
+ '[[.attach/t.txt]]'
77
+ ok_wi "<p><a href=\".attach/s t.txt\">.attach/s t.txt</a></p>",
78
+ '[[.attach/s t.txt]]'
79
+ end
80
+
81
+ def test_all2
82
+ res = session
83
+
84
+ # test_block
85
+ ok_wi '<dl><dt>t</dt><dd>s</dd></dl>', ':t:s'
86
+ ok_wi '<dl><dt>t</dt></dl>', ':t:'
87
+ ok_wi '<dl><dt>t</dt></dl>', ':t'
88
+ ok_wi '<blockquote><p>t</p></blockquote>', '> t'
89
+ ok_wi '<blockquote><p>t</p></blockquote>', '>t'
90
+ ok_wi '<table><tr><td>t</td><td>s</td></tr></table>', '|t|s|'
91
+
92
+ # test_name
93
+ #ok_wi "<h2><span class='date'/><span class='title'><a name='l0'> </a> t</span></h2>", '* t'
94
+
95
+ # test_inline
96
+ ok_wi '<p><em>t</em></p>', "''t''"
97
+ ok_wi '<p><strong>t</strong></p>', "'''t'''"
98
+ end
99
+
100
+ def test_all3
101
+ res = session
102
+
103
+ # test_link
104
+ ok_wi '<p>t</p>', 't'
105
+ page = @site['FrontPage']
106
+ page.store '*title'
107
+ ok_wi "<p><a href=\"FrontPage.html\">title</a></p>", '[[FrontPage]]'
108
+ page = @site.create('t')
109
+ page.store 't2'
110
+ ok_wi "<p><a href=\"t.html\">t</a></p>", '[[t]]'
111
+ ok_wi "<p><a href=\"FrontPage.html\">t</a></p>", '[[t|FrontPage]]'
112
+ ok_wi "<p><a href=\"t.html\">s</a></p>", '[[s|t]]'
113
+ page = @site.create_new
114
+ page.store '*あ'
115
+ ok_wi "<p><a href=\"2.html\">あ</a></p>", "[[2]]"
116
+
117
+ # test_find_title
118
+ ok_wi "<p><a href=\"2.html\">あ</a></p>", '[[あ]]'
119
+ end
120
+ end
121
+ end
@@ -0,0 +1,228 @@
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
+ require 'webrick/cookie'
6
+
7
+ $LOAD_PATH.unshift '..' unless $LOAD_PATH.include? '..'
8
+ require 'qwik/config'
9
+ require 'qwik/wabisabi-format-xml'
10
+
11
+ module Qwik
12
+ class Response
13
+ COOKIE_EXP = 60*60*24*30 # 30 days
14
+
15
+ MIME_TYPES = {
16
+ 'smil' => 'application/smil',
17
+ 'swf' => 'application/x-shockwave-flash',
18
+ # 'ico' => 'image/bitmap', # FIXME: Is this OK?
19
+ 'ico' => 'image/vnd.microsoft.icon',
20
+ 'png' => 'image/png',
21
+ '3gp' => 'video/3gpp',
22
+ 'tgz' => 'application/octet-stream',
23
+ 'gz' => 'application/octet-stream',
24
+ 'mdlb' => 'application/x-modulobe',
25
+ }
26
+
27
+ def initialize(config)
28
+ @config = config
29
+ clear
30
+ end
31
+ attr_accessor :body, :status
32
+ attr_reader :headers # for test
33
+ attr_reader :cookies # for test
34
+ attr_accessor :basicauth
35
+ attr_accessor :sessionid
36
+
37
+ def clear
38
+ @body = nil
39
+ @status = 200
40
+ @cookies = []
41
+ @headers = {}
42
+ @mimetypes = {}
43
+ @basicauth = nil
44
+ @sessionid = nil
45
+ end
46
+
47
+ def set_webrick(response)
48
+ make_mimetypes(response.config[:MimeTypes])
49
+ end
50
+
51
+ def make_mimetypes(mimetypes)
52
+ @mimetypes = mimetypes
53
+ @mimetypes.update(MIME_TYPES)
54
+ end
55
+
56
+ def get_mimetypes(ext)
57
+ @mimetypes[ext.downcase]
58
+ end
59
+
60
+ def set_content_type(ext)
61
+ mtype = get_mimetypes(ext) # Get content type.
62
+ @headers['Content-Type'] = mtype
63
+ end
64
+
65
+ def [](k)
66
+ return @headers[k]
67
+ end
68
+
69
+ def []=(k, v)
70
+ @headers[k] = v
71
+ end
72
+
73
+ def set_cookies(user, pass)
74
+ set_cookie('user', user)
75
+ set_cookie('pass', pass)
76
+ end
77
+
78
+ def set_cookie(k, v)
79
+ @cookies << make_cookie(k, v)
80
+ end
81
+
82
+ def clear_cookies
83
+ # Set cookies to 1 hour ago, to clear cookies from browser.
84
+ clear_cookie('user')
85
+ clear_cookie('pass')
86
+ clear_cookie('sid')
87
+ end
88
+
89
+ def clear_cookie(k)
90
+ @cookies << make_cookie(k, '', -60*60)
91
+ end
92
+
93
+ def make_cookie(k, v, exp=COOKIE_EXP)
94
+ c = WEBrick::Cookie.new(k, v)
95
+ c.path = '/'
96
+ c.expires = Time.now + exp
97
+ return c
98
+ end
99
+ private :make_cookie
100
+
101
+ def setback_body(body)
102
+ case body
103
+ when Array # wabisabi
104
+ return body.format_xml
105
+ when File
106
+ return body # do not convert
107
+ when String
108
+ return body
109
+ when IO
110
+ return body
111
+ else
112
+ return body.to_s
113
+ end
114
+ end
115
+
116
+ def setback(response)
117
+ response.body = setback_body(@body)
118
+ response.status = @status
119
+ @cookies.each {|c| response.cookies << c }
120
+ @headers.each {|k, v| response[k] = v }
121
+ #imitate_apache_header_order(response.header)
122
+ end
123
+
124
+ def imitate_apache_header_order(h)
125
+ def h.each
126
+ h = {}
127
+ super {|k, v|
128
+ h[k] = v
129
+ }
130
+
131
+ pre_header = %w(date server)
132
+ post_header = %w(etag last-modified location cache-control pragma keep-alive transfer-encoding content-encoding content-length connection content-type)
133
+
134
+ ar = []
135
+ pre_header.each {|k|
136
+ if h[k]
137
+ ar << [k, h[k]]
138
+ h.delete(k)
139
+ end
140
+ }
141
+
142
+ postar = []
143
+ post_header.each {|k|
144
+ if h[k]
145
+ postar << [k, h[k]]
146
+ h.delete(k)
147
+ end
148
+ }
149
+
150
+ h.each {|k, v|
151
+ ar << [k, v]
152
+ }
153
+
154
+ ar += postar
155
+
156
+ ar.each {|k, v|
157
+ yield(k, v)
158
+ }
159
+ end
160
+ end
161
+ end
162
+ end
163
+
164
+ if $0 == __FILE__
165
+ require 'qwik/testunit'
166
+ $test = true
167
+ end
168
+
169
+ if defined?($test) && $test
170
+ class TestResponse < Test::Unit::TestCase
171
+ def test_all
172
+ config = Qwik::Config.new
173
+ res = Qwik::Response.new(config)
174
+
175
+ # test_mimetypes
176
+ mt = {}
177
+ res.make_mimetypes(mt)
178
+ ok_eq('application/x-shockwave-flash', mt['swf'])
179
+ ok_eq('application/smil', mt['smil'])
180
+ ok_eq('image/vnd.microsoft.icon', mt['ico'])
181
+ ok_eq('image/png', mt['png'])
182
+ ok_eq('video/3gpp', mt['3gp'])
183
+
184
+ # test_headers
185
+ res['X-Test-Header'] = 't1'
186
+ ok_eq('t1', res['X-Test-Header'])
187
+ res.clear
188
+ ok_eq(nil, res['X-Test-Header'])
189
+
190
+ # test_cookie
191
+ res.set_cookies('t@e.com', 'testpass')
192
+ ok_eq(2, res.cookies.length)
193
+ res.clear_cookies
194
+ #ok_eq(4, res.cookies.length)
195
+ res.clear
196
+ ok_eq(0, res.cookies.length)
197
+
198
+ # test_setback
199
+ ok_eq('', res.setback_body([]))
200
+ ok_eq("<t\n></t\n>", res.setback_body([:t, ""]))
201
+ ok_eq('t', res.setback_body('t'))
202
+ ok_eq('', res.setback_body(nil))
203
+ end
204
+
205
+ def test_mimetypes
206
+ config = Qwik::Config.new
207
+ res = Qwik::Response.new(config)
208
+
209
+ require 'webrick/httputils'
210
+
211
+ default_mimetypes = WEBrick::HTTPUtils::DefaultMimeTypes
212
+ res.make_mimetypes(default_mimetypes)
213
+
214
+ # Check mimetypes.
215
+ ok_eq('text/html', res.get_mimetypes('html'))
216
+ ok_eq('text/plain', res.get_mimetypes('txt'))
217
+ ok_eq('text/css', res.get_mimetypes('css'))
218
+ ok_eq('image/gif', res.get_mimetypes('gif'))
219
+ ok_eq('image/png', res.get_mimetypes('png'))
220
+ ok_eq('image/jpeg', res.get_mimetypes('jpg'))
221
+ ok_eq('image/jpeg', res.get_mimetypes('JPG')) # Check upcase
222
+ ok_eq('image/jpeg', res.get_mimetypes('JPEG')) # Check upcase
223
+ ok_eq('application/smil', res.get_mimetypes('smil'))
224
+ ok_eq('application/zip', res.get_mimetypes('zip'))
225
+ ok_eq('application/x-modulobe', res.get_mimetypes('mdlb'))
226
+ end
227
+ end
228
+ end
@@ -0,0 +1,57 @@
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/farm' # Do not add farm here.
7
+
8
+ module Qwik
9
+ class ServerMemory
10
+ def initialize(config)
11
+ @config = config
12
+ @cache = {}
13
+ end
14
+
15
+ def [](k)
16
+ @cache[k]
17
+ end
18
+
19
+ def []=(k, v)
20
+ @cache[k] = v
21
+ end
22
+
23
+ # farm
24
+ def farm
25
+ # @farm = Farm.new(@config, self) unless defined? @farm
26
+ # @farm
27
+ return Farm.new(@config, self)
28
+ end
29
+
30
+ # template
31
+ def template
32
+ @template = TemplateFactory.new(@config) unless defined? @template
33
+ @template
34
+ end
35
+
36
+ # catalog
37
+ def catalog
38
+ unless defined? @catalog
39
+ @catalog = CatalogFactory.new
40
+ @catalog.load_all_here('catalog-??.rb')
41
+ end
42
+ @catalog
43
+ end
44
+
45
+ # act-theme
46
+ def theme
47
+ @theme = ThemeFactory.new(@config) unless defined? @theme
48
+ @theme
49
+ end
50
+
51
+ # common-session
52
+ def sessiondb
53
+ @sessiondb = SessionDB.new(@config) unless defined? @sessiondb
54
+ @sessiondb
55
+ end
56
+ end
57
+ end