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,164 @@
|
|
1
|
+
# -*- coding: shift_jis -*-
|
2
|
+
# Copyright (C) 2003-2006 Kouichirou Eto, All rights reserved.
|
3
|
+
# This is free software with ABSOLUTELY NO WARRANTY.
|
4
|
+
# You can redistribute it and/or modify it under the terms of the GNU GPL 2.
|
5
|
+
|
6
|
+
$LOAD_PATH.unshift '..' unless $LOAD_PATH.include? '..'
|
7
|
+
|
8
|
+
module Qwik
|
9
|
+
class Action
|
10
|
+
D_PluginTextarea = {
|
11
|
+
:dt => 'Textarea plugin',
|
12
|
+
:dd => 'You can show a simple textarea field.',
|
13
|
+
:dc => "* Example
|
14
|
+
{{textarea
|
15
|
+
This is an example for textarea.
|
16
|
+
}}
|
17
|
+
{{textarea
|
18
|
+
This is an example for textarea.
|
19
|
+
}}
|
20
|
+
You can show an editable text field.
|
21
|
+
"
|
22
|
+
}
|
23
|
+
|
24
|
+
D_PluginTextarea_ja = {
|
25
|
+
:dt => 'テキストエリアプラグイン',
|
26
|
+
:dd => '編集可能なテキストエリアを表示します。',
|
27
|
+
:dc => "* 例
|
28
|
+
{{textarea
|
29
|
+
これはテキストエリアのサンプルです。
|
30
|
+
}}
|
31
|
+
{{textarea
|
32
|
+
これはテキストエリアのサンプルです。
|
33
|
+
}}
|
34
|
+
編集可能なテキストエリアです。
|
35
|
+
"
|
36
|
+
}
|
37
|
+
|
38
|
+
TEXTAREA_MIN_COLS = 50
|
39
|
+
TEXTAREA_MIN_ROWS = 4
|
40
|
+
TEXTAREA_MAX_COLS = 100
|
41
|
+
TEXTAREA_MAX_ROWS = 50
|
42
|
+
def plg_textarea
|
43
|
+
# @textarea_num is global for an action.
|
44
|
+
@textarea_num = 0 if ! defined?(@textarea_num)
|
45
|
+
@textarea_num += 1
|
46
|
+
action = "#{@req.base}.#{@textarea_num}.textarea"
|
47
|
+
|
48
|
+
content = ''
|
49
|
+
content = yield if block_given?
|
50
|
+
|
51
|
+
cols = rows = 1
|
52
|
+
content.each {|line|
|
53
|
+
len = line.chomp.length
|
54
|
+
cols = len if cols < len
|
55
|
+
rows += 1
|
56
|
+
}
|
57
|
+
cols = TEXTAREA_MIN_COLS if cols < TEXTAREA_MIN_COLS
|
58
|
+
rows = TEXTAREA_MIN_ROWS if rows < TEXTAREA_MIN_ROWS
|
59
|
+
cols = TEXTAREA_MAX_COLS if TEXTAREA_MAX_COLS < cols
|
60
|
+
rows = TEXTAREA_MAX_ROWS if TEXTAREA_MAX_ROWS < rows
|
61
|
+
|
62
|
+
return [:div, {:class=>'textarea'},
|
63
|
+
[:form, {:method=>'POST', :action=>action},
|
64
|
+
[:textarea, {:name=>'t', :cols=>cols, :rows=>rows}, content],
|
65
|
+
[:br],
|
66
|
+
[:input, {:type=>'submit', :value=>_('Update')}]]]
|
67
|
+
end
|
68
|
+
|
69
|
+
def ext_textarea
|
70
|
+
c_require_post
|
71
|
+
c_require_page_exist
|
72
|
+
|
73
|
+
num = @req.ext_args[0].to_i
|
74
|
+
return c_nerror(_('Error')) if num < 1
|
75
|
+
|
76
|
+
text = @req.query['t']
|
77
|
+
return c_nerror(_('No text.')) if text.nil? || text.empty?
|
78
|
+
text = text.normalize_newline
|
79
|
+
|
80
|
+
begin
|
81
|
+
plugin_edit(:textarea, num) {|content|
|
82
|
+
text
|
83
|
+
}
|
84
|
+
rescue NoCorrespondingPlugin
|
85
|
+
return c_nerror(_('Failed'))
|
86
|
+
rescue PageCollisionError
|
87
|
+
return mcomment_error(_('Page collision detected.'))
|
88
|
+
end
|
89
|
+
|
90
|
+
c_make_log('textarea') # TEXTAREA
|
91
|
+
|
92
|
+
url = "#{@req.base}.html"
|
93
|
+
return c_notice(_('Edit text done.'), url){
|
94
|
+
[[:h2, _('Edit text done.')],
|
95
|
+
[:p, [:a, {:href=>url}, _('Go back')]]]
|
96
|
+
}
|
97
|
+
end
|
98
|
+
end
|
99
|
+
end
|
100
|
+
|
101
|
+
if $0 == __FILE__
|
102
|
+
require 'qwik/test-common'
|
103
|
+
$test = true
|
104
|
+
end
|
105
|
+
|
106
|
+
if defined?($test) && $test
|
107
|
+
class TestActTextarea < Test::Unit::TestCase
|
108
|
+
include TestSession
|
109
|
+
|
110
|
+
def test_plg_textarea
|
111
|
+
ok_wi([:div, {:class=>"textarea"},
|
112
|
+
[:form, {:action=>"1.1.textarea", :method=>"POST"},
|
113
|
+
[:textarea, {:rows=>4, :name=>"t", :cols=>50}, "a\n"],
|
114
|
+
[:br],
|
115
|
+
[:input, {:value=>"Update", :type=>"submit"}]]],
|
116
|
+
"{{textarea
|
117
|
+
a
|
118
|
+
}}")
|
119
|
+
ok_wi([:div, {:class=>"textarea"},
|
120
|
+
[:form, {:action=>"1.1.textarea", :method=>"POST"},
|
121
|
+
[:textarea, {:rows=>4, :name=>"t", :cols=>55},
|
122
|
+
"aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa\n"],
|
123
|
+
[:br],
|
124
|
+
[:input, {:value=>"Update", :type=>"submit"}]]],
|
125
|
+
"{{textarea
|
126
|
+
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
|
127
|
+
}}")
|
128
|
+
ok_wi([:div, {:class=>"textarea"},
|
129
|
+
[:form, {:action=>"1.1.textarea", :method=>"POST"},
|
130
|
+
[:textarea, {:rows=>7, :name=>"t", :cols=>50},
|
131
|
+
"a\nb\nc\nd\ne\nf\n"],
|
132
|
+
[:br],
|
133
|
+
[:input, {:value=>"Update", :type=>"submit"}]]],
|
134
|
+
"{{textarea
|
135
|
+
a
|
136
|
+
b
|
137
|
+
c
|
138
|
+
d
|
139
|
+
e
|
140
|
+
f
|
141
|
+
}}")
|
142
|
+
end
|
143
|
+
|
144
|
+
def test_ext_textarea
|
145
|
+
t_add_user
|
146
|
+
|
147
|
+
page = @site.create_new
|
148
|
+
page.store("{{textarea}}\n")
|
149
|
+
res = session('POST /test/1.html')
|
150
|
+
ok_xp([:div, {:class=>"textarea"},
|
151
|
+
[:form, {:action=>"1.1.textarea", :method=>"POST"},
|
152
|
+
[:textarea, {:rows=>4, :name=>"t", :cols=>50}, ""],
|
153
|
+
[:br],
|
154
|
+
[:input, {:value=>"Update", :type=>"submit"}]]],
|
155
|
+
"//div[@class='textarea']")
|
156
|
+
|
157
|
+
res = session("POST /test/1.1.textarea?t=a")
|
158
|
+
ok_eq("{{textarea\na\n}}\n", page.load)
|
159
|
+
|
160
|
+
res = session("POST /test/1.1.textarea?t=a2")
|
161
|
+
ok_eq("{{textarea\na2\n}}\n", page.load)
|
162
|
+
end
|
163
|
+
end
|
164
|
+
end
|
@@ -0,0 +1,346 @@
|
|
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 'uri'
|
6
|
+
require 'net/http'
|
7
|
+
|
8
|
+
$LOAD_PATH.unshift '..' unless $LOAD_PATH.include? '..'
|
9
|
+
|
10
|
+
module Qwik
|
11
|
+
class Action
|
12
|
+
D_SiteTheme = {
|
13
|
+
:dt => 'Site Theme',
|
14
|
+
:dd => 'You can choose your favorite page design.',
|
15
|
+
:dc => '* How to
|
16
|
+
** Choose from themes of qwikWeb
|
17
|
+
{{theme_list}}
|
18
|
+
You can choose a theme from this list.
|
19
|
+
Go to [[_SiteConfig]] page, replace
|
20
|
+
:theme:qwikgreen
|
21
|
+
line. The page design will be changed.
|
22
|
+
|
23
|
+
\'\'\'Caution:\'\'\' Some themes, such as qwiksystem, are for system pages.
|
24
|
+
If you choose to use such themes, the page design will be strange.
|
25
|
+
|
26
|
+
** Use your own CSS file
|
27
|
+
Go to [[_SiteTheme]] page, attach your css file with the filename
|
28
|
+
"\'\'\'theme.css\'\'\'".
|
29
|
+
|
30
|
+
\'\'\'Caution:\'\'\' There are several inhibited elements in CSS.
|
31
|
+
Please see [[PluginStyle.describe]].
|
32
|
+
|
33
|
+
{{warning_for_css}}
|
34
|
+
|
35
|
+
** Use CSS file on external Web site
|
36
|
+
Goto [[_SiteConfig]] page,
|
37
|
+
replace
|
38
|
+
:theme:qwikgreen
|
39
|
+
line to something like
|
40
|
+
:theme:http://d.hatena.ne.jp/theme/clover/clover.css
|
41
|
+
to specify the css file. The page design will be changed.
|
42
|
+
|
43
|
+
\'\'\'Caution:\'\'\' Even if you are using an external CSS file,
|
44
|
+
there are several inhibited pattern. Please see [[PluginStyle.describe]].
|
45
|
+
'
|
46
|
+
}
|
47
|
+
|
48
|
+
D_SiteTheme_ja = {
|
49
|
+
:dt => 'サイト・テーマ',
|
50
|
+
:dd => 'サイト毎にページ・デザインを指定できます。',
|
51
|
+
:dc => '* 使い方
|
52
|
+
** qwikWebが提供するテーマから選ぶ
|
53
|
+
{{theme_list}}
|
54
|
+
この選択可能なテーマ一覧の中から一つを選び、[[_SiteConfig]]ページにて
|
55
|
+
:theme:qwikgreen
|
56
|
+
という一行を書換えてください。ページ・デザインが変更されます。
|
57
|
+
|
58
|
+
\'\'\'注意:\'\'\' qwiksystemなどの一部のページは、システム表示のための
|
59
|
+
ものです。通常のページ表示に使うと、表示が変になります。
|
60
|
+
|
61
|
+
** 自分で作ったCSSファイルを使う
|
62
|
+
[[_SiteTheme]]というページに行き、そのページに添付ファイルとして
|
63
|
+
「\'\'\'theme.css\'\'\'」というファイル名で自分の好きなCSSファイルを
|
64
|
+
添付してください。
|
65
|
+
|
66
|
+
\'\'\'注意:\'\'\' CSS中には使えない要素があります。
|
67
|
+
詳しくは[[PluginStyle.describe]]をご覧ください。
|
68
|
+
|
69
|
+
{{warning_for_css}}
|
70
|
+
|
71
|
+
** 外部のWebサイトに置いてあるCSSファイルを使う
|
72
|
+
[[_SiteConfig]]ページの
|
73
|
+
:theme:qwikgreen
|
74
|
+
という一行を書換えて、
|
75
|
+
:theme:http://d.hatena.ne.jp/theme/clover/clover.css
|
76
|
+
という感じにURLを指定してください。ページ・デザインが変更されます。
|
77
|
+
|
78
|
+
\'\'\'注意:\'\'\' 外部CSSファイルを使う場合にも、そのCSSファイル中に
|
79
|
+
使用禁止要素が含まれている場合には使えません。
|
80
|
+
詳しくは[[PluginStyle.describe]]をご覧ください。
|
81
|
+
|
82
|
+
'
|
83
|
+
}
|
84
|
+
|
85
|
+
# ============================== site theme
|
86
|
+
SITE_THEME = '_SiteTheme'
|
87
|
+
THEME_FILE = 'theme.css'
|
88
|
+
|
89
|
+
def site_theme
|
90
|
+
return @site.siteconfig['theme']
|
91
|
+
end
|
92
|
+
|
93
|
+
def site_theme_path
|
94
|
+
files = @site.files(SITE_THEME)
|
95
|
+
if files && files.exist?(THEME_FILE)
|
96
|
+
#return "/#{@site.sitename}/.css/theme.css"
|
97
|
+
#return c_relative_to_root(".css/theme.css")
|
98
|
+
return ".css/theme.css"
|
99
|
+
end
|
100
|
+
|
101
|
+
t = site_theme
|
102
|
+
if /\Ahttp:\/\// =~ t
|
103
|
+
#return "/#{@site.sitename}/.css/#{t}"
|
104
|
+
#return c_relative_to_root(".css/#{t}")
|
105
|
+
return ".css/#{t}"
|
106
|
+
end
|
107
|
+
|
108
|
+
return ".theme/#{t}/#{t}.css"
|
109
|
+
end
|
110
|
+
|
111
|
+
# ============================== theme_list
|
112
|
+
def plg_theme_list
|
113
|
+
return [:ul, *theme_list.map {|t| [:li, t] }]
|
114
|
+
end
|
115
|
+
|
116
|
+
THEME_IGNORE_DIR = %(css i js s5 swf)
|
117
|
+
|
118
|
+
def theme_list
|
119
|
+
themes = []
|
120
|
+
theme_path = @config.theme_dir.path
|
121
|
+
theme_path.each_entry {|d|
|
122
|
+
s = d.to_s
|
123
|
+
next if /\A\./ =~ s
|
124
|
+
next if THEME_IGNORE_DIR.include?(s)
|
125
|
+
dir = theme_path+d
|
126
|
+
next unless dir.directory?
|
127
|
+
themes << d.to_s
|
128
|
+
}
|
129
|
+
return themes.sort
|
130
|
+
end
|
131
|
+
|
132
|
+
# ============================== theme
|
133
|
+
def pre_act_theme
|
134
|
+
args = @req.path_args
|
135
|
+
filename = args.join('/')
|
136
|
+
path = @config.theme_dir.path+filename
|
137
|
+
return c_simple_send(path)
|
138
|
+
end
|
139
|
+
|
140
|
+
# from act-archive.rb. Used for archive.
|
141
|
+
def theme_files(theme)
|
142
|
+
dir = @config.theme_dir.path+theme
|
143
|
+
return unless dir.directory?
|
144
|
+
files = []
|
145
|
+
dir.each_entry {|f|
|
146
|
+
file = dir+f
|
147
|
+
next if file.directory?
|
148
|
+
s = f.to_s
|
149
|
+
next if /\A\./ =~ s || /\~\z/ =~ s || s == 'CVS'
|
150
|
+
files << f.to_s
|
151
|
+
}
|
152
|
+
return files
|
153
|
+
end
|
154
|
+
|
155
|
+
# ============================== CSS
|
156
|
+
def pre_act_css
|
157
|
+
str = ''
|
158
|
+
return nil if @req.path_args.empty?
|
159
|
+
|
160
|
+
if @req.path_args.length == 1
|
161
|
+
filename = @req.path_args[0]
|
162
|
+
content, type = css_get_from_site_theme(filename)
|
163
|
+
return c_notfound if content.nil?
|
164
|
+
|
165
|
+
@res['Content-Type'] = type
|
166
|
+
@res.body = content
|
167
|
+
return
|
168
|
+
end
|
169
|
+
|
170
|
+
url = @req.path_args.join('/')
|
171
|
+
content = css_get_by_url(url)
|
172
|
+
return c_notfound if content.nil?
|
173
|
+
@res['Content-Type'] = 'text/css'
|
174
|
+
@res.body = content
|
175
|
+
return
|
176
|
+
end
|
177
|
+
|
178
|
+
INVALID_CSS_INDICATOR = '/* invalid css */'
|
179
|
+
def css_get_from_site_theme(filename)
|
180
|
+
files = @site.files(SITE_THEME)
|
181
|
+
return nil if files.nil? || ! files.exist?(filename)
|
182
|
+
str = files.get(filename)
|
183
|
+
return nil if str.nil?
|
184
|
+
ext = filename.path.ext
|
185
|
+
type = @res.get_mimetypes ext
|
186
|
+
if type == 'text/css'
|
187
|
+
str = INVALID_CSS_INDICATOR if ! CSS.valid?(str)
|
188
|
+
return str, type
|
189
|
+
elsif /\Aimage\// =~ type
|
190
|
+
return str, type
|
191
|
+
else
|
192
|
+
return nil
|
193
|
+
end
|
194
|
+
end
|
195
|
+
|
196
|
+
def css_get_by_url(url)
|
197
|
+
# Add one more slash.
|
198
|
+
url = url.sub(/\Ahttp:\//, 'http://') if /\Ahttp:\/[^\/]/ =~ url
|
199
|
+
content = c_fetch_by_url(url)
|
200
|
+
return nil if content.nil?
|
201
|
+
return '/* invalid css */' if ! CSS.valid?(content)
|
202
|
+
return content
|
203
|
+
end
|
204
|
+
|
205
|
+
def c_fetch_by_url(url)
|
206
|
+
uri = URI(url)
|
207
|
+
return nil if uri.scheme != 'http'
|
208
|
+
res = nil
|
209
|
+
begin
|
210
|
+
Net::HTTP.start(uri.host, uri.port) {|http|
|
211
|
+
res = http.get(uri.path)
|
212
|
+
}
|
213
|
+
rescue
|
214
|
+
return nil
|
215
|
+
end
|
216
|
+
return res.body
|
217
|
+
end
|
218
|
+
|
219
|
+
# ============================== warning for CSS
|
220
|
+
def plg_warning_for_css
|
221
|
+
content, type = css_get_from_site_theme('theme.css')
|
222
|
+
return nil if content.nil?
|
223
|
+
if content != INVALID_CSS_INDICATOR
|
224
|
+
return [:span, 'Attached CSS content is safe.']
|
225
|
+
else
|
226
|
+
return [:strong, 'Invalid elements are used in your CSS file.']
|
227
|
+
end
|
228
|
+
end
|
229
|
+
|
230
|
+
# ============================== favicon.ico
|
231
|
+
def pre_ext_ico
|
232
|
+
#p @req.base
|
233
|
+
if ! @req.base == "favicon"
|
234
|
+
#p "Error"
|
235
|
+
return c_nerror(_('Error'))
|
236
|
+
end
|
237
|
+
path = @config.theme_dir.path + "i/favicon.ico"
|
238
|
+
return c_simple_send(path, "image/vnd.microsoft.icon")
|
239
|
+
end
|
240
|
+
|
241
|
+
end
|
242
|
+
end
|
243
|
+
|
244
|
+
if $0 == __FILE__
|
245
|
+
require 'qwik/test-common'
|
246
|
+
$test = true
|
247
|
+
end
|
248
|
+
|
249
|
+
if defined?($test) && $test
|
250
|
+
class TestActTheme < Test::Unit::TestCase
|
251
|
+
include TestSession
|
252
|
+
|
253
|
+
def test_site_theme
|
254
|
+
res = session
|
255
|
+
|
256
|
+
# test_theme
|
257
|
+
eq 'qwikgreen', @action.site_theme
|
258
|
+
|
259
|
+
# test_theme_path
|
260
|
+
eq '.theme/qwikgreen/qwikgreen.css', @action.site_theme_path
|
261
|
+
|
262
|
+
page = @site['_SiteConfig']
|
263
|
+
page.store(':theme:t') # No such theme, but this is just a test.
|
264
|
+
eq 't', @action.site_theme
|
265
|
+
eq '.theme/t/t.css', @action.site_theme_path
|
266
|
+
|
267
|
+
# test_site_theme
|
268
|
+
page = @site['_SiteTheme']
|
269
|
+
page.store 't'
|
270
|
+
files = @site.files('_SiteTheme')
|
271
|
+
files.put 'theme.css', 't'
|
272
|
+
eq '.css/theme.css', @action.site_theme_path
|
273
|
+
|
274
|
+
t_with_path {
|
275
|
+
eq '.css/theme.css', @action.site_theme_path
|
276
|
+
}
|
277
|
+
|
278
|
+
t_with_siteurl {
|
279
|
+
eq '.css/theme.css', @action.site_theme_path
|
280
|
+
}
|
281
|
+
end
|
282
|
+
|
283
|
+
def test_act_theme
|
284
|
+
res = session '/.theme/css/base.css'
|
285
|
+
assert_match(/\A\/*/, res.body)
|
286
|
+
end
|
287
|
+
|
288
|
+
def test_theme_all
|
289
|
+
# test_theme_list
|
290
|
+
res = session
|
291
|
+
list = @action.theme_list
|
292
|
+
eq true, list.include?('qwiksystem')
|
293
|
+
eq true, list.include?('qwikborder')
|
294
|
+
eq true, 4 <= list.length # At least 4 themes.
|
295
|
+
|
296
|
+
# test_plg_theme_list
|
297
|
+
ok_wi(/<li>qwikborder<\/li>/, '{{theme_list}}')
|
298
|
+
ok_wi(/<li>qwiksystem<\/li>/, '{{theme_list}}')
|
299
|
+
|
300
|
+
# test_theme_files
|
301
|
+
list = @action.theme_files('qwikborder')
|
302
|
+
eq ['qwikborder.css', 'qwikborder_ball.png',
|
303
|
+
'qwikborder_h2.png', 'qwikborder_li.png'], list.sort # It depends.
|
304
|
+
eq true, 4 <= list.length # At least 4 files.
|
305
|
+
end
|
306
|
+
|
307
|
+
# Please see check-act-theme.rb for external CSS.
|
308
|
+
def test_act_css
|
309
|
+
page = @site['_SiteTheme']
|
310
|
+
page.store 't'
|
311
|
+
|
312
|
+
files = @site.files('_SiteTheme')
|
313
|
+
files.put 'theme.css', '/* test */'
|
314
|
+
|
315
|
+
res = session '/test/.css/theme.css'
|
316
|
+
eq '/* test */', res.body
|
317
|
+
eq 'text/css', res['Content-Type']
|
318
|
+
files.delete 'theme.css'
|
319
|
+
|
320
|
+
# test_invalid_css
|
321
|
+
files.put 'theme.css', '@i'
|
322
|
+
res = session '/test/.css/theme.css'
|
323
|
+
eq '/* invalid css */', res.body
|
324
|
+
files.delete 'theme.css'
|
325
|
+
|
326
|
+
# test_image
|
327
|
+
files.put 't.png', 't'
|
328
|
+
res = session '/test/.css/t.png'
|
329
|
+
eq 't', res.body
|
330
|
+
eq 'image/png', res['Content-Type']
|
331
|
+
files.delete 't.png'
|
332
|
+
end
|
333
|
+
|
334
|
+
def test_ext_ico
|
335
|
+
# FIXME: This test case is broken.
|
336
|
+
res = session("/nosuch.ico")
|
337
|
+
#is "text/html; charset=Shift_JIS", res['Content-Type']
|
338
|
+
#is 894, res.body
|
339
|
+
|
340
|
+
res = session("/favicon.ico")
|
341
|
+
is "image/vnd.microsoft.icon", res['Content-Type']
|
342
|
+
is 894, res.body.size # This size may vary.
|
343
|
+
end
|
344
|
+
|
345
|
+
end
|
346
|
+
end
|
@@ -0,0 +1,112 @@
|
|
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/wabisabi-template'
|
7
|
+
|
8
|
+
module Qwik
|
9
|
+
class Action
|
10
|
+
REPLACE_TOC = {
|
11
|
+
:h2=>[:ol, 1],
|
12
|
+
:h3=>[:ol, 2],
|
13
|
+
:h4=>[:ol, 3],
|
14
|
+
:h5=>[:ol, 4],
|
15
|
+
:h6=>[:ol, 5],
|
16
|
+
}
|
17
|
+
|
18
|
+
# FIXME: Use tokenes instead of tree.
|
19
|
+
def toc_inside
|
20
|
+
page = @site[@req.base]
|
21
|
+
return nil if page.nil?
|
22
|
+
wabisabi = page.get_body_tree
|
23
|
+
wabisabi ||= []
|
24
|
+
|
25
|
+
res = TDiaryResolver.new(@config, @site, self)
|
26
|
+
|
27
|
+
tokens = []
|
28
|
+
wabisabi.each_tag(:h2, :h3, :h4, :h5, :h6) {|w|
|
29
|
+
tag = w.element_name
|
30
|
+
head = REPLACE_TOC[tag]
|
31
|
+
name = TDiaryResolver.get_title_name(w)
|
32
|
+
if tag == :h2
|
33
|
+
label = res.encode_label(name)
|
34
|
+
link = [[:a, {:href=>"#"+label}, w.text]]
|
35
|
+
w = head + [link]
|
36
|
+
else
|
37
|
+
w = head + [w.text]
|
38
|
+
end
|
39
|
+
tokens << w
|
40
|
+
}
|
41
|
+
return nil if tokens.length == 0
|
42
|
+
|
43
|
+
w = TextParser.make_tree(tokens).get_single
|
44
|
+
w = [[:h5, _('Contents')],
|
45
|
+
[:div, {:id=>'tocinside'}, w]]
|
46
|
+
return w
|
47
|
+
end
|
48
|
+
|
49
|
+
def plg_toc # deleted
|
50
|
+
return nil
|
51
|
+
end
|
52
|
+
end
|
53
|
+
end
|
54
|
+
|
55
|
+
if $0 == __FILE__
|
56
|
+
require 'qwik/test-common'
|
57
|
+
$test = true
|
58
|
+
end
|
59
|
+
|
60
|
+
if defined?($test) && $test
|
61
|
+
class TestActTOC < Test::Unit::TestCase
|
62
|
+
include TestSession
|
63
|
+
|
64
|
+
def test_toc
|
65
|
+
t_add_user
|
66
|
+
page = @site.create_new
|
67
|
+
|
68
|
+
page.store("{{toc}}
|
69
|
+
*t1
|
70
|
+
*t2")
|
71
|
+
session('/test/1.html')
|
72
|
+
ok_in([[:h5, 'Contents'],
|
73
|
+
[:div, {:id=>'tocinside'},
|
74
|
+
[:ol, [:li, [:a, {:href=>"#t1"}, 't1']],
|
75
|
+
[:li, [:a, {:href=>"#t2"}, 't2']]]]],
|
76
|
+
"//div[@class='toc']")
|
77
|
+
|
78
|
+
# test with []
|
79
|
+
page.store("{{toc}}
|
80
|
+
*t1
|
81
|
+
**t2")
|
82
|
+
session('/test/1.html')
|
83
|
+
ok_in([[:h5, 'Contents'],
|
84
|
+
[:div, {:id=>'tocinside'},
|
85
|
+
[:ol, [:li, [:a, {:href=>"#t1"}, 't1']], [:ol, [:li, 't2']]]]],
|
86
|
+
"//div[@class='toc']")
|
87
|
+
|
88
|
+
# test with []
|
89
|
+
page.store("{{toc}}
|
90
|
+
*[hoge]hhh")
|
91
|
+
session('/test/1.html')
|
92
|
+
ok_in([[:h5, 'Contents'],
|
93
|
+
[:div,
|
94
|
+
{:id=>'tocinside'},
|
95
|
+
[:ol, [:li, [:a, {:href=>"#815417267f76f6f460a4a61f9db75fdb"}, "[hoge]hhh"]]]]],
|
96
|
+
"//div[@class='toc']")
|
97
|
+
|
98
|
+
|
99
|
+
# test with []
|
100
|
+
page.store("{{toc}}
|
101
|
+
*t1
|
102
|
+
***[hoge]hhh")
|
103
|
+
session('/test/1.html')
|
104
|
+
ok_in([[:h5, 'Contents'],
|
105
|
+
[:div,
|
106
|
+
{:id=>'tocinside'},
|
107
|
+
[:ol, [:li, [:a, {:href=>"#t1"}, 't1']], [:ol, [:ol, [:li, "[", 'hoge', "]", 'hhh']]]]]],
|
108
|
+
"//div[@class='toc']")
|
109
|
+
|
110
|
+
end
|
111
|
+
end
|
112
|
+
end
|