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,1071 @@
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
+ # Special mode for Ring.
6
+
7
+ $LOAD_PATH.unshift '..' unless $LOAD_PATH.include? '..'
8
+
9
+ $KCODE = 's'
10
+
11
+ module Qwik
12
+ class Action
13
+ NotUse_D_ExtRing = {
14
+ :dt => 'Ring mode',
15
+ :dd => 'This is a special mode for Ring.',
16
+ :dc => "* How to
17
+ * invite
18
+ {{ring_invite_form}}
19
+ ** invite list
20
+ {{ring_invite_list}}
21
+ * maker
22
+ {{ring_make_form}}
23
+ * msg
24
+ {{ring_message_form}}
25
+ ** date
26
+ {{ring_date(1)}}
27
+ * user
28
+ {{ring_user(guest@example.com, mail)}}
29
+ {{ring_show(mail)}}
30
+ {{ring_link(guest@example.com)}}
31
+ {{ring_get_user_from_pagename(1)}}
32
+ {{ring_see(1)}}
33
+ {{ring_personal_info}}
34
+ {{ring_ul(guest@example.com)}}
35
+
36
+ "
37
+ }
38
+
39
+ # ============================== common
40
+ RING_MEMBER = 'RingMember'
41
+ RING_INVITE_MEMBER = 'RingInvitedMember'
42
+ RING_INVITE_MAIL_TEMPLATE = 'RingInviteMailTemplate'
43
+ RING_PAGE_TEMPLATE = 'RingPageTemplate'
44
+ RING_CATALOG = 'RingCatalog'
45
+
46
+ # ============================== catalog
47
+ def _r(text)
48
+ catalog = ring_catalog
49
+ t = catalog[text]
50
+ return t if t
51
+
52
+ # Try to reload.
53
+ @memory[:ring_catalog] = ring_generate_catalog
54
+ catalog = ring_catalog
55
+ t = catalog[text]
56
+ return t if t
57
+
58
+ #raise if @config.test # Only for test.
59
+
60
+ return text.to_s # abandon
61
+ end
62
+
63
+ def ring_catalog
64
+ if @memory[:ring_catalog].nil?
65
+ @memory[:ring_catalog] = ring_generate_catalog
66
+ end
67
+ return @memory[:ring_catalog]
68
+ end
69
+
70
+ def ring_generate_catalog
71
+ catalog = {}
72
+ page = @site.get_superpage(RING_CATALOG)
73
+ if page.nil?
74
+ page = @site.create("_#{RING_CATALOG}")
75
+ page.store(RING_CATALOG_CONTENT)
76
+ end
77
+ if page
78
+ wdb = page.wikidb
79
+ wdb.hash.each {|k, v|
80
+ catalog[k.intern] = v
81
+ }
82
+ end
83
+ return catalog
84
+ end
85
+
86
+ RING_CATALOG_CONTENT = '
87
+ :TEST:テスト
88
+ :RIGHT_ARROW:→
89
+ :BULLET:●
90
+ :USER:ユーザ名
91
+ :YOUR_MAIL:あなたのメール
92
+ :YOUR_USER:あなたのユーザ名
93
+ :YOUR_NAME:あなたの名前
94
+ :MAIL:メール
95
+ :USER_NAME:ユーザネーム
96
+ :MESSAGE:メッセージ
97
+ :REALNAME:本名
98
+ :THANKYOU:どうもありがとうございました。
99
+ :CONFIRM_YOUR_INPUT:もう一度入力を確認してください。
100
+ :NAME:名前
101
+ :NYUGAKU:入学
102
+ :YEAR:年
103
+ '
104
+
105
+ # ============================== invite
106
+ # Show invite form
107
+ def plg_ring_invite_form(dest=nil)
108
+ action = "#{@req.base}.ring_invite"
109
+ your_mail = plg_ring_show('mail')
110
+ your_username = plg_ring_show('user')
111
+ your_name = plg_ring_show('name')
112
+ guest_mail = 'guest@example.com'
113
+ w = [:div, {:class=>'form'},
114
+ [:form, {:method=>'POST', :action=>action},
115
+ [:table,
116
+ [:tr,
117
+ [:th, _r(:BULLET)+_r(:YOUR_MAIL)],
118
+ [:td, your_mail]],
119
+ [:tr,
120
+ [:th, _r(:BULLET)+_r(:YOUR_USER)],
121
+ [:td, your_username]],
122
+ [:tr,
123
+ [:th, _r(:BULLET)+_r(:YOUR_NAME)],
124
+ [:td, your_name]],
125
+ [:tr,
126
+ [:th, _r(:BULLET)+_r(:MAIL)],
127
+ [:td, [:textarea, {:cols=>'40', :rows=>'4', :name=>'guest_mail'},
128
+ guest_mail]]],
129
+ [:tr,
130
+ [:td, {:class=>'msg', :colspan=>2},
131
+ _r(:INVITE_INPUT_GUEST_MAIL)]],
132
+ [:tr,
133
+ [:th, _r(:BULLET)+_r(:MESSAGE)],
134
+ [:td, [:textarea, {:cols=>'40', :rows=>'7', :name=>'message'},
135
+ _r(:INVITE_MESSAGE_DUMMY_TEXT)]]],
136
+ [:tr,
137
+ [:td, {:class=>'msg', :colspan=>2}, _r(:INVITE_DESC)]],
138
+ [:tr,
139
+ [:th, ''],
140
+ [:td, [:input, {:type=>'submit', :class=>'submit',
141
+ :value=>_r(:INVITE_DO_INVITE)}]]]]]]
142
+ return w
143
+ end
144
+
145
+ def plg_ring_invite_go(arg=nil) # obsolete
146
+ return
147
+ end
148
+
149
+ def ext_ring_invite
150
+ page = @site[@req.base]
151
+ href = page.url
152
+
153
+ guest_mails = @req.query['guest_mail']
154
+ message = @req.query['message']
155
+ if guest_mails.nil? || guest_mails.empty? || message.nil?
156
+ return ring_invite_goback(href)
157
+ end
158
+
159
+ if guest_mails.to_s == 'guest@example.com'
160
+ return ring_invite_goback(href)
161
+ end
162
+
163
+ guest_mail_ar = Action.ring_invite_parse_guest_mails(guest_mails)
164
+ if guest_mail_ar.length == 0
165
+ return ring_invite_goback(href)
166
+ end
167
+
168
+ ring_invite_guest(guest_mail_ar, message)
169
+
170
+ return c_notice(_r(:INVITE_MAIL_IS_SENT)) {
171
+ [[:h3, _r(:INVITE_MAIL_IS_SENT)],
172
+ [:dl,
173
+ [:dt, _r(:MESSAGE)],
174
+ [:dd, message]],
175
+ [:p, _r(:THANKYOU)],
176
+ [:p, [:a, {:href=>href}, _('Go back')]]]
177
+ }
178
+ end
179
+
180
+ def ring_invite_goback(href)
181
+ return c_nerror(_r(:INVITE_NOSEND)) {
182
+ [[:h3, _r(:INVITE_NOSEND)],
183
+ [:p, _r(:CONFIRM_YOUR_INPUT)],
184
+ [:p, [:a, {:href=>href}, _('Go back')]]]
185
+ }
186
+ end
187
+
188
+ def self.ring_invite_parse_guest_mails(guest_mails)
189
+ guest_mail_ar = []
190
+ guest_mails.each {|line|
191
+ line.chomp!
192
+ line.sub!(/\A\s+/, "")
193
+ line.sub!(/\s+\z/, "")
194
+ line.sub!(/,\z/, "")
195
+ guest_mail = line
196
+ next unless MailAddress.valid?(guest_mail)
197
+ guest_mail_ar << guest_mail
198
+ }
199
+ return guest_mail_ar
200
+ end
201
+
202
+ # In this method, we actually add the guest user.
203
+ def ring_invite_guest(guest_mail_ar, message)
204
+ host_mail = @req.user
205
+ page = @site.get_superpage(RING_INVITE_MEMBER)
206
+ page = @site.create('_'+RING_INVITE_MEMBER) if page.nil?
207
+ now = @req.start_time
208
+
209
+ member = @site.member
210
+ guest_mail_ar.each {|guest_mail|
211
+ next if member.exist_qwik_members?(guest_mail)
212
+ member.add(guest_mail, host_mail)
213
+ page.wikidb.add(guest_mail, '', host_mail, message, now.to_i)
214
+ ring_invite_sendmail(host_mail, guest_mail, '', message)
215
+ }
216
+ end
217
+
218
+ def ring_dummy_template
219
+ str = '#{guest_mail}
220
+ #{message}
221
+ #{host_name}
222
+ #{host_mail}
223
+ http://ring.sfc.keio.ac.jp/.getpass?mail=#{guest_mail}
224
+ '
225
+ return str
226
+ end
227
+
228
+ def ring_invite_sendmail(host_mail, guest_mail, guest_name, message)
229
+ host_name = plg_ring_user(host_mail, 'name')
230
+ host_name ||= ''
231
+ host_from = "#{host_name} <#{host_mail}>"
232
+ guest_to = guest_mail
233
+ subject = _r(:INVITE_SUBJECT)
234
+ template_page = @site.get_superpage(RING_INVITE_MAIL_TEMPLATE)
235
+
236
+ if template_page
237
+ content = template_page.load
238
+ else
239
+ content = ring_dummy_template
240
+ end
241
+
242
+ content.gsub!(/\#\{host_name\}/, host_name)
243
+ content.gsub!(/\#\{host_mail\}/, host_mail)
244
+ content.gsub!(/\#\{guest_mail\}/, guest_mail)
245
+ content.gsub!(/\#\{message\}/, message)
246
+
247
+ mail = {
248
+ :from => host_from,
249
+ :to => guest_to,
250
+ :subject => subject,
251
+ :content => content,
252
+ }
253
+ sm = Sendmail.new(@config.smtp_host, @config.smtp_port, @config.test)
254
+ sm.send(mail)
255
+ end
256
+
257
+ def plg_ring_invite_list(arg=nil)
258
+ page = @site.get_superpage(RING_INVITE_MEMBER)
259
+ return if page.nil?
260
+ ar = page.wikidb.hash.to_a
261
+
262
+ dl = [:dl]
263
+ ar.reverse.each {|k, v|
264
+ guest_mail = k
265
+ guest_name, host_mail, message, time = v
266
+ ymd = ''
267
+ if time.is_a? String
268
+ time = Time.at(time.to_i)
269
+ ymd = time.ymd
270
+ end
271
+
272
+ userlink = plg_ring_ul(host_mail)
273
+ dt = [:dt, userlink,
274
+ "#{_r(:RIGHT_ARROW)}#{guest_name} (#{guest_mail}) #{ymd}"]
275
+ dd = [:dd, message]
276
+ dl << dt
277
+ dl << dd
278
+ }
279
+
280
+ return [:div, {:class=>'ring_invite_list'}, dl]
281
+ end
282
+
283
+ # ============================== maker
284
+ # ========== make user page from template
285
+ # http://colinux:9190/ring.sfc.keio.ac.jp/_TestActRingMaker.html
286
+ def plg_ring_make_form(dest=nil)
287
+ action = "#{@req.base}.ring_make"
288
+ mail = @req.user
289
+ return [:div, {:class=>'form'},
290
+ [:form, {:action=>action, :method=>'POST'},
291
+ [:table,
292
+ [:tr,
293
+ [:th, _r(:BULLET)+_r(:MAIL)],
294
+ [:td, mail]],
295
+ [:tr,
296
+ [:th, _r(:BULLET)+_r(:NAME)],
297
+ [:td, [:input, {:name=>'username'}]]],
298
+ [:tr,
299
+ [:td, {:class=>'msg', :colspan=>2}, _r(:MAKER_USER_NAME_DESC)]],
300
+ [:tr,
301
+ [:th, _r(:BULLET)+_r(:REALNAME)],
302
+ [:td, [:input, {:name=>'realname'}]]],
303
+ [:tr,
304
+ [:th, _r(:BULLET)+_r(:NYUUGAKU_GAKUBU)],
305
+ [:td, [:select, {:name=>'faculty'},
306
+ [:option, {:name=>_r(:FACULTY_SS)}, _r(:FACULTY_SS)],
307
+ [:option, {:name=>_r(:FACULTY_EI)}, _r(:FACULTY_EI)],
308
+ [:option, {:name=>_r(:FACULTY_KI)}, _r(:FACULTY_KI)],
309
+ [:option, {:name=>_r(:FACULTY_SM)}, _r(:FACULTY_SM)]]]],
310
+ [:tr,
311
+ [:th, _r(:BULLET)+_r(:NYUUGAKU_NENDO)],
312
+ [:td, [:select, {:name=>'year'},
313
+ [:option, {:name=>'1990'}, '1990'],
314
+ [:option, {:name=>'1991'}, '1991'],
315
+ [:option, {:name=>'1992'}, '1992'],
316
+ [:option, {:name=>'1993'}, '1993'],
317
+ [:option, {:name=>'1994'}, '1994'],
318
+ [:option, {:name=>'1995'}, '1995'],
319
+ [:option, {:name=>'1996'}, '1996'],
320
+ [:option, {:name=>'1997'}, '1997'],
321
+ [:option, {:name=>'1998'}, '1998'],
322
+ [:option, {:name=>'1999'}, '1999'],
323
+ [:option, {:name=>'2000'}, '2000'],
324
+ [:option, {:name=>'2001'}, '2001'],
325
+ [:option, {:name=>'2002'}, '2002'],
326
+ [:option, {:name=>'2003'}, '2003']]]],
327
+ [:tr,
328
+ [:th, ''],
329
+ [:td, [:input, {:value=>_r(:MAKER_REGISTER),
330
+ :type=>'submit', :class=>'submit'}]]]]]]
331
+ end
332
+
333
+ def plg_ring_make_go(arg=nil)
334
+ return # obsolete
335
+ end
336
+
337
+ def ext_ring_make
338
+ href = "#{@req.base}.html"
339
+ mail = @req.user
340
+
341
+ ring_member_page = @site.get_superpage(RING_MEMBER)
342
+ ring_member_page = @site.create("_#{RING_MEMBER}") if ring_member_page.nil?
343
+ if ring_member_page.wikidb.exist?(mail)
344
+ return ring_make_already_exist(href)
345
+ end
346
+
347
+ username = @req.query['username']
348
+ realname = @req.query['realname']
349
+ faculty = @req.query['faculty']
350
+ year = @req.query['year']
351
+
352
+ if username.nil? || username.empty? || realname.nil? || realname.empty?
353
+ return ring_make_not_registerd(href)
354
+ end
355
+
356
+ newpage = ring_make_create_newpage(username)
357
+ newkey = newpage.key
358
+
359
+ now = @req.start_time
360
+ ring_member_page.wikidb.add(mail, username, realname,
361
+ faculty, year, newkey, now.to_i)
362
+
363
+ return ring_make_registerd(href, username, realname, newkey)
364
+ end
365
+
366
+ def ring_maker_dummy_template
367
+ str = '* #{username}
368
+ * profile
369
+ {{ring_personal_info}}
370
+ * message
371
+ {{ring_message_form}}
372
+ '
373
+ return str
374
+ end
375
+
376
+ def ring_make_create_newpage(user)
377
+ template_page = @site.get_superpage(RING_PAGE_TEMPLATE)
378
+
379
+ if template_page
380
+ content = template_page.load
381
+ else
382
+ content = ring_maker_dummy_template
383
+ end
384
+
385
+ content.sub!(/\#\{username\}/, user)
386
+ page = @site.create_new # Create new file.
387
+ page.store(content)
388
+ return page
389
+ end
390
+
391
+ def ring_make_not_registerd(href)
392
+ return c_nerror(_r(:MAKER_NOT_REGISTERD)) {
393
+ [[:h3, _r(:MAKER_NOT_REGISTERD)],
394
+ [:p, _r(:CONFIRM_YOUR_INPUT)],
395
+ [:p, [:a, {:href=>href}, _('Go back')]]]
396
+ }
397
+ end
398
+
399
+ def ring_make_already_exist(href)
400
+ return c_nerror(_r(:MAKER_ALREADY_REGISTERD)) {
401
+ [[:h3, _r(:MAKER_ALREADY_REGISTERD)],
402
+ [:p, _r(:CONFIRM_YOUR_INPUT)],
403
+ [:p, [:a, {:href=>href}, _('Go back')]]]
404
+ }
405
+ end
406
+
407
+ def ring_make_registerd(href, username, realname, newkey)
408
+ return c_notice(_r(:MAKER_REGISTERD)) {
409
+ [[:h3, _r(:MAKER_REGISTERD)],
410
+ [:dl,
411
+ [:dt, _r(:USER)], [:dd, username],
412
+ [:dt, _r(:REALNAME)], [:dd, realname]],
413
+ [:p, [:a, {:href=>"#{newkey}.html"}, _r(:MAKER_THE_PAGE)],
414
+ _r(:MAKER_SEE)]]
415
+ }
416
+ end
417
+
418
+ # ============================== msg
419
+ # ========== write a message
420
+ # http://colinux:9190/ring.sfc.keio.ac.jp/_TestActRingMsg.html
421
+ def plg_ring_message_form(arg=nil)
422
+ action = "#{@req.base}.ring_msg"
423
+ username = @req.user
424
+ div = [:div, {:class=>'form'},
425
+ [:form, {:method=>'POST', :action=>action},
426
+ [:table,
427
+ [:tr,
428
+ [:th, _r(:BULLET)+_r(:USER)],
429
+ [:td, username]],
430
+ [:tr,
431
+ [:th, _r(:BULLET)+_r(:MESSAGE)],
432
+ [:td, [:textarea, {:name=>'message', :cols=>'40', :rows=>'7'},
433
+ _r(:MSG_INPUT_HERE)]]],
434
+ [:tr,
435
+ [:th, ''],
436
+ [:td, [:input, {:type=>'submit', :class=>'submit',
437
+ :value=>" POST! "}]]]]]]
438
+ return div
439
+ end
440
+
441
+ def plg_ring_message_go(arg=nil)
442
+ return # obsolete
443
+ end
444
+
445
+ # Append a a message to the page.
446
+ def ext_ring_msg
447
+ c_require_page_exist
448
+
449
+ href = "#{@req.base}.html"
450
+ message = @req.query['message']
451
+
452
+ # Check error.
453
+ if ! message || message.empty? || message == _r(:MSG_INPUT_HERE)
454
+ return ring_msg_input_message(href)
455
+ end
456
+
457
+ mail = @req.user
458
+ datenum = @req.start_time.to_i.to_s
459
+
460
+ # Add a message.
461
+ content = ":{{ring_ul(#{mail})}} ({{ring_date(#{datenum})}}):#{message}\n"
462
+ page = @site[@req.base]
463
+ page.add(content)
464
+
465
+ return c_notice(_r(:MSG_MESSAGE_IS_ADDED), href){
466
+ [[:h3, _r(:MSG_MESSAGE_IS_ADDED)],
467
+ [:p, _r(:THANKYOU)],
468
+ [:p, [:a, {:href=>href}, _('Go back')]]]
469
+ }
470
+ end
471
+
472
+ def ring_msg_input_message(href)
473
+ return c_notice(_r(:MSG_INPUT_MESSAGE), href, 200, 3) { # 3sec.
474
+ [[:h3, _r(:MSG_INPUT_MESSAGE)],
475
+ [:p, [:a, {:href=>href}, _('Go back')]]]
476
+ }
477
+ end
478
+
479
+ def plg_ring_date(n)
480
+ time = Time.at(n.to_i)
481
+ return [:span, {:class=>'ring_date'}, time.ymdx]
482
+ end
483
+
484
+ # ============================== new
485
+ def pre_act_ring_new
486
+ id = @req.query['id']
487
+ mail = @req.query['mail']
488
+
489
+ # We need the id and mail.
490
+ if id.nil? || mail.nil?
491
+ return c_nerror('No id nor mail')
492
+ end
493
+
494
+ res = ring_new_create_account(id, mail)
495
+ if res == 'exist'
496
+ return c_nerror('Already exist')
497
+ end
498
+
499
+ div = [:div,
500
+ [:p, 'id is ', id],
501
+ [:p, 'mail is ', mail]]
502
+
503
+ return c_notice(_r(:NEW_CREATED)) { div }
504
+ end
505
+
506
+ def ring_new_create_account(id, mail)
507
+ message = _r(:NEW_FROM_SFCNEJP)
508
+
509
+ host_mail = 'info@ring.sfc.ne.jp' # dummy
510
+ page = @site.get_superpage(RING_INVITE_MEMBER)
511
+ page = @site.create('_'+RING_INVITE_MEMBER) if page.nil?
512
+ now = @req.start_time
513
+
514
+ guest_mail = id
515
+ member = @site.member
516
+ return 'exist' if member.exist_qwik_members?(guest_mail)
517
+ member.add(guest_mail, host_mail)
518
+ page.wikidb.add(guest_mail, '', host_mail, message, now.to_i)
519
+ #ring_invite_sendmail(host_mail, guest_mail, '', message)
520
+ return nil
521
+ end
522
+
523
+ # ============================== user
524
+ # ========== manage user information.
525
+ def ring_user_info(key, mail)
526
+ # Get member database page.
527
+ page = @site.get_superpage(key)
528
+ return nil if page.nil?
529
+
530
+ # Get the correspondig record to the mail.
531
+ ar = page.wikidb[mail]
532
+ return nil if ar.nil? # No record.
533
+
534
+ return ar
535
+ end
536
+
537
+ # ========== show user information
538
+ def plg_ring_user(mail, type)
539
+ ar = ring_user_info(RING_MEMBER, mail)
540
+ return nil if ar.nil?
541
+
542
+ type = type.to_s
543
+
544
+ # Primary key is the mail address.
545
+ return mail if type == 'mail'
546
+
547
+ # You can select the values from these types.
548
+ types = %w(user name faculty year pagename time)
549
+ typenum = types.index(type)
550
+ return nil if typenum.nil?
551
+ return ar[typenum]
552
+ end
553
+
554
+ # ========== show my own information
555
+ def plg_ring_show(arg)
556
+ user = @req.user
557
+ return plg_ring_user(user, arg)
558
+ end
559
+
560
+ def plg_ring_link(mail)
561
+ user = plg_ring_user(mail, 'user')
562
+ if user.nil? || user.empty?
563
+ doc = c_res("[[anonymous]]")
564
+ return doc[0][1]
565
+ end
566
+
567
+ pagename = plg_ring_user(mail, 'pagename')
568
+ if pagename.nil? || pagename.empty?
569
+ key = "[[#{user}]]"
570
+ else
571
+ key = "[[#{user}|#{pagename}]]" if pagename
572
+ end
573
+
574
+ doc = c_res(key)
575
+ return doc[0][1]
576
+ end
577
+
578
+ def plg_ring_get_user_from_pagename(pagename)
579
+ page = @site.get_superpage(RING_MEMBER)
580
+ return if page.nil?
581
+
582
+ page.wikidb.each {|k, ar|
583
+ if ar[4] == pagename
584
+ return k
585
+ end
586
+ }
587
+
588
+ return ''
589
+ end
590
+
591
+ # see the information of the owner of this page
592
+ def plg_ring_see(arg)
593
+ pagename = @req.base
594
+ user = plg_ring_get_user_from_pagename(pagename)
595
+ return '' if user.nil?
596
+ return plg_ring_user(user, arg)
597
+ end
598
+
599
+ # see the personal information of this page
600
+ def plg_ring_personal_info
601
+ return [:dl,
602
+ [:dt, _r(:NAME)+' E-mail'],
603
+ [:dd, plg_ring_see(:name), " <", plg_ring_see(:mail), ">"],
604
+ [:dt, _r(:NYUGAKU)],
605
+ [:dd, plg_ring_see(:year), _r(:YEAR)+' ', plg_ring_see(:faculty)]]
606
+ end
607
+
608
+ # ring_user_link
609
+ def plg_ring_ul(mail)
610
+ span = [:span, {:class=>'ring_ul'}]
611
+
612
+ user = plg_ring_user(mail, 'user')
613
+ if user.nil?
614
+ return span << mail
615
+ end
616
+
617
+ userpage = plg_ring_user(mail, 'pagename')
618
+ if userpage.nil?
619
+ return span << user
620
+ end
621
+
622
+ return span << [:a, {:href=>"#{userpage}.html"}, user]
623
+ end
624
+
625
+ end
626
+ end
627
+
628
+ if $0 == __FILE__
629
+ require 'qwik/test-common'
630
+ $test = true
631
+ end
632
+
633
+ if defined?($test) && $test
634
+ class TestActRing < Test::Unit::TestCase
635
+ include TestSession
636
+
637
+ # ============================== catalog
638
+ def test_catalog
639
+ res = session
640
+ eq "テスト", @action._r(:TEST)
641
+ end
642
+
643
+ # ============================== invite
644
+ def test_plg_ring_invite_form
645
+ t_add_user
646
+
647
+ page = @site.create_new
648
+ page.store("{{ring_invite_form}}")
649
+ res = session('/test/1.html')
650
+ assert_rattr({:action=>'1.ring_invite', :method=>'POST'},
651
+ "//div[@class='section']/form")
652
+ ok_xp([:textarea, {:cols=>'40', :name=>'guest_mail', :rows=>'4'},
653
+ 'guest@example.com'],
654
+ "//div[@class='section']/textarea")
655
+ end
656
+
657
+ def test_ext_ring_invite
658
+ t_add_user
659
+
660
+ template_page = @site.create('_'+Qwik::Action::RING_INVITE_MAIL_TEMPLATE)
661
+ template_page.store("
662
+ \#{guest_mail}
663
+ \#{message}
664
+ \#{host_name}
665
+ \#{host_mail}
666
+ ")
667
+
668
+ page = @site.create_new
669
+ page.store('')
670
+
671
+ res = session('/test/1.ring_invite')
672
+ ok_xp([:div, {:class=>'section'},
673
+ [[:h3, "INVITE_NOSEND"],
674
+ [:p, "もう一度入力を確認してください。"],
675
+ [:p, [:a, {:href=>'1.html'}, 'Go back']]]],
676
+ "//div[@class='section']")
677
+
678
+ res = session("/test/1.ring_invite?guest_mail=g@e.com&message=hi")
679
+ ok_xp([:div, {:class=>'section'},
680
+ [[:h3, "INVITE_MAIL_IS_SENT"],
681
+ [:dl, [:dt, "メッセージ"], [:dd, 'hi']],
682
+ [:p, "どうもありがとうございました。"],
683
+ [:p, [:a, {:href=>'1.html'}, 'Go back']]]],
684
+ "//div[@class='section']")
685
+
686
+ eq '', page.load
687
+
688
+ invite_member_page = @site['_'+Qwik::Action::RING_INVITE_MEMBER]
689
+ eq ",g@e.com,,user@e.com,hi,0\n", invite_member_page.load
690
+
691
+ member_page = @site['_SiteMember']
692
+ eq ",user@e.com,
693
+ ,g@e.com,user@e.com
694
+ ", member_page.load
695
+ end
696
+
697
+ def test_plg_ring_invite_list
698
+ t_add_user
699
+
700
+ invite_member_page = @site.create('_'+Qwik::Action::RING_INVITE_MEMBER)
701
+ invite_member_page.store(",g@e.com,,user@e.com,hi,0\n")
702
+
703
+ page = @site.create_new
704
+ page.store("{{ring_invite_list}}")
705
+ res = session('/test/1.html')
706
+ ok_xp([:dl,
707
+ [:dt, [:span, {:class=>'ring_ul'}, 'user@e.com'], "→ (g@e.com) 1970-01-01"],
708
+ [:dd, 'hi']],
709
+ "//div[@class='ring_invite_list']/dl")
710
+ end
711
+
712
+ def test_ring_invite
713
+ t_add_user
714
+
715
+ page = @site.create('_RingMember')
716
+ page.store(',user@e.com,Test User,Alan Smithy,ei,1990,1,0')
717
+
718
+ page = @site.create_new
719
+ page.store("{{ring_invite_form}}")
720
+
721
+ # See invite page.
722
+ res = session('/test/1.html')
723
+ assert_rattr({:action=>'1.ring_invite', :method=>'POST'}, '//form')
724
+ ok_in(['user@e.com'], '//table/tr/td')
725
+ ok_in(['guest@example.com'], "//form/table/tr[4]/td/textarea")
726
+
727
+ # Try to invite, but it cause error.
728
+ res = session("/test/1.ring_invite?guest_mail=invalid@mailaddress")
729
+ ok_in(["INVITE_NOSEND"], '//h3')
730
+
731
+ # Try to invite again.
732
+ res = session("/test/1.ring_invite?guest_mail=gu@e.com&message=invite")
733
+ ok_in(["INVITE_MAIL_IS_SENT"], '//h3')
734
+ eq ",gu@e.com,,user@e.com,invite,0\n", @site['_RingInvitedMember'].load
735
+ eq "Alan Smithy <user@e.com>", $smtp_sendmail[2]
736
+ eq 'gu@e.com', $smtp_sendmail[3]
737
+ assert_match(/^From/, $smtp_sendmail[4])
738
+ url = "http://ring.sfc.keio.ac.jp/.getpass?mail=gu@e.com"
739
+ assert_match(Regexp.new(Regexp.escape(url)), $smtp_sendmail[4])
740
+
741
+ # Try to invite another person.
742
+ res = session("/test/1.ring_invite?guest_mail=fe@e.com&message=youtoo")
743
+ ok_in(["INVITE_MAIL_IS_SENT"], '//h3')
744
+ eq ",gu@e.com,,user@e.com,invite,0\n,fe@e.com,,user@e.com,youtoo,0\n",
745
+ @site['_RingInvitedMember'].load
746
+ eq "Alan Smithy <user@e.com>", $smtp_sendmail[2]
747
+ eq 'fe@e.com', $smtp_sendmail[3]
748
+ assert_match(/^From/, $smtp_sendmail[4])
749
+ url = "http://ring.sfc.keio.ac.jp/.getpass?mail=fe@e.com"
750
+ assert_match(Regexp.new(Regexp.escape(url)), $smtp_sendmail[4])
751
+
752
+ # See invited member list.
753
+ page = @site.create_new
754
+ page.store("{{ring_invite_list}}")
755
+
756
+ res = session('/test/2.html')
757
+ ok_in([:dl,
758
+ [:dt, [:span, {:class=>'ring_ul'},
759
+ [:a, {:href=>'1.html'}, 'Test User']],
760
+ "→ (gu@e.com) 1970-01-01"],
761
+ [:dd, 'invite'],
762
+ [:dt, [:span, {:class=>'ring_ul'},
763
+ [:a, {:href=>'1.html'}, 'Test User']],
764
+ "→ (fe@e.com) 1970-01-01"],
765
+ [:dd, 'youtoo']],
766
+ "//div[@class='ring_invite_list']")
767
+
768
+ page = @site['_RingMember']
769
+ eq ',user@e.com,Test User,Alan Smithy,ei,1990,1,0', page.load
770
+ page = @site['_SiteMember']
771
+ eq ",user@e.com,\n,gu@e.com,user@e.com\n,fe@e.com,user@e.com\n", page.load
772
+ end
773
+
774
+ # ============================== maker
775
+ def test_plg_ring_make_form
776
+ t_add_user
777
+
778
+ page = @site.create_new
779
+ page.store("{{ring_make_form}}")
780
+ res = session('/test/1.html')
781
+ assert_rattr({:action=>'1.ring_make', :method=>'POST'},
782
+ "//div[@class='section']/form")
783
+ end
784
+
785
+ def test_ext_ring_make
786
+ t_add_user
787
+
788
+ ring_member_page = @site.create('_'+Qwik::Action::RING_MEMBER)
789
+ template_page = @site.create('_'+Qwik::Action::RING_PAGE_TEMPLATE)
790
+ template_page.store("\#{username}")
791
+
792
+ page = @site.create_new
793
+
794
+ res = session('/test/1.ring_make')
795
+ ok_xp([:div, {:class=>'section'},
796
+ [[:h3, "MAKER_NOT_REGISTERD"],
797
+ [:p, "もう一度入力を確認してください。"],
798
+ [:p, [:a, {:href=>'1.html'}, 'Go back']]]],
799
+ "//div[@class='section']")
800
+
801
+ res = session("/test/1.ring_make?username=u&realname=r&faculty=f&year=1990")
802
+ ok_xp([:div, {:class=>'section'},
803
+ [[:h3, "MAKER_REGISTERD"],
804
+ [:dl, [:dt, "ユーザ名"], [:dd, 'u'], [:dt, "本名"], [:dd, 'r']],
805
+ [:p, [:a, {:href=>'2.html'}, "MAKER_THE_PAGE"], "MAKER_SEE"]]],
806
+ "//div[@class='section']")
807
+ page = @site['2']
808
+ ok_eq('u', page.load)
809
+ ok_eq(",user@e.com,u,r,f,1990,2,0\n", ring_member_page.load)
810
+ end
811
+
812
+ def ok_guest(e, w)
813
+ user = 'gu@e.com'
814
+ assert_path(e, w, user, "//div[@class='section']")
815
+ end
816
+
817
+ def test_make_page
818
+ t_add_user
819
+
820
+ page = @site['_SiteMember']
821
+ page.store(",user@e.com,\n,gu@e.com,user@e.com\n")
822
+
823
+ page = @site.create('r')
824
+ page.store("{{ring_make_form}}")
825
+
826
+ # Login as guest.
827
+ res = session('/test/r.html') {|req|
828
+ req.cookies.clear # login as the guest
829
+ pass = @memory.passgen.generate('gu@e.com')
830
+ req.cookies.update({'user'=>'gu@e.com', 'pass'=>pass})
831
+ }
832
+ assert_rattr({:action=>'r.ring_make', :method=>'POST'}, '//form')
833
+
834
+ # Make my page.
835
+ res = session("/test/1.ring_make?page=RingMakePage&username=ゲスト&realname=山田太郎&faculty=総合政策&year=1990") {|req|
836
+ req.cookies.clear # login as the guest
837
+ pass = @memory.passgen.generate('gu@e.com')
838
+ req.cookies.update({'user'=>'gu@e.com', 'pass'=>pass})
839
+ }
840
+ ok_in(["MAKER_REGISTERD"], "//div[@class='section']//h3")
841
+ ok_in(["ゲスト"], "//div[@class='section']//dd[1]")
842
+ ok_in(["山田太郎"], "//div[@class='section']//dd[2]")
843
+ ok_in(["MAKER_THE_PAGE"], "//div[@class='section']//a")
844
+ ok_xp([:a, {:href=>'1.html'}, "MAKER_THE_PAGE"], "//div[@class='section']//a")
845
+ ok_eq("* ゲスト
846
+ * profile
847
+ {{ring_personal_info}}
848
+ * message
849
+ {{ring_message_form}}
850
+ ", @site["1"].load)
851
+
852
+ # See my page.
853
+ res = session('/test/1.html') {|req|
854
+ req.cookies.clear # login as the guest
855
+ pass = @memory.passgen.generate('gu@e.com')
856
+ req.cookies.update({'user'=>'gu@e.com', 'pass'=>pass})
857
+ }
858
+ assert_text("ゲスト", 'h1')
859
+ assert_text('profile', 'h2')
860
+ assert_rattr({:method=>'POST', :action=>'1.ring_msg'}, '//form')
861
+ assert_match(/,gu@e.com,ゲスト,山田太郎,総合政策,1990,1,/,
862
+ @site['_RingMember'].load)
863
+ ok_eq('gu@e.com', @action.plg_ring_user('gu@e.com', 'mail'))
864
+ # @action.user = 'gu@e.com'
865
+ #ok_eq('gu@e.com', @action.plg_ring_show('mail'))
866
+ #ok_eq('gu@e.com', @action.plg_ring_show('mail'))
867
+ ok_guest('gu@e.com', "{{ring_show(mail)}}")
868
+ ok_guest("ゲスト", "{{ring_show(user)}}")
869
+ ok_guest("山田太郎", "{{ring_show(name)}}")
870
+ ok_guest("総合政策", "{{ring_show(faculty)}}")
871
+ ok_guest('1990', "{{ring_show(year)}}")
872
+ ok_guest('1', "{{ring_show(pagename)}}")
873
+ ok_guest(%r|\d+|, "{{ring_show(time)}}")
874
+
875
+ # See my page again.
876
+ res = session('/test/1.html') # login as test again.
877
+
878
+ # @action.user = 'user@e.com'
879
+ # @action.pagename = '1'
880
+ =begin
881
+ ok_wi('gu@e.com', "{{ring_user(guest@example.com, mail)}}")
882
+ ok_wi('gu@e.com', "{{ring_see(mail)}}")
883
+ ok_wi("ゲスト", "{{ring_see(user)}}")
884
+ ok_wi("山田太郎", "{{ring_see(name)}}")
885
+ ok_wi("総合政策", "{{ring_see(faculty)}}")
886
+ ok_wi('1990', "{{ring_see(year)}}")
887
+ ok_wi('1', "{{ring_see(pagename)}}")
888
+ ok_wi(%r|\d+|, "{{ring_see(time)}}")
889
+ ok_wi("<dl><dt>名前、E-mail</dt><dd>山田太郎 &lt;gu@e.com&gt;</dd><dt>入学</dt><dd>1990年 総合政策</dd></dl>", "{{ring_personal_info}}")
890
+ ok_eq("* ゲスト\n{{ring_personal_info}}\n\n* profile\n# ここにprofileを記述してください。\n:研究会:\n:職業:\n:最近のマイブーム:\n\n* SEND MESSAGE\n{{ring_message_form}}\n\n* MESSAGE\n", @site['1'].load)
891
+ ok_wi(/山田太郎/, @site['1'].load)
892
+ =end
893
+
894
+ page = @site['1']
895
+ ok_eq("{{ring_show(time)}}", page.load)
896
+
897
+ page = @site['_RingMember']
898
+ ok_eq(",gu@e.com,ゲスト,山田太郎,総合政策,1990,1,0\n", page.load)
899
+
900
+ page = @site['_SiteMember']
901
+ ok_eq(",user@e.com,\n,gu@e.com,user@e.com\n", page.load)
902
+ end
903
+
904
+ # ============================== msg
905
+ def test_plg_ring_message_form
906
+ t_add_user
907
+
908
+ page = @site.create_new
909
+ page.store("{{ring_message_form}}")
910
+
911
+ # See the message form.
912
+ res = session('/test/1.html')
913
+ div = res.body.get_path("//div[@class='form']/form")
914
+ ok_eq({:method=>'POST', :action=>'1.ring_msg'}, div.attr)
915
+ ok_eq([:tr, [:th, "●ユーザ名"], [:td, 'user@e.com']],
916
+ div.get_path('/table/tr'))
917
+ ok_xp([:input, {:value=>" POST! ", :type=>'submit', :class=>'submit'}],
918
+ "//div[@class='form']/input")
919
+ end
920
+
921
+ def test_ext_ring_msg
922
+ t_add_user
923
+
924
+ page = @site.create_new
925
+ page.store('')
926
+
927
+ # Try to write, but it cause error.
928
+ res = session('/test/1.ring_msg')
929
+ ok_in(["MSG_INPUT_MESSAGE"], '//h3')
930
+
931
+ # Try to write, but it cause error.
932
+ res = session("/test/1.ring_msg?message=")
933
+ ok_in(["MSG_INPUT_MESSAGE"], '//h3')
934
+
935
+ # Send a message.
936
+ res = session("/test/1.ring_msg?message=Hi")
937
+ ok_in(["MSG_MESSAGE_IS_ADDED"], '//h3')
938
+
939
+ # Check the content.
940
+ ok_eq(":{{ring_ul(user@e.com)}} ({{ring_date(0)}}):Hi\n", page.load)
941
+ end
942
+
943
+ def test_ring_link
944
+ page = @site.create('_RingMember')
945
+ page.store(",gu@e.com,gugu,T Y,ei,1990,1,0\n")
946
+
947
+ ok_wi([:p, [:a, {:href=>'1.html'}, "ゲスト"]], "[[ゲスト|1]]")
948
+ ok_wi([:a, {:href=>'1.html'}, 'gugu'], "{{ring_link('gu@e.com')}}")
949
+ ok_wi([:span, {:class=>'ring_ul'}, [:a, {:href=>'1.html'}, 'gugu']],
950
+ "{{ring_ul('gu@e.com')}}")
951
+ end
952
+
953
+ # ============================== new
954
+ def test_act_ring_new
955
+ #t_add_user # before login
956
+
957
+ res = session('/test/.ring_new') {|req|
958
+ req.cookies.clear # before login
959
+ }
960
+ ok_title 'No id nor mail'
961
+
962
+ res = session("/test/.ring_new?id=d@1990.sfc.ne.jp&mail=d@g.jp")
963
+ ok_title 'NEW_CREATED'
964
+
965
+ invite_member_page = @site['_'+Qwik::Action::RING_INVITE_MEMBER]
966
+ ok_eq(",d@1990.sfc.ne.jp,,info@ring.sfc.ne.jp,NEW_FROM_SFCNEJP,0\n", invite_member_page.load)
967
+
968
+ member_page = @site['_SiteMember']
969
+ ok_eq(",d@1990.sfc.ne.jp,info@ring.sfc.ne.jp\n", member_page.load)
970
+ end
971
+
972
+ # ============================== user
973
+ def ok_ui(e, mail, type)
974
+ ok_eq(e, @action.plg_ring_user(mail, type))
975
+ end
976
+
977
+ def test_user
978
+ t_add_user
979
+
980
+ res = session
981
+
982
+ # test_get_userinfo
983
+ ok_ui(nil, 'user@e.com', 'mail') # No record.
984
+
985
+ # Store user infomation.
986
+ page = @site.create('_RingMember')
987
+ page.store(',user@e.com,Test User,Alan Smithy,ei,1990,1,0')
988
+
989
+ ok_ui('user@e.com', 'user@e.com', 'mail')
990
+ ok_ui('Test User', 'user@e.com', 'user')
991
+ ok_ui('Alan Smithy', 'user@e.com', 'name')
992
+ ok_ui('ei', 'user@e.com', 'faculty')
993
+ ok_ui('1990', 'user@e.com', 'year')
994
+ ok_ui('1', 'user@e.com', 'pagename')
995
+ ok_ui('0', 'user@e.com', 'time')
996
+
997
+ # test_plg_ring_user
998
+ ok_wi(['user@e.com'], "{{ring_user(user@e.com,mail)}}")
999
+ ok_wi(['Test User'], "{{ring_user(user@e.com,user)}}")
1000
+ ok_wi(['Alan Smithy'], "{{ring_user(user@e.com,name)}}")
1001
+ ok_wi(['ei'], "{{ring_user(user@e.com,faculty)}}")
1002
+ ok_wi(['1990'], "{{ring_user(user@e.com,year)}}")
1003
+ ok_wi(['1'], "{{ring_user(user@e.com,pagename)}}")
1004
+ ok_wi(['0'], "{{ring_user(user@e.com,time)}}")
1005
+
1006
+ # test plg_ring_show
1007
+ ok_wi(['user@e.com'], "{{ring_show(mail)}}")
1008
+ ok_wi(['Test User'], "{{ring_show(user)}}")
1009
+ ok_wi(['Alan Smithy'], "{{ring_show(name)}}")
1010
+ ok_wi(['ei'], "{{ring_show(faculty)}}")
1011
+ ok_wi(['1990'], "{{ring_show(year)}}")
1012
+ ok_wi(['1'], "{{ring_show(pagename)}}")
1013
+ ok_wi(['0'], "{{ring_show(time)}}")
1014
+
1015
+ # test plg_ring_link
1016
+ ok_wi([:a, {:href=>'1.html'}, 'Test User'],
1017
+ "{{ring_link(user@e.com)}}")
1018
+
1019
+ # test plg_ring_get_user_from_pagename
1020
+ ok_wi(['user@e.com'],
1021
+ "{{ring_get_user_from_pagename(1)}}")
1022
+
1023
+ # test plg_ring_see
1024
+ ok_wi(['user@e.com'], "{{ring_see(mail)}}")
1025
+ # same as ring_show in this page.
1026
+
1027
+ # test plg_ring_personal_info
1028
+ ok_wi([:dl,
1029
+ [:dt, "名前 E-mail"],
1030
+ [:dd, "Alan Smithy", " <", "user@e.com", ">"],
1031
+ [:dt, "入学"],
1032
+ [:dd, '1990', "年 ", 'ei']],
1033
+ "{{ring_personal_info}}")
1034
+ end
1035
+
1036
+ def test_ring_link
1037
+ t_add_user
1038
+
1039
+ page = @site.create_new
1040
+ page.store("{{ring_link('t@e.com')}}")
1041
+ res = session('/test/1.html')
1042
+
1043
+ ringmember = @site.create('RingMember')
1044
+ ringmember.store(',t@e.com')
1045
+
1046
+ page.store("{{ring_link('t@e.com')}}")
1047
+ res = session('/test/1.html')
1048
+ ok_in([:span, {:class=>'new'}, 'anonymous',
1049
+ [:a, {:href=>".new?t=anonymous"},
1050
+ [:img, {:alt=>'create', :src=>'.theme/i/new.png'}]]],
1051
+ "//div[@class='section']")
1052
+
1053
+ ringmember.store(',t@e.com,t,Mr. T,EI,2004,1,0')
1054
+
1055
+ page.store("{{ring_link('t@e.com')}}")
1056
+ res = session('/test/1.html')
1057
+ ok_xp([:a, {:href=>'1.html'}, 't'], "//div[@class='section']/a")
1058
+
1059
+ page.store(":{{ring_link('t@e.com')}}:m")
1060
+ res = session('/test/1.html')
1061
+ ok_xp([:dl, [:dt, [:a, {:href=>'1.html'}, 't']], [:dd, 'm']],
1062
+ "//div[@class='section']/dl")
1063
+ end
1064
+
1065
+ def test_ring_loginstatus
1066
+ t_add_user
1067
+ res = session('/test/') # You are logged in as user@e.com
1068
+ ok_in(['user@e.com'], "//div[@class='loginstatus']/em")
1069
+ end
1070
+ end
1071
+ end