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,160 @@
|
|
1
|
+
#
|
2
|
+
# Copyright (C) 2005 jouno <jouno2002@yahoo.co.jp>
|
3
|
+
# License under GPL-2
|
4
|
+
#
|
5
|
+
# original is Adam Bregenzer(<adam@bregenzer.net>)'s python version
|
6
|
+
# http://adam.bregenzer.net/python/typekey/TypeKey.py
|
7
|
+
#
|
8
|
+
# modified by Kouichirou Eto
|
9
|
+
#
|
10
|
+
# note:
|
11
|
+
# nick name field must be sent as utf-8 url_encoded string.
|
12
|
+
|
13
|
+
# sample code:
|
14
|
+
|
15
|
+
=begin
|
16
|
+
token = 'your_site_token'
|
17
|
+
tk = TypeKey.new(token, '1.1')
|
18
|
+
|
19
|
+
if cgi.params['tk'][0] == '1'
|
20
|
+
ts = cgi.params['ts'][0]
|
21
|
+
email = cgi.params['email'][0]
|
22
|
+
name = cgi.params['name'][0]
|
23
|
+
nick = cgi.params['nick'][0]
|
24
|
+
sig = cgi.params['sig'][0]
|
25
|
+
if tk.verify(email, name, nick, ts, sig)
|
26
|
+
puts 'verify!'
|
27
|
+
else
|
28
|
+
puts 'not!'
|
29
|
+
end
|
30
|
+
end
|
31
|
+
|
32
|
+
return_url = 'http://localhost/cgi-bin/tk_test.cgi'
|
33
|
+
|
34
|
+
url_sign_in = tk.get_login_url(return_url + '?tk=1')
|
35
|
+
url_sign_out = tk.get_logout_url(return_url)
|
36
|
+
|
37
|
+
puts "<a href=\"#{url_sign_in}\">sign in</a><br />"
|
38
|
+
puts "<a href=\"#{url_sign_out}\">sign out</a><br />"
|
39
|
+
=end
|
40
|
+
|
41
|
+
require 'uri'
|
42
|
+
require 'open-uri'
|
43
|
+
require 'base64'
|
44
|
+
require 'openssl'
|
45
|
+
|
46
|
+
class TypeKeyError < StandardError; end
|
47
|
+
class TimeOutError < TypeKeyError; end
|
48
|
+
class VerifyFailed < TypeKeyError; end
|
49
|
+
|
50
|
+
# This class handles TypeKey logins.
|
51
|
+
class TypeKey
|
52
|
+
def initialize(token, version = '1.1')
|
53
|
+
@token = token
|
54
|
+
@version = version
|
55
|
+
|
56
|
+
# Base url for generating login and logout urls.
|
57
|
+
@base_url = 'https://www.typekey.com/t/typekey/'
|
58
|
+
|
59
|
+
# Url used to download the public key.
|
60
|
+
@key_url = 'http://www.typekey.com/extras/regkeys.txt'
|
61
|
+
|
62
|
+
# Location for caching the public key.
|
63
|
+
@key_cache_path = '/tmp/tk_key_cache'
|
64
|
+
|
65
|
+
# Length of time to wait before refreshing the public key cache, in seconds.
|
66
|
+
# Defaults to two days.
|
67
|
+
@key_cache_timeout = 60 * 60 * 24 * 2
|
68
|
+
|
69
|
+
# Length of time logins remain valid, in seconds.
|
70
|
+
# Defaults to five minutes.
|
71
|
+
@login_timeout = 60 * 5
|
72
|
+
end
|
73
|
+
attr_accessor :base_url, :login_timeout
|
74
|
+
attr_accessor :key_url, :key_cache_path, :key_cache_timeout
|
75
|
+
|
76
|
+
# Verify a typekey login
|
77
|
+
def verify(email, name, nick, ts, sig, key = nil)
|
78
|
+
sig.gsub!(/ /, '+') # sig isn't urlencoded.
|
79
|
+
|
80
|
+
key = get_key if key.nil?
|
81
|
+
|
82
|
+
message_ar = [email, name, nick, ts.to_s]
|
83
|
+
message_ar << @token if @version == '1.1'
|
84
|
+
message = message_ar.join('::')
|
85
|
+
|
86
|
+
raise VerifyFailed if ! dsa_verify(message, sig, key)
|
87
|
+
raise TimeOutError if (Time.now.to_i - ts.to_i) > @login_timeout
|
88
|
+
return true
|
89
|
+
end
|
90
|
+
|
91
|
+
# Return a URL to login to TypeKey
|
92
|
+
def get_login_url(return_url, email = false)
|
93
|
+
url = @base_url
|
94
|
+
url += "login?t=#{@token}"
|
95
|
+
url += (email ? '&need_email=1' : '')
|
96
|
+
url += "&_return=#{URI.escape(return_url)}"
|
97
|
+
url += "&v=#{@version}"
|
98
|
+
return url
|
99
|
+
end
|
100
|
+
|
101
|
+
# Return a URL to logout of TypeKey
|
102
|
+
def get_logout_url(return_url)
|
103
|
+
return @base_url + 'logout?_return=' + URI.escape(return_url)
|
104
|
+
end
|
105
|
+
|
106
|
+
# Return the TypeKey public keys, cache results unless a url is passed
|
107
|
+
def get_key(url = nil)
|
108
|
+
if url.nil?
|
109
|
+
begin
|
110
|
+
mod_time = File.mtime(@key_cache_path).to_i
|
111
|
+
rescue SystemCallError
|
112
|
+
mod_time = 0
|
113
|
+
end
|
114
|
+
|
115
|
+
if @key_cache_timeout < (Time.now.to_i - mod_time) ||
|
116
|
+
! File.exist?(@key_cache_path)
|
117
|
+
open(@key_url) {|fh| # using open-uri
|
118
|
+
@key_string = fh.read
|
119
|
+
}
|
120
|
+
File.open(@key_cache_path, 'w') {|fh|
|
121
|
+
fh.puts(@key_string)
|
122
|
+
}
|
123
|
+
else
|
124
|
+
File.open(@key_cache_path, 'r') {|fh|
|
125
|
+
@key_string = fh.read
|
126
|
+
}
|
127
|
+
end
|
128
|
+
else
|
129
|
+
open(url) {|fh|
|
130
|
+
@key_string = fh.read
|
131
|
+
}
|
132
|
+
end
|
133
|
+
|
134
|
+
tk_key = Hash.new
|
135
|
+
|
136
|
+
for pair in @key_string.strip.split(' ')
|
137
|
+
key, value = pair.split('=')
|
138
|
+
tk_key[key] = value.to_i
|
139
|
+
end
|
140
|
+
|
141
|
+
return tk_key
|
142
|
+
end
|
143
|
+
|
144
|
+
# Verify a DSA signature
|
145
|
+
def dsa_verify(message, sig, key)
|
146
|
+
r_sig, s_sig = sig.split(':')
|
147
|
+
r_sig = Base64.decode64(r_sig).unpack('H*')[0].hex
|
148
|
+
s_sig = Base64.decode64(s_sig).unpack('H*')[0].hex
|
149
|
+
sign = OpenSSL::ASN1::Sequence.new([OpenSSL::ASN1::Integer.new(r_sig),
|
150
|
+
OpenSSL::ASN1::Integer.new(s_sig)]
|
151
|
+
).to_der
|
152
|
+
dsa = OpenSSL::PKey::DSA.new
|
153
|
+
dsa.p = key['p']
|
154
|
+
dsa.q = key['q']
|
155
|
+
dsa.g = key['g']
|
156
|
+
dsa.pub_key = key['pub_key']
|
157
|
+
dss1 = OpenSSL::Digest::DSS1.new
|
158
|
+
return dsa.verify(dss1, sign, message)
|
159
|
+
end
|
160
|
+
end
|
@@ -0,0 +1,135 @@
|
|
1
|
+
#
|
2
|
+
# Copyright (C) 2002-2004 Satoru Takabayashi <satoru@namazu.org>
|
3
|
+
# Copyright (C) 2003-2006 Kouichirou Eto
|
4
|
+
# All rights reserved.
|
5
|
+
# This is free software with ABSOLUTELY NO WARRANTY.
|
6
|
+
#
|
7
|
+
# You can redistribute it and/or modify it under the terms of
|
8
|
+
# the GNU General Public License version 2.
|
9
|
+
#
|
10
|
+
|
11
|
+
$LOAD_PATH.unshift '..' unless $LOAD_PATH.include? '..'
|
12
|
+
require 'qwik/util-string'
|
13
|
+
|
14
|
+
class NilClass
|
15
|
+
def empty?
|
16
|
+
return true
|
17
|
+
end
|
18
|
+
end
|
19
|
+
|
20
|
+
class Integer
|
21
|
+
# 12345.commify => '12,345'
|
22
|
+
def commify
|
23
|
+
numstr = self.to_s
|
24
|
+
true while numstr.sub!(/^([-+]?\d+)(\d{3})/, '\1,\2')
|
25
|
+
return numstr
|
26
|
+
end
|
27
|
+
|
28
|
+
UNITS = ['Bytes','KB','MB','GB','TB','PB']
|
29
|
+
# 1024 => 1KB
|
30
|
+
def byte_format
|
31
|
+
n = self
|
32
|
+
UNITS.each {|unit|
|
33
|
+
t = n/1024
|
34
|
+
if t > 0
|
35
|
+
n = t
|
36
|
+
else
|
37
|
+
return n.to_s + unit
|
38
|
+
end
|
39
|
+
}
|
40
|
+
return n.to_s + _(unit)
|
41
|
+
end
|
42
|
+
end
|
43
|
+
|
44
|
+
# It preserves case information. but it accepts an
|
45
|
+
# address case-insensitively for member management.
|
46
|
+
class IcaseArray < Array
|
47
|
+
def include? (item)
|
48
|
+
if self.find {|x| x.downcase == item.downcase }
|
49
|
+
return true
|
50
|
+
else
|
51
|
+
return false
|
52
|
+
end
|
53
|
+
end
|
54
|
+
|
55
|
+
def delete (item)
|
56
|
+
self.replace(self.find_all {|x| x.downcase != item.downcase })
|
57
|
+
end
|
58
|
+
end
|
59
|
+
|
60
|
+
class IcaseHash < Hash
|
61
|
+
def include? (key)
|
62
|
+
super(key.downcase)
|
63
|
+
end
|
64
|
+
|
65
|
+
def delete (key)
|
66
|
+
super(key.downcase)
|
67
|
+
end
|
68
|
+
|
69
|
+
def [] (key)
|
70
|
+
super(key.downcase)
|
71
|
+
end
|
72
|
+
|
73
|
+
def []= (key, value)
|
74
|
+
super(key.downcase, value)
|
75
|
+
end
|
76
|
+
end
|
77
|
+
|
78
|
+
class Hash
|
79
|
+
def to_query_string
|
80
|
+
ar = []
|
81
|
+
self.each {|k, v|
|
82
|
+
if k && v
|
83
|
+
ar << "#{k.to_s.escape}=#{v.to_s.escape}"
|
84
|
+
end
|
85
|
+
}
|
86
|
+
return ar.sort.join('&')
|
87
|
+
end
|
88
|
+
end
|
89
|
+
|
90
|
+
if $0 == __FILE__
|
91
|
+
require 'test/unit'
|
92
|
+
$test = true
|
93
|
+
end
|
94
|
+
|
95
|
+
if defined?($test) && $test
|
96
|
+
class TestUtilBasic < Test::Unit::TestCase
|
97
|
+
def test_nil
|
98
|
+
assert_equal true, nil.empty?
|
99
|
+
end
|
100
|
+
|
101
|
+
def test_integer
|
102
|
+
assert_equal '12,345', 12345.commify
|
103
|
+
assert_equal '123,456,789', 123456789.commify
|
104
|
+
|
105
|
+
assert_equal '1KB', (1024+1).byte_format
|
106
|
+
assert_equal '2MB', (2*1024*1024+2).byte_format
|
107
|
+
assert_equal '3GB', (3*1024*1024*1024+3).byte_format
|
108
|
+
assert_equal '4TB', (4*1024*1024*1024*1024+4).byte_format
|
109
|
+
end
|
110
|
+
|
111
|
+
def test_iscase_array
|
112
|
+
iar = IcaseArray.new
|
113
|
+
iar << 'T'
|
114
|
+
assert_equal true, iar.include?('T')
|
115
|
+
assert_equal true, iar.include?('t')
|
116
|
+
iar.delete('t')
|
117
|
+
assert_equal false, iar.include?('t')
|
118
|
+
end
|
119
|
+
|
120
|
+
def test_icase_hash
|
121
|
+
ih = IcaseHash.new
|
122
|
+
ih['T'] = 1
|
123
|
+
assert_equal true, ih.include?('t')
|
124
|
+
assert_equal 1, ih['t']
|
125
|
+
ih.delete('t')
|
126
|
+
assert_equal false, ih.include?('t')
|
127
|
+
end
|
128
|
+
|
129
|
+
def test_hash
|
130
|
+
# test_hash_to_query_string
|
131
|
+
assert_equal 'k=v', {:k=>'v'}.to_query_string
|
132
|
+
assert_equal 'k1=v1&k2=v2', {:k1=>'v1', :k2=>'v2'}.to_query_string
|
133
|
+
end
|
134
|
+
end
|
135
|
+
end
|
@@ -0,0 +1,331 @@
|
|
1
|
+
# Copyright (C) 2003-2006 Kouichirou Eto, All rights reserved.
|
2
|
+
# This is free software with ABSOLUTELY NO WARRANTY.
|
3
|
+
# You can redistribute it and/or modify it under the terms of the GNU GPL 2.
|
4
|
+
|
5
|
+
require 'kconv'
|
6
|
+
require 'iconv'
|
7
|
+
|
8
|
+
$LOAD_PATH.unshift '..' unless $LOAD_PATH.include? '..'
|
9
|
+
|
10
|
+
class String
|
11
|
+
# ============================== kconv
|
12
|
+
def sjistoeuc
|
13
|
+
self.kconv(Kconv::EUC, Kconv::SJIS).set_euc
|
14
|
+
end
|
15
|
+
|
16
|
+
def euctosjis
|
17
|
+
self.kconv(Kconv::SJIS, Kconv::EUC).set_sjis
|
18
|
+
end
|
19
|
+
|
20
|
+
def sjistojis
|
21
|
+
self.kconv(Kconv::JIS, Kconv::SJIS).set_jis
|
22
|
+
end
|
23
|
+
|
24
|
+
def jistosjis
|
25
|
+
self.kconv(Kconv::SJIS, Kconv::JIS).set_sjis
|
26
|
+
end
|
27
|
+
|
28
|
+
def euctojis
|
29
|
+
self.kconv(Kconv::JIS, Kconv::EUC).set_jis
|
30
|
+
end
|
31
|
+
|
32
|
+
def jistoeuc
|
33
|
+
self.kconv(Kconv::EUC, Kconv::JIS).set_euc
|
34
|
+
end
|
35
|
+
|
36
|
+
# ============================== iconv
|
37
|
+
def sjistou8; Iconv.iconv_to_from('UTF-8', 'Shift_JIS', self) end
|
38
|
+
def u8tosjis; Iconv.iconv_to_from('Shift_JIS', 'UTF-8', self) end
|
39
|
+
def euctou8; Iconv.iconv_to_from('UTF-8', 'EUC-JP', self) end
|
40
|
+
def u8toeuc; Iconv.iconv_to_from('EUC-JP', 'UTF-8', self) end
|
41
|
+
def jistou8; Iconv.iconv_to_from('UTF-8', 'ISO-2022-JP', self) end
|
42
|
+
def u8tojis
|
43
|
+
iconv = Iconv.new('ISO-2022-JP', 'UTF-8')
|
44
|
+
out = iconv.iconv(self)+iconv.close
|
45
|
+
out.set_charset('ISO-2022-JP')
|
46
|
+
out
|
47
|
+
end
|
48
|
+
|
49
|
+
# ============================== charset
|
50
|
+
def set_charset(charset)
|
51
|
+
@charset = charset
|
52
|
+
return self
|
53
|
+
end
|
54
|
+
|
55
|
+
def charset
|
56
|
+
return @charset if defined?(@charset)
|
57
|
+
return nil
|
58
|
+
end
|
59
|
+
|
60
|
+
def set_utf8; set_charset('UTF-8') end
|
61
|
+
def set_sjis; set_charset('Shift_JIS') end
|
62
|
+
def set_euc; set_charset('EUC-JP') end
|
63
|
+
def set_jis; set_charset('ISO-2022-JP') end
|
64
|
+
|
65
|
+
KCONV_TO_CHARSET = {
|
66
|
+
#Kconv::AUTO => '?',
|
67
|
+
Kconv::JIS => 'ISO-2022-JP',
|
68
|
+
Kconv::EUC => 'EUC-JP',
|
69
|
+
Kconv::SJIS => 'Shift_JIS',
|
70
|
+
#Kconv::BINARY => '?BINARY',
|
71
|
+
#Kconv::NOCONV => '?NOCONV',
|
72
|
+
Kconv::ASCII => 'ASCII',
|
73
|
+
Kconv::UTF8 => 'UTF-8',
|
74
|
+
Kconv::UTF16 => 'UTF-16',
|
75
|
+
Kconv::UTF32 => 'UTF-32',
|
76
|
+
#Kconv::UNKNOWN => '?',
|
77
|
+
}
|
78
|
+
|
79
|
+
def guess_charset
|
80
|
+
kconv_charset = Kconv::guess(self)
|
81
|
+
charset = KCONV_TO_CHARSET[kconv_charset]
|
82
|
+
if /\A\?/ =~ charset
|
83
|
+
#p kconv_charset, charset
|
84
|
+
end
|
85
|
+
return charset
|
86
|
+
end
|
87
|
+
|
88
|
+
def guess_charset!
|
89
|
+
set_charset(self.guess_charset)
|
90
|
+
return self
|
91
|
+
end
|
92
|
+
|
93
|
+
# tosjis is used in kconv.rb
|
94
|
+
def to_sjis
|
95
|
+
raise 'Undefined charset.' if self.charset.nil?
|
96
|
+
case self.charset
|
97
|
+
when 'ASCII'; return self
|
98
|
+
when 'UTF-8'; return self.u8tosjis
|
99
|
+
when 'Shift_JIS'; return self
|
100
|
+
when 'EUC-JP'; return self.euctosjis
|
101
|
+
when 'ISO-2022-JP'; return self.jistosjis
|
102
|
+
end
|
103
|
+
raise 'Unknown charset.'
|
104
|
+
end
|
105
|
+
|
106
|
+
# toeuc is used in kconv.rb
|
107
|
+
def to_euc
|
108
|
+
raise 'Undefined charset.' if self.charset.nil?
|
109
|
+
case self.charset
|
110
|
+
when 'ASCII'; return self
|
111
|
+
when 'UTF-8'; return self.u8toeuc
|
112
|
+
when 'Shift_JIS'; return self.sjistoeuc
|
113
|
+
when 'EUC-JP'; return self
|
114
|
+
when 'ISO-2022-JP'; return self.jistoeuc
|
115
|
+
end
|
116
|
+
raise 'Unknown charset.'
|
117
|
+
end
|
118
|
+
|
119
|
+
# tojis is used in kconv.rb
|
120
|
+
def to_jis
|
121
|
+
raise 'Undefined charset.' if self.charset.nil?
|
122
|
+
case self.charset
|
123
|
+
when 'ASCII'; return self
|
124
|
+
when 'UTF-8'; return self.u8tojis
|
125
|
+
when 'Shift_JIS'; return self.sjistojis
|
126
|
+
when 'EUC-JP'; return self.euctojis
|
127
|
+
when 'ISO-2022-JP'; return self
|
128
|
+
end
|
129
|
+
raise 'Unknown charset.'
|
130
|
+
end
|
131
|
+
|
132
|
+
def to_utf8
|
133
|
+
#raise 'Undefined charset.' if self.charset.nil?
|
134
|
+
self.guess_charset! if self.charset.nil?
|
135
|
+
case self.charset
|
136
|
+
when 'ASCII'; return self
|
137
|
+
when 'UTF-8'; return self
|
138
|
+
when 'Shift_JIS'; return self.sjistou8
|
139
|
+
when 'EUC-JP'; return self.euctou8
|
140
|
+
when 'ISO-2022-JP'; return self.jistou8
|
141
|
+
end
|
142
|
+
raise 'Unknown charset.'
|
143
|
+
end
|
144
|
+
|
145
|
+
# Some use case.
|
146
|
+
alias set_mail_charset set_jis
|
147
|
+
alias set_page_charset set_sjis # This can be changed.
|
148
|
+
alias set_sourcecode_charset set_sjis # This can be changed.
|
149
|
+
alias set_xml_charset set_utf8
|
150
|
+
alias set_url_charset set_utf8
|
151
|
+
alias set_filename_charset set_utf8
|
152
|
+
|
153
|
+
alias to_mail_charset to_jis
|
154
|
+
alias to_page_charset to_sjis
|
155
|
+
alias to_xml_charset to_utf8
|
156
|
+
alias to_url_charset to_utf8
|
157
|
+
alias to_filename_charset to_utf8
|
158
|
+
|
159
|
+
def page_to_xml
|
160
|
+
self.set_page_charset.to_xml_charset
|
161
|
+
end
|
162
|
+
end
|
163
|
+
|
164
|
+
class Iconv
|
165
|
+
UNKNOWN_CHARACTER = '?'
|
166
|
+
|
167
|
+
def self.iconv_to_from(to, from, str)
|
168
|
+
iconv = Iconv.new(to, from)
|
169
|
+
out = ''
|
170
|
+
begin
|
171
|
+
out << iconv.iconv(str)
|
172
|
+
rescue Iconv::IllegalSequence => e # FIXME: Merge with InvalidCharacter
|
173
|
+
out << e.success
|
174
|
+
ch, str = e.failed.split(//u, 2)
|
175
|
+
out << UNKNOWN_CHARACTER
|
176
|
+
retry
|
177
|
+
rescue Iconv::InvalidCharacter => e
|
178
|
+
out << e.success
|
179
|
+
ch, str = e.failed.split(//u, 2)
|
180
|
+
out << UNKNOWN_CHARACTER
|
181
|
+
retry
|
182
|
+
end
|
183
|
+
out.set_charset(to)
|
184
|
+
return out
|
185
|
+
end
|
186
|
+
|
187
|
+
def self.iconv_to_utf8(from, str)
|
188
|
+
to = 'UTF-8'
|
189
|
+
iconv = Iconv.new(from, to)
|
190
|
+
out = ''
|
191
|
+
begin
|
192
|
+
out << iconv.iconv(str)
|
193
|
+
rescue Iconv::IllegalSequence => e
|
194
|
+
out << e.success
|
195
|
+
ch, str = e.failed.split(//u, 2)
|
196
|
+
if respond_to?(:unknown_unicode_handler)
|
197
|
+
u = ch.unpack('U').first
|
198
|
+
out << unknown_unicode_handler(u)
|
199
|
+
else
|
200
|
+
out << UNKNOWN_CHARACTER
|
201
|
+
end
|
202
|
+
retry
|
203
|
+
end
|
204
|
+
out.set_charset(to)
|
205
|
+
return out
|
206
|
+
end
|
207
|
+
|
208
|
+
def self.unknown_unicode_handler (u)
|
209
|
+
return sprintf("&#x%04x;", u)
|
210
|
+
end
|
211
|
+
end
|
212
|
+
|
213
|
+
module Charset
|
214
|
+
UTF8 = 'utf-8'
|
215
|
+
end
|
216
|
+
|
217
|
+
if $0 == __FILE__
|
218
|
+
require 'test/unit'
|
219
|
+
$test = true
|
220
|
+
end
|
221
|
+
|
222
|
+
if defined?($test) && $test
|
223
|
+
class TestUtilCharset < Test::Unit::TestCase
|
224
|
+
def test_kconv
|
225
|
+
# test_sjistoeuc
|
226
|
+
assert_equal "\244\242", 'あ'.sjistoeuc
|
227
|
+
assert_equal 'EUC-JP', 'あ'.sjistoeuc.charset
|
228
|
+
|
229
|
+
# test_euctosjis
|
230
|
+
assert_equal 'あ', "\244\242".euctosjis
|
231
|
+
assert_equal 'Shift_JIS', "\244\242".euctosjis.charset
|
232
|
+
|
233
|
+
# test_sjistojis
|
234
|
+
assert_equal "\e$B$\"\e(B", 'あ'.sjistojis
|
235
|
+
assert_equal 'ISO-2022-JP', 'あ'.sjistojis.charset
|
236
|
+
|
237
|
+
# test_jistosjis
|
238
|
+
assert_equal 'あ', "\e$B$\"\e(B".jistosjis
|
239
|
+
assert_equal 'Shift_JIS', "\e$B$\"\e(B".jistosjis.charset
|
240
|
+
|
241
|
+
# test_euctojis
|
242
|
+
assert_equal "\e$B$\"\e(B", "\244\242".euctojis
|
243
|
+
assert_equal 'ISO-2022-JP', "\244\242".euctojis.charset
|
244
|
+
|
245
|
+
# test_jistoeuc
|
246
|
+
assert_equal "\244\242", "\e$B$\"\e(B".jistoeuc
|
247
|
+
assert_equal 'EUC-JP', "\e$B$\"\e(B".jistoeuc.charset
|
248
|
+
|
249
|
+
# test_some_characters
|
250
|
+
assert_equal "\e$B4A;z\e(B", '漢字'.sjistojis
|
251
|
+
end
|
252
|
+
|
253
|
+
def test_iconv
|
254
|
+
assert_equal '字', '字'.sjistou8.u8tosjis
|
255
|
+
assert_equal '字', '字'.sjistoeuc.euctou8.u8toeuc.euctosjis
|
256
|
+
assert_equal '字', '字'.sjistojis.jistou8.u8tojis.jistosjis
|
257
|
+
|
258
|
+
# test_sjistou8
|
259
|
+
assert_equal "\343\201\202", 'あ'.sjistou8
|
260
|
+
assert_equal 'UTF-8', 'あ'.sjistou8.charset
|
261
|
+
|
262
|
+
assert_equal "\342\200\276", '~'.sjistou8
|
263
|
+
|
264
|
+
# test_u8tosjis
|
265
|
+
assert_equal "\202\240", "\343\201\202".u8tosjis
|
266
|
+
assert_equal 'Shift_JIS', "\343\201\202".u8tosjis.charset
|
267
|
+
|
268
|
+
# test_sjistoeuc
|
269
|
+
assert_equal "\244\242", 'あ'.sjistoeuc
|
270
|
+
assert_equal 'EUC-JP', 'あ'.sjistoeuc.charset
|
271
|
+
|
272
|
+
# test_euctou8
|
273
|
+
assert_equal "\343\201\202", "\244\242".euctou8
|
274
|
+
assert_equal 'UTF-8', "\244\242".euctou8.charset
|
275
|
+
|
276
|
+
# test_u8toeuc
|
277
|
+
assert_equal "\244\242", "\343\201\202".u8toeuc
|
278
|
+
assert_equal 'EUC-JP', "\343\201\202".u8toeuc.charset
|
279
|
+
|
280
|
+
# test_sjistojis
|
281
|
+
assert_equal "\e$B$\"\e(B", "あ".sjistojis
|
282
|
+
assert_equal 'ISO-2022-JP', "あ".sjistojis.charset
|
283
|
+
|
284
|
+
# test_jistou8
|
285
|
+
assert_equal "\343\201\202", "\e$B$\"\e(B".jistou8
|
286
|
+
assert_equal 'UTF-8', "\e$B$\"\e(B".jistou8.charset
|
287
|
+
|
288
|
+
# test_u8tojis
|
289
|
+
assert_equal "\e$B$\"\e(B", "\343\201\202".u8tojis
|
290
|
+
assert_equal 'ISO-2022-JP', "\343\201\202".u8tojis.charset
|
291
|
+
|
292
|
+
# test_illegal_sequence
|
293
|
+
# last \202 is illegal
|
294
|
+
assert_equal "\202\240?", "\343\201\202\202".u8tosjis
|
295
|
+
# first \202 is illegal
|
296
|
+
assert_equal "?\202\240", "\202\343\201\202".u8tosjis
|
297
|
+
|
298
|
+
# test_annoying_character
|
299
|
+
assert_equal "\343\200\234", '~'.sjistou8
|
300
|
+
assert_equal '~', "\343\200\234".u8tosjis
|
301
|
+
end
|
302
|
+
|
303
|
+
def test_charset
|
304
|
+
s = "\202\240"
|
305
|
+
assert_equal nil, s.charset
|
306
|
+
assert_equal "\202\240", s.set_charset('Shift_JIS')
|
307
|
+
assert_equal 'Shift_JIS', s.charset
|
308
|
+
|
309
|
+
# test_guess
|
310
|
+
assert_equal 'UTF-8', "\343\201\202".guess_charset
|
311
|
+
assert_equal 'Shift_JIS', "\202\240".guess_charset # あ
|
312
|
+
# assert_equal 'EUC-JP', "\244\242".guess_charset
|
313
|
+
assert_equal 'ISO-2022-JP', "\e$B$\"\e(B".guess_charset
|
314
|
+
|
315
|
+
# test_to
|
316
|
+
s = "\202\240".set_sjis
|
317
|
+
assert_equal "\343\201\202", s.to_utf8
|
318
|
+
assert_equal "\202\240", s.to_sjis
|
319
|
+
assert_equal "\244\242", s.to_euc
|
320
|
+
assert_equal "\e$B$\"\e(B", s.to_jis
|
321
|
+
end
|
322
|
+
|
323
|
+
def test_bug
|
324
|
+
# $KCODE = 'u'
|
325
|
+
assert_equal "~", "~".to_utf8
|
326
|
+
assert_equal "\342\200\276", "~".set_sjis.to_utf8 # annoying...
|
327
|
+
#assert_equal "\343\200\234", "~".to_utf8
|
328
|
+
#assert_equal "\343\200\234", "~".set_sjis.to_utf8
|
329
|
+
end
|
330
|
+
end
|
331
|
+
end
|
@@ -0,0 +1,56 @@
|
|
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 CSS
|
8
|
+
INHIBIT_PATTERN = %w(
|
9
|
+
@i
|
10
|
+
\\
|
11
|
+
javascript
|
12
|
+
vbscript
|
13
|
+
cookie
|
14
|
+
eval
|
15
|
+
expression
|
16
|
+
behavior
|
17
|
+
behaviour
|
18
|
+
binding
|
19
|
+
include-source
|
20
|
+
)
|
21
|
+
|
22
|
+
def self.valid?(str)
|
23
|
+
INHIBIT_PATTERN.each {|c|
|
24
|
+
return false if str.include?(c)
|
25
|
+
}
|
26
|
+
return true
|
27
|
+
end
|
28
|
+
end
|
29
|
+
|
30
|
+
if $0 == __FILE__
|
31
|
+
require 'test/unit'
|
32
|
+
$test = true
|
33
|
+
end
|
34
|
+
|
35
|
+
if defined?($test) && $test
|
36
|
+
class TestCSS < Test::Unit::TestCase
|
37
|
+
def valid(s)
|
38
|
+
assert_equal true, CSS.valid?(s)
|
39
|
+
end
|
40
|
+
|
41
|
+
def invalid(s)
|
42
|
+
assert_equal false, CSS.valid?(s)
|
43
|
+
end
|
44
|
+
|
45
|
+
def test_all
|
46
|
+
valid 'h2 { color: red }'
|
47
|
+
invalid "@import"
|
48
|
+
invalid "\\important"
|
49
|
+
valid ''
|
50
|
+
valid 'text-align:center;'
|
51
|
+
valid 'ok@style'
|
52
|
+
valid 'ok.style'
|
53
|
+
invalid '@i'
|
54
|
+
end
|
55
|
+
end
|
56
|
+
end
|