qwikdoc 0.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- 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,27 @@
|
|
|
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/catalog-factory'
|
|
7
|
+
|
|
8
|
+
module QuickML
|
|
9
|
+
class CatalogFactory < Qwik::CatalogFactory
|
|
10
|
+
end
|
|
11
|
+
end
|
|
12
|
+
|
|
13
|
+
if $0 == __FILE__
|
|
14
|
+
require 'test/unit'
|
|
15
|
+
$test = true
|
|
16
|
+
end
|
|
17
|
+
|
|
18
|
+
if defined?($test) && $test
|
|
19
|
+
class TestMLCatalogFactory < Test::Unit::TestCase
|
|
20
|
+
def test_all
|
|
21
|
+
cf = QuickML::CatalogFactory.new
|
|
22
|
+
cf.load_all_here('catalog-ml-??.rb')
|
|
23
|
+
catalog_ja = cf.get_catalog('ja')
|
|
24
|
+
assert_equal true, catalog_ja != nil
|
|
25
|
+
end
|
|
26
|
+
end
|
|
27
|
+
end
|
|
@@ -0,0 +1,15 @@
|
|
|
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
|
+
module QuickML
|
|
12
|
+
class QuickMLException < StandardError; end
|
|
13
|
+
class TooManyMembers < QuickMLException; end
|
|
14
|
+
class InvalidMLName < QuickMLException; end
|
|
15
|
+
end
|
|
@@ -0,0 +1,28 @@
|
|
|
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
|
+
|
|
13
|
+
module QuickML
|
|
14
|
+
class Generator
|
|
15
|
+
end
|
|
16
|
+
end
|
|
17
|
+
|
|
18
|
+
if $0 == __FILE__
|
|
19
|
+
require 'qwik/mail'
|
|
20
|
+
$test = true
|
|
21
|
+
end
|
|
22
|
+
|
|
23
|
+
if defined?($test) && $test
|
|
24
|
+
class TestMLGenerator < Test::Unit::TestCase
|
|
25
|
+
def test_all
|
|
26
|
+
end
|
|
27
|
+
end
|
|
28
|
+
end
|
|
@@ -0,0 +1,137 @@
|
|
|
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
|
+
|
|
13
|
+
module QuickML
|
|
14
|
+
module GetText
|
|
15
|
+
def set_catalog (catalog)
|
|
16
|
+
@catalog = nil
|
|
17
|
+
@gettext_catalog = catalog
|
|
18
|
+
end
|
|
19
|
+
|
|
20
|
+
def set_charset(charset)
|
|
21
|
+
@message_charset = nil
|
|
22
|
+
@gettext_charset = charset
|
|
23
|
+
end
|
|
24
|
+
|
|
25
|
+
# Used in group-sendmail.rb, ml-processor.rb, ml-session.rb
|
|
26
|
+
def codeconv (text)
|
|
27
|
+
return text if @gettext_catalog.nil?
|
|
28
|
+
method = @gettext_catalog[:codeconv_method]
|
|
29
|
+
return text if method.nil?
|
|
30
|
+
return text.send(method)
|
|
31
|
+
end
|
|
32
|
+
|
|
33
|
+
def gettext (text, *args)
|
|
34
|
+
@gettext_catalog = nil if ! defined?(@gettext_catalog)
|
|
35
|
+
@catalog = nil if ! defined?(@catalog)
|
|
36
|
+
@message_charset = nil if ! defined?(@message_charset)
|
|
37
|
+
@gettext_charset = nil if ! defined?(@gettext_charset)
|
|
38
|
+
@gettext_catalog = @catalog if @catalog && @gettext_catalog.nil?
|
|
39
|
+
if @message_charset && @gettext_charset.nil?
|
|
40
|
+
@gettext_charset = @message_charset
|
|
41
|
+
end
|
|
42
|
+
unless @gettext_catalog && @gettext_catalog[:charset] == @gettext_charset
|
|
43
|
+
return sprintf(text, *args)
|
|
44
|
+
end
|
|
45
|
+
translated_message = @gettext_catalog[text]
|
|
46
|
+
if translated_message
|
|
47
|
+
text = sprintf(translated_message, *args)
|
|
48
|
+
method = @gettext_catalog[:codeconv_method]
|
|
49
|
+
return text.send(method) if method
|
|
50
|
+
return text
|
|
51
|
+
end
|
|
52
|
+
return sprintf(text, *args)
|
|
53
|
+
end
|
|
54
|
+
alias :_ :gettext
|
|
55
|
+
|
|
56
|
+
def gettext2 (text)
|
|
57
|
+
@gettext_catalog = nil if ! defined?(@gettext_catalog)
|
|
58
|
+
@catalog = nil if ! defined?(@catalog)
|
|
59
|
+
@message_charset = nil if ! defined?(@message_charset)
|
|
60
|
+
@gettext_charset = nil if ! defined?(@gettext_charset)
|
|
61
|
+
@gettext_catalog = @catalog if @catalog && @gettext_catalog.nil?
|
|
62
|
+
if @message_charset && @gettext_charset.nil?
|
|
63
|
+
@gettext_charset = @message_charset
|
|
64
|
+
end
|
|
65
|
+
unless @gettext_catalog && @gettext_catalog[:charset] == @gettext_charset
|
|
66
|
+
return text
|
|
67
|
+
end
|
|
68
|
+
translated_message = @gettext_catalog[text]
|
|
69
|
+
if translated_message
|
|
70
|
+
text = translated_message
|
|
71
|
+
method = @gettext_catalog[:codeconv_method]
|
|
72
|
+
return text.send(method) if method
|
|
73
|
+
return text
|
|
74
|
+
end
|
|
75
|
+
return text
|
|
76
|
+
end
|
|
77
|
+
alias :__ :gettext2
|
|
78
|
+
end
|
|
79
|
+
end
|
|
80
|
+
|
|
81
|
+
if $0 == __FILE__
|
|
82
|
+
require 'qwik/testunit'
|
|
83
|
+
require 'qwik/ml-catalog-factory'
|
|
84
|
+
require 'qwik/util-charset'
|
|
85
|
+
$test = true
|
|
86
|
+
end
|
|
87
|
+
|
|
88
|
+
if defined?($test) && $test
|
|
89
|
+
class MockMLGetText
|
|
90
|
+
include QuickML::GetText
|
|
91
|
+
|
|
92
|
+
def test_all(t)
|
|
93
|
+
# $KCODE = 's'
|
|
94
|
+
|
|
95
|
+
# test_set_catalog
|
|
96
|
+
cf = QuickML::CatalogFactory.new
|
|
97
|
+
cf.load_all_here('catalog-ml-??.rb')
|
|
98
|
+
catalog_ja = cf.get_catalog('ja')
|
|
99
|
+
set_catalog(catalog_ja)
|
|
100
|
+
|
|
101
|
+
# test before set catalog
|
|
102
|
+
@catalog = nil
|
|
103
|
+
@message_charset = nil
|
|
104
|
+
set_catalog(nil)
|
|
105
|
+
set_charset(nil)
|
|
106
|
+
t.is 'hello', gettext('hello')
|
|
107
|
+
t.is "Info: a\n", gettext("Info: %s\n", 'a')
|
|
108
|
+
t.is "If you agree, then,\n", gettext("If you agree, then,\n")
|
|
109
|
+
|
|
110
|
+
# test_codeconv
|
|
111
|
+
t.is '��', codeconv('��')
|
|
112
|
+
|
|
113
|
+
# test after set catalog
|
|
114
|
+
@catalog = catalog_ja
|
|
115
|
+
@message_charset = 'iso-2022-jp'
|
|
116
|
+
set_catalog(catalog_ja)
|
|
117
|
+
set_charset('iso-2022-jp')
|
|
118
|
+
t.is '����ɂ���'.set_sourcecode_charset.to_mail_charset, gettext('hello')
|
|
119
|
+
t.is '����ɂ���'.set_sourcecode_charset.to_mail_charset, _('hello')
|
|
120
|
+
t.is '����ɂ���'.set_sourcecode_charset.to_mail_charset, gettext2('hello')
|
|
121
|
+
t.is '����ɂ���'.set_sourcecode_charset.to_mail_charset, gettext('hello')
|
|
122
|
+
t.is "�g����: a\n".set_sourcecode_charset.to_mail_charset, gettext("Info: %s\n", 'a')
|
|
123
|
+
t.is "�������F����ꍇ�A\n".set_sourcecode_charset.to_mail_charset,
|
|
124
|
+
gettext("If you agree, then,\n")
|
|
125
|
+
|
|
126
|
+
# test_codeconv_ja
|
|
127
|
+
t.is "\e$B$\"\e(B", codeconv('��')
|
|
128
|
+
end
|
|
129
|
+
end
|
|
130
|
+
|
|
131
|
+
class TestMockMLGetText < Test::Unit::TestCase
|
|
132
|
+
def test_all
|
|
133
|
+
mock = MockMLGetText.new
|
|
134
|
+
mock.test_all(self)
|
|
135
|
+
end
|
|
136
|
+
end
|
|
137
|
+
end
|
|
@@ -0,0 +1,82 @@
|
|
|
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
|
+
require 'thread'
|
|
12
|
+
|
|
13
|
+
$LOAD_PATH.unshift '..' unless $LOAD_PATH.include? '..'
|
|
14
|
+
require 'qwik/util-safe'
|
|
15
|
+
require 'qwik/util-pathname'
|
|
16
|
+
|
|
17
|
+
module QuickML
|
|
18
|
+
class Logger
|
|
19
|
+
ML_LOG_FILE = 'quickml.log'
|
|
20
|
+
|
|
21
|
+
def initialize (log_filename, verbose_mode = nil)
|
|
22
|
+
@mutex = Mutex.new
|
|
23
|
+
log_path = log_filename.path
|
|
24
|
+
log_path.parent.check_directory
|
|
25
|
+
@log_file = log_path.open('a')
|
|
26
|
+
@log_file.sync = true
|
|
27
|
+
@verbose_mode = verbose_mode
|
|
28
|
+
end
|
|
29
|
+
|
|
30
|
+
def log (msg)
|
|
31
|
+
puts_log(msg)
|
|
32
|
+
end
|
|
33
|
+
|
|
34
|
+
def vlog (msg)
|
|
35
|
+
puts_log(msg) if @verbose_mode
|
|
36
|
+
end
|
|
37
|
+
|
|
38
|
+
def reopen
|
|
39
|
+
@mutex.synchronize {
|
|
40
|
+
log_filename = @log_file.path
|
|
41
|
+
@log_file.close
|
|
42
|
+
@log_file = File.open(log_filename, 'a')
|
|
43
|
+
}
|
|
44
|
+
end
|
|
45
|
+
|
|
46
|
+
private
|
|
47
|
+
|
|
48
|
+
def puts_log (msg)
|
|
49
|
+
@mutex.synchronize {
|
|
50
|
+
time = Time.now.strftime('%Y-%m-%dT%H:%M:%S')
|
|
51
|
+
str = "#{time}: #{msg}"
|
|
52
|
+
@log_file.puts str
|
|
53
|
+
$stdout.puts str if $ml_debug
|
|
54
|
+
}
|
|
55
|
+
end
|
|
56
|
+
end
|
|
57
|
+
end
|
|
58
|
+
|
|
59
|
+
if $0 == __FILE__
|
|
60
|
+
require 'qwik/testunit'
|
|
61
|
+
$test = true
|
|
62
|
+
end
|
|
63
|
+
|
|
64
|
+
if defined?($test) && $test
|
|
65
|
+
class TestMLLogger < Test::Unit::TestCase
|
|
66
|
+
def test_all
|
|
67
|
+
file = '.test/testlog.txt'
|
|
68
|
+
logger = QuickML::Logger.new(file)
|
|
69
|
+
|
|
70
|
+
# test_log
|
|
71
|
+
logger.log('t')
|
|
72
|
+
str = open(file) {|f| f.read }
|
|
73
|
+
assert_match(/: t\n/, str)
|
|
74
|
+
file.path.unlink
|
|
75
|
+
|
|
76
|
+
# TODO
|
|
77
|
+
# test_vlog
|
|
78
|
+
# test_reopen
|
|
79
|
+
# test_puts_log
|
|
80
|
+
end
|
|
81
|
+
end
|
|
82
|
+
end
|
|
@@ -0,0 +1,65 @@
|
|
|
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/config'
|
|
7
|
+
require 'qwik/ml-logger'
|
|
8
|
+
require 'qwik/ml-catalog-factory'
|
|
9
|
+
require 'qwik/util-safe'
|
|
10
|
+
|
|
11
|
+
module QuickML
|
|
12
|
+
class ServerMemory
|
|
13
|
+
def self.init_logger(memory, config)
|
|
14
|
+
ml_log_file = (config[:log_dir].path + Logger::ML_LOG_FILE).to_s
|
|
15
|
+
memory[:logger] = Logger.new(ml_log_file, config[:verbose_mode])
|
|
16
|
+
end
|
|
17
|
+
|
|
18
|
+
def self.init_mutex(memory)
|
|
19
|
+
memory[:ml_mutexes] = Hash.new
|
|
20
|
+
end
|
|
21
|
+
|
|
22
|
+
def self.ml_mutex(memory, address)
|
|
23
|
+
hash = memory[:ml_mutexes]
|
|
24
|
+
return hash.fetch(address) {|x| hash[x] = Mutex.new }
|
|
25
|
+
end
|
|
26
|
+
|
|
27
|
+
def self.init_catalog(memory)
|
|
28
|
+
memory[:catalog] = nil
|
|
29
|
+
if memory[:message_catalog]
|
|
30
|
+
cf = CatalogFactory.new
|
|
31
|
+
cf.load_all_here('catalog-ml-??.rb')
|
|
32
|
+
memory[:catalog] = cf.get_catalog('ja')
|
|
33
|
+
end
|
|
34
|
+
end
|
|
35
|
+
end
|
|
36
|
+
end
|
|
37
|
+
|
|
38
|
+
if $0 == __FILE__
|
|
39
|
+
require 'qwik/testunit'
|
|
40
|
+
$test = true
|
|
41
|
+
end
|
|
42
|
+
|
|
43
|
+
if defined?($test) && $test
|
|
44
|
+
class TestMLMemory < Test::Unit::TestCase
|
|
45
|
+
def test_all
|
|
46
|
+
c = QuickML::ServerMemory
|
|
47
|
+
|
|
48
|
+
# test_init_logger
|
|
49
|
+
memory = {}
|
|
50
|
+
config = {:log_dir=>'.'}
|
|
51
|
+
c.init_logger(memory, config)
|
|
52
|
+
assert_instance_of(QuickML::Logger, memory[:logger])
|
|
53
|
+
|
|
54
|
+
# test_init_mutex
|
|
55
|
+
memory = {}
|
|
56
|
+
c.init_mutex(memory)
|
|
57
|
+
eq({:ml_mutexes=>{}}, memory)
|
|
58
|
+
|
|
59
|
+
# test_init_catalog
|
|
60
|
+
memory = {:message_catalog=>'something'}
|
|
61
|
+
c.init_catalog(memory)
|
|
62
|
+
assert_instance_of(Hash, memory[:catalog])
|
|
63
|
+
end
|
|
64
|
+
end
|
|
65
|
+
end
|
|
@@ -0,0 +1,86 @@
|
|
|
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/ml-gettext'
|
|
13
|
+
|
|
14
|
+
module QuickML
|
|
15
|
+
module GetText
|
|
16
|
+
class MessageValidator
|
|
17
|
+
def self.main(argv)
|
|
18
|
+
if argv.length < 2
|
|
19
|
+
puts "Usage: ruby ml-msg-validator.rb <catalog> <source...>"
|
|
20
|
+
exit
|
|
21
|
+
end
|
|
22
|
+
|
|
23
|
+
catalog_file = argv.shift
|
|
24
|
+
catalog = Catalog.new(catalog_file)
|
|
25
|
+
|
|
26
|
+
ok = true
|
|
27
|
+
argv.each {|source_file|
|
|
28
|
+
validator = MessageValidator.new(catalog, source_file)
|
|
29
|
+
validator.validate
|
|
30
|
+
ok = (ok and validator.ok?)
|
|
31
|
+
}
|
|
32
|
+
if ok then exit else exit(1) end
|
|
33
|
+
end
|
|
34
|
+
|
|
35
|
+
def initialize (catalog, source_filename)
|
|
36
|
+
@catalog = catalog
|
|
37
|
+
@source_filename = source_filename
|
|
38
|
+
@has_error = false
|
|
39
|
+
end
|
|
40
|
+
|
|
41
|
+
def read_file_with_numbering (filename)
|
|
42
|
+
content = ''
|
|
43
|
+
File.open(filename).each_with_index {|line, idx|
|
|
44
|
+
lineno = idx + 1
|
|
45
|
+
content << line.gsub(/\b_\(/, "_[#{lineno}](")
|
|
46
|
+
}
|
|
47
|
+
content
|
|
48
|
+
end
|
|
49
|
+
|
|
50
|
+
def collect_messages (content)
|
|
51
|
+
messages = []
|
|
52
|
+
while content.sub!(/\b_\[(\d+)\]\((".*?").*?\)/m, "")
|
|
53
|
+
lineno = $1.to_i
|
|
54
|
+
message = eval($2)
|
|
55
|
+
messages.push([lineno, message])
|
|
56
|
+
end
|
|
57
|
+
messages
|
|
58
|
+
end
|
|
59
|
+
|
|
60
|
+
def validate
|
|
61
|
+
@catalog or return
|
|
62
|
+
content = read_file_with_numbering(@source_filename)
|
|
63
|
+
messages = collect_messages(content)
|
|
64
|
+
messages.each {|lineno, message|
|
|
65
|
+
translated_message = @catalog.messages[message]
|
|
66
|
+
if not translated_message
|
|
67
|
+
printf "%s:%d: %s\n", @source_filename, lineno, message.inspect
|
|
68
|
+
@has_error = true
|
|
69
|
+
elsif message.count('%') != translated_message.count('%')
|
|
70
|
+
printf "%s:%d: %s => # of %% mismatch.\n",
|
|
71
|
+
@source_filename, lineno, message.inspect, translated_message
|
|
72
|
+
@has_error = true
|
|
73
|
+
end
|
|
74
|
+
}
|
|
75
|
+
end
|
|
76
|
+
|
|
77
|
+
def ok?
|
|
78
|
+
not @has_error
|
|
79
|
+
end
|
|
80
|
+
end
|
|
81
|
+
end
|
|
82
|
+
end
|
|
83
|
+
|
|
84
|
+
if $0 == __FILE__
|
|
85
|
+
QuickML::GetText::MessageValidator.main(ARGV)
|
|
86
|
+
end
|