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,249 @@
|
|
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/parser'
|
7
|
+
|
8
|
+
module Qwik
|
9
|
+
class Plugin
|
10
|
+
# Split a string into paragraphs.
|
11
|
+
def self.split(str)
|
12
|
+
paras = []
|
13
|
+
|
14
|
+
cur_str = nil
|
15
|
+
in_plugin = false
|
16
|
+
str.each_line {|line|
|
17
|
+
if ! in_plugin
|
18
|
+
if /\A\{\{/ =~ line
|
19
|
+
paras << cur_str if cur_str
|
20
|
+
cur_str = line
|
21
|
+
in_plugin = true
|
22
|
+
if /\}\}$/ =~ line # Use $ for new line.
|
23
|
+
paras << cur_str
|
24
|
+
cur_str = nil
|
25
|
+
in_plugin = false
|
26
|
+
end
|
27
|
+
else
|
28
|
+
cur_str = '' if cur_str.nil?
|
29
|
+
cur_str += line
|
30
|
+
end
|
31
|
+
else
|
32
|
+
if /\A\}\}$/ =~ line
|
33
|
+
cur_str += line
|
34
|
+
paras << cur_str
|
35
|
+
cur_str = nil
|
36
|
+
in_plugin = nil
|
37
|
+
else
|
38
|
+
cur_str += line
|
39
|
+
end
|
40
|
+
end
|
41
|
+
}
|
42
|
+
|
43
|
+
if cur_str
|
44
|
+
paras << cur_str
|
45
|
+
end
|
46
|
+
|
47
|
+
return paras
|
48
|
+
end
|
49
|
+
|
50
|
+
def self.rewrite(paras, pluginname, num)
|
51
|
+
cur_num = 1
|
52
|
+
nparas = []
|
53
|
+
paras.each {|para|
|
54
|
+
if /\A\{\{(\w+)/ =~ para && (name = $1.intern) == pluginname
|
55
|
+
if cur_num == num
|
56
|
+
tokens = TextTokenizer.tokenize(para)
|
57
|
+
tree = TextParser.make_tree(tokens)
|
58
|
+
raise if 1 < tree.length
|
59
|
+
plugin = tree[0]
|
60
|
+
raise if plugin[0] != :plugin
|
61
|
+
new_plugin = yield(plugin)
|
62
|
+
new_para = encode(new_plugin)
|
63
|
+
nparas << new_para
|
64
|
+
else
|
65
|
+
nparas << para
|
66
|
+
end
|
67
|
+
cur_num += 1
|
68
|
+
else
|
69
|
+
nparas << para
|
70
|
+
end
|
71
|
+
}
|
72
|
+
return nparas
|
73
|
+
end
|
74
|
+
|
75
|
+
def self.encode(plugin)
|
76
|
+
method = plugin[1][:method]
|
77
|
+
param = plugin[1][:param]
|
78
|
+
content = plugin[2]
|
79
|
+
str = "{{#{method}"
|
80
|
+
str << "(#{param})" if param && ! param.empty?
|
81
|
+
if content
|
82
|
+
content.chomp!
|
83
|
+
str << "
|
84
|
+
#{content}
|
85
|
+
"
|
86
|
+
end
|
87
|
+
str << "}}
|
88
|
+
"
|
89
|
+
return str
|
90
|
+
end
|
91
|
+
|
92
|
+
def self.join(paras)
|
93
|
+
str = paras.join
|
94
|
+
return str
|
95
|
+
end
|
96
|
+
end
|
97
|
+
end
|
98
|
+
|
99
|
+
if $0 == __FILE__
|
100
|
+
require 'qwik/test-common'
|
101
|
+
$test = true
|
102
|
+
end
|
103
|
+
|
104
|
+
if defined?($test) && $test
|
105
|
+
class TestPlugin < Test::Unit::TestCase
|
106
|
+
include TestSession
|
107
|
+
|
108
|
+
def ok_sp(e, s)
|
109
|
+
ok_eq(e, Qwik::Plugin.split(s))
|
110
|
+
end
|
111
|
+
|
112
|
+
def test_plugin_split
|
113
|
+
ok_sp([], '')
|
114
|
+
ok_sp(['a'], 'a')
|
115
|
+
ok_sp(['a
|
116
|
+
b'], 'a
|
117
|
+
b')
|
118
|
+
ok_sp(['{{p}}'], '{{p}}')
|
119
|
+
ok_sp(['a
|
120
|
+
', '{{p}}'], 'a
|
121
|
+
{{p}}')
|
122
|
+
ok_sp(['a
|
123
|
+
', '{{p}}
|
124
|
+
', 'b'], 'a
|
125
|
+
{{p}}
|
126
|
+
b')
|
127
|
+
ok_sp(['a
|
128
|
+
', '{{p
|
129
|
+
}}
|
130
|
+
', 'b'], 'a
|
131
|
+
{{p
|
132
|
+
}}
|
133
|
+
b')
|
134
|
+
end
|
135
|
+
|
136
|
+
def ok_re(expected, paras, num)
|
137
|
+
nparas = Qwik::Plugin.rewrite(paras, :p, num) {|plugin|
|
138
|
+
plugin << 'c'
|
139
|
+
plugin
|
140
|
+
}
|
141
|
+
ok_eq(expected, nparas)
|
142
|
+
end
|
143
|
+
|
144
|
+
def test_plugin_rewrite
|
145
|
+
ok_re(["{{p
|
146
|
+
c
|
147
|
+
}}
|
148
|
+
"],
|
149
|
+
['{{p}}'], 1)
|
150
|
+
ok_re(['{{p}}'], ['{{p}}'], 2)
|
151
|
+
ok_re(["a
|
152
|
+
", "{{p
|
153
|
+
c
|
154
|
+
}}
|
155
|
+
", "b
|
156
|
+
"],
|
157
|
+
["a
|
158
|
+
", "{{p}}
|
159
|
+
", "b
|
160
|
+
"], 1)
|
161
|
+
ok_re(["a
|
162
|
+
", "{{p
|
163
|
+
c
|
164
|
+
}}
|
165
|
+
", "{{p}}
|
166
|
+
", "b
|
167
|
+
"],
|
168
|
+
["a
|
169
|
+
", "{{p}}
|
170
|
+
", "{{p}}
|
171
|
+
", "b
|
172
|
+
"], 1)
|
173
|
+
ok_re(["{{p}}
|
174
|
+
", "{{p
|
175
|
+
c
|
176
|
+
}}
|
177
|
+
"],
|
178
|
+
["{{p}}
|
179
|
+
", '{{p}}'], 2)
|
180
|
+
ok_re(["{{p
|
181
|
+
c
|
182
|
+
}}
|
183
|
+
", '{{q}}'],
|
184
|
+
["{{p}}
|
185
|
+
", '{{q}}'], 1)
|
186
|
+
ok_re(["{{p}}
|
187
|
+
", '{{q}}'],
|
188
|
+
["{{p}}
|
189
|
+
", '{{q}}'], 2)
|
190
|
+
end
|
191
|
+
|
192
|
+
def ok_en(e, s)
|
193
|
+
ok_eq(e, Qwik::Plugin.encode(s))
|
194
|
+
end
|
195
|
+
|
196
|
+
def test_plugin_encode
|
197
|
+
ok_en("{{m}}
|
198
|
+
", [:plugin, {:method=>'m'}])
|
199
|
+
ok_en("{{m}}
|
200
|
+
", [:plugin, {:method=>'m', :param=>''}])
|
201
|
+
ok_en("{{m(p)}}
|
202
|
+
", [:plugin, {:method=>'m', :param=>'p'}])
|
203
|
+
ok_en("{{m(p)
|
204
|
+
|
205
|
+
}}
|
206
|
+
", [:plugin, {:method=>'m', :param=>'p'}, ''])
|
207
|
+
ok_en("{{m
|
208
|
+
c
|
209
|
+
}}
|
210
|
+
", [:plugin, {:method=>'m'}, 'c'])
|
211
|
+
ok_en("{{m
|
212
|
+
c
|
213
|
+
}}
|
214
|
+
", [:plugin, {:method=>'m'}, "c
|
215
|
+
"])
|
216
|
+
ok_en("{{m
|
217
|
+
c
|
218
|
+
|
219
|
+
}}
|
220
|
+
", [:plugin, {:method=>'m'}, "c
|
221
|
+
|
222
|
+
"])
|
223
|
+
ok_en("{{m(p)
|
224
|
+
c
|
225
|
+
}}
|
226
|
+
", [:plugin, {:method=>'m', :param=>'p'}, 'c'])
|
227
|
+
ok_en("{{m(p)
|
228
|
+
c
|
229
|
+
}}
|
230
|
+
", [:plugin, {:method=>'m', :param=>'p'}, "c
|
231
|
+
"])
|
232
|
+
end
|
233
|
+
|
234
|
+
def test_plugin_join
|
235
|
+
ok_eq("a
|
236
|
+
{{p
|
237
|
+
c
|
238
|
+
}}
|
239
|
+
b
|
240
|
+
",
|
241
|
+
Qwik::Plugin.join(["a
|
242
|
+
", "{{p
|
243
|
+
c
|
244
|
+
}}
|
245
|
+
", "b
|
246
|
+
"]))
|
247
|
+
end
|
248
|
+
end
|
249
|
+
end
|
@@ -0,0 +1,116 @@
|
|
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
|
+
# Special mode, not for general use.
|
8
|
+
|
9
|
+
module Qwik
|
10
|
+
class EmodePreProcessor
|
11
|
+
def self.emode?(str)
|
12
|
+
/\A============================================================/ =~ str
|
13
|
+
end
|
14
|
+
|
15
|
+
HMARK = {
|
16
|
+
'h2' => '*',
|
17
|
+
'h3' => '**'
|
18
|
+
}
|
19
|
+
|
20
|
+
def self.preprocess(str)
|
21
|
+
next_line = nil
|
22
|
+
num = 0
|
23
|
+
ar = []
|
24
|
+
str.each {|line|
|
25
|
+
line.chomp!
|
26
|
+
if next_line
|
27
|
+
if next_line == 'h2'
|
28
|
+
num += 1
|
29
|
+
end
|
30
|
+
if /\A([●■])(.*)\z/ =~ line
|
31
|
+
ar << HMARK[next_line] + $2
|
32
|
+
else
|
33
|
+
if next_line == 'h2'
|
34
|
+
ar << '*' + num.to_s
|
35
|
+
else
|
36
|
+
ar << "===="
|
37
|
+
end
|
38
|
+
next_line = add_line(next_line, ar, line)
|
39
|
+
end
|
40
|
+
next_line = nil
|
41
|
+
else
|
42
|
+
next_line = add_line(next_line, ar, line)
|
43
|
+
end
|
44
|
+
}
|
45
|
+
return ar.join("\n")
|
46
|
+
end
|
47
|
+
|
48
|
+
def self.add_line(next_line, ar, line)
|
49
|
+
case line
|
50
|
+
when /\A(=+)\z/ # only =
|
51
|
+
return 'h2'
|
52
|
+
when /\A(------+)/ # only -
|
53
|
+
return 'h3'
|
54
|
+
when /\A([→・])(.*)\z/
|
55
|
+
ar << '-'+$2
|
56
|
+
return next_line
|
57
|
+
when /\A([●■])(.*)\z/
|
58
|
+
ar << '***'+$2
|
59
|
+
return next_line
|
60
|
+
end
|
61
|
+
|
62
|
+
ignore_chars = [?\s, ?-, ?*, ?>, ?|, ?,, ?{, ?}]
|
63
|
+
if ignore_chars.include?(line[0]) || line.empty?
|
64
|
+
ar << line
|
65
|
+
return next_line
|
66
|
+
end
|
67
|
+
|
68
|
+
ar << line+"{{br}}"
|
69
|
+
return next_line
|
70
|
+
end
|
71
|
+
end
|
72
|
+
end
|
73
|
+
|
74
|
+
if $0 == __FILE__
|
75
|
+
require 'qwik/testunit'
|
76
|
+
$test = true
|
77
|
+
end
|
78
|
+
|
79
|
+
if defined?($test) && $test
|
80
|
+
class TestEmodePreProcessor < Test::Unit::TestCase
|
81
|
+
def ok(e, str)
|
82
|
+
str = "============================================================\n"+str
|
83
|
+
ok_eq(e, Qwik::EmodePreProcessor.preprocess(str))
|
84
|
+
end
|
85
|
+
|
86
|
+
def test_all
|
87
|
+
c = Qwik::EmodePreProcessor
|
88
|
+
|
89
|
+
# test_emode?
|
90
|
+
eq(false, !!c.emode?(''))
|
91
|
+
eq(true, !!c.emode?("============================================================"))
|
92
|
+
|
93
|
+
# test_preprocess
|
94
|
+
ok('*t', "●t")
|
95
|
+
ok("*1\n-t", "・t")
|
96
|
+
ok("*1\nt{{br}}", 't')
|
97
|
+
ok("*t\nt1{{br}}\nt2{{br}}", "●t\nt1\nt2")
|
98
|
+
ok("*t\nt1{{br}}\n====\nt2{{br}}",
|
99
|
+
"●t\nt1\n------------------------------------------------------------\nt2")
|
100
|
+
#ok("*t\n>t1{{br}}\n>t2{{br}}", "●t\n>t1\n>t2") # impossible...
|
101
|
+
ok("*t\n>t1\n>t2", "●t\n>t1\n>t2")
|
102
|
+
ok("*1\n-", '-')
|
103
|
+
ok('*1',
|
104
|
+
'------------------------------------------------------------')
|
105
|
+
|
106
|
+
# test_sjis_bug
|
107
|
+
ok("*1\nー{{br}}\nt{{br}}", "ー\nt")
|
108
|
+
|
109
|
+
# test_br
|
110
|
+
ok("*1\n{{{\nt{{br}}\n}}}", "{{{\nt\n}}}")
|
111
|
+
|
112
|
+
# test_multiline
|
113
|
+
ok("*1\na{{br}}\n\nb{{br}}", "a\n\nb")
|
114
|
+
end
|
115
|
+
end
|
116
|
+
end
|
@@ -0,0 +1,272 @@
|
|
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 InlineParser
|
9
|
+
URL = '(?:http|https|ftp|mailto|file):[a-zA-Z0-9;/?:@&=+$,\-_.!~*\'()#%]+'
|
10
|
+
|
11
|
+
INLINE_PATTERNS = {
|
12
|
+
:"'''"=>:strong,
|
13
|
+
:"''"=>:em,
|
14
|
+
:'=='=>:del,
|
15
|
+
}
|
16
|
+
|
17
|
+
def self.make_tree(line_ar)
|
18
|
+
root = []
|
19
|
+
stack = []
|
20
|
+
stack << root
|
21
|
+
in_tag = {}
|
22
|
+
|
23
|
+
line_ar.each {|t|
|
24
|
+
if t.is_a?(Symbol)
|
25
|
+
if in_tag[t]
|
26
|
+
in_tag[t] = nil
|
27
|
+
if stack.last.length == 1 # bad hack
|
28
|
+
stack.last << ''
|
29
|
+
end
|
30
|
+
stack.pop if 1 < stack.length
|
31
|
+
else
|
32
|
+
in_tag[t] = true
|
33
|
+
ar = [INLINE_PATTERNS[t]]
|
34
|
+
stack.last << ar
|
35
|
+
stack << ar
|
36
|
+
end
|
37
|
+
|
38
|
+
else
|
39
|
+
if t.is_a? Array
|
40
|
+
elem = t.first
|
41
|
+
case elem
|
42
|
+
when :ref
|
43
|
+
stack.last << parse_ref(t[1])
|
44
|
+
when :plugin
|
45
|
+
stack.last << parse_plugin(t)
|
46
|
+
when :url
|
47
|
+
stack.last << [:a, {:href=>t[1]}, t[1]]
|
48
|
+
else
|
49
|
+
# do nothing
|
50
|
+
end
|
51
|
+
|
52
|
+
else
|
53
|
+
stack.last << t
|
54
|
+
end
|
55
|
+
end
|
56
|
+
}
|
57
|
+
|
58
|
+
# bad hack
|
59
|
+
if stack.last.length == 1 && stack.last.is_a?(Array) &&
|
60
|
+
stack.last.first.is_a?(Symbol)
|
61
|
+
stack.last << ''
|
62
|
+
end
|
63
|
+
|
64
|
+
return root
|
65
|
+
end
|
66
|
+
|
67
|
+
def self.parse_plugin(t)
|
68
|
+
method = t[1].to_s
|
69
|
+
param = t[2].to_s
|
70
|
+
data = t[3].to_s
|
71
|
+
return [:br] if method == 'br' # shortcut
|
72
|
+
return [:plugin, {:method=>method, :param=>param}, data]
|
73
|
+
end
|
74
|
+
|
75
|
+
def self.parse_ref(uri)
|
76
|
+
text, uri = $1, $2 if /\A([^|]*)\|(.+)\z/ =~ uri
|
77
|
+
if text.nil? or text.empty?
|
78
|
+
text = uri
|
79
|
+
end
|
80
|
+
|
81
|
+
case uri
|
82
|
+
when /\A#{URL}/o
|
83
|
+
if /\.(?:jpg|jpeg|png|gif)\z/i =~ uri
|
84
|
+
[:img, {:src=>uri, :alt=>text}]
|
85
|
+
else
|
86
|
+
[:a, {:href=>uri}, text]
|
87
|
+
end
|
88
|
+
when /\A(.+?):(.+)\z/
|
89
|
+
[:plugin, {:method=>'interwiki', :param=>uri}, text]
|
90
|
+
else
|
91
|
+
uri = "#{uri}.html" unless uri.include?('.')
|
92
|
+
[:a, {:href=>uri}, text]
|
93
|
+
end
|
94
|
+
end
|
95
|
+
end
|
96
|
+
end
|
97
|
+
|
98
|
+
if $0 == __FILE__
|
99
|
+
if ARGV[0] == '-b'
|
100
|
+
$bench = true
|
101
|
+
else
|
102
|
+
require 'qwik/testunit'
|
103
|
+
$test = true
|
104
|
+
end
|
105
|
+
end
|
106
|
+
|
107
|
+
if defined?($test) && $test
|
108
|
+
require 'qwik/tokenizer-inline'
|
109
|
+
|
110
|
+
class TestInlineParser < Test::Unit::TestCase
|
111
|
+
def ok(e, str)
|
112
|
+
tokens = Qwik::InlineTokenizer.tokenize(str)
|
113
|
+
tree = Qwik::InlineParser.make_tree(tokens)
|
114
|
+
ok_eq(e, tree)
|
115
|
+
end
|
116
|
+
|
117
|
+
def test_all
|
118
|
+
ok([], '')
|
119
|
+
ok(['t'], 't')
|
120
|
+
|
121
|
+
# test em, strong and del
|
122
|
+
ok([[:em, 't']], "''t''")
|
123
|
+
ok([[:strong, 't']], "'''t'''")
|
124
|
+
ok([[:strong, 't', [:em, '']]], "'''t''")
|
125
|
+
ok(["'"], "'")
|
126
|
+
ok(["'", 't'], "'t")
|
127
|
+
ok([[:del, 't']], '==t==')
|
128
|
+
ok(['='], '=')
|
129
|
+
ok(['=', 't'], '=t')
|
130
|
+
ok(['a ',[:em,'b ',[:strong,'c'],' d'],' e'], "a ''b '''c''' d'' e")
|
131
|
+
# FIXME: Take care of incomplete patterns.
|
132
|
+
ok([[:em, 'a', [:strong, 'b', [:del, 'c']]]], "''a'''b==c")
|
133
|
+
ok([[:strong, '']], "''''''")
|
134
|
+
ok(['a', [:em, 'b', [:strong, 'c'], 'd'], 'e'], "a''b'''c''d'''e")
|
135
|
+
ok(['a', [:del, 'b', [:em, 'c'], 'd'], 'e'], "a==b''c==d''e")
|
136
|
+
|
137
|
+
# test_ref
|
138
|
+
ok([[:a, {:href=>'t.html'}, 't']], '[[t]]')
|
139
|
+
ok([[:a, {:href=>'t.html'}, 's']], '[[s|t]]')
|
140
|
+
ok([[:a, {:href=>'http://e.com/'}, 'e']], '[[e|http://e.com/]]')
|
141
|
+
ok([[:plugin, {:method=>'interwiki', :param=>'w:p'}, 'w:p']],
|
142
|
+
'[[w:p]]')
|
143
|
+
ok([']'], ']')
|
144
|
+
ok(['[', 't', ']'], '[t]')
|
145
|
+
ok([[:a, {:href=>'http://e.com/'}, 't']], '[http://e.com/ t]')
|
146
|
+
|
147
|
+
ok([[:a, {:href=>'C++.html'}, 'C++']], '[[C++]]')
|
148
|
+
|
149
|
+
# test_plugin
|
150
|
+
ok([[:plugin, {:method=>'t', :param=>''}, '']], '{{t}}')
|
151
|
+
ok([[:plugin, {:method=>'t', :param=>'a'}, '']], '{{t(a)}}')
|
152
|
+
ok(['{', 't', '}'], '{t}')
|
153
|
+
#ok(['{', '{', '}}'], '{{}}') # regexp version.
|
154
|
+
ok(['{{}}'], '{{}}') # strscan version.
|
155
|
+
ok([[:br]], '{{br}}') # shotcut
|
156
|
+
|
157
|
+
# test_url
|
158
|
+
ok([[:a, {:href=>'http://e.com/'}, 'http://e.com/']], 'http://e.com/')
|
159
|
+
ok([[:a, {:href=>'https://e.com/'}, 'https://e.com/']],
|
160
|
+
'https://e.com/')
|
161
|
+
ok(['t ', [:a, {:href=>'http://e.com/'}, 'http://e.com/'], ' a'],
|
162
|
+
't http://e.com/ a')
|
163
|
+
|
164
|
+
# test etc. at a time
|
165
|
+
ok(['a ', [:em, 'b'], ' ', [:strong, 'c'], ' ', [:del, 'd'], ' ',
|
166
|
+
[:a, {:href=>'e.html'}, 'e'], ' ',
|
167
|
+
[:plugin, {:method=>'f', :param=>''}, ''], ' ',
|
168
|
+
[:a, {:href=>'http://e.com/'}, 'http://e.com/'], ' g'],
|
169
|
+
"a ''b'' '''c''' ==d== [[e]] {{f}} http://e.com/ g")
|
170
|
+
|
171
|
+
# test_img
|
172
|
+
ok([[:img, {:alt=>'http://e.com/t.jpg', :src=>'http://e.com/t.jpg'}]],
|
173
|
+
'[[http://e.com/t.jpg]]')
|
174
|
+
ok([[:img, {:alt=>'m', :src=>'http://e.com/t.jpg'}]],
|
175
|
+
'[[m|http://e.com/t.jpg]]')
|
176
|
+
|
177
|
+
# test_security
|
178
|
+
ok([[:a, {:href=>'t.html'}, 't']], '[[t]]')
|
179
|
+
ok([[:a, {:href=>'http://e.com/'}, 'http://e.com/']],
|
180
|
+
'[[http://e.com/]]')
|
181
|
+
ok([[:plugin, {:param=>'javascript:t', :method=>'interwiki'},
|
182
|
+
'javascript:t']],
|
183
|
+
'[[javascript:t]]') # Treated as InterWiki
|
184
|
+
ok([[:a, {:href=>"&{alert('hello');};.html"}, "&{alert('hello');};"]],
|
185
|
+
"[[&{alert('hello');};]]")
|
186
|
+
|
187
|
+
# test_bug
|
188
|
+
ok([[:a, {:href=>"\226].html"}, "\226]"]], '[[望]]')
|
189
|
+
end
|
190
|
+
end
|
191
|
+
|
192
|
+
class TestInlineParser_parse_ref < Test::Unit::TestCase
|
193
|
+
def ok(e, str)
|
194
|
+
ok_eq(e, Qwik::InlineParser.parse_ref(str))
|
195
|
+
end
|
196
|
+
|
197
|
+
def test_all
|
198
|
+
# normal ref
|
199
|
+
ok([:a, {:href=>'t.html'}, 't'], 't')
|
200
|
+
ok([:a, {:href=>'http://e.com/'}, 'http://e.com/'], 'http://e.com/')
|
201
|
+
|
202
|
+
# with title
|
203
|
+
ok([:a, {:href=>'t.html'}, 's'], 's|t')
|
204
|
+
ok([:a, {:href=>'http://e.com/'}, 's'], 's|http://e.com/')
|
205
|
+
|
206
|
+
# interwiki
|
207
|
+
ok([:plugin, {:param=>'s:t', :method=>'interwiki'}, 's:t'], 's:t')
|
208
|
+
ok([:plugin, {:param=>'s:t', :method=>'interwiki'}, 'foo'], 'foo|s:t')
|
209
|
+
|
210
|
+
# test_plugin_ref
|
211
|
+
ok([:a, {:href=>'.attach'}, '.attach'], '.attach')
|
212
|
+
ok([:a, {:href=>'.attach/t.txt'}, '.attach/t.txt'], '.attach/t.txt')
|
213
|
+
ok([:a, {:href=>'.attach/s t.txt'}, '.attach/s t.txt'],
|
214
|
+
'.attach/s t.txt')
|
215
|
+
|
216
|
+
# test_img
|
217
|
+
ok([:img, {:alt=>'http://e.com/t.jpg', :src=>'http://e.com/t.jpg'}],
|
218
|
+
'http://e.com/t.jpg')
|
219
|
+
ok([:img, {:alt=>'s', :src=>'http://e.com/t.jpg'}],
|
220
|
+
's|http://e.com/t.jpg')
|
221
|
+
|
222
|
+
# test security
|
223
|
+
ok([:a, {:href=>"&{alert('hello');};.html"}, "&{alert('hello');};"],
|
224
|
+
"&{alert('hello');};")
|
225
|
+
|
226
|
+
# test_sjis_bug
|
227
|
+
ok_eq("\203|\203X", 'ポス')
|
228
|
+
ok([:a, {:href=>"\203|\203X.html"}, "\203|\203X"], 'ポス')
|
229
|
+
|
230
|
+
# test_bug
|
231
|
+
ok_eq("\226]", '望')
|
232
|
+
ok([:a, {:href=>"\226].html"}, "\226]"], '望')
|
233
|
+
|
234
|
+
# abnormal cases
|
235
|
+
ok([:a, {:href=>'|.html'}, '|'], '|')
|
236
|
+
ok([:a, {:href=>'|.html'}, '|'], '||')
|
237
|
+
ok([:a, {:href=>'||.html'}, '||'], '|||')
|
238
|
+
ok([:a, {:href=>'s|.html'}, 's|'], 's|')
|
239
|
+
ok([:a, {:href=>'s.html'}, 's'], '|s')
|
240
|
+
ok([:a, {:href=>'http://example.com'}, 'http://example.com'], '|http://example.com')
|
241
|
+
ok([:plugin, {:param=>'s:t', :method=>'interwiki'}, 's:t'], '|s:t')
|
242
|
+
end
|
243
|
+
end
|
244
|
+
end
|
245
|
+
|
246
|
+
if defined?($bench) && $bench
|
247
|
+
require 'qwik/bench-module-session'
|
248
|
+
|
249
|
+
def ok(e, str)
|
250
|
+
tree = Qwik::InlineParser.parse(str)
|
251
|
+
end
|
252
|
+
|
253
|
+
def main
|
254
|
+
n = 10000
|
255
|
+
|
256
|
+
# 10000 times.
|
257
|
+
# 5.460000 0.220000 5.680000 ( 5.683599)
|
258
|
+
# 5.460000 0.180000 5.640000 ( 5.641708)
|
259
|
+
# 5.480000 0.350000 5.830000 ( 5.840561)
|
260
|
+
|
261
|
+
BenchmarkModule::benchmark {
|
262
|
+
n.times {
|
263
|
+
ok(['a ', [:em, 'b'], ' ', [:strong, 'c'], ' ', [:del, 'd'], ' ',
|
264
|
+
[:a, {:href=>'e.html'}, 'e'], ' ',
|
265
|
+
[:plugin, {:method=>'f', :param=>''}, ''], ' ',
|
266
|
+
[:a, {:href=>'http://e.com/'}, 'http://e.com/'], ' g'],
|
267
|
+
"a ''b'' '''c''' ==d== [[e]] {{f}} http://e.com/ g")
|
268
|
+
}
|
269
|
+
}
|
270
|
+
end
|
271
|
+
main
|
272
|
+
end
|