qwikdoc 0.0.1
Sign up to get free protection for your applications and to get access to all the features.
- data/.gitignore +5 -0
- data/.rspec +2 -0
- data/CHANGES +3 -0
- data/COPYING +340 -0
- data/Gemfile +3 -0
- data/README.md +10 -0
- data/Rakefile +10 -0
- data/TextFormattingRules +137 -0
- data/TextFormattingRules.ja +143 -0
- data/bin/qwikdoc +34 -0
- data/lib/qwik_doc.rb +15 -0
- data/lib/qwik_doc/hack.rb +184 -0
- data/qwikdoc.gemspec +26 -0
- data/spec/qwik_doc_spec.rb +305 -0
- data/spec/spec_helper.rb +12 -0
- data/vendor/qwik/Makefile +63 -0
- data/vendor/qwik/Rakefile +17 -0
- data/vendor/qwik/act-aa.rb +83 -0
- data/vendor/qwik/act-archive.rb +386 -0
- data/vendor/qwik/act-attach.rb +304 -0
- data/vendor/qwik/act-backup.rb +236 -0
- data/vendor/qwik/act-basic.rb +325 -0
- data/vendor/qwik/act-book.rb +161 -0
- data/vendor/qwik/act-calc.rb +371 -0
- data/vendor/qwik/act-charset.rb +251 -0
- data/vendor/qwik/act-christel.rb +112 -0
- data/vendor/qwik/act-chronology.rb +149 -0
- data/vendor/qwik/act-code.rb +155 -0
- data/vendor/qwik/act-comment.rb +554 -0
- data/vendor/qwik/act-config.rb +49 -0
- data/vendor/qwik/act-counter.rb +125 -0
- data/vendor/qwik/act-day.rb +96 -0
- data/vendor/qwik/act-describe.rb +135 -0
- data/vendor/qwik/act-diary.rb +109 -0
- data/vendor/qwik/act-edit.rb +317 -0
- data/vendor/qwik/act-embed-html.rb +296 -0
- data/vendor/qwik/act-emode.rb +150 -0
- data/vendor/qwik/act-event.rb +187 -0
- data/vendor/qwik/act-file.rb +303 -0
- data/vendor/qwik/act-files.rb +771 -0
- data/vendor/qwik/act-getpass.rb +295 -0
- data/vendor/qwik/act-history.rb +136 -0
- data/vendor/qwik/act-html.rb +204 -0
- data/vendor/qwik/act-httpauth.rb +147 -0
- data/vendor/qwik/act-include.rb +142 -0
- data/vendor/qwik/act-interwiki.rb +189 -0
- data/vendor/qwik/act-isearch.rb +109 -0
- data/vendor/qwik/act-keywords.rb +137 -0
- data/vendor/qwik/act-lang.rb +81 -0
- data/vendor/qwik/act-license.rb +63 -0
- data/vendor/qwik/act-list.rb +287 -0
- data/vendor/qwik/act-login.rb +410 -0
- data/vendor/qwik/act-logout.rb +60 -0
- data/vendor/qwik/act-mail.rb +159 -0
- data/vendor/qwik/act-map.rb +292 -0
- data/vendor/qwik/act-md5.rb +42 -0
- data/vendor/qwik/act-mdlb.rb +741 -0
- data/vendor/qwik/act-media.rb +416 -0
- data/vendor/qwik/act-member.rb +157 -0
- data/vendor/qwik/act-menu.rb +142 -0
- data/vendor/qwik/act-metadata.rb +323 -0
- data/vendor/qwik/act-mlsubmitform.rb +49 -0
- data/vendor/qwik/act-monitor.rb +167 -0
- data/vendor/qwik/act-new.rb +418 -0
- data/vendor/qwik/act-pagelist.rb +248 -0
- data/vendor/qwik/act-password.rb +145 -0
- data/vendor/qwik/act-plan.rb +210 -0
- data/vendor/qwik/act-povray.rb +230 -0
- data/vendor/qwik/act-presen.rb +380 -0
- data/vendor/qwik/act-redirect.rb +133 -0
- data/vendor/qwik/act-ring.rb +1071 -0
- data/vendor/qwik/act-rrefs.rb +255 -0
- data/vendor/qwik/act-ruby.rb +116 -0
- data/vendor/qwik/act-sample.rb +170 -0
- data/vendor/qwik/act-save.rb +295 -0
- data/vendor/qwik/act-schedule.rb +374 -0
- data/vendor/qwik/act-search.rb +180 -0
- data/vendor/qwik/act-searchwords.rb +51 -0
- data/vendor/qwik/act-sendpass.rb +83 -0
- data/vendor/qwik/act-site.rb +89 -0
- data/vendor/qwik/act-sitebackup.rb +419 -0
- data/vendor/qwik/act-sitelog.rb +118 -0
- data/vendor/qwik/act-smil.rb +299 -0
- data/vendor/qwik/act-status.rb +220 -0
- data/vendor/qwik/act-style.rb +608 -0
- data/vendor/qwik/act-table.rb +263 -0
- data/vendor/qwik/act-tableform.rb +241 -0
- data/vendor/qwik/act-tag.rb +103 -0
- data/vendor/qwik/act-text.rb +70 -0
- data/vendor/qwik/act-textarea.rb +164 -0
- data/vendor/qwik/act-theme.rb +346 -0
- data/vendor/qwik/act-toc.rb +112 -0
- data/vendor/qwik/act-typekey.rb +198 -0
- data/vendor/qwik/act-under-const.rb +94 -0
- data/vendor/qwik/act-webservice.rb +321 -0
- data/vendor/qwik/act-wema.rb +558 -0
- data/vendor/qwik/act-wysiwyg.rb +238 -0
- data/vendor/qwik/action.rb +325 -0
- data/vendor/qwik/autoreload.rb +98 -0
- data/vendor/qwik/bench-bench.rb +28 -0
- data/vendor/qwik/bench-emode.rb +47 -0
- data/vendor/qwik/bench-format-xml.rb +70 -0
- data/vendor/qwik/bench-large-table.rb +62 -0
- data/vendor/qwik/bench-md5.rb +14 -0
- data/vendor/qwik/bench-module-session.rb +19 -0
- data/vendor/qwik/bench-page.rb +50 -0
- data/vendor/qwik/bench-s-md5.rb +28 -0
- data/vendor/qwik/bench-session.rb +25 -0
- data/vendor/qwik/bench-textformat.rb +31 -0
- data/vendor/qwik/catalog-factory.rb +91 -0
- data/vendor/qwik/catalog-ja.rb +479 -0
- data/vendor/qwik/catalog-ml-ja.rb +145 -0
- data/vendor/qwik/check-act-monitor.rb +112 -0
- data/vendor/qwik/check-act-monitor2.rb +46 -0
- data/vendor/qwik/check-act-theme.rb +27 -0
- data/vendor/qwik/check-event.rb +112 -0
- data/vendor/qwik/check-event2.rb +55 -0
- data/vendor/qwik/check-htree-rexml.rb +77 -0
- data/vendor/qwik/check-htree.rb +51 -0
- data/vendor/qwik/check-libxml.rb +135 -0
- data/vendor/qwik/check-many-pages.rb +47 -0
- data/vendor/qwik/check-monitor.rb +33 -0
- data/vendor/qwik/check-observer.rb +67 -0
- data/vendor/qwik/check-server.rb +61 -0
- data/vendor/qwik/check-uuencode.rb +33 -0
- data/vendor/qwik/check-webdav.rb +65 -0
- data/vendor/qwik/check-xml-xpath.rb +27 -0
- data/vendor/qwik/common-backtrace.rb +94 -0
- data/vendor/qwik/common-basic.rb +111 -0
- data/vendor/qwik/common-condition.rb +142 -0
- data/vendor/qwik/common-error.rb +48 -0
- data/vendor/qwik/common-gettext.rb +50 -0
- data/vendor/qwik/common-javascript.rb +45 -0
- data/vendor/qwik/common-notice.rb +132 -0
- data/vendor/qwik/common-plain.rb +105 -0
- data/vendor/qwik/common-plugin.rb +111 -0
- data/vendor/qwik/common-res.rb +76 -0
- data/vendor/qwik/common-resolve.rb +92 -0
- data/vendor/qwik/common-send.rb +171 -0
- data/vendor/qwik/common-session.rb +139 -0
- data/vendor/qwik/common-surface.rb +261 -0
- data/vendor/qwik/common-url.rb +90 -0
- data/vendor/qwik/compat/Makefile +12 -0
- data/vendor/qwik/compat/add_load_path.rb +1 -0
- data/vendor/qwik/config.rb +299 -0
- data/vendor/qwik/db-b-backup.rb +142 -0
- data/vendor/qwik/db-backup.rb +184 -0
- data/vendor/qwik/db-berkeley.rb +306 -0
- data/vendor/qwik/db-filesystem.rb +305 -0
- data/vendor/qwik/db-indexer.rb +154 -0
- data/vendor/qwik/db-searchwords.rb +238 -0
- data/vendor/qwik/description-ja.rb +267 -0
- data/vendor/qwik/description.rb +256 -0
- data/vendor/qwik/dev-add-copyright.rb +23 -0
- data/vendor/qwik/dev-backup.rb +24 -0
- data/vendor/qwik/dev-bench.rb +175 -0
- data/vendor/qwik/dev-calctime.rb +52 -0
- data/vendor/qwik/dev-css-compressor.rb +60 -0
- data/vendor/qwik/dev-extract-catalog.rb +102 -0
- data/vendor/qwik/dev-js-compressor.rb +73 -0
- data/vendor/qwik/dev-release.rb +235 -0
- data/vendor/qwik/dev-replace.rb +353 -0
- data/vendor/qwik/dev-sendmail.rb +25 -0
- data/vendor/qwik/farm.rb +283 -0
- data/vendor/qwik/gettext.rb +56 -0
- data/vendor/qwik/group-cond.rb +157 -0
- data/vendor/qwik/group-config.rb +247 -0
- data/vendor/qwik/group-confirm.rb +147 -0
- data/vendor/qwik/group-db.rb +326 -0
- data/vendor/qwik/group-mail.rb +195 -0
- data/vendor/qwik/group-member.rb +307 -0
- data/vendor/qwik/group-sendmail.rb +231 -0
- data/vendor/qwik/group-site.rb +374 -0
- data/vendor/qwik/group-sweep.rb +63 -0
- data/vendor/qwik/group.rb +157 -0
- data/vendor/qwik/helper.rb +6 -0
- data/vendor/qwik/html-generator.rb +104 -0
- data/vendor/qwik/html-to-wabisabi.rb +149 -0
- data/vendor/qwik/htree-diff.rb +87 -0
- data/vendor/qwik/htree-format-xml.rb +57 -0
- data/vendor/qwik/htree-generator.rb +144 -0
- data/vendor/qwik/htree-get.rb +251 -0
- data/vendor/qwik/htree-html-generator.rb +179 -0
- data/vendor/qwik/htree-template.rb +263 -0
- data/vendor/qwik/htree-to-wabisabi.rb +171 -0
- data/vendor/qwik/loadlib.rb +79 -0
- data/vendor/qwik/logger.rb +115 -0
- data/vendor/qwik/mail-body.rb +171 -0
- data/vendor/qwik/mail-header.rb +474 -0
- data/vendor/qwik/mail-multipart.rb +193 -0
- data/vendor/qwik/mail-parse.rb +147 -0
- data/vendor/qwik/mail.rb +341 -0
- data/vendor/qwik/mailaddress.rb +83 -0
- data/vendor/qwik/mdlb-model.rb +81 -0
- data/vendor/qwik/mdlb-sample.rb +324 -0
- data/vendor/qwik/ml-catalog-factory.rb +27 -0
- data/vendor/qwik/ml-exception.rb +15 -0
- data/vendor/qwik/ml-generator.rb +28 -0
- data/vendor/qwik/ml-gettext.rb +137 -0
- data/vendor/qwik/ml-logger.rb +82 -0
- data/vendor/qwik/ml-memory.rb +65 -0
- data/vendor/qwik/ml-msg-validator.rb +86 -0
- data/vendor/qwik/ml-processor.rb +609 -0
- data/vendor/qwik/ml-quickml-server.rb +122 -0
- data/vendor/qwik/ml-sendmail.rb +0 -0
- data/vendor/qwik/ml-server.rb +107 -0
- data/vendor/qwik/ml-session.rb +348 -0
- data/vendor/qwik/ml-sweeper.rb +101 -0
- data/vendor/qwik/mock-logger.rb +65 -0
- data/vendor/qwik/mock-sendmail.rb +78 -0
- data/vendor/qwik/mock-socket.rb +82 -0
- data/vendor/qwik/modulobe.rb +406 -0
- data/vendor/qwik/mongrel-server.rb +72 -0
- data/vendor/qwik/page-files.rb +249 -0
- data/vendor/qwik/page-generate.rb +82 -0
- data/vendor/qwik/page-get.rb +262 -0
- data/vendor/qwik/page-images.rb +168 -0
- data/vendor/qwik/page-put.rb +128 -0
- data/vendor/qwik/page-rrefs.rb +154 -0
- data/vendor/qwik/page-title.rb +0 -0
- data/vendor/qwik/page-wikidb.rb +234 -0
- data/vendor/qwik/page.rb +67 -0
- data/vendor/qwik/pages.rb +444 -0
- data/vendor/qwik/parse-plugin.rb +249 -0
- data/vendor/qwik/parser-emode.rb +116 -0
- data/vendor/qwik/parser-inline.rb +273 -0
- data/vendor/qwik/parser.rb +350 -0
- data/vendor/qwik/password.rb +183 -0
- data/vendor/qwik/periodic.rb +79 -0
- data/vendor/qwik/qp.rb +56 -0
- data/vendor/qwik/qwik-service.rb +341 -0
- data/vendor/qwik/qwik.rb +5 -0
- data/vendor/qwik/qwikweb-adduser.rb +34 -0
- data/vendor/qwik/qwikweb-catalog-validator.rb +110 -0
- data/vendor/qwik/qwikweb-incgen.rb +28 -0
- data/vendor/qwik/qwikweb-makesite.rb +41 -0
- data/vendor/qwik/qwikweb-server.rb +44 -0
- data/vendor/qwik/qwikweb-showpassword.rb +26 -0
- data/vendor/qwik/qwikweb-watchlog.rb +67 -0
- data/vendor/qwik/request-path.rb +304 -0
- data/vendor/qwik/request-ua.rb +76 -0
- data/vendor/qwik/request-webrick.rb +81 -0
- data/vendor/qwik/request.rb +91 -0
- data/vendor/qwik/resolve-tdiary.rb +292 -0
- data/vendor/qwik/resolve.rb +121 -0
- data/vendor/qwik/response.rb +228 -0
- data/vendor/qwik/server-memory.rb +57 -0
- data/vendor/qwik/server-webrick.rb +102 -0
- data/vendor/qwik/server.rb +252 -0
- data/vendor/qwik/site-config.rb +149 -0
- data/vendor/qwik/site-db.rb +136 -0
- data/vendor/qwik/site-event.rb +162 -0
- data/vendor/qwik/site-files.rb +86 -0
- data/vendor/qwik/site-group.rb +103 -0
- data/vendor/qwik/site-index.rb +47 -0
- data/vendor/qwik/site-log.rb +64 -0
- data/vendor/qwik/site-member.rb +230 -0
- data/vendor/qwik/site-monitor.rb +97 -0
- data/vendor/qwik/site-pages.rb +62 -0
- data/vendor/qwik/site-plan.rb +139 -0
- data/vendor/qwik/site-report.rb +282 -0
- data/vendor/qwik/site-resolve.rb +230 -0
- data/vendor/qwik/site-rrefs.rb +18 -0
- data/vendor/qwik/site-search.rb +180 -0
- data/vendor/qwik/site-timeline.rb +153 -0
- data/vendor/qwik/site-url.rb +189 -0
- data/vendor/qwik/site.rb +76 -0
- data/vendor/qwik/smil-time.rb +105 -0
- data/vendor/qwik/smtp-session.rb +331 -0
- data/vendor/qwik/template-generator.rb +149 -0
- data/vendor/qwik/template.rb +85 -0
- data/vendor/qwik/test-common.rb +10 -0
- data/vendor/qwik/test-ml-info.rb +225 -0
- data/vendor/qwik/test-module-ml.rb +142 -0
- data/vendor/qwik/test-module-path.rb +110 -0
- data/vendor/qwik/test-module-public.rb +70 -0
- data/vendor/qwik/test-module-server.rb +98 -0
- data/vendor/qwik/test-module-session.rb +264 -0
- data/vendor/qwik/test-module-suite.rb +91 -0
- data/vendor/qwik/test-ms-applemail.rb +59 -0
- data/vendor/qwik/test-ms-attach.rb +174 -0
- data/vendor/qwik/test-ms-basic.rb +40 -0
- data/vendor/qwik/test-ms-close.rb +35 -0
- data/vendor/qwik/test-ms-confirm.rb +75 -0
- data/vendor/qwik/test-ms-ignore-spam.rb +57 -0
- data/vendor/qwik/test-ms-japanese.rb +97 -0
- data/vendor/qwik/test-ms-jfilename.rb +82 -0
- data/vendor/qwik/test-ms-large.rb +58 -0
- data/vendor/qwik/test-ms-member.rb +103 -0
- data/vendor/qwik/test-ms-multipart.rb +84 -0
- data/vendor/qwik/test-ms-org.rb +129 -0
- data/vendor/qwik/test-ms-plan.rb +130 -0
- data/vendor/qwik/test-ms-post.rb +53 -0
- data/vendor/qwik/test-ms-quopri.rb +76 -0
- data/vendor/qwik/test-sub-quopri.rb +45 -0
- data/vendor/qwik/test-submit-base64.rb +59 -0
- data/vendor/qwik/test-submit-forward.rb +61 -0
- data/vendor/qwik/test-submit-html-mail.rb +52 -0
- data/vendor/qwik/test-submit-japanese.rb +135 -0
- data/vendor/qwik/test-submit-jfilename.rb +144 -0
- data/vendor/qwik/test-submit-uuencode.rb +71 -0
- data/vendor/qwik/test-suite-all.rb +8 -0
- data/vendor/qwik/test-suite-basic.rb +9 -0
- data/vendor/qwik/test-suite-ml.rb +9 -0
- data/vendor/qwik/test-typekey.rb +64 -0
- data/vendor/qwik/testunit.rb +45 -0
- data/vendor/qwik/tokenizer-inline.rb +294 -0
- data/vendor/qwik/tokenizer.rb +332 -0
- data/vendor/qwik/typekey.rb +160 -0
- data/vendor/qwik/util-basic.rb +135 -0
- data/vendor/qwik/util-charset.rb +332 -0
- data/vendor/qwik/util-css.rb +56 -0
- data/vendor/qwik/util-csv-tokenizer.rb +113 -0
- data/vendor/qwik/util-filename.rb +112 -0
- data/vendor/qwik/util-pathname.rb +202 -0
- data/vendor/qwik/util-pid.rb +58 -0
- data/vendor/qwik/util-safe.rb +67 -0
- data/vendor/qwik/util-sendmail.rb +273 -0
- data/vendor/qwik/util-string.rb +203 -0
- data/vendor/qwik/util-time.rb +125 -0
- data/vendor/qwik/util-webrick.rb +176 -0
- data/vendor/qwik/version.rb +11 -0
- data/vendor/qwik/wabisabi-basic.rb +163 -0
- data/vendor/qwik/wabisabi-diff.rb +130 -0
- data/vendor/qwik/wabisabi-format-xml.rb +310 -0
- data/vendor/qwik/wabisabi-generator.rb +262 -0
- data/vendor/qwik/wabisabi-index.rb +174 -0
- data/vendor/qwik/wabisabi-table.rb +212 -0
- data/vendor/qwik/wabisabi-template.rb +295 -0
- data/vendor/qwik/wabisabi-to-htree.rb +111 -0
- data/vendor/qwik/wabisabi-to-wiki.rb +690 -0
- data/vendor/qwik/wabisabi-traverse.rb +207 -0
- data/vendor/qwik/wabisabi-validator.rb +116 -0
- data/vendor/qwik/wabisabi.rb +5 -0
- metadata +416 -0
@@ -0,0 +1,103 @@
|
|
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 Action
|
9
|
+
def plg_show_tags
|
10
|
+
page = @site[@req.base]
|
11
|
+
return if page.nil?
|
12
|
+
tags = page.get_tags
|
13
|
+
return nil if tags.nil?
|
14
|
+
div = [:div, {:class=>'tags'}]
|
15
|
+
tags.each {|tag|
|
16
|
+
div << [:a, {:href=>"#{tag}.tag"}, tag]
|
17
|
+
}
|
18
|
+
return div
|
19
|
+
end
|
20
|
+
|
21
|
+
def self.tag_get_pages(site)
|
22
|
+
pages = Hash.new {|h, k| h[k] = []}
|
23
|
+
site.each {|page|
|
24
|
+
tags = page.get_tags
|
25
|
+
next if tags.nil?
|
26
|
+
tags.each {|tag|
|
27
|
+
pages[tag] << page.key
|
28
|
+
}
|
29
|
+
}
|
30
|
+
return pages
|
31
|
+
end
|
32
|
+
|
33
|
+
def ext_tag
|
34
|
+
target_tag = @req.base
|
35
|
+
|
36
|
+
all_pages = Action.tag_get_pages(@site)
|
37
|
+
pages = all_pages[target_tag]
|
38
|
+
return c_nerror('no such tag') if pages.empty?
|
39
|
+
|
40
|
+
div = [:div, {:class=>'tag_pages'}]
|
41
|
+
pages.each {|key|
|
42
|
+
page = @site[key]
|
43
|
+
body = surface_get_body(page)
|
44
|
+
div += body
|
45
|
+
}
|
46
|
+
return c_surface("tag : #{target_tag}"){
|
47
|
+
div
|
48
|
+
}
|
49
|
+
end
|
50
|
+
end
|
51
|
+
end
|
52
|
+
|
53
|
+
if $0 == __FILE__
|
54
|
+
require 'qwik/test-common'
|
55
|
+
$test = true
|
56
|
+
end
|
57
|
+
|
58
|
+
if defined?($test) && $test
|
59
|
+
class TestActTag < Test::Unit::TestCase
|
60
|
+
include TestSession
|
61
|
+
|
62
|
+
def test_all
|
63
|
+
t_add_user
|
64
|
+
|
65
|
+
# test_plg_show_tags
|
66
|
+
page = @site.create_new
|
67
|
+
page.store("* [t1][t2] t
|
68
|
+
{{show_tags}}")
|
69
|
+
res = session('/test/1.html')
|
70
|
+
ok_title 't'
|
71
|
+
ok_xp([:div, {:class=>'tags'},
|
72
|
+
[:a, {:href=>'t1.tag'}, 't1'],
|
73
|
+
[:a, {:href=>'t2.tag'}, 't2']], "//div[@class='tags']")
|
74
|
+
|
75
|
+
# Make pages with tag 't1'.
|
76
|
+
page1 = @site['1']
|
77
|
+
page1.store("* [t1] page1
|
78
|
+
body1")
|
79
|
+
page2 = @site.create('2')
|
80
|
+
page2.store("* [t1] page2
|
81
|
+
body2")
|
82
|
+
|
83
|
+
# test_tag_get_pages
|
84
|
+
pages = Qwik::Action.tag_get_pages(@site)
|
85
|
+
ok_eq({'t1'=>['1', '2']}, pages)
|
86
|
+
|
87
|
+
# test_act_tag
|
88
|
+
res = session('/test/nosuch.tag')
|
89
|
+
ok_title 'no such tag'
|
90
|
+
|
91
|
+
res = session('/test/t1.tag')
|
92
|
+
ok_title 'tag : t1'
|
93
|
+
ok_xp([:div, {:class=>'tag_pages'},
|
94
|
+
[:div, {:class=>'day'}, '',
|
95
|
+
[:div, {:class=>'body'},
|
96
|
+
[:div, {:class=>'section'}, [[:p, 'body1']]]]],
|
97
|
+
[:div, {:class=>'day'}, '',
|
98
|
+
[:div, {:class=>'body'},
|
99
|
+
[:div, {:class=>'section'}, [[:p, 'body2']]]]]],
|
100
|
+
"//div[@class='tag_pages']")
|
101
|
+
end
|
102
|
+
end
|
103
|
+
end
|
@@ -0,0 +1,70 @@
|
|
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 Action
|
9
|
+
def plg_text
|
10
|
+
str = yield
|
11
|
+
return c_res(str)
|
12
|
+
end
|
13
|
+
|
14
|
+
def plg_pre_text
|
15
|
+
str = yield
|
16
|
+
return c_pre_text { str }
|
17
|
+
end
|
18
|
+
|
19
|
+
def c_pre_text
|
20
|
+
str = yield
|
21
|
+
tokens = TextTokenizer.tokenize(str, true)
|
22
|
+
tree = TextParser.make_tree(tokens)
|
23
|
+
w = Resolver.resolve(@site, self, tree)
|
24
|
+
return w
|
25
|
+
end
|
26
|
+
end
|
27
|
+
end
|
28
|
+
|
29
|
+
if $0 == __FILE__
|
30
|
+
require 'qwik/test-common'
|
31
|
+
$test = true
|
32
|
+
end
|
33
|
+
|
34
|
+
if defined?($test) && $test
|
35
|
+
class TestActText < Test::Unit::TestCase
|
36
|
+
include TestSession
|
37
|
+
|
38
|
+
def ok_day(e, w, user=DEFAULT_USER)
|
39
|
+
assert_path(e, w, user, "//div[@class='day']")
|
40
|
+
end
|
41
|
+
|
42
|
+
def test_plg_text
|
43
|
+
ok_day([[:h2, {:id=>'8f03c3a6dbec1d0f1a5af60947b7b052'}, '��'],
|
44
|
+
[:div, {:class=>'body'}, [:div, {:class=>'section'}, []]]],
|
45
|
+
"{{text\n* ��\n}}")
|
46
|
+
ok_day([[:h2, {:id=>'7657b04993b557a2ee9b36bf280a3ec4'}, '��'],
|
47
|
+
[:div, {:class=>'body'}, [:div, {:class=>'section'}, []]]],
|
48
|
+
"{{text\n* ��\n}}")
|
49
|
+
ok_wi([:p, '<'], "{{text\n<\n}}")
|
50
|
+
@site['1'].delete
|
51
|
+
@site.erase_all
|
52
|
+
ok_wi([[:dl, [:dt, 'dt1'], [:dd, 'dd1']],
|
53
|
+
[:p, 'p1'], [:dl, [:dd, 'dd2']]],
|
54
|
+
"{{text\n:dt1:dd1\np1\n::dd2\n}}")
|
55
|
+
end
|
56
|
+
|
57
|
+
def test_c_pre_text
|
58
|
+
res = session
|
59
|
+
ok_eq([[:p, 'a']], @action.c_pre_text { 'a' })
|
60
|
+
ok_eq([[:br]], @action.c_pre_text { '{{br}}' })
|
61
|
+
ok_eq([[:div, {:class=>'ref'},
|
62
|
+
[:a, {:href=>'FrontPage.files/a.jpg'},
|
63
|
+
[:img, {:src=>'.theme/i/broken.gif',
|
64
|
+
:class=>'icon', :alt=>'a.jpg'}],
|
65
|
+
[:br],
|
66
|
+
'a.jpg']]],
|
67
|
+
@action.c_pre_text { '{{file(a.jpg)}}' })
|
68
|
+
end
|
69
|
+
end
|
70
|
+
end
|
@@ -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 => '�e�L�X�g�G���A�v���O�C��',
|
26
|
+
:dd => '�ҏW�\�ȃe�L�X�g�G���A��\�����܂��B',
|
27
|
+
:dc => "* ��
|
28
|
+
{{textarea
|
29
|
+
����̓e�L�X�g�G���A�̃T���v���ł��B
|
30
|
+
}}
|
31
|
+
{{textarea
|
32
|
+
����̓e�L�X�g�G���A�̃T���v���ł��B
|
33
|
+
}}
|
34
|
+
�ҏW�\�ȃe�L�X�g�G���A�ł��B
|
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 => '�T�C�g�E�e�[�}',
|
50
|
+
:dd => '�T�C�g���Ƀy�[�W�E�f�U�C�����w��ł��܂��B',
|
51
|
+
:dc => '* �g����
|
52
|
+
** qwikWeb������e�[�}����I��
|
53
|
+
{{theme_list}}
|
54
|
+
���̑I���\�ȃe�[�}�ꗗ�̒�������I�сA[[_SiteConfig]]�y�[�W�ɂ�
|
55
|
+
:theme:qwikgreen
|
56
|
+
�Ƃ�����s���������Ă��������B�y�[�W�E�f�U�C�����ύX����܂��B
|
57
|
+
|
58
|
+
\'\'\'����:\'\'\' qwiksystem�Ȃǂ̈ꕔ�̃y�[�W�́A�V�X�e���\���̂��߂�
|
59
|
+
���̂ł��B�ʏ�̃y�[�W�\���Ɏg���ƁA�\�����ςɂȂ�܂��B
|
60
|
+
|
61
|
+
** �����ō����CSS�t�@�C�����g��
|
62
|
+
[[_SiteTheme]]�Ƃ����y�[�W�ɍs���A���̃y�[�W�ɓY�t�t�@�C���Ƃ���
|
63
|
+
�u\'\'\'theme.css\'\'\'�v�Ƃ����t�@�C�����Ŏ����̍D����CSS�t�@�C����
|
64
|
+
�Y�t�����������B
|
65
|
+
|
66
|
+
\'\'\'����:\'\'\' CSS���ɂ͎g���Ȃ��v�f������܂��B
|
67
|
+
�ڂ�����[[PluginStyle.describe]]���������������B
|
68
|
+
|
69
|
+
{{warning_for_css}}
|
70
|
+
|
71
|
+
** �O����Web�T�C�g�ɒu���Ă���CSS�t�@�C�����g��
|
72
|
+
[[_SiteConfig]]�y�[�W��
|
73
|
+
:theme:qwikgreen
|
74
|
+
�Ƃ�����s���������āA
|
75
|
+
:theme:http://d.hatena.ne.jp/theme/clover/clover.css
|
76
|
+
�Ƃ���������URL���w�肵�Ă��������B�y�[�W�E�f�U�C�����ύX����܂��B
|
77
|
+
|
78
|
+
\'\'\'����:\'\'\' �O��CSS�t�@�C�����g���ꍇ�ɂ��A����CSS�t�@�C������
|
79
|
+
�g�p�֎~�v�f���܂܂�Ă���ꍇ�ɂ͎g���܂���B
|
80
|
+
�ڂ�����[[PluginStyle.describe]]���������������B
|
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
|