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