qwik2md 0.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.gitignore +9 -0
- data/.travis.yml +4 -0
- data/Gemfile +4 -0
- data/README.md +36 -0
- data/Rakefile +10 -0
- data/bin/console +14 -0
- data/bin/setup +8 -0
- data/exe/qwik2md +17 -0
- data/lib/qwik2md/version.rb +3 -0
- data/lib/qwik2md.rb +39 -0
- data/qwik2md.gemspec +30 -0
- data/vendor/qwik/AUTHORS +10 -0
- data/vendor/qwik/COPYING +340 -0
- data/vendor/qwik/COPYRIGHT +346 -0
- data/vendor/qwik/lib/qwik/Makefile +63 -0
- data/vendor/qwik/lib/qwik/Rakefile +17 -0
- data/vendor/qwik/lib/qwik/act-aa.rb +83 -0
- data/vendor/qwik/lib/qwik/act-archive.rb +386 -0
- data/vendor/qwik/lib/qwik/act-attach.rb +304 -0
- data/vendor/qwik/lib/qwik/act-backup.rb +236 -0
- data/vendor/qwik/lib/qwik/act-basic.rb +325 -0
- data/vendor/qwik/lib/qwik/act-book.rb +161 -0
- data/vendor/qwik/lib/qwik/act-calc.rb +371 -0
- data/vendor/qwik/lib/qwik/act-charset.rb +251 -0
- data/vendor/qwik/lib/qwik/act-christel.rb +112 -0
- data/vendor/qwik/lib/qwik/act-chronology.rb +149 -0
- data/vendor/qwik/lib/qwik/act-code.rb +155 -0
- data/vendor/qwik/lib/qwik/act-comment.rb +554 -0
- data/vendor/qwik/lib/qwik/act-config.rb +49 -0
- data/vendor/qwik/lib/qwik/act-counter.rb +125 -0
- data/vendor/qwik/lib/qwik/act-day.rb +96 -0
- data/vendor/qwik/lib/qwik/act-describe.rb +135 -0
- data/vendor/qwik/lib/qwik/act-diary.rb +109 -0
- data/vendor/qwik/lib/qwik/act-edit.rb +317 -0
- data/vendor/qwik/lib/qwik/act-embed-html.rb +296 -0
- data/vendor/qwik/lib/qwik/act-emode.rb +150 -0
- data/vendor/qwik/lib/qwik/act-event.rb +187 -0
- data/vendor/qwik/lib/qwik/act-file.rb +303 -0
- data/vendor/qwik/lib/qwik/act-files.rb +771 -0
- data/vendor/qwik/lib/qwik/act-getpass.rb +295 -0
- data/vendor/qwik/lib/qwik/act-history.rb +136 -0
- data/vendor/qwik/lib/qwik/act-html.rb +204 -0
- data/vendor/qwik/lib/qwik/act-httpauth.rb +147 -0
- data/vendor/qwik/lib/qwik/act-include.rb +142 -0
- data/vendor/qwik/lib/qwik/act-interwiki.rb +189 -0
- data/vendor/qwik/lib/qwik/act-isearch.rb +109 -0
- data/vendor/qwik/lib/qwik/act-keywords.rb +137 -0
- data/vendor/qwik/lib/qwik/act-lang.rb +81 -0
- data/vendor/qwik/lib/qwik/act-license.rb +63 -0
- data/vendor/qwik/lib/qwik/act-list.rb +287 -0
- data/vendor/qwik/lib/qwik/act-login.rb +410 -0
- data/vendor/qwik/lib/qwik/act-logout.rb +60 -0
- data/vendor/qwik/lib/qwik/act-mail.rb +159 -0
- data/vendor/qwik/lib/qwik/act-map.rb +292 -0
- data/vendor/qwik/lib/qwik/act-md5.rb +42 -0
- data/vendor/qwik/lib/qwik/act-mdlb.rb +741 -0
- data/vendor/qwik/lib/qwik/act-media.rb +416 -0
- data/vendor/qwik/lib/qwik/act-member.rb +157 -0
- data/vendor/qwik/lib/qwik/act-menu.rb +142 -0
- data/vendor/qwik/lib/qwik/act-metadata.rb +323 -0
- data/vendor/qwik/lib/qwik/act-mlsubmitform.rb +49 -0
- data/vendor/qwik/lib/qwik/act-monitor.rb +167 -0
- data/vendor/qwik/lib/qwik/act-new.rb +418 -0
- data/vendor/qwik/lib/qwik/act-pagelist.rb +248 -0
- data/vendor/qwik/lib/qwik/act-password.rb +145 -0
- data/vendor/qwik/lib/qwik/act-plan.rb +210 -0
- data/vendor/qwik/lib/qwik/act-povray.rb +230 -0
- data/vendor/qwik/lib/qwik/act-presen.rb +380 -0
- data/vendor/qwik/lib/qwik/act-redirect.rb +133 -0
- data/vendor/qwik/lib/qwik/act-ring.rb +1071 -0
- data/vendor/qwik/lib/qwik/act-rrefs.rb +255 -0
- data/vendor/qwik/lib/qwik/act-ruby.rb +116 -0
- data/vendor/qwik/lib/qwik/act-sample.rb +170 -0
- data/vendor/qwik/lib/qwik/act-save.rb +295 -0
- data/vendor/qwik/lib/qwik/act-schedule.rb +374 -0
- data/vendor/qwik/lib/qwik/act-search.rb +180 -0
- data/vendor/qwik/lib/qwik/act-searchwords.rb +51 -0
- data/vendor/qwik/lib/qwik/act-sendpass.rb +83 -0
- data/vendor/qwik/lib/qwik/act-site.rb +89 -0
- data/vendor/qwik/lib/qwik/act-sitebackup.rb +419 -0
- data/vendor/qwik/lib/qwik/act-sitelog.rb +118 -0
- data/vendor/qwik/lib/qwik/act-smil.rb +299 -0
- data/vendor/qwik/lib/qwik/act-status.rb +220 -0
- data/vendor/qwik/lib/qwik/act-style.rb +608 -0
- data/vendor/qwik/lib/qwik/act-table.rb +263 -0
- data/vendor/qwik/lib/qwik/act-tableform.rb +241 -0
- data/vendor/qwik/lib/qwik/act-tag.rb +103 -0
- data/vendor/qwik/lib/qwik/act-text.rb +70 -0
- data/vendor/qwik/lib/qwik/act-textarea.rb +164 -0
- data/vendor/qwik/lib/qwik/act-theme.rb +346 -0
- data/vendor/qwik/lib/qwik/act-toc.rb +112 -0
- data/vendor/qwik/lib/qwik/act-typekey.rb +198 -0
- data/vendor/qwik/lib/qwik/act-under-const.rb +94 -0
- data/vendor/qwik/lib/qwik/act-webservice.rb +321 -0
- data/vendor/qwik/lib/qwik/act-wema.rb +558 -0
- data/vendor/qwik/lib/qwik/act-wysiwyg.rb +238 -0
- data/vendor/qwik/lib/qwik/action.rb +325 -0
- data/vendor/qwik/lib/qwik/autoreload.rb +98 -0
- data/vendor/qwik/lib/qwik/bench-bench.rb +28 -0
- data/vendor/qwik/lib/qwik/bench-emode.rb +47 -0
- data/vendor/qwik/lib/qwik/bench-format-xml.rb +70 -0
- data/vendor/qwik/lib/qwik/bench-large-table.rb +62 -0
- data/vendor/qwik/lib/qwik/bench-md5.rb +14 -0
- data/vendor/qwik/lib/qwik/bench-module-session.rb +19 -0
- data/vendor/qwik/lib/qwik/bench-page.rb +50 -0
- data/vendor/qwik/lib/qwik/bench-s-md5.rb +28 -0
- data/vendor/qwik/lib/qwik/bench-session.rb +25 -0
- data/vendor/qwik/lib/qwik/bench-textformat.rb +31 -0
- data/vendor/qwik/lib/qwik/catalog-factory.rb +91 -0
- data/vendor/qwik/lib/qwik/catalog-ja.rb +479 -0
- data/vendor/qwik/lib/qwik/catalog-ml-ja.rb +145 -0
- data/vendor/qwik/lib/qwik/check-act-monitor.rb +112 -0
- data/vendor/qwik/lib/qwik/check-act-monitor2.rb +46 -0
- data/vendor/qwik/lib/qwik/check-act-theme.rb +27 -0
- data/vendor/qwik/lib/qwik/check-event.rb +112 -0
- data/vendor/qwik/lib/qwik/check-event2.rb +55 -0
- data/vendor/qwik/lib/qwik/check-htree-rexml.rb +77 -0
- data/vendor/qwik/lib/qwik/check-htree.rb +51 -0
- data/vendor/qwik/lib/qwik/check-libxml.rb +135 -0
- data/vendor/qwik/lib/qwik/check-many-pages.rb +47 -0
- data/vendor/qwik/lib/qwik/check-monitor.rb +33 -0
- data/vendor/qwik/lib/qwik/check-observer.rb +67 -0
- data/vendor/qwik/lib/qwik/check-server.rb +61 -0
- data/vendor/qwik/lib/qwik/check-uuencode.rb +33 -0
- data/vendor/qwik/lib/qwik/check-webdav.rb +65 -0
- data/vendor/qwik/lib/qwik/check-xml-xpath.rb +27 -0
- data/vendor/qwik/lib/qwik/common-backtrace.rb +94 -0
- data/vendor/qwik/lib/qwik/common-basic.rb +111 -0
- data/vendor/qwik/lib/qwik/common-condition.rb +142 -0
- data/vendor/qwik/lib/qwik/common-error.rb +48 -0
- data/vendor/qwik/lib/qwik/common-gettext.rb +50 -0
- data/vendor/qwik/lib/qwik/common-javascript.rb +45 -0
- data/vendor/qwik/lib/qwik/common-notice.rb +132 -0
- data/vendor/qwik/lib/qwik/common-plain.rb +105 -0
- data/vendor/qwik/lib/qwik/common-plugin.rb +111 -0
- data/vendor/qwik/lib/qwik/common-res.rb +76 -0
- data/vendor/qwik/lib/qwik/common-resolve.rb +92 -0
- data/vendor/qwik/lib/qwik/common-send.rb +171 -0
- data/vendor/qwik/lib/qwik/common-session.rb +139 -0
- data/vendor/qwik/lib/qwik/common-surface.rb +261 -0
- data/vendor/qwik/lib/qwik/common-url.rb +90 -0
- data/vendor/qwik/lib/qwik/compat/Makefile +12 -0
- data/vendor/qwik/lib/qwik/compat/add_load_path.rb +1 -0
- data/vendor/qwik/lib/qwik/config.rb +299 -0
- data/vendor/qwik/lib/qwik/db-b-backup.rb +142 -0
- data/vendor/qwik/lib/qwik/db-backup.rb +184 -0
- data/vendor/qwik/lib/qwik/db-berkeley.rb +306 -0
- data/vendor/qwik/lib/qwik/db-filesystem.rb +305 -0
- data/vendor/qwik/lib/qwik/db-indexer.rb +154 -0
- data/vendor/qwik/lib/qwik/db-searchwords.rb +238 -0
- data/vendor/qwik/lib/qwik/description-ja.rb +267 -0
- data/vendor/qwik/lib/qwik/description.rb +256 -0
- data/vendor/qwik/lib/qwik/dev-add-copyright.rb +23 -0
- data/vendor/qwik/lib/qwik/dev-backup.rb +24 -0
- data/vendor/qwik/lib/qwik/dev-bench.rb +175 -0
- data/vendor/qwik/lib/qwik/dev-calctime.rb +52 -0
- data/vendor/qwik/lib/qwik/dev-css-compressor.rb +60 -0
- data/vendor/qwik/lib/qwik/dev-extract-catalog.rb +102 -0
- data/vendor/qwik/lib/qwik/dev-js-compressor.rb +73 -0
- data/vendor/qwik/lib/qwik/dev-release.rb +235 -0
- data/vendor/qwik/lib/qwik/dev-replace.rb +353 -0
- data/vendor/qwik/lib/qwik/dev-sendmail.rb +25 -0
- data/vendor/qwik/lib/qwik/farm.rb +283 -0
- data/vendor/qwik/lib/qwik/gettext.rb +56 -0
- data/vendor/qwik/lib/qwik/group-cond.rb +157 -0
- data/vendor/qwik/lib/qwik/group-config.rb +247 -0
- data/vendor/qwik/lib/qwik/group-confirm.rb +147 -0
- data/vendor/qwik/lib/qwik/group-db.rb +326 -0
- data/vendor/qwik/lib/qwik/group-mail.rb +195 -0
- data/vendor/qwik/lib/qwik/group-member.rb +307 -0
- data/vendor/qwik/lib/qwik/group-sendmail.rb +231 -0
- data/vendor/qwik/lib/qwik/group-site.rb +374 -0
- data/vendor/qwik/lib/qwik/group-sweep.rb +63 -0
- data/vendor/qwik/lib/qwik/group.rb +157 -0
- data/vendor/qwik/lib/qwik/helper.rb +6 -0
- data/vendor/qwik/lib/qwik/html-generator.rb +104 -0
- data/vendor/qwik/lib/qwik/html-to-wabisabi.rb +148 -0
- data/vendor/qwik/lib/qwik/htree-diff.rb +87 -0
- data/vendor/qwik/lib/qwik/htree-format-xml.rb +57 -0
- data/vendor/qwik/lib/qwik/htree-generator.rb +144 -0
- data/vendor/qwik/lib/qwik/htree-get.rb +251 -0
- data/vendor/qwik/lib/qwik/htree-html-generator.rb +179 -0
- data/vendor/qwik/lib/qwik/htree-template.rb +263 -0
- data/vendor/qwik/lib/qwik/htree-to-wabisabi.rb +171 -0
- data/vendor/qwik/lib/qwik/loadlib.rb +79 -0
- data/vendor/qwik/lib/qwik/logger.rb +115 -0
- data/vendor/qwik/lib/qwik/mail-body.rb +171 -0
- data/vendor/qwik/lib/qwik/mail-header.rb +474 -0
- data/vendor/qwik/lib/qwik/mail-multipart.rb +193 -0
- data/vendor/qwik/lib/qwik/mail-parse.rb +147 -0
- data/vendor/qwik/lib/qwik/mail.rb +341 -0
- data/vendor/qwik/lib/qwik/mailaddress.rb +83 -0
- data/vendor/qwik/lib/qwik/mdlb-model.rb +81 -0
- data/vendor/qwik/lib/qwik/mdlb-sample.rb +324 -0
- data/vendor/qwik/lib/qwik/ml-catalog-factory.rb +27 -0
- data/vendor/qwik/lib/qwik/ml-exception.rb +15 -0
- data/vendor/qwik/lib/qwik/ml-generator.rb +28 -0
- data/vendor/qwik/lib/qwik/ml-gettext.rb +137 -0
- data/vendor/qwik/lib/qwik/ml-logger.rb +82 -0
- data/vendor/qwik/lib/qwik/ml-memory.rb +65 -0
- data/vendor/qwik/lib/qwik/ml-msg-validator.rb +86 -0
- data/vendor/qwik/lib/qwik/ml-processor.rb +609 -0
- data/vendor/qwik/lib/qwik/ml-quickml-server.rb +122 -0
- data/vendor/qwik/lib/qwik/ml-sendmail.rb +0 -0
- data/vendor/qwik/lib/qwik/ml-server.rb +107 -0
- data/vendor/qwik/lib/qwik/ml-session.rb +348 -0
- data/vendor/qwik/lib/qwik/ml-sweeper.rb +101 -0
- data/vendor/qwik/lib/qwik/mock-logger.rb +65 -0
- data/vendor/qwik/lib/qwik/mock-sendmail.rb +78 -0
- data/vendor/qwik/lib/qwik/mock-socket.rb +82 -0
- data/vendor/qwik/lib/qwik/modulobe.rb +406 -0
- data/vendor/qwik/lib/qwik/mongrel-server.rb +72 -0
- data/vendor/qwik/lib/qwik/page-files.rb +249 -0
- data/vendor/qwik/lib/qwik/page-generate.rb +82 -0
- data/vendor/qwik/lib/qwik/page-get.rb +262 -0
- data/vendor/qwik/lib/qwik/page-images.rb +168 -0
- data/vendor/qwik/lib/qwik/page-put.rb +128 -0
- data/vendor/qwik/lib/qwik/page-rrefs.rb +154 -0
- data/vendor/qwik/lib/qwik/page-title.rb +0 -0
- data/vendor/qwik/lib/qwik/page-wikidb.rb +234 -0
- data/vendor/qwik/lib/qwik/page.rb +67 -0
- data/vendor/qwik/lib/qwik/pages.rb +444 -0
- data/vendor/qwik/lib/qwik/parse-plugin.rb +249 -0
- data/vendor/qwik/lib/qwik/parser-emode.rb +116 -0
- data/vendor/qwik/lib/qwik/parser-inline.rb +272 -0
- data/vendor/qwik/lib/qwik/parser.rb +349 -0
- data/vendor/qwik/lib/qwik/password.rb +183 -0
- data/vendor/qwik/lib/qwik/periodic.rb +79 -0
- data/vendor/qwik/lib/qwik/qp.rb +56 -0
- data/vendor/qwik/lib/qwik/qwik-service.rb +341 -0
- data/vendor/qwik/lib/qwik/qwik.rb +5 -0
- data/vendor/qwik/lib/qwik/qwikweb-adduser.rb +34 -0
- data/vendor/qwik/lib/qwik/qwikweb-catalog-validator.rb +110 -0
- data/vendor/qwik/lib/qwik/qwikweb-incgen.rb +28 -0
- data/vendor/qwik/lib/qwik/qwikweb-makesite.rb +41 -0
- data/vendor/qwik/lib/qwik/qwikweb-server.rb +44 -0
- data/vendor/qwik/lib/qwik/qwikweb-showpassword.rb +26 -0
- data/vendor/qwik/lib/qwik/qwikweb-watchlog.rb +67 -0
- data/vendor/qwik/lib/qwik/request-path.rb +304 -0
- data/vendor/qwik/lib/qwik/request-ua.rb +76 -0
- data/vendor/qwik/lib/qwik/request-webrick.rb +81 -0
- data/vendor/qwik/lib/qwik/request.rb +91 -0
- data/vendor/qwik/lib/qwik/resolve-tdiary.rb +292 -0
- data/vendor/qwik/lib/qwik/resolve.rb +121 -0
- data/vendor/qwik/lib/qwik/response.rb +228 -0
- data/vendor/qwik/lib/qwik/server-memory.rb +57 -0
- data/vendor/qwik/lib/qwik/server-webrick.rb +102 -0
- data/vendor/qwik/lib/qwik/server.rb +252 -0
- data/vendor/qwik/lib/qwik/site-config.rb +149 -0
- data/vendor/qwik/lib/qwik/site-db.rb +136 -0
- data/vendor/qwik/lib/qwik/site-event.rb +162 -0
- data/vendor/qwik/lib/qwik/site-files.rb +86 -0
- data/vendor/qwik/lib/qwik/site-group.rb +103 -0
- data/vendor/qwik/lib/qwik/site-index.rb +47 -0
- data/vendor/qwik/lib/qwik/site-log.rb +64 -0
- data/vendor/qwik/lib/qwik/site-member.rb +230 -0
- data/vendor/qwik/lib/qwik/site-monitor.rb +97 -0
- data/vendor/qwik/lib/qwik/site-pages.rb +62 -0
- data/vendor/qwik/lib/qwik/site-plan.rb +139 -0
- data/vendor/qwik/lib/qwik/site-report.rb +282 -0
- data/vendor/qwik/lib/qwik/site-resolve.rb +230 -0
- data/vendor/qwik/lib/qwik/site-rrefs.rb +18 -0
- data/vendor/qwik/lib/qwik/site-search.rb +180 -0
- data/vendor/qwik/lib/qwik/site-timeline.rb +153 -0
- data/vendor/qwik/lib/qwik/site-url.rb +189 -0
- data/vendor/qwik/lib/qwik/site.rb +76 -0
- data/vendor/qwik/lib/qwik/smil-time.rb +105 -0
- data/vendor/qwik/lib/qwik/smtp-session.rb +331 -0
- data/vendor/qwik/lib/qwik/template-generator.rb +149 -0
- data/vendor/qwik/lib/qwik/template.rb +85 -0
- data/vendor/qwik/lib/qwik/test-common.rb +10 -0
- data/vendor/qwik/lib/qwik/test-ml-info.rb +225 -0
- data/vendor/qwik/lib/qwik/test-module-ml.rb +142 -0
- data/vendor/qwik/lib/qwik/test-module-path.rb +110 -0
- data/vendor/qwik/lib/qwik/test-module-public.rb +70 -0
- data/vendor/qwik/lib/qwik/test-module-server.rb +98 -0
- data/vendor/qwik/lib/qwik/test-module-session.rb +264 -0
- data/vendor/qwik/lib/qwik/test-module-suite.rb +91 -0
- data/vendor/qwik/lib/qwik/test-ms-applemail.rb +59 -0
- data/vendor/qwik/lib/qwik/test-ms-attach.rb +174 -0
- data/vendor/qwik/lib/qwik/test-ms-basic.rb +40 -0
- data/vendor/qwik/lib/qwik/test-ms-close.rb +35 -0
- data/vendor/qwik/lib/qwik/test-ms-confirm.rb +75 -0
- data/vendor/qwik/lib/qwik/test-ms-ignore-spam.rb +57 -0
- data/vendor/qwik/lib/qwik/test-ms-japanese.rb +97 -0
- data/vendor/qwik/lib/qwik/test-ms-jfilename.rb +82 -0
- data/vendor/qwik/lib/qwik/test-ms-large.rb +58 -0
- data/vendor/qwik/lib/qwik/test-ms-member.rb +103 -0
- data/vendor/qwik/lib/qwik/test-ms-multipart.rb +84 -0
- data/vendor/qwik/lib/qwik/test-ms-org.rb +129 -0
- data/vendor/qwik/lib/qwik/test-ms-plan.rb +130 -0
- data/vendor/qwik/lib/qwik/test-ms-post.rb +53 -0
- data/vendor/qwik/lib/qwik/test-ms-quopri.rb +76 -0
- data/vendor/qwik/lib/qwik/test-sub-quopri.rb +45 -0
- data/vendor/qwik/lib/qwik/test-submit-base64.rb +59 -0
- data/vendor/qwik/lib/qwik/test-submit-forward.rb +61 -0
- data/vendor/qwik/lib/qwik/test-submit-html-mail.rb +52 -0
- data/vendor/qwik/lib/qwik/test-submit-japanese.rb +135 -0
- data/vendor/qwik/lib/qwik/test-submit-jfilename.rb +144 -0
- data/vendor/qwik/lib/qwik/test-submit-uuencode.rb +71 -0
- data/vendor/qwik/lib/qwik/test-suite-all.rb +8 -0
- data/vendor/qwik/lib/qwik/test-suite-basic.rb +9 -0
- data/vendor/qwik/lib/qwik/test-suite-ml.rb +9 -0
- data/vendor/qwik/lib/qwik/test-typekey.rb +64 -0
- data/vendor/qwik/lib/qwik/testunit.rb +45 -0
- data/vendor/qwik/lib/qwik/tokenizer-inline.rb +288 -0
- data/vendor/qwik/lib/qwik/tokenizer.rb +331 -0
- data/vendor/qwik/lib/qwik/typekey.rb +160 -0
- data/vendor/qwik/lib/qwik/util-basic.rb +135 -0
- data/vendor/qwik/lib/qwik/util-charset.rb +331 -0
- data/vendor/qwik/lib/qwik/util-css.rb +56 -0
- data/vendor/qwik/lib/qwik/util-csv-tokenizer.rb +113 -0
- data/vendor/qwik/lib/qwik/util-filename.rb +112 -0
- data/vendor/qwik/lib/qwik/util-pathname.rb +202 -0
- data/vendor/qwik/lib/qwik/util-pid.rb +58 -0
- data/vendor/qwik/lib/qwik/util-safe.rb +67 -0
- data/vendor/qwik/lib/qwik/util-sendmail.rb +273 -0
- data/vendor/qwik/lib/qwik/util-string.rb +202 -0
- data/vendor/qwik/lib/qwik/util-time.rb +125 -0
- data/vendor/qwik/lib/qwik/util-webrick.rb +176 -0
- data/vendor/qwik/lib/qwik/version.rb +11 -0
- data/vendor/qwik/lib/qwik/wabisabi-basic.rb +163 -0
- data/vendor/qwik/lib/qwik/wabisabi-diff.rb +130 -0
- data/vendor/qwik/lib/qwik/wabisabi-format-xml.rb +310 -0
- data/vendor/qwik/lib/qwik/wabisabi-generator.rb +262 -0
- data/vendor/qwik/lib/qwik/wabisabi-index.rb +174 -0
- data/vendor/qwik/lib/qwik/wabisabi-table.rb +212 -0
- data/vendor/qwik/lib/qwik/wabisabi-template.rb +295 -0
- data/vendor/qwik/lib/qwik/wabisabi-to-htree.rb +111 -0
- data/vendor/qwik/lib/qwik/wabisabi-to-wiki.rb +690 -0
- data/vendor/qwik/lib/qwik/wabisabi-traverse.rb +207 -0
- data/vendor/qwik/lib/qwik/wabisabi-validator.rb +116 -0
- data/vendor/qwik/lib/qwik/wabisabi.rb +5 -0
- 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
|