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,168 @@
|
|
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/page-files'
|
7
|
+
|
8
|
+
module Qwik
|
9
|
+
class PageFiles
|
10
|
+
IMAGE_EXT = %w(jpg jpeg png gif bmp ico ppm)
|
11
|
+
CONVERT_PATH = '/usr/bin/convert'
|
12
|
+
THUMB_SIZE = 100
|
13
|
+
SCREEN_WIDTH = 1024
|
14
|
+
SCREEN_HEIGHT = 768
|
15
|
+
|
16
|
+
def image_list
|
17
|
+
return self.select {|file|
|
18
|
+
PageFiles.is_image?(file.path.ext)
|
19
|
+
}
|
20
|
+
end
|
21
|
+
|
22
|
+
def each_image
|
23
|
+
image_list.each {|file|
|
24
|
+
yield(file)
|
25
|
+
}
|
26
|
+
end
|
27
|
+
|
28
|
+
def self.is_image?(ext)
|
29
|
+
return true if IMAGE_EXT.include?(ext.downcase)
|
30
|
+
return false
|
31
|
+
end
|
32
|
+
|
33
|
+
def generate_all_thumb
|
34
|
+
self.each_image {|file|
|
35
|
+
generate_thumb(file)
|
36
|
+
}
|
37
|
+
end
|
38
|
+
|
39
|
+
def generate_thumb(file)
|
40
|
+
generate_scaled(file, '.thumb', THUMB_SIZE, THUMB_SIZE)
|
41
|
+
end
|
42
|
+
|
43
|
+
def generate_all_screen
|
44
|
+
self.each_image {|file|
|
45
|
+
generate_screen(file)
|
46
|
+
}
|
47
|
+
end
|
48
|
+
|
49
|
+
def generate_screen(file)
|
50
|
+
generate_scaled(file, '.screen', SCREEN_WIDTH, SCREEN_HEIGHT)
|
51
|
+
end
|
52
|
+
|
53
|
+
def generate_scaled(file, scaled_dir, w, h)
|
54
|
+
return if $test
|
55
|
+
|
56
|
+
sc_dir = self.path(scaled_dir)
|
57
|
+
sc_dir.check_directory
|
58
|
+
|
59
|
+
org = self.path(file)
|
60
|
+
#scaled = sc_dir+file
|
61
|
+
scaled = sc_dir + Filename.encode(file)
|
62
|
+
if ! scaled.exist?
|
63
|
+
convert = CONVERT_PATH
|
64
|
+
return nil if ! convert.path.exist?
|
65
|
+
geom = "#{w}x#{h}"
|
66
|
+
cmd = "#{convert} -size #{geom} \"#{org}\" -resize #{geom} \"#{scaled}\""
|
67
|
+
#cmd = "#{convert} -size #{geom} #{org} -resize #{geom} #{scaled}"
|
68
|
+
#p cmd
|
69
|
+
system cmd
|
70
|
+
end
|
71
|
+
end
|
72
|
+
|
73
|
+
=begin
|
74
|
+
# Excerpt from man convert
|
75
|
+
|
76
|
+
To make a thumbnail of a JPEG image, use:
|
77
|
+
|
78
|
+
convert -size 120x120 cockatoo.jpg -resize 120x120
|
79
|
+
+profile '*' thumbnail.jpg
|
80
|
+
|
81
|
+
In this example, '-size 120x120' gives a hint to the JPEG decoder that
|
82
|
+
the image is going to be downscaled to 120x120, allowing it to run
|
83
|
+
faster by avoiding returning full-resolution images to ImageMagick for
|
84
|
+
the subsequent resizing operation. The output image. It will be
|
85
|
+
scaled so its largest dimension is 120 pixels. The that might be
|
86
|
+
present in the input and aren't needed in the thumbnail.
|
87
|
+
=end
|
88
|
+
|
89
|
+
end
|
90
|
+
end
|
91
|
+
|
92
|
+
if $0 == __FILE__
|
93
|
+
require 'qwik/testunit'
|
94
|
+
require 'qwik/test-module-session'
|
95
|
+
$test = true
|
96
|
+
end
|
97
|
+
|
98
|
+
if defined?($test) && $test
|
99
|
+
class TestPageImages < Test::Unit::TestCase
|
100
|
+
include TestSession
|
101
|
+
|
102
|
+
def setup
|
103
|
+
end
|
104
|
+
|
105
|
+
def teardown
|
106
|
+
end
|
107
|
+
|
108
|
+
def test_all
|
109
|
+
dir = './.test/'.path
|
110
|
+
dir.setup
|
111
|
+
files = Qwik::PageFiles.new(dir.to_s, '1')
|
112
|
+
|
113
|
+
png = TEST_PNG_DATA
|
114
|
+
files.fput('1.jpg', png) # content is PNG, but use it as .jpg
|
115
|
+
files.fput('2.jpg', png)
|
116
|
+
|
117
|
+
# test_image_list
|
118
|
+
eq(['1.jpg', '2.jpg'], files.image_list)
|
119
|
+
|
120
|
+
# test_each_image
|
121
|
+
files.each_image {|file|
|
122
|
+
assert_match(/jpg\z/, file)
|
123
|
+
}
|
124
|
+
|
125
|
+
return if $0 != __FILE__ # Only for separated test.
|
126
|
+
|
127
|
+
org_debug = $test
|
128
|
+
$test = false
|
129
|
+
|
130
|
+
# test_generate_thumb
|
131
|
+
files.generate_thumb('1.jpg')
|
132
|
+
ok_eq(true, files.exist?('.thumb/1.jpg'))
|
133
|
+
ok_eq(false, files.exist?('.thumb/2.jpg'))
|
134
|
+
|
135
|
+
# test_generate_all_thumb
|
136
|
+
files.generate_all_thumb
|
137
|
+
ok_eq(true, files.exist?('.thumb/1.jpg'))
|
138
|
+
ok_eq(true, files.exist?('.thumb/2.jpg'))
|
139
|
+
|
140
|
+
# test_generate_screen
|
141
|
+
files.generate_screen('1.jpg')
|
142
|
+
ok_eq(true, files.exist?('.screen/1.jpg'))
|
143
|
+
ok_eq(false, files.exist?('.screen/2.jpg'))
|
144
|
+
|
145
|
+
# test_generate_all_screen
|
146
|
+
files.generate_all_screen
|
147
|
+
ok_eq(true, files.exist?('.screen/1.jpg'))
|
148
|
+
ok_eq(true, files.exist?('.screen/2.jpg'))
|
149
|
+
|
150
|
+
$test = org_debug
|
151
|
+
|
152
|
+
dir.teardown
|
153
|
+
end
|
154
|
+
|
155
|
+
def test_is_image?
|
156
|
+
c = Qwik::PageFiles
|
157
|
+
ok_eq(true, c.is_image?('jpg'))
|
158
|
+
ok_eq(true, c.is_image?('jpeg'))
|
159
|
+
ok_eq(true, c.is_image?('JPG'))
|
160
|
+
ok_eq(true, c.is_image?('png'))
|
161
|
+
ok_eq(true, c.is_image?('gif'))
|
162
|
+
ok_eq(true, c.is_image?('bmp'))
|
163
|
+
ok_eq(true, c.is_image?('ico'))
|
164
|
+
ok_eq(true, c.is_image?('ppm'))
|
165
|
+
ok_eq(false, c.is_image?('pdf'))
|
166
|
+
end
|
167
|
+
end
|
168
|
+
end
|
@@ -0,0 +1,128 @@
|
|
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/util-string'
|
7
|
+
|
8
|
+
module Qwik
|
9
|
+
class Page
|
10
|
+
def put(v)
|
11
|
+
return @db.put(@key, v)
|
12
|
+
end
|
13
|
+
alias store put
|
14
|
+
|
15
|
+
def put_with_time(v, time)
|
16
|
+
@db.put(@key, v, time)
|
17
|
+
end
|
18
|
+
|
19
|
+
def put_with_md5(v, md5)
|
20
|
+
if md5 && self.get.md5hex != md5
|
21
|
+
raise PageCollisionError
|
22
|
+
end
|
23
|
+
put(v)
|
24
|
+
end
|
25
|
+
|
26
|
+
def add(v)
|
27
|
+
str = self.get
|
28
|
+
addstr = ''
|
29
|
+
|
30
|
+
# FIXME: Use normalize_eol?
|
31
|
+
if ! (str.empty? || str[-1] == ?\n)
|
32
|
+
addstr += "\n"
|
33
|
+
end
|
34
|
+
|
35
|
+
addstr += v
|
36
|
+
|
37
|
+
if !(v.empty? || v[-1] == ?\n)
|
38
|
+
addstr += "\n"
|
39
|
+
end
|
40
|
+
|
41
|
+
@db.add(@key, addstr)
|
42
|
+
end
|
43
|
+
|
44
|
+
def delete
|
45
|
+
@db.delete(@key)
|
46
|
+
# @pages.delete(@key)
|
47
|
+
end
|
48
|
+
|
49
|
+
def touch
|
50
|
+
@db.touch(@key)
|
51
|
+
end
|
52
|
+
|
53
|
+
end
|
54
|
+
end
|
55
|
+
|
56
|
+
if $0 == __FILE__
|
57
|
+
require 'qwik/farm'
|
58
|
+
require 'qwik/server-memory'
|
59
|
+
require 'qwik/test-module-session'
|
60
|
+
$test = true
|
61
|
+
end
|
62
|
+
|
63
|
+
if defined?($test) && $test
|
64
|
+
class TestPagePut < Test::Unit::TestCase
|
65
|
+
include TestSession
|
66
|
+
|
67
|
+
def test_all
|
68
|
+
pages = @site.get_pages
|
69
|
+
page = pages.create_new
|
70
|
+
|
71
|
+
# test_put
|
72
|
+
page.put('test1')
|
73
|
+
page.store('test1')
|
74
|
+
ok_eq('test1', page.get)
|
75
|
+
|
76
|
+
# test_put_with_time
|
77
|
+
page.put_with_time('test1', 0)
|
78
|
+
ok_eq(0, page.mtime.to_i)
|
79
|
+
|
80
|
+
# test_put_with_md5
|
81
|
+
page.put('t1')
|
82
|
+
assert_raises(Qwik::PageCollisionError) {
|
83
|
+
page.put_with_md5('t1', 'somethingwrong')
|
84
|
+
}
|
85
|
+
md5 = page.get.md5hex
|
86
|
+
page.put_with_md5('t2', md5)
|
87
|
+
ok_eq('t2', page.get)
|
88
|
+
|
89
|
+
# test_add
|
90
|
+
page.add('t3')
|
91
|
+
ok_eq("t2\nt3\n", page.get)
|
92
|
+
|
93
|
+
# test_mtime_with_nonexistent_page
|
94
|
+
assert_instance_of(Time, pages.last_page_time)
|
95
|
+
|
96
|
+
page = pages['1']
|
97
|
+
page.put('* a')
|
98
|
+
assert_instance_of(Time, page.mtime)
|
99
|
+
assert_instance_of(Time, pages.last_page_time)
|
100
|
+
|
101
|
+
page.delete
|
102
|
+
assert_instance_of(Time, page.mtime)
|
103
|
+
assert_instance_of(Time, pages.last_page_time)
|
104
|
+
ok_eq(0, page.mtime.to_i)
|
105
|
+
end
|
106
|
+
|
107
|
+
def test_add
|
108
|
+
pages = @site.get_pages
|
109
|
+
page = pages.create_new
|
110
|
+
|
111
|
+
page.put('t1')
|
112
|
+
page.add('t2')
|
113
|
+
ok_eq("t1\nt2\n", page.get)
|
114
|
+
|
115
|
+
page.put('')
|
116
|
+
page.add('t2')
|
117
|
+
ok_eq("t2\n", page.get)
|
118
|
+
|
119
|
+
page.put('t1')
|
120
|
+
page.add('')
|
121
|
+
ok_eq("t1\n", page.get)
|
122
|
+
|
123
|
+
page.delete
|
124
|
+
page.add('')
|
125
|
+
ok_eq('', page.get)
|
126
|
+
end
|
127
|
+
end
|
128
|
+
end
|
@@ -0,0 +1,154 @@
|
|
1
|
+
# Copyright (C) 2009 AIST, 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 'fileutils'
|
6
|
+
|
7
|
+
$LOAD_PATH.unshift '..' unless $LOAD_PATH.include? '..'
|
8
|
+
require 'qwik/util-pathname'
|
9
|
+
require 'qwik/util-filename'
|
10
|
+
|
11
|
+
module Qwik
|
12
|
+
class PageRRefs
|
13
|
+
include Enumerable
|
14
|
+
|
15
|
+
def initialize(site_dir, key)
|
16
|
+
@rref_file = site_dir.path+"#{key}.rrefs"
|
17
|
+
|
18
|
+
# fix me!
|
19
|
+
# the mutex works only in a process
|
20
|
+
# wiki server process is the process to update rrefs
|
21
|
+
# ml-server is not supposed to update rrefs
|
22
|
+
@lock = Mutex.new
|
23
|
+
end
|
24
|
+
|
25
|
+
def exist?
|
26
|
+
FileTest.exists?(@rref_file)
|
27
|
+
end
|
28
|
+
|
29
|
+
def get
|
30
|
+
if self.exist?
|
31
|
+
rrefs = File.open(@rref_file).read
|
32
|
+
return rrefs
|
33
|
+
else
|
34
|
+
return ""
|
35
|
+
end
|
36
|
+
end
|
37
|
+
|
38
|
+
def delete(key)
|
39
|
+
@lock.synchronize {
|
40
|
+
rrefs = self.get
|
41
|
+
rrefs = rrefs.map {|r| r if r.chomp != key }.to_s
|
42
|
+
@rref_file.path.put(rrefs)
|
43
|
+
}
|
44
|
+
end
|
45
|
+
|
46
|
+
def add(key)
|
47
|
+
@lock.synchronize {
|
48
|
+
f = File.open(@rref_file,"a")
|
49
|
+
f.puts key
|
50
|
+
f.close
|
51
|
+
}
|
52
|
+
end
|
53
|
+
|
54
|
+
def put(keys)
|
55
|
+
rrefs = keys.join($/) + $/
|
56
|
+
@rref_file.path.put(rrefs)
|
57
|
+
end
|
58
|
+
|
59
|
+
def each
|
60
|
+
return unless self.exist?
|
61
|
+
# key might be deleted in the loop
|
62
|
+
keys = self.get
|
63
|
+
keys.each {|a|
|
64
|
+
yield(a.chomp)
|
65
|
+
}
|
66
|
+
end
|
67
|
+
end
|
68
|
+
end
|
69
|
+
|
70
|
+
if $0 == __FILE__
|
71
|
+
require 'qwik/testunit'
|
72
|
+
require 'qwik/test-module-path'
|
73
|
+
$test = true
|
74
|
+
end
|
75
|
+
|
76
|
+
if defined?($test) && $test
|
77
|
+
require 'qwik/test-module-public'
|
78
|
+
|
79
|
+
class TestPageRRefs < Test::Unit::TestCase
|
80
|
+
include TestModulePublic
|
81
|
+
|
82
|
+
def setup_rrefs
|
83
|
+
dir = '.test/'.path
|
84
|
+
dir.setup
|
85
|
+
rrefs = Qwik::PageRRefs.new(dir.to_s, '1')
|
86
|
+
|
87
|
+
return [dir, rrefs]
|
88
|
+
end
|
89
|
+
|
90
|
+
def teardown_rrefs(dir)
|
91
|
+
dir.teardown
|
92
|
+
end
|
93
|
+
|
94
|
+
def test_put
|
95
|
+
dir, rrefs = setup_rrefs
|
96
|
+
|
97
|
+
rrefs.put(["2","3"])
|
98
|
+
ok_eq(true, rrefs.exist?)
|
99
|
+
|
100
|
+
cont = rrefs.get
|
101
|
+
ok_eq("2#{$/}3#{$/}",cont)
|
102
|
+
|
103
|
+
teardown_rrefs(dir)
|
104
|
+
end
|
105
|
+
|
106
|
+
def test_add
|
107
|
+
dir, rrefs = setup_rrefs
|
108
|
+
rrefs.put(["2","3"])
|
109
|
+
|
110
|
+
rrefs.add("4")
|
111
|
+
cont = rrefs.get
|
112
|
+
|
113
|
+
ok_eq(true, rrefs.exist?)
|
114
|
+
ok_eq("2#{$/}3#{$/}4#{$/}",cont)
|
115
|
+
|
116
|
+
teardown_rrefs(dir)
|
117
|
+
end
|
118
|
+
|
119
|
+
def test_delete
|
120
|
+
dir, rrefs = setup_rrefs
|
121
|
+
rrefs.put(["2","3","4"])
|
122
|
+
rrefs.delete("3")
|
123
|
+
|
124
|
+
cont = rrefs.get
|
125
|
+
ok_eq(true, rrefs.exist?)
|
126
|
+
ok_eq("2#{$/}4#{$/}",cont)
|
127
|
+
|
128
|
+
teardown_rrefs(dir)
|
129
|
+
end
|
130
|
+
|
131
|
+
def test_each
|
132
|
+
dir, rrefs = setup_rrefs
|
133
|
+
keys = ["2","3","4"]
|
134
|
+
rrefs.put(keys)
|
135
|
+
|
136
|
+
|
137
|
+
i = 0
|
138
|
+
rrefs.each {|key|
|
139
|
+
ok_eq(keys[i],key)
|
140
|
+
i+=1
|
141
|
+
}
|
142
|
+
end
|
143
|
+
|
144
|
+
def test_each_empty
|
145
|
+
dir, rrefs = setup_rrefs
|
146
|
+
|
147
|
+
cont = []
|
148
|
+
rrefs.each {|key|
|
149
|
+
cont << key
|
150
|
+
}
|
151
|
+
ok_eq([],cont)
|
152
|
+
end
|
153
|
+
end
|
154
|
+
end
|
File without changes
|
@@ -0,0 +1,234 @@
|
|
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
|
+
class Array
|
8
|
+
def to_hash
|
9
|
+
hash = {}
|
10
|
+
self.each {|k, v| hash[k] = v }
|
11
|
+
return hash
|
12
|
+
end
|
13
|
+
end
|
14
|
+
|
15
|
+
module Qwik
|
16
|
+
class Page
|
17
|
+
def wikidb
|
18
|
+
# @wikidb = WikiDB.new(self) unless defined?(@wikidb)
|
19
|
+
# return @wikidb
|
20
|
+
WikiDB.new(self)
|
21
|
+
end
|
22
|
+
end
|
23
|
+
|
24
|
+
class WikiDB
|
25
|
+
include Enumerable
|
26
|
+
|
27
|
+
def initialize(page)
|
28
|
+
@page = page
|
29
|
+
@str = nil
|
30
|
+
check_new
|
31
|
+
end
|
32
|
+
|
33
|
+
def array
|
34
|
+
check_new
|
35
|
+
return @array.dup # dup prevent from destructive method
|
36
|
+
end
|
37
|
+
|
38
|
+
def hash
|
39
|
+
check_new
|
40
|
+
return @hash.dup # dup prevent from destructive method
|
41
|
+
end
|
42
|
+
|
43
|
+
def rev_hash
|
44
|
+
check_new
|
45
|
+
return @rev_hash.dup # dup prevent from destructive method
|
46
|
+
end
|
47
|
+
|
48
|
+
def [](key)
|
49
|
+
v = hash[key]
|
50
|
+
return nil if v.nil?
|
51
|
+
return v.dup # dup prevent from destructive method
|
52
|
+
end
|
53
|
+
|
54
|
+
def exist?(key)
|
55
|
+
return self[key]
|
56
|
+
end
|
57
|
+
|
58
|
+
def each
|
59
|
+
array.each {|k, v|
|
60
|
+
k = k.dup # unfreeze
|
61
|
+
v = v.dup # dup prevent from destructive method
|
62
|
+
yield(k, v)
|
63
|
+
}
|
64
|
+
end
|
65
|
+
|
66
|
+
def add(k, *ar)
|
67
|
+
ar = ar.flatten
|
68
|
+
@page.add(WikiDB.encode_line(k, ar)+"\n")
|
69
|
+
end
|
70
|
+
|
71
|
+
def remove(key)
|
72
|
+
return false unless exist?(key) # Return if the key is not exist.
|
73
|
+
str = @page.load
|
74
|
+
newstr, status = WikiDB.generate_without(str, key)
|
75
|
+
# @page.store(newstr, str.md5hex) # FIXME: Check collision.
|
76
|
+
@page.store(newstr) # FIXME: Store should check the collision.
|
77
|
+
return status
|
78
|
+
end
|
79
|
+
|
80
|
+
private
|
81
|
+
|
82
|
+
def check_new
|
83
|
+
str = @page.load
|
84
|
+
return if str == @str # Do nothing.
|
85
|
+
@str = str
|
86
|
+
|
87
|
+
@array = WikiDB.parse(@str)
|
88
|
+
@hash = @array.to_hash
|
89
|
+
@rev_hash = @hash.invert
|
90
|
+
return nil
|
91
|
+
end
|
92
|
+
|
93
|
+
SIGNATURE = ['|', ',', ':']
|
94
|
+
|
95
|
+
def self.parse(str)
|
96
|
+
array = []
|
97
|
+
str.each {|line|
|
98
|
+
firstchar = line[0, 1]
|
99
|
+
next unless SIGNATURE.include?(firstchar)
|
100
|
+
ar = line.chomp.split(firstchar)
|
101
|
+
ar.shift # Drop the first column.
|
102
|
+
k = ar.shift
|
103
|
+
ar = ar.map {|a| a.strip }
|
104
|
+
v = (firstchar == ':') ? ar.join(':') : ar
|
105
|
+
v.freeze
|
106
|
+
array << [k, v]
|
107
|
+
}
|
108
|
+
return array
|
109
|
+
end
|
110
|
+
|
111
|
+
def self.generate_without(str, key)
|
112
|
+
status = false
|
113
|
+
newar = []
|
114
|
+
str.each {|line|
|
115
|
+
firstchar = line[0, 1]
|
116
|
+
if SIGNATURE.include?(firstchar)
|
117
|
+
ar = line.chomp.split(firstchar)
|
118
|
+
ar.shift # Drop the first column.
|
119
|
+
k = ar.shift
|
120
|
+
if k && k == key # Do not add the line with the key.
|
121
|
+
status = true # ok.
|
122
|
+
next # Delete the line.
|
123
|
+
end
|
124
|
+
end
|
125
|
+
newar << line
|
126
|
+
}
|
127
|
+
return newar.join, status
|
128
|
+
end
|
129
|
+
|
130
|
+
def self.encode_line(k, *ar)
|
131
|
+
ar = ar.flatten
|
132
|
+
nar = []
|
133
|
+
nar << '' # Empty entry.
|
134
|
+
nar << k # The key.
|
135
|
+
nar << ar if ar && ! ar.empty?
|
136
|
+
str = nar.flatten.join(',')
|
137
|
+
return str
|
138
|
+
end
|
139
|
+
end
|
140
|
+
end
|
141
|
+
|
142
|
+
if $0 == __FILE__
|
143
|
+
require 'qwik/test-common'
|
144
|
+
$test = true
|
145
|
+
end
|
146
|
+
|
147
|
+
if defined?($test) && $test
|
148
|
+
class TestWikiDB < Test::Unit::TestCase
|
149
|
+
include TestSession
|
150
|
+
|
151
|
+
def test_class_method
|
152
|
+
c = Qwik::WikiDB
|
153
|
+
|
154
|
+
# test_parse
|
155
|
+
eq [["k", ["v"]]], c.parse(',k,v')
|
156
|
+
eq [["k", ["v"]]], c.parse('|k|v')
|
157
|
+
eq [["k", "v"]], c.parse(':k:v')
|
158
|
+
eq [["k", "v"]], c.parse(':k: v')
|
159
|
+
eq [["k", "v"]], c.parse(':k: v')
|
160
|
+
|
161
|
+
# test_encode_line
|
162
|
+
eq ',k,v', c.encode_line('k', 'v')
|
163
|
+
eq ',k,v1,v2', c.encode_line('k', ['v1', 'v2'])
|
164
|
+
eq ',k,v1,v2', c.encode_line('k', 'v1', 'v2')
|
165
|
+
eq ',k,,v2', c.encode_line('k', nil, 'v2')
|
166
|
+
end
|
167
|
+
|
168
|
+
def test_colon
|
169
|
+
page = @site.create_new
|
170
|
+
wdb = Qwik::WikiDB.new(page)
|
171
|
+
page.store(':k: v')
|
172
|
+
eq true, !!wdb.exist?('k')
|
173
|
+
eq 'v', wdb['k']
|
174
|
+
end
|
175
|
+
|
176
|
+
def test_all
|
177
|
+
page = @site.create_new
|
178
|
+
wdb = Qwik::WikiDB.new(page)
|
179
|
+
|
180
|
+
# test_exist?
|
181
|
+
eq false, !!wdb.exist?('k')
|
182
|
+
wdb.add('k', 'v')
|
183
|
+
eq ",k,v\n", page.load
|
184
|
+
|
185
|
+
eq true, !!wdb.exist?('k')
|
186
|
+
eq ['v'], wdb['k']
|
187
|
+
eq 'v', wdb['k'][0]
|
188
|
+
eq false, wdb['k'][0].frozen?
|
189
|
+
|
190
|
+
# test_hash
|
191
|
+
eq({'k'=>['v']}, wdb.hash)
|
192
|
+
wdb.add('k', 'v2')
|
193
|
+
eq ['v2'], wdb['k'] # can get second value
|
194
|
+
|
195
|
+
# test_remove
|
196
|
+
eq true, wdb.remove('k') # remove
|
197
|
+
eq false, wdb.remove('k') # fail to remove
|
198
|
+
|
199
|
+
# test_add
|
200
|
+
eq false, !!wdb.exist?('k')
|
201
|
+
wdb.add('k', 'v1', 'v2')
|
202
|
+
eq true, !!wdb.exist?('k')
|
203
|
+
eq ['v1', 'v2'], wdb['k']
|
204
|
+
eq({'k'=>['v1', 'v2']}, wdb.hash)
|
205
|
+
eq true, wdb.remove('k') # remove
|
206
|
+
eq false, wdb.remove('k') # fail to remove
|
207
|
+
|
208
|
+
wdb.add('a', 'b')
|
209
|
+
wdb.add('c', 'd')
|
210
|
+
eq({'a'=>['b'], 'c'=>['d']}, wdb.hash)
|
211
|
+
|
212
|
+
# test_each
|
213
|
+
wdb.each {|k, v|
|
214
|
+
eq false, k.frozen?
|
215
|
+
assert_instance_of(Array, v)
|
216
|
+
}
|
217
|
+
|
218
|
+
eq [['a', ['b']], ['c', ['d']]], wdb.array
|
219
|
+
wdb.array.each {|name, args|
|
220
|
+
args = args.dup
|
221
|
+
t = args.shift
|
222
|
+
}
|
223
|
+
eq [['a', ['b']], ['c', ['d']]], wdb.array
|
224
|
+
|
225
|
+
# test_nil
|
226
|
+
page = @site.create_new
|
227
|
+
wdb = Qwik::WikiDB.new(page)
|
228
|
+
eq false, !!wdb.exist?('k')
|
229
|
+
wdb.add('k', nil, 'v2')
|
230
|
+
eq ",k,,v2\n", page.load
|
231
|
+
eq ['', 'v2'], wdb['k']
|
232
|
+
end
|
233
|
+
end
|
234
|
+
end
|