pax_global_header00006660000000000000000000000064121253335630014515gustar00rootroot0000000000000052 comment=08e8322251811f3ac21761f4df74b7d67174da2a hiki-1.0.0/000077500000000000000000000000001212533356300124375ustar00rootroot00000000000000hiki-1.0.0/.gitignore000066400000000000000000000003031212533356300144230ustar00rootroot00000000000000/data/cache/ /data/hiki.conf /data/info.db /data/session/ /data/text/ !/data/text/FrontPage !/data/text/InterWikiName !/data/text/SideMenu !/data/text/TextFormattingRules /hikiconf.rb /test/tmp/ hiki-1.0.0/.travis.yml000066400000000000000000000004271212533356300145530ustar00rootroot00000000000000language: ruby before_script: - git config --global user.email "you@example.com" - git config --global user.name "Your Name" rvm: - 1.9.3 - 2.0.0 install: - sudo apt-get install subversion mercurial - bundle install script: bundle exec ruby -W0 test/runner.rb -v hiki-1.0.0/ChangeLog000066400000000000000000003752201212533356300142220ustar00rootroot000000000000002009-09-05 okkez * hiki/util.rb (Hiki::Util): add module functions (escape, unescape, escape_html, h, unescape_html) (String#escape, unescape, escapeHTML, unescapeHTML): use Hiki::Util instead of CGI. 2009-09-03 okkez * hiki/command.rb (Hiki::Command): do not include Hiki::Util on top level. * hiki/plugin.rb (Hiki::Plugin): include Hiki::Util instead of ERB::Util. 2009-08-31 okkez * hiki/auth/typekey.rb: use literal instead of obvious new method. * hiki/auth/typekey.rb: ditto. * misc/plugin/attach.rb: ditto. * misc/plugin/category.rb: ditto. * misc/plugin/google-sitemaps.rb: ditto. * misc/plugin/incremental_search.rb: ditto. * misc/plugin/keyword.rb: ditto. * misc/plugin/math.rb: ditto. * misc/plugin/pagerank.rb: ditto. * misc/plugin/rss.rb: ditto. * misc/plugin/src.rb: ditto. * plugin/01sp.rb: ditto. * style/default/html_formatter.rb: ditto. * style/rd+/anchorlist.rb: ditto. * style/rd+/rd2html.rb: ditto. 2009-08-30 okkez * hiki/command.rb: use Hiki::Util#escape, Hiki::Util#unescape, Hiki::Util#escape_html and Hiki::Util#unescape_html instead of CGI.escape, CGI.unescape, CGI.escapeHTML and CGI.unescapeHTML. * hiki/db/flatfile.rb: ditto. * hiki/filter/bayes_filter.rb: ditto. * hiki/interwiki.rb: ditto. * hiki/repos/cvs.rb: ditto. * hiki/repos/default.rb: ditto. * hiki/repos/git.rb: ditto. * hiki/repos/hg.rb: ditto. * hiki/repos/plain.rb: ditto. * hiki/repos/svn.rb: ditto. * hiki/storage.rb: ditto. * hiki/util.rb: ditto. * misc/plugin/append-css.rb: ditto. * misc/plugin/attach.rb: ditto. * misc/plugin/attach/attach.cgi: ditto. * misc/plugin/auth_typekey.rb: ditto. * misc/plugin/bbs.rb: ditto. * misc/plugin/category.rb: ditto. * misc/plugin/comment.rb: ditto. * misc/plugin/diffmail.rb: ditto. * misc/plugin/edit_user.rb: ditto. * misc/plugin/footnote.rb: ditto. * misc/plugin/google-sitemaps.rb: ditto. * misc/plugin/highlight.rb: ditto. * misc/plugin/history.rb: ditto. * misc/plugin/incremental_search.rb: ditto. * misc/plugin/isbn.rb: ditto. * misc/plugin/its.rb: ditto. * misc/plugin/keyword.rb: ditto. * misc/plugin/math.rb: ditto. * misc/plugin/note.rb: ditto. * misc/plugin/orphan.rb: ditto. * misc/plugin/pagerank.rb: ditto. * misc/plugin/rank.rb: ditto. * misc/plugin/readlirs.rb: ditto. * misc/plugin/recent2.rb: ditto. * misc/plugin/referer.rb: ditto. * misc/plugin/rss-show.rb: ditto. * misc/plugin/rss.rb: ditto. * misc/plugin/sitemap.rb: ditto. * misc/plugin/src.rb: ditto. * misc/plugin/template.rb: ditto. * misc/plugin/todo.rb: ditto. * misc/plugin/trackback.rb: ditto. * plugin/00default.rb: ditto. * plugin/01sp.rb: ditto. * plugin/50bayes_filter.rb: ditto. * plugin/de/00default.rb: ditto. * plugin/en/00default.rb: ditto. * plugin/fr/00default.rb: ditto. * plugin/it/00default.rb: ditto. * plugin/ja/00default.rb: ditto. * style/default/html_formatter.rb: ditto. * style/math/html_formatter.rb: ditto. * style/math/latex.rb: ditto. * style/rd+/anchorlist.rb: ditto. * style/rd+/html_formatter.rb: ditto. * style/rd+/rd2html.rb: ditto. 2009-08-30 okkez * hiki/util.rb (Hiki::Util): dead copy from Ruby 1.8 cgi.rb. Hiki::Util#escape, Hiki::Util#unescape, Hiki::Util#unescapeHTML, Hiki::Util#escapeHTML. 2009-08-28 okkez * hiki/config.rb (Hiki::Config#initialize): improved performance. 2009-08-24 Kazuhiko * style/default/parser.rb, style/default/html_formatter.rb: replacing WikiName links is now handled by HikiDoc by specifying use_wiki_name parameter. 2009-08-23 okkez * hiki/command.rb (Hiki::Command): use ERB::Util#h instead of String#escapeHTML or CGI::Util#escapeHTML . * hiki/interwiki.rb (Hiki::InterWiki): ditto. * hiki/pluginutil.rb (Hiki::Util): ditto. * hiki/storage.rb (Hiki::HikiDBBase): ditto. * hiki/util.rb (Hiki::Util): ditto. 2009-08-23 Kazuhiko * style/default/hikidoc.rb: use recent hikidoc.rb (rev.122). fix a bug: strings after non-WikiName expression are ignored. 2009-08-19 Kazuhiko * misc/plugin/rank.rb: increment hit count only in view mode. 2009-08-17 Kazuhiko * hiki/docdiff/charstring.rb: code cleanup. 2009-08-16 Kazuhiko * hiki/docdiff/charstring.rb: many changes for Ruby-1.9. * hiki/docdiff/encoding/document.rb: do not guess encoding for Ruby-1.9. * hiki/docdiff/encoding/ja_utf8.rb: quote regular expressions correctly. * style/default/hikidoc.rb: use recent hikidoc.rb (rev.116). 2009-08-15 Kazuhiko * hiki/command.rb (cmd_diff): use unified_diff if word_diff raises an exception, because word_diff can raise Encoding::CompatibilityError in Ruby-1.9. this change should be temporary and should be removed when docdiff becomes Ruby-1.9 ready. * hiki/util.rb (ppunified_diff): escape output in this method just same as word_diff() does. * misc/plugin/rss.rb (rss_body): remove escape because unified_diff() will escape instead. * hiki.cgi: set Encoding::defailt_external if exists (for Ruby 1.9). add :accept_charset parameter in CGI.new(). * style/default/html_formatter.rb: remove a needless regexp option. * hiki/docdiff/view.rb (apply_style, apply_style_digest): use Array#join instead of Array#to_s, whose specification is different between Ruby 1.8 and Ruby 1.9. * hiki/util.rb (word_diff): ditto. * hiki/util.rb (unified_diff): use String#split(/^/) instead of String#to_a, that works on both (old) Ruby-1.8 and Ruby-1.9. * style/default/parser.rb (parse): use HikiDoc.to_html instead of HikiDoc#to_html. 2009-08-14 Kazuhiko * plugin/00default.rb (hiki_footer): display fcgi information in footer. * hiki/page.rb (process): use String#bytesize instead of String#size if exists. * hiki/config.rb (load_cgi_conf): call eval() with binding, that is required for Ruby 1.9. * hiki/db/ptstore.rb: define commit_new if missing, that is required for Ruby 1.9. * hiki/db/tmarshal.rb: use Array#join instead of Array#to_s, whose specification is different between Ruby 1.8 and Ruby 1.9. 2009-08-09 Kazuhiko * Hiki 0.8.8 released! 2009-08-08 Kazuhiko * hiki/util.rb (String): add a warning comment to notify that all instance methods added in String class will be obsoleted in the future release. * misc/plugin/amazon.rb: import tDiary's amazon.rb (rev.3501). 2009-08-05 Kazuhiko * style/default/hikidoc.rb: use recent hikidoc.rb (rev.110). 2009-08-04 okkez * misc/plugin/attach/attach.cgi: use dot instead of double colon when call singleton methods. 2009-08-01 Kazuhiko * hiki/util.rb (Hiki::Util::sendmail): fix a typo (Hiki::Version -> Hiki::VERSION). 2009-07-28 okkez * misc/plugin/history.rb (Hiki::History#history): uncomment. (see rev.942) 2009-07-28 okkez * misc/plugin/history.rb: use dot instead double colon when call singleton meshods. 2009-07-28 Kazuhiko * plugin/00default.rb: use ::Hiki::VERSION instead of Hiki::VERSION. * misc/plugin/amazon.rb: import tDiary's amazon.rb (rev.3484). 2009-07-25 okkez * contrib/plugin/rast-register.rb: delete trailing white spaces, fix indent. * contrib/plugin/rast-search.rb: ditto. * misc/plugin/attach.rb: ditto. * misc/plugin/attach/attach.cgi: ditto. * misc/plugin/auth_typekey.rb: ditto. * misc/plugin/bbs.rb: ditto. * misc/plugin/category.rb: ditto. * misc/plugin/comment.rb: ditto. * misc/plugin/diffmail.rb: ditto. * misc/plugin/footnote.rb: ditto. * misc/plugin/history.rb: ditto. * misc/plugin/incremental_search.rb: ditto. * misc/plugin/keyword.rb: ditto. * misc/plugin/pagerank.rb: ditto. * misc/plugin/rank.rb: ditto. * misc/plugin/rbl.rb: ditto. * misc/plugin/readlirs.rb: ditto. * misc/plugin/recent2.rb: ditto. * misc/plugin/referer.rb: ditto. * misc/plugin/rss-show.rb: ditto. * misc/plugin/rss.rb: ditto. * misc/plugin/template.rb: ditto. 2009-07-23 okkez * hiki.cgi: use dot instead double colon when call singleton methods. 2009-07-23 okkez * hiki/aliaswiki.rb: delete trailing white spaces, fix indent. * hiki/auth/typekey.rb: ditto. * hiki/config.rb: ditto. * hiki/db/ptstore.rb: ditto. * hiki/db/tmarshal.rb: ditto. * hiki/filter.rb: ditto. * hiki/filter/bayes_filter.rb: ditto. * hiki/filter/word_filter.rb: ditto. * hiki/hiki_formatter.rb: ditto. * hiki/image_size.rb: ditto. * hiki/interwiki.rb: ditto. * hiki/plugin.rb: ditto. * hiki/pluginutil.rb: ditto. * hiki/repos/default.rb: ditto. * hiki/repos/hg.rb: ditto. * hiki/storage.rb: ditto. * hiki/util.rb: ditto. 2009-07-23 okkez * style/default/html_formatter.rb: use dot instead double colon when call singleton methods. * plugin/01sp.rb: ditto. * plugin/00default.rb: ditto. * hiki/xmlrpc.rb: ditto. * hiki/util.rb: ditto. * hiki/storage.rb: ditto. * hiki/command.rb: ditto. * hiki/config.rb: ditto. 2009-07-19 okkez * hiki/config.rb (Hiki): add Hiki::VERSION, Hiki::RELEASE_DATE. (Hiki::Config#load): use Hiki::VERSION instead HIKI_VERSION. * plugin/00default.rb (#hiki_footer): ditto. * hiki/util.rb (Hiki::Util#sendmail): ditto. * hiki/storage.rb (Hiki::HikiDBBase#load_cache): use Hiki::RELEASE_DATE instead HIKI_RELEASE_DATE. * hiki/storage.rb (Hiki::HikiDBBase#save_cache): ditto. 2008-10-12 KURODA Hiraku * plugin/50bayes_filter.rb: Use unified diff insted of "appended lines" in "submitted_pages" * hiki/filter/bayes_filter.rb: add Hiki::Filter::BayesFilter::PageData#get_unified_diff. * test/spec_bayes_filter.rb: ditto. 2008-10-12 KURODA Hiraku * test/spec_bayes_filter.rb: Update some specs. 2008-10-12 KURODA Hiraku * hiki/xmlrpc.rb: Fix: Error is raised in 'wiki.putPage' because Filter was not initialized. 2008-09-24 Kazuhiro NISHIYAMA * misc/webrick/hikilet.rb: revert change on 2008-01-06, because ENV[key]=nil behavior of ruby 1.9 reverted. 2008-09-19 okkez * hiki/plugin.rb (Hiki::Plugin#initialize): use Object#instance_variable_set instead Kernel.eval. 2008-09-19 okkez * hiki/config.rb (Hiki::Config#database): add new method. * hiki.cgi: use Hiki::Config#datacase. * hiki/xmlrpc.rb (Hiki::XMLRPCHandler#init_handler): ditto. * misc/webrick/hikilet.rb (Hikilet#do_GET): ditto. 2008-09-18 KURODA Hiraku * plugin/50bayes_filter.rb, plugin/en/50bayes_filter.rb, plugin/ja/50bayes_filter.rb, test/spec_50bayes_filter.rb : In submitted_page_diff, show difference of text using Util#word_diff. 2008-09-18 KURODA Hiraku * hiki/filter.rb, hiki/filter/bayes_filter.rb, hiki/filter/word_filter.rb, test/spec_bayes_filter.rb : In bayes filter, when text is posted by registered user and judged as spam, add text to ham-db. 2008-08-07 KURODA Hiraku * messages/en.rb: Fix typo. Reported by Kouhei Sutou. 2008-08-06 KURODA Hiraku * hiki/repos/hg.rb, test/test_repos_hg.rb: support mercurial repository. 2008-08-06 KURODA Hiraku * hiki/filter/bayes_filter/bayes.rb: Update bayes library. * hiki/filter/bayes_filter.rb, plugin/50bayes_filter.rb, test/spec_50bayes_filter.rb, test/spec_bayes_filter.rb : + Limit number of times of adding ham/spam into database to 10 times. + Add new threshold for ham, then post for page is treated as 'doubt' if threshold_ham < score < threshold(for spam). 2008-07-06 SAKAI Masahiro * misc/plugin/rss.rb: applied patch Hiki-dev:01126,01127. * style/rd+/rd2html.rb: applied patch Hiki-dev:01163. 2008-06-25 SHIBATA Hiroshi * plugin/00default.rb: display RUBY_PATCHLEVEL in footer. 2008-05-18 KURODA Hiraku * hiki/filter/bayes_filter.rb, plugin/50bayes_filter.rb, plugin/en/50bayes_filter.rb, plugin/ja/50bayes_filter.rb : Add feature to limit to show submitted pages. 2008-05-16 KURODA Hiraku * hiki/filter/bayes_filter.rb, plugin/50bayes_filter.rb, test/spec_50bayes_filter.rb, test/spec_bayes_filter.rb : URL of posted pagedata in bayes filter become to refer the page 'in Wiki'. 2008-05-14 KURODA Hiraku * hiki/filter/bayes_filter.rb, plugin/50bayes_filter.rb, plugin/ja/50bayes_filter.rb, plubin/en/50bayes_filter.rb : Add feature to share database for bayes filtering. 2008-03-26 Kazuhiko * hiki/repos/git.rb, test/test_repos_git.rb: support git repository (contributed by Kouhei Sutou). 2008-02-23 KURODA Hiraku * hiki/filter.rb, test/spec_filter.rb: Ignore error raised inregisterd filter. * hiki/filter/bayes_filter.rb, plugin/50bayes_filter.rb, plugin/en/50bayes_filter.rb, plugin/ja/50bayes_filter.rb, test/spec_bayes_filter.rb: Send report mail ONLY WHEN configuration is set so. 2008-02-20 KURODA Hiraku * plugin/50bayes_filter.rb: Fix a bug for ruby-1.8.5. 2008-02-12 KURODA Hiraku * hiki/command.rb, hiki/plugin.rb, messages/en.rb, messages/ja.rb: hiki/filter.rb, hiki/filter/bayes_filter.rb, hiki/filter/bayes_filter/bayes.rb, hiki/filter/word_filter.rb, plugin/50bayes_filter.rb, plugin/50word_filter.rb, plugin/en/50bayes_filter.rb, plugin/en/50word_filter.rb, plugin/ja/50bayes_filter.rb, plugin/ja/50word_filter.rb, test/spec_50bayes_filter.rb, test/spec_bayes_filter.rb: add spam filtering features. 2008-02-08 Kouhei Yanagita * template/adminform.html: div.main should precede div.sidebar. 2008-01-25 Kazuhiro NISHIYAMA * hiki.cgi, misc/plugin/attach/attach.cgi: $defout -> $stdout. 2008-01-07 Kazuhiro NISHIYAMA * plugin/01sp.rb: improve previous incompatible change. 2008-01-06 Kazuhiro NISHIYAMA * hiki/config.rb, hiki/hiki_formatter.rb, misc/webrick/hikilet.rb, plugin/01sp.rb, hiki/pluginutil.rb, style/default/html_formatter.rb: partially support ruby 1.9.0. 2007-10-29 Kazuhiro NISHIYAMA * hiki/command.rb: revert partial patched toc_lv. (see [Hiki-dev:01106], [Hiki-dev:01164]) 2007-09-26 U.Nakamura * hiki/command.rb: raise SessionError instead of PermissionError in case of session errors. 2007-09-25 Kazuhiko * hiki/db/flatfile.rb, hiki.cgi, hiki/xmlrpc.rb, misc/webrick/hikilet.rb: use HikiDB_dbtype as the name of the class instead of HikiDB. * hiki.cgi: remove "$SAFE = 1" for FastCGI. 2007-09-24 Kazuhiko * misc/plugin/history.rb: hide "Changes" heading in non-cvs repository case. 2007-07-17 Kouhei Yanagita * plugin/00default.rb (create_menu): set rel="nofollow" in menu links to edit/diff pages (patch by Kazuhiro NISHIYAMA). 2007-06-24 Kouhei Yanagita * Hiki 0.8.7 released! * hiki/session.rb (initialize): fix a arbitrary file delete vulnerability. 2007-06-24 Kazuhiko * misc/plugin/attach.rb (attach_download): add a Content-Length header. 2007-06-23 Kazuhiko * hiki/command.rb (cmd_admin): escape config key in admin mode. 2007-06-22 Kouhei Yanagita * hiki/session.rb (create_new_id): use Time#usec to make a session id more hard-to-crack. 2007-05-23 Kazuhiro NISHIYAMA * hiki/page.rb: add Vary to response headers. 2007-04-08 * misc/plugin/attach.rb: get image size of other pages correctly. 2007-03-14 Kazuhiro NISHIYAMA * misc/webrick/hikilet.rb: set $SAFE=1 in Hikilet. return hiki.cgi style response on error. support xmlrpc. * hiki/xmlrpc.rb: support hikilet. 2007-02-06 Kazuhiko * hiki/command.rb (cmd_view): fix too-escaped bug in title (closes #76). 2007-01-12 Kazuhiko * misc/plugin/src.rb: use the language and charset configured as default (by Richard Zidlicky). 2007-01-01 Kazuhiko * misc/plugin/amazon.rb, misc/plugin/en/amazon.rb, misc/plugin/ja/amazon.rb: import the tDiary's amazon plugin. 2006-11-26 Kazuhiko * hiki/storage.rb (md5hex): use MD5.hexdigest(s) instead of MD5.new(s).hexdigest (closes #73). 2006-10-16 Kazuhiro NISHIYAMA * hiki.cgi: return status 500 on error. 2006-10-11 Kouhei Yanagita * style/default/html_formatter.rb (URI_RE): allow file scheme in URI. 2006-10-05 Kazuhiko * hiki/command.rb: check postable? if request method is "POST". * misc/plugin/bbs.rb, misc/plugin/comment.rb, misc/plugin/its.rb, misc/plugin/trackback.rb: cancel checking postable? in plugins. 2006-10-04 Kazuhiko * plugin/00default.rb: add postable?. * hiki/command.rb, misc/plugin/bbs.rb, misc/plugin/comment.rb, misc/plugin/its.rb, misc/plugin/trackback.rb: use postable?. * misc/plugin/rbl.rb: add a new plugin that overrides postable? by looking up Realtime Blackhole Lists. 2006-09-03 Kazuhiko * misc/plugin/amazon.rb: follow up to change format and image URL (closes #70) . 2006-09-03 Kazuhiro NISHIYAMA <zn@mbf.nifty.com> * misc/webrick/hikilet.rb: session_id bug fix. 2006-09-02 Kazuhiro NISHIYAMA <zn@mbf.nifty.com> * hiki/plugin.rb: use URI.parse() instead of URI(). (Ticket-66) * misc/webrick/hikilet.rb: cookies bug fix. 2006-08-08 Kazuhiko <kazuhiko@fdiary.net> * hiki/command.rb (cmd_view): set correct references (closes #68). 2006-08-07 Kazuhiko <kazuhiko@fdiary.net> * misc/plugin/bbs.rb: revise HTML. * misc/plugin/its.rb: enable adding a comment and changing properties with a single post. * hiki/plugin.rb: add accessors of session_id. * misc/plugin/bbs.rb, misc/plugin/comment.rb, misc/plugin/its.rb: validate a session_id. * hiki/command.rb: create a new session if a session_id is invalid. * hiki/session.rb: save a session file if @user is nil. 2006-08-05 Kazuhiko <kazuhiko@fdiary.net> * style/default/html_formatter.rb (replace_inline): do not convert tag texts at all (reported by shino). * misc/plugin/rank.rb: return an empty string in body_leave_proc. * hiki/db/ptstore.rb: inherit the PStore class and rewrite cache-related codes. * hiki/command.rb (cmd_view): update references only when references differ from previous. * hiki/command.rb (cmd_view), misc/plugin/rank.rb: increment a counter only when the 'rank.rb' plugin is active. 2006-07-31 Kazuhiko <kazuhiko@fdiary.net> * hikiconf.rb.sample, hiki/command.rb, hiki/config.rb, misc/plugin/bbs.rb, misc/plugin/comment.rb, misc/plugin/its.rb: add '@conf.use_session' to prevent spams. * style/default/hikidoc.rb: sync with hikidoc rev.38. support nested modifier (reported by MoonWolf). 2006-07-21 Kazuhiro NISHIYAMA <zn@mbf.nifty.com> * hiki/page.rb, misc/hikifarm/index.cgi, misc/plugin/referer.rb, misc/plugin/trackback.rb: check request_method exactly. * hiki/storage.rb: use Array#reverse_each instead of reverse.each. 2006-07-03 Kazuhiko <kazuhiko@fdiary.net> * Hiki 0.8.6 released! * misc/plugin/trackback.rb (trackback): use SCRIPT_FILENAME instead of SCRIPT_NAME. * data/text/TextFormattingRules: add explanations about multi-lines pre-formatted text and description-only text. 2006-07-02 Kazuhiko <kazuhiko@fdiary.net> * hiki/command.rb (dispatch), hiki/config.rb: raise an error if timeout exceeds. * hikiconf.rb.sample, misc/i18n/hikiconf.rb.sample.en: add '@timeout'. 2006-06-06 Kazuhiko <kazuhiko@fdiary.net> * hiki/docdiff/view.rb: sync to docdiff-0.3.3. 2006-06-01 Kazuhiko <kazuhiko@fdiary.net> * plugin/00default.rb (saveconf_theme): fix a bug that raises an exception when setting a wrong theme_path (closes #64). 2006-04-28 Kazuhiro NISHIYAMA <zn@mbf.nifty.com> * hiki/db/ptstore.rb (fetch): merge from pstore.rb in ruby 1.8.4. 2006-03-15 Kouhei Yanagita <yanagi@shakenbu.org> * hiki/config.rb (mobile_agent?): support WILLCOM's mobile agents (closes #57). 2006-02-27 Kouhei Yanagita <yanagi@shakenbu.org> * hiki/plugin.rb (cookie_path): fix the bug of breaking the path of the cookie when base_url is specified (closes #56). 2006-02-18 Kouhei Yanagita <yanagi@shakenbu.org> * misc/plugin/show_plugins.rb: add a comment. 2006-02-15 Kouhei Yanagita <yanagi@shakenbu.org> * plugin/02help.rb (set_s): support Safari (patch by NAGASAKI). 2006-02-04 Kazuhiro NISHIYAMA <zn@mbf.nifty.com> * hiki/db/ptstore.rb: bug fix file.flock(File::LOCK_UN) without lock. 2006-01-30 Kouhei Yanagita <yanagi@shakenbu.org> * misc/plugin/attach.rb, hiki/image_size.rb: suppress the width/height attributes when ImageSize could not determine the size of an image. * misc/plugin/attach.rb (attach_image_anchor): introduce options['attach.cache_url']. Don't use this unless all of the attached file is believed to be safe (patch by U.Nakamura). * style/default/html_formatter.rb (replace_inline): Do not consider WikiName inside of pre elements. 2005-12-31 Kazuhiko <kazuhiko@fdiary.net> * hiki/config.rb (load_cgi_conf): convert @mail to Array even if no cgi_conf file is found. 2005-12-29 Kazuhiko <kazuhiko@fdiary.net> * Hiki 0.8.5 released! * plugin/00default.rb: revise handling of theme_path (by OZAWA Sakuro [Hiki-dev:01086]). * hiki/interwiki.rb (interwiki): escapeHTML uris (by KURODA Hiraku [Hik-dev:01089]). * plugin/02help.rb: code cleanup by NAGASAKI. * style/default/hikidoc.rb: sync with hikidoc rev.36. support relative inline URLs. fix parse_table (reported by H.M) (closes #44). * misc/plugin/quote_page.rb: revise for current hiki (closes #47). * style/default/parser.rb (parse): add a second argument to specify top level. * hiki/repos/cvs.rb (revisions): revise a regexp by miya (closes #50). 2005-12-26 Kazuhiko <kazuhiko@fdiary.net> * style/rd+/rd2html.rb (apply_to_Reference_with_URL): revise a regexp of image uris by Masao Mutoh (reported by GOTO Naohisa). 2005-12-25 Kouhei Yanagita <yanagi@shakenbu.org> * misc/plugin/attach.rb (attach_image_anchor): specify the size of attached images using width and height attributes of img elements. * template/view.html: add a <hr> separator between main contents and a sidebar (closes #45). * hiki/util.rb (sendmail), hikiconf.rb.sample, misc/i18n/hikiconf.rb.sample.en, misc/hikifarm/template/index.html: Multiple mail addresses are available at conf.mail by separating a comma (closes #23). * hikiconf.rb.sample, hiki/config.rb, hiki/util.rb, misc/i18n/hikiconf.rb.sample.en, plugin/00default.rb, plugin/de/00default.rb, plugin/en/00default.rb, plugin/fr/00default.rb, plugin/it/00default.rb, plugin/ja/00default.rb, template/hiki.conf: Administrator's mail addresses are held as an array internally. 2005-12-18 Kazuhiko <kazuhiko@fdiary.net> * hiki/command.rb (dispatch): enter 'preview' mode when no submit parameter is sent from 'edit' mode (closes #43). 2005-12-17 Kazuhiko <kazuhiko@fdiary.net> * hiki/plugin.rb (save): do not remove spaces from the begining and the end of texts (reported by ISOBE, Kazuhiko [Hiki-dev:01078]). 2005-12-02 Kazuhiko <kazuhiko@fdiary.net> * contrib/plugin/rast-register.rb: add a new plugin. * contrib/plugin/rast-search.rb: add a new plugin. 2005-11-28 Kouhei Yanagita <yanagi@shakenbu.org> * hiki/config.rb (load): fixed: The XMLRPC feature could not be disabled (reported by Atsushi SHICHI). 2005-11-22 Kazuhiko <kazuhiko@fdiary.net> * misc/hikifarm/index.cgi: revise output HTML. 2005-11-19 Kouhei Yanagita <yanagi@shakenbu.org> * plugin/02help.rb, plugin/en/02help.rb, plugin/ja/02help.rb: refine the interface of editing support (by NAGASAKI). 2005-11-16 Kazuhiko <kazuhiko@fdiary.net> * misc/plugin/its.rb: add a 'Issue Tracking System' plugin. 2005-11-15 Kazuhiko <kazuhiko@fdiary.net> * misc/hikifarm/hiki.conf: add descriptions by Atsushi SHICHI. * doc/README-attach.txt: update a document by Atsushi SHICHI. 2005-11-07 Kazuhiko <kazuhiko@fdiary.net> * misc/plugin/amazon.rb (getAmazon): revise for recent amazon sites. 2005-11-03 Kouhei Yanagita <yanagi@shakenbu.org> * plugin/01sp.rb, misc/plugin/show_plugins.rb: new plugin. It displays enabled plugins. 2005-11-02 Kouhei Yanagita <yanagi@shakenbu.org> * hiki/command.rb (cmd_save): editors can delete pages without administrative privilege. 2005-11-01 Kouhei Yanagita <yanagi@shakenbu.org> * hiki/db/flatfile.rb (unlink): backup the data when a page is deleted. 2005-10-25 Kouhei Yanagita <yanagi@shakenbu.org> * style/rd+/rd2html.rb (a_name_href): fixed a escape string remaining bug (patch by Masao Mutoh). 2005-10-19 Kouhei Yanagita <yanagi@shakenbu.org> * hiki/repos/plain.rb, test/test_repos_plain.rb, misc/hikifarm/hikifarm.conf: add a new version control backend, which stores whole copy of each version. 2005-10-15 Kazuhiro NISHIYAMA <zn@mbf.nifty.com> * hiki/xmlrpc.rb: keyword bug fix. use XMLRPC::FaultException instead of rescue and false. support minoredit and md5hex. split XMLRPCHandler. 2005-10-03 Kouhei Yanagita <yanagi@shakenbu.org> * hiki/plugin.rb: use *_proc methods regardless of the value of @conf.use_plugin. 2005-10-02 Kazuhiko <kazuhiko@fdiary.net> * style/default/hikidoc.rb: sync with hikidoc rev.33. revise esacpes in parse_link allow empty descriptions in definition lists * style/default/html_formatter.rb (replace_link): follow the change of hikidoc.rb. 2005-09-30 Kazuhiko <kazuhiko@fdiary.net> * hiki/hiki_formatter.rb (apply_tdiary_theme): revise H2_RE (reported by NISHI Takao). * misc/plugin/attach.rb, misc/plugin/category.rb, misc/plugin/keyword.rb, misc/plugin/orphan.rb, misc/plugin/referer.rb, misc/plugin/sitemap.rb, misc/plugin/template.rb, plugin/00default.rb, style/default/html_formatter.rb: revise for more strict HTML (by KURODA Hiraku). 2005-09-29 Kazuhiko <kazuhiko@fdiary.net> * Hiki 0.8.4 released! * misc/webrick/hikilet.rb: add a script to run hiki with WEBrick (by Kazuhiro NISHIYAMA). * style/math/parser.rb, style/math/html_formatter.rb: follow the changes of the default style. * hiki/xmlrpc.rb: use utf-8 as the input/output charset. add 'wiki.getPageInfo'. * hiki/util.rb (redirect): always use 'meta refresh' (closes #26). * style/default/hikidoc.rb: sync with hikidoc rev.30. allow empty descriptions in definition lists. 2005-09-27 Kazuhiko <kazuhiko@fdiary.net> * style/default/hikidoc.rb: sync with hikidoc rev.29. bugfix in parse_plugin. revise URI_RE. 2005-09-26 Kazuhiko <kazuhiko@fdiary.net> * misc/plugin/rss-show.rb: use the rss library. * style/default/hikidoc.rb: sync with hikidoc rev.27. revise parse_plugin. 2005-09-20 Kazuhiko <kazuhiko@fdiary.net> * style/default/html_formatter.rb (replace_link): display specified titles in interwikis (closes #25). ditto in outer aliases. * plugin/00default.rb (toc): return an empty string (closes #24). 2005-09-18 Kazuhiko <kazuhiko@fdiary.net> * style/default/html_formatter.rb (replace_auto_link): do nothing if @auto_links is empty. * style/default/hikidoc.rb: sync with hikidoc rev.25. minimum match in parse_modifier. 2005-09-15 Kazuhiko <kazuhiko@fdiary.net> * misc/plugin/amazon.rb (getAmazon): allow hankaku colon in a regexp of an item_name. 2005-09-14 Kazuhiko <kazuhiko@fdiary.net> * misc/plugin/amazon.rb: follow-up format changing of amazon.com and amazon.co.jp. * style/default/html_formatter.rb (replace_auto_link): typo. 2005-09-13 Kazuhiko <kazuhiko@fdiary.net> * hiki/command.rb: disallow a page whose name is '.' or '..' (reported by take_tk [Hiki-users:51]). * style/default/html_formatter.rb: correct auto links (reported by take_tk [Hiki-users:46]). 2005-09-11 Kazuhiko <kazuhiko@fdiary.net> * style/default/html_formatter.rb (to_s): 'replace_auto_link' after 'replace_link'. (replace_auto_link): correct links. * misc/plugin/rss.rb (rss): disable @conf.use_plugin in making full-text HTML contents (reported by MORIOKA Toru [Hiki-dev:01029]). * hiki/hiki_formatter.rb (apply_tdiary_theme, tdiary_section): move from style/default/html_formatter.rb. * hiki/repos/svn.rb (commit, delete): add the '--force-log' option to avoid an error in editing a page whose name and the editor is the same (by ISOBE, Kazuhiko [Hiki-dev:01027]). 2005-09-09 Kazuhiko <kazuhiko@fdiary.net> * style/default/html_formatter.rb (replace_inline): add 'class="external"' to uri liks (hikidoc:18). 2005-09-08 Kazuhiko <kazuhiko@fdiary.net> * style/default/parser.db, style/default/html_formatter.rb: use the HikiDoc library. 2005-09-06 Kazuhiko <kazuhiko@fdiary.net> * misc/plugin/ja/rss.rb: support whole HTML output (instead of title-only). 2005-09-05 Kouhei Yanagita <yanagi@shakenbu.org> * misc/plugin/rss.rb (rss_body), misc/plugin/ja/rss.rb (label_rss_mode_candidate): RSS which lists only titles of updated pages is supported (report by vette). * misc/plugin/footnote.rb (render): support a block element argument (patch by U.Nakamura). 2005-09-03 Kazuhiko <kazuhiko@fdiary.net> * misc/plugin/sitemap.rb: code cleanup (report by Atsushi Koga). 2005-09-01 Kazuhiko <kazuhiko@fdiary.net> * style/default/html_formatter.rb (make_link): support anchors in bracket links. * misc/plugin/orphan.rb (orphan_pages): code cleanup (reported by ISOBE, Kazuhiko). 2005-08-30 Kouhei Yanagita <yanagi@shakenbu.org> * misc/plugin/rss.rb (rss): deal with the If-Modified-Since header in a request. 2005-08-29 Kouhei Yanagita <yanagi@shakenbu.org> * test/test_hikifarm.rb (test_create_wiki): the test failed because one of the arguments of Hikifarm#create_wiki is lack. * test/test_default_parser.rb (test_link, test_url): add some tests. * style/default/parser.rb (inline_impl): the href of URL was not escaped at tokens of URL_RE. 2005-08-28 Kouhei Yanagita <yanagi@shakenbu.org> * test/test_default_parser.rb: (test_emphasis, test_strong, test_delete): add new test methods. * style/default/parser.rb: Remove the HikiStack class and use Array instead. perform some refactorings. * misc/hikifarm/index.cgi: update HIKIFARM_RELEASE_DATE. I've forgotten to do it. 2005-08-26 Kazuhiko <kazuhiko@fdiary.net> * hiki/db/flatfile.rb (set_references, get_references): store references as Array instead of csv String. 2005-08-25 Kazuhiko <kazuhiko@fdiary.net> * style/default/html_formatter.rb (make_link): display page names instead of page titles if @conf.use_wikiname is false. 2005-08-25 Kouhei Yanagita <yanagi@shakenbu.org> * misc/hikifarm/hiki.conf, misc/hikifarm/hikifarm.conf, misc/hikifarm/index.cgi: Hikifarm becomes to be able to set up a CGI file for file attachment (by Kouhei Sutou). * misc/plugin/attach.rb: moved from misc/plugin/attach/attach.rb to be able to select a attach.rb plugin without file copy. 2005-08-24 Kazuhiko <kazuhiko@fdiary.net> * hiki/xmlrpc.rb (wiki.getPage, wiki.getAllPages): encode strings with base64. * misc/hiki-mode/hiki-mode.el (hiki-edit-save-page): escape page name (reported by YAA). * hiki/db/flatfile.rb: update a timestamp of a text file in minor changes to making cvs commit properly. 2005-08-04 Kazuhiko <kazuhiko@fdiary.net> * Hiki 0.8.3 released! 2005-08-03 Kazuhiko <kazuhiko@fdiary.net> * plugin/00default.rb (create_menu): [SECURITY FIX] escape a page name in a login menu (reported by Yutaka OIWA). * hiki/config.rb (save_config): make contents of a conf file before trying to write (reported by Yutaka OIWA). * hiki/command.rb (cmd_create): [SECURITY FIX] escape a page name. * hiki/command.rb (cmd_login): returns 'FORBIDDEN' if login fails. (generate_page): accept 'status' as a second argument. * hiki/repos/cvs.rb (revisions): revise for the current cvs. 2005-08-03 Kouhei Yanagita <sugi@dream.big.or.jp> * hiki/config.rb (base_url): detecting https implemented wrongly. * misc/hiki-mode/hiki-mode.el (hiki-fetch-index): fixed: Emacs hangs up when fetching the index. * misc/hiki-mode/hiki-mode.el (hiki-http-request): The URL contains no query when method is POST. 2005-08-03 Kazuhiko <kazuhiko@fdiary.net> * hiki/config.rb (base_url): revise for IIS (closes #17). 2005-08-02 Kouhei Yanagita <sugi@dream.big.or.jp> * messages/de.rb, misc/plugin/de/*, misc/text/default.de/*, plugin/de/00default.rb, plugin/de/01sp.rb, plugin/de/02help.rb: German resources are added (translated by Kashia Buch). * doc/INSTALL.en: add description about German text. 2005-07-31 Kouhei Yanagita <sugi@dream.big.or.jp> * hiki/xmlrpc.rb (init_handler): implement wiki.getAllPages. 2005-07-29 Kouhei Yanagita <sugi@dream.big.or.jp> * hiki.cgi, hikiconf.rb.sample, hiki/config.rb, hiki/xmlrpc.rb, misc/hikifarm/hiki.conf, misc/i18n/hikiconf.rb.sample.en, plugin/00default.rb, plugin/en/00default.rb, plugin/fr/00default.rb, plugin/it/00default.rb, plugin/ja/00default.rb, template/hiki.conf: add web interface to enable/disable XML-RPC interfaces. 2005-07-28 Kouhei Yanagita <sugi@dream.big.or.jp> * hiki.cgi, hiki/xmlrpc.rb: XMLRPC interface is now available via hiki.cgi. xmlrpc.cgi becomes needless. * misc/xmlrpc/xmlrpc.cgi, misc/xmlrpc/README: removed. 2005-07-26 Kouhei Yanagita <sugi@dream.big.or.jp> * misc/hikifarm/vc-backend-setup.cgi: HikifarmRepos*#import/imported? should take a basenamed wiki name. (by Atsushi Koga) * style/default/html_formatter.rb (make_link): use a page name instead of a page title in a toc (suggested by Shinya Kawaji). 2005-07-21 Kazuhiko <kazuhiko@fdiary.net> * Hiki 0.8.2 released! 2005-07-21 Kouhei Yanagita <sugi@dream.big.or.jp> * misc/hiki-mode/hiki-mode.el (hiki-fetch-index): fixed: FrontPage is not listed in hiki-index. * misc/hiki-mode/hiki-mode.el (hiki-edit-save-page): fixed: Can't save keywords when initial keyword is empty. (by Takeshi UME Imai) * misc/hiki-mode/hiki-mode.el (hiki-display-page): fixed: Can't input keywords if keywords area is erased once. 2005-07-20 Kazuhiko <kazuhiko@fdiary.net> * misc/plugin/attach/attach.cgi: only output basename of attached / detached files in diff mails. * style/default/html_formatter.rb (make_link): use a page name instead of a page title in a 'title' attribute (closes #14). * misc/plugin/bbs.rb: support changing heading levels (by U.Nakamura). * hiki/pluginutil.rb (argwords): escape double quotes (reported by Kazuhiro NISHIYAMA). 2005-07-19 Kazuhiko <kazuhiko@fdiary.net> * hiki-mode.el: revise for 0.8.1 (by Takeshi UME Imai). 2005-07-17 Kazuhiko <kazuhiko@fdiary.net> * plugin/00default.rb (toc_here): support a toc of another page. * misc/plugin/diffmail.rb (updating_mail): support the word diff format. * hiki/util.rb (word_diff_text): support the digest mode. 2005-07-17 Kouhei Yanagita <sugi@dream.big.or.jp> * doc/HACKING.txt, doc/HACKING.en: add HACKING documents. 2005-07-16 Kazuhiko <kazuhiko@fdiary.net> * style/default/html_formatter.rb (token_to_s): add interwiki to toc_title (reported by Kazuhiro NISHIYAMA). * misc/plugin/attach/attach.rb (attach_show_page_files_checkbox): escape a filename (reported by Kazuhiro NISHIYAMA). (attach_flash_anchor): escape a filename. 2005-07-16 Kouhei Yanagita <sugi@dream.big.or.jp> * hiki/repos/default.rb: ReposBase#root and ReposBase#data_path are now private. * hiki/repos/cvs.rb (setup, import, update, commit, delete, get_revision, revisions): use Dir.chdir with a block. * hiki/repos/default.rb, hiki/repos/cvs.rb, hiki/repos/svn.rb, hiki/repos/svnsingle.rb, misc/hikifarm/index.cgi, misc/hikifarm/vc-backend-setup.cgi: separate HikifarmRepos* from Repos*. * test/test_hikifarm.rb: change @data_path to @data_root. 2005-07-15 Kazuhiko <kazuhiko@fdiary.net> * misc/plugin/en/math.rb: add English resources (by Kashia Buch). * hiki/config.rb (load): now default vaule of @use_plugin is true. set @cgi_name to './' if it is empty. * hiki/plugin.rb (save): set a ':editor' attribute. 2005-07-14 Kouhei Yanagita <sugi@dream.big.or.jp> * Hiki 0.8.1 released! * misc/hikifarm/index.cgi (run): not to use Hiki::Util.redirect as a module function to avoid an error. * misc/hikifarm/cvs.rb, misc/hikifarm/svn.rb: ReposCvs and ReposSvnBase are derived from ReposBase instead of ReposDefault. * misc/hikifarm/default.rb: methods of ReposBase raises an exception because it should not to be instantiated. 2005-07-14 Kazuhiko <kazuhiko@fdiary.net> * Hiki 0.8.1 released! * hiki/command.rb (cmd_preview, cmd_save, cmd_admin), template/adminform.html, template/edit.html, template/i.adminform.html, template/i.edit.html: check the session_id in cgi queries to avoid 'Cross-Site Request Forgeries' vulnerabilities. * hiki/command.rb (cmd_admin): raise PermissionError instead of redirection to FrontPage. * template/i.edit.html: remove needless 'freeze_msg'. add a link to the editing form. * plugin/00default.rb, template/edit.html, template/i.edit.html: remove 'accesskey' attributes (closes #9). * messages/en.rb, messages/fr.rb, messages/it.rb, messages/ja.rb (msg_preview), template/edit.html: add a link to the editing form (suggested by Kouhei Sutou). 2005-07-13 Kouhei Yanagita <sugi@dream.big.or.jp> * test/test_repos_default.rb: add unit tests for ReposDefault. 2005-07-13 Kazuhiko <kazuhiko@fdiary.net> * template/edit.html: remove needless 'freeze_msg'. * hiki/command.rb (cmd_edit): preserve freeze status in preview mode. * hiki/util.rb (redirect): use 'meta refresh' if @conf.use_refresh is set (reported by nkoz and 7743). * hiki/command.rb: use an absolute path in the 'redirect' method (reported by 7743). * style/default/parser.rb (heading, link, blockquote), style/rd+/parser.rb (heading, link, blockquote): add format methods (suggested by Kouhei Sutou). * misc/plugin/bbs.rb (bbs_post): use 'Parser.heading'. * misc/plugin/trackback.rb (trackback_post): use 'Parser.link' and 'Parser.blockquote'. * misc/plugin/comment.rb, misc/plugin/bbs.rb: use @user instead of @cgi.cookies['auth_name'][0]. * misc/text/rd+/TextFormattingRules: revise URIs about the RD format. * plugin/00default.rb (create_menu): code cleanup. (creatable?): add a new method. * style/default/html_formatter.rb (make_link): use 'Plugin#creatable?' instead of 'Plugin#auth?' in missing anchors. * misc/plugin/src.rb (src): add a title. * hiki/command.rb (PermissionError): add a new exception class. (dispatch): add an error message in the error page. * template/error.html: display an error message. * template/view.html: wrap main contents with 'div.main' and wrap preview contents with 'div.preview'. * hiki/repos/cvs.rb (import): use 'hiki' as a vendor-tag. 2005-07-12 Kazuhiko <kazuhiko@fdiary.net> * style/default/html_formatter.rb (tdiary_section): return empty strings if contents is empty. * hiki/command.rb (cmd_login), plugin/00default.rb (create_menu), template/login.html: redirect to the current page (suggested by hadai). * misc/plugin/attach/attach.rb (attach_map): unescape page names (by NAGASAKI). * hiki/command.rb (cmd_login): use Plugin#login. * misc/xmlrpc/xmlrpc.cgi: use Plugin#login and Plugin#editable?. save 'editor' and 'title' correctly. * plugin/00default.rb (editable?): add a new method. * hiki/plugin.rb (login): add a new method to set '@user'. * hiki-mode.el: support login and logout (by Takeshi UME Imai). 2005-07-09 Kouhei Yanagita <sugi@dream.big.or.jp> * style/default/html_formatter.rb: fixed: a block plugin preceding a heading level 1 (!) makes markup wrong. * theme/hiki/hiki.css: widen padding-bottom of 'div.body h3'. 2005-07-08 Kouhei Yanagita <sugi@dream.big.or.jp> * hiki/config.rb (load_messages): change name from guess_lang. use all values in HTTP_ACCEPT_LANGUAGE. use 'en' as @lang when resources of the acceptable languages is not found. set @lang in this function instead of load(). 2005-07-08 Kazuhiko <kazuhiko@fdiary.net> * messages/fr.rb, messages/it.rb (msg_login_failure): add a missing 'end'. * hiki/config.rb (guess_lang): add a new method to detect browsers' accept languages. 2005-07-06 Kouhei Yanagita <sugi@dream.big.or.jp> * misc/i18n/hikiconf.rb.sample.en: add a setting of @base_url. 2005-07-06 Kazuhiko <kazuhiko@fdiary.net> * misc/plugin/attach/attach.rb: export 'attach_form' method (reported by Fu). 2005-07-05 Kazuhiko <kazuhiko@fdiary.net> * hiki/db/flatfile.rb (store): ignore Errno::EPERM in File::utime (reported by hashi). * hiki/command.rb (cmd_save): always save the 'editor' attribute. 2005-07-04 Kazuhiko <kazuhiko@fdiary.net> * hiki/pluginutil.rb (apply_plugin): catch all exceptions (reported by Kouhei Sutou). * style/default/html_formatter.rb (token_to_s): always use the 'plugin_error' method (reported by Kouhei Sutou). * style/default/html_formatter.rb (toc): return more simple HTML. * hiki/util.rb (plugin_error): escape exception messages (reported by Kouhei Sutou). 2005-07-03 Kouhei Yanagita <sugi@dream.big.or.jp> * style/default/html_formatter.rb (token_to_s): a double quote for colspan is lacked. 2005-07-02 Kazuhiko <kazuhiko@fdiary.net> * template/adminform.html: revise HTML (reported by Fu). 2005-07-01 Kazuhiko <kazuhiko@fdiary.net> * misc/xmlrpc/xmlrpc.cgi: use 'Plugin#save' instead of 'HikiDB#save'. 2005-06-29 Kazuhiko <kazuhiko@fdiary.net> * Hiki 0.8.0 released! * plugin/02help.rb (help_enabled?): add a new method. * template/edit.html, template/i.edit.html: set a value in a 'update_timestamp' checkbox (reported by KAWAI Masahiro). * plugin/02help.rb, plugin/en/02help.rb, plugin/ja/02help.rb: add a new plugin for support editing (by NAGASAKI). * hiki/db/flatfile.rb (store): fix a bug in making a new page without updating timestamp. * misc/plugin/comment.rb (comment_post): not add emphasize and link tags around a name (reported by Kouhei Sutou). * plugin/00default.rb (br): add a new plugin method. * hiki/command.rb (code_conv): add a new method for mobile agents. * misc/plugin/amazon.rb: for a little modified of web site changing. 2005-06-28 Kouhei Yanagita <sugi@dream.big.or.jp> * theme/hiki/hiki.css: revise the default theme. * data/text/SideMenu, misc/text/rd+/SideMenu: SideMenu should begin with a heading level 1. * doc/README.txt, doc/INSTALL.txt: revise the documents. * doc/README.en: add English README. 2005-06-27 Kazuhiko <kazuhiko@fdiary.net> * misc/plugin/footnote.rb, misc/plugin/keyword.rb, misc/plugin/orphan.rb, misc/plugin/pagerank.rb, misc/plugin/referer.rb, misc/plugin/sitemap.rb: use 'export_plugin_methods'. * misc/plugin/isbn.rb (isbn): revise bk1's uri. remove 'Fujisan'. * misc/plugin/rss-show.rb: use 'rss-show/' directory under the cache path. * hiki/config.rb (load): mkdir a cache path if not exists. * misc/plugin/readlirs.rb: use 'readlirs/' directory under the cache path. * misc/plugin/about.rb, remap_headings.rb: removed. * misc/plugin/quote_page.rb: merge remap_headings.rb. * misc/plugin/template.rb: support configuration via browsers. 2005-06-25 Kazuhiko <kazuhiko@fdiary.net> * misc/hikifarm/index.cgi: check the remote repository condition only if @repos_root exists (reported by NAGASAKI). 2005-06-25 Kouhei Yanagita <sugi@dream.big.or.jp> * misc/text/default.en/*: add English data. * data/text/EnglishTextFormattingRules: moved to `misc/text/default.en/TextFormattingRules'. * misc/text/default: removed because this is same to `data/text'. * doc/INSTALL.en: add English data information to the document. * misc/text/default.en/TextFormattingRules: reviced. * misc/i18n/hikiconf.rb.sample.en: add a new file. 2005-06-24 Kouhei Yanagita <sugi@dream.big.or.jp> * plugin/00default.rb, plugin/en/00default.rb, plugin/fr/00default.rb, plugin/it/00default.rb, plugin/ja/00default.rb: show a result message when admin password is tried to be changed. * doc/INSTALL.en: add an English document for installation. 2005-06-24 Kazuhiko <kazuhiko@fdiary.net> * hiki/config.rb (mobile_agent?): add a new method. * hiki/page.rb, plugin/00default.rb: support mobile agents. * style/default/html_formatter.rb (toc, apply_tdiary_theme): support mobile agents * hiki/repos/svn.rb: code cleanup. * misc/hikifarm/index.cgi: revise the condition whether the repository is local. 2005-06-23 Kazuhiko <kazuhiko@fdiary.net> * hiki/command.rb (generate_page): support 'toc' and 'toc_here' plugins. * plugin/00default.rb (toc_here): add a new plugin method. (toc): display table of content at the top of the text for backword compatibility. 2005-06-23 Kouhei Yanagita <sugi@dream.big.or.jp> * hiki/config.rb (load), hikiconf.rb.sample: most of the instance variables of Config class are now configurable in hikiconf.rb. 2005-06-23 Kazuhiko <kazuhiko@fdiary.net> * hiki/config.rb, plugin/00default.rb, plugin/en/00default.rb, plugin/fr/00default.rb, plugin/it/00default.rb, plugin/ja/00default.rb, template/hiki.conf: support configuration of using the WikiName feature (by NAGASAKI). * data/text/TextFormattingRules, misc/text/default/TextFormattingRules: update (by fumifumi). * style/default/parser.rb (parse): fix a bug in parsing plugins in pre-formatted texts. * style/default/parser.rb (parse_line): the format of table headers is changed from '||~' to '||!' (suggested by Kouhei Yanagita). * hiki/command.rb, hiki/plugin.rb, hiki/db/flatfile.rb, template/edit.html: support minor change edit that does not update the timestamp (by hadai). * messages/en.rb, messages/fr.rb, messages/it.rb, messages/ja.rb: add 'msg_update_timestamp'. * hiki/command.rb (cmd_edit): preserve keywords in preview mode. escapeHTML keywords. 2005-06-22 Kouhei Yanagita <sugi@dream.big.or.jp> * theme/hiki/hiki.css: revise the default theme. 2005-06-22 Kazuhiko <kazuhiko@fdiary.net> * hiki/command.rb (cmd_edit), template/edit.html: support '{{toc}}' in the preview mode. * plugin/00default.rb (toc), hiki/command.rb (generate_page), template/view.html: display table of contents where '{{toc}}' appears. 2005-06-22 Kouhei Yanagita <sugi@dream.big.or.jp> * theme/hiki_base.css: add CSS for printing. 2005-06-21 Kazuhiko <kazuhiko@fdiary.net> * misc/plugin/history.rb: fix bugs with default repos (reported by Yazawa). * hiki/plugin.rb (admin?): return true if the admin password is empty. * hiki/command.rb (initialize): not set @user if the admin password is empty (suggested by Kouhei Sutou). * style/default/parser.rb: support comments. * util/plugin.rb, style/default/html_formatter.rb: support inline/block contexts (by Kenta MURATA). * style/default/parser.rb, style/default/html_formatter.rb: support table headers and cell connections (by fumifumi and NAGASAKI). 2005-06-20 Kazuhiko <kazuhiko@fdiary.net> * plugin/00default.rb (anchor): add cgi_name for valid html outputs. * hiki/repos/default.rb (get_revision, revisions): add new methods. * misc/plugin/history.rb: support default repos. not display '[Diff to ]' if the page has only one revision. 2005-06-17 Kazuhiko <kazuhiko@fdiary.net> * hiki/page.rb (out): accept headers hash as an argument. * hiki/command.rb (generate_error_page): add a new method to display an error page. * template/error.html: add a new template file. * misc/plugin/attach/attach.rb (attach_download): display an error message if the file does not exist. use 'export_plugin_methods' (by Yazawa). * misc/plugin/attach/attach.cgi: use Hiki::Utils::redirect (by Yazawa). 2005-06-16 Kouhei Yanagita <sugi@dream.big.or.jp> * hiki/command.rb (cmd_login), messages/en.rb, messages/fr.rb, messages/it.rb, messages/ja.rb, template/login.html (msg_login_failure): show a message when login failure. 2005-06-16 Kazuhiko <kazuhiko@fdiary.net> * hiki/db/flatfile.rb (save): raise an exception with informations about the incompatibility. * hiki/plugin.rb (load, load_backup): add methods which are aliases of HikiDB#load and HikiDB#load_backup. * hiki/db/flatfile.rb (store): add 'preserve' option to keep modified time. * hiki/repos/svn.rb (revisions): use Time#strftime instead of Time#to_s since Time#to_s may contains SJIS characters in mingw32 ruby (suggested by Atsushi Koga). * view/template.html: ditto. * hiki/command.rb (cmd_edit): support editing with a specified revision. * misc/plugin/history.rb: add a link to revert to a specified revision. * hiki/repos/cvs.rb (get_revision, revisions): add new methods. * hiki/repos/svn.rb (get_revision, revisions): ditto. * misc/plugin/history.rb: follow the changes. * hiki/plugin.rb (Hiki::Plugin): add new instance variable @data. * hiki/command.rb (generate_page): merge @plugin.data to control parameters from plugins. * hiki/repos/svn.rb: support Windows (suggested by Atsushi Koga). * hiki/util.rb (Util::get_common_data): load a cache of 'SideMenu' if exists (by Yazawa). * style/default/html_formatter.rb (HTMLFormatter_default::make_link): fix a bug that loses wikinames in the table of contents. 2005-06-15 Kazuhiko <kazuhiko@fdiary.net> * misc/plugin/attach/attach.rb: use @options['attach.cgi_name'] to change the filename of 'attach.cgi' (by Koichiro Ohba). * style/default/html_formatter.rb: add 'class="external"' to InterWiki links (report by Kazuhiro NISHIYAMA). * template/edit.html: move 'preview' and 'save' button just next to the textarea. * hiki/aliaswiki.rb (AliasWiki::initialize): the argument is now contents of the aliaswiki page instead of 'db' and 'conf'. * hiki/interwiki.rb (InterWiki::initialize): the argument is now contents of the aliaswiki page instead of 'db', 'conf' and 'plugin'. * style/default/html_formatter.rb: follow changes of aliaswiki.rb and interwiki.rb. * style/default/html_formatter.rb: make a normal anchor if a link is missing interwiki link (by Kouhei Sutou). 2005-06-14 Kazuhiko <kazuhiko@fdiary.net> * misc/plugin/en/edit_user.rb (label_edit_user_title): add a missing resource (by GOTO Naohisa). * template/login.html, messages/en.rb, messages/fr.rb, messages/it.rb, messages/ja.rb (msg_login_info): add an information about admin login. * misc/plugin/history.rb: not display changes in 'svn' or 'svnsingle' mode (by ISOBE, Kazuhiko). 2005-06-13 Kouhei Yanagita <sugi@dream.big.or.jp> * hiki/command.rb, hiki/config.rb, hiki/plugin.rb: use Config#admin_name as a admin's login name. 2005-06-13 Kazuhiko <kazuhiko@fdiary.net> * plugin/00default.rb: use '@user' for a commit message if exists. * hiki/repos/svn.rb (ReposSvnBase::commit, ReposSvnBase::delete): add a second argument for a commit message. * hiki/repos/cvs.rb: ditto. * hiki/repos/default.rb (ReposDefault::default_msg): add a new method for the default commit message. 2005-06-12 Kazuhiko <kazuhiko@fdiary.net> * misc/plugin/edit_user.rb (saveconf_edit_user): fix a typo of the field name for user authentication (report by ISOBE, Kazuhiko). 2005-06-11 Kazuhiko <kazuhiko@fdiary.net> * style/default/parser.rb: revise the regexp of PLUGIN not to allow '}}' in arguments. 2005-06-10 Kazuhiko <kazuhiko@fdiary.net> * misc/plugin/search.rb (search_form): rename from 'search'. use 'export_plugin_methods'. add resource files. * hiki/plugin.rb (Plugin::load_plugin): 'export_plugin_methods' now works for not only a plugin but also a plugin and its resource files. * misc/plugin/attach/attach.rb: set the default value of 'attach.form' to 'edit'. * hiki/command.rb (Command::cmd_view): not add a search link to 'view_title'. 2005-06-09 Kazuhiko <kazuhiko@fdiary.net> * hiki/plugin.rb (Plugin::load_file): export no methods if 'export_plugin_methods' is called without arguments. 2005-06-09 Kouhei Yanagita <sugi@dream.big.or.jp> * misc/plugin/google-sitemaps.rb: add a new plugin. 2005-06-09 Kazuhiko <kazuhiko@fdiary.net> * template/login.html: add a new template. input name and password. * hiki/plugin.rb (Plugin::admin?): add a new method. * template/edit.html: remove a password field. display a checkbox to freeze a page for 'admin' only. * plugin/00default.rb: display acceptable menues only. * hiki/command.rb (Command::cmd_save): use Plugin#admin?. * hiki/storage.rb (HikiDBBase::backup): add a new method. * hiki/db/flatfile.rb (HikiDB::store): call backup method first. * hiki/pluginutil.rb (Util::convert_value, Util::argwords): take '0123' as String. * hiki/util.rb (Util::redirect): use 'Location' header instead of 'meta refresh'. * hiki/command.rb (Command::initialize): automatically login as 'admin' if admin password is empty. 2005-06-08 Kazuhiko <kazuhiko@fdiary.net> * hiki/config.rb (Config::default): add an entry of 'login' in @template. * hiki/command.rb (Command::cmd_theme, Command::admin_enter_password): remove needless methods. * misc/plugin/edit_user.rb: add a new plugin. * hiki/command.rb (cmd_login): support @conf['user.list'] that is made by 'edit_user.rb' plugin. * misc/plugin/rss.rb: use export_plugin_methods. support hiding RSS menu. * hiki/storage.rb (load_cache): only use cache files with same HIKI_RELEASE_DATE. * style/default/parser.rb: support multiple line plugins. * style/default/html_formatter.rb (call_plugin_method): use apply_plugin method in pluginutil.rb. * hiki/util.rb (csv_split): remove a needless method. 2005-06-07 Kazuhiko <kazuhiko@fdiary.net> * messages/en.rb, messages/fr.rb, messages/it.rb, messages/ja.rb (msg_password_title): remove a needless message. (msg_login): add a new message. * misc/plugin/auth_typekey.rb: save 'auth_name' in a session file instead of browser's cookie. * hiki/command.rb (Command::cmd_view): redirect to FrontPage if a page name is invalid. (Command::template, Command::themes): remove needless methods. 2005-06-06 Kazuhiko <kazuhiko@fdiary.net> * hiki/page.rb (Page::process): rename from 'Page#page'. (Page::out): add a new method. * hiki/command.rb (Command::initialize): not put @plugin to @db. (dispatch): redirect to FrontPage if a command is invalid. (Command::themes): remove a needless method. * hiki/storage.rb (HikiDBBase::save): move to 'Plugin#save'. * misc/plugin/bbs.rb, misc/plugin/comment.rb, misc/plugin/trackback.rb: use 'Plugin#save' instead of 'DB#save'. * hiki/plugin.rb (Plugin::load_file): rename from 'Plugin#load'. * hiki/config.rb (Config::load): fix a typo (main_on_update -> mail_on_update). (Config::read_template): add a new method. 2005-06-06 Kouhei Yanagita <sugi@dream.big.or.jp> * misc/plugin/{rss-show.rb,trackback.rb}: remove needless `require's. 2005-06-06 Kouhei Yanagita <sugi@dream.big.or.jp> * misc/plugin/rss-show.rb (rss_parse): use Hiki::Util::utf8_to_euc. * misc/plugin/trackback.rb (trackback_post): use Hiki::Util::utf8_to_euc. 2005-06-03 Masanori KADO <QVE02451@nifty.com> * misc/plugin/rss-show.rb (rss_show): add an argument to set the number of items. 2005-05-30 Kazuhiko <kazuhiko@fdiary.net> * style/default/parser.rb (Parser_default::inline_impl): treat as 'reference' if interwiki's name is empty. 2005-05-24 Kazuhiko <kazuhiko@fdiary.net> * hiki/util.rb (Util::sendmail): make a MIME encoded subject. (Util::send_updating_mail): use 'site_name' as a prefix of a subject (by kdmsnr). 2005-05-22 KOMATSU Shinichiro <koma2@lovepeers.org> * misc/plugin/attach/attach.cgi (attach_file): If the attached file contains scripts, deny it. ([Hiki-dev:00747]) 2005-05-21 Kouhei Yanagita <sugi@dream.big.or.jp> * hiki/image_size.rb (ImageSize::check_type): revise HTML detection algorithm. 2005-05-21 Kazuhiko <kazuhiko@fdiary.net> * hiki/image_size.rb (ImageSize::check_type): revise HTML detection algorithm. * misc/plugin/attach/attach.rb (attach_download): use 'image_size' library and set 'Content-Disposition: inline' if an attached file is an image. * hiki/image_size.rb: add a new file made by Keisuke Minami. (ImageSize::mime_type): add a new method. (ImageSize::check_type): treat as non-image file if 'script' tags are included. * misc/hikifarm/index.cgi: support symlinks. 2005-05-21 Kouhei Yanagita <sugi@dream.big.or.jp> * misc/hikifarm/{index.cgi,hikifarm.conf,template/*}: separate template files of Hikifarm. 2005-05-21 Kazuhiko <kazuhiko@fdiary.net> * misc/hikifarm/index.cgi: support RSS output and add a link to a wiki without any page by Kouhei Sutou. * misc/hikifarm/index.cgi: define 'hikifarm_path' automatically. 2005-05-19 Kazuhiko <kazuhiko@fdiary.net> * misc/hikifarm/index.cgi: support hiki.conf made by hiki 0.6.x. 2005-05-19 Kouhei Yanagita <sugi@dream.big.or.jp> * hiki.cgi: use CGI.escapeHTML. 2005-05-19 Kouhei Yanagita <sugi@dream.big.or.jp> * hiki.cgi: use text/html (not text/plain) to show error page when an exception is raised. 2005-05-17 Kazuhiko <kazuhiko@fdiary.net> * misc/plugin/local_css.rb: remove. use 'append-css.rb' instead. * hiki/util.rb: change the class name from 'DocDiff' to 'Diff'. * hiki/config.rb: add a new constant 'HIKI_RELEASE_DATE'. 2005-05-12 Kazuhiko <kazuhiko@fdiary.net> * misc/plugin/attach/attach.rb (attach_image_anchor): remove a needless tag (report by 7743). * style/rd+/rd2html.rb (RD2HTMLVisitor::apply_to_Verbatim): support tables if RTtool is available (by GOTOU Yuuzou). * style/default/parser.rb (Parser_default::inline_impl): support a block plugin (by Yazawa). 2005-05-11 Kazuhiko <kazuhiko@fdiary.net> * misc/hikifarm/index.cgi: revise for mod_ruby. support a wiki without any page. * style/default/html_formatter.rb (HTMLFormatter_default::token_to_s): display page's title if available. 2005-05-10 Kazuhiko <kazuhiko@fdiary.net> * hiki.cgi, misc/plugin/attach/attach.cgi: use absolute paths for load paths. 2005-05-09 Kouhei Yanagita <sugi@dream.big.or.jp> * misc/hikifarm/*: Hikifarm のコードを書き直し、 バージョン管理バックエンドのセットアップを分離した。 * test/test_hikifarm.rb: Hikifarm の Test Case を追加した。 2005-05-09 Kazuhiko <kazuhiko@fdiary.net> * hiki/storage.rb (HikiDBBase::save_cache): revise for mod_ruby (by Yazawa). * style/default/parser.rb (parse_line): not make empty <dt> tags. 2005-05-08 Kazuhiko <kazuhiko@fdiary.net> * misc/plugin/footnote.rb (fn): fix a multiple escapeHTML problem. 2005-05-06 Kazuhiko <kazuhiko@fdiary.net> * hiki.cgi, misc/plugin/attach/attach.cgi: support a relative symlink link. 2005-05-02 Kazuhiko <kazuhiko@fdiary.net> * hiki-mode.el (hiki-fetch-source): follow the change of 'edit.rhtml'. 2005-04-27 Kazuhiko <kazuhiko@fdiary.net> * hiki/page.rb (Page::page): set an empty 'page_attribute' if nil. 2005-04-26 Kazuhiko <kazuhiko@fdiary.net> * misc/plugin/rss-show.rb (rss_parse): revise a regexp of rss (by kdmsnr). * hiki/storage.rb (HikiDBBase::load_cache): read cache files by binary mode. 2005-04-22 Kazuhiko <kazuhiko@fdiary.net> * template/adminform.html: output a correct <h2> header (by Yazawa). * hiki/command.rb (Command::cmd_edit), template/edit.html, template/view.html: output more valid HTML (by Yazawa). * hiki.cgi: remove the current directory from $: when it is writable. 2005-04-20 Kouhei Yanagita <sugi@dream.big.or.jp> * hiki/misc/hiki-mode/*: hiki-mode.el を Attic から復活。 2005-04-11 Kouhei Yanagita <sugi@dream.big.or.jp> * hiki/style/default/html_formatter.rb (token_to_s): h2 の span.sanchor に `_' を入れていたのをやめて、  にした。 2005-04-10 Kouhei Yanagita <sugi@dream.big.or.jp> * hiki/repos/svn.rb, hiki/repos/svnsingle.rb, misc/hikifarm/index.cgi, misc/hikifarm/hikifarm.conf: svn バックエ ンドで、リポジトリの作り方が変だったのを修正。 * misc/plugin/history.rb: svn バックエンドで、ログが表示されていな かったのを修正。 2005-04-05 Kazuhiko <kazuhiko@fdiary.net> * misc/hikifarm/index.cgi: fix a bug in collecting site_name (reported by kdmsnr). remove the current directory from $: when it is writable (by hsuzuki) 2005-04-01 Kazuhiko <kazuhiko@fdiary.net> * hiki/command.rb (Command::cmd_admin, Command::admin_config): 不要 なコードの削除 2005-03-26 Kazuhiko <kazuhiko@fdiary.net> * plugin/00default.rb (saveconf_theme): テーマ一覧取得のバグを修正 2005-03-24 Kouhei Yanagita <sugi@dream.big.or.jp> * misc/hikifarm/hiki.conf: hikifarm.conf の data_path の値を使うよ うに修正 2005-03-22 Kazuhiko <kazuhiko@fdiary.net> * misc/xmlrpc/xmlrpc.cgi: options['params'] の初期化のバグを修正 report by Yoshikazu TAKATA 2005-03-20 Kazuhiko <kazuhiko@fdiary.net> * hiki/interwiki.rb: utf8 に対応 report by Zeus 2005-03-18 Kouhei Yanagita <sugi@dream.big.or.jp> * plugin/00default.rb, style/default/html_formatter.rb, style/rd+/rd2html.rb: URL 形式のリンクに class="external" を付けた。 2005-03-17 Kazuhiko <kazuhiko@fdiary.net> * misc/xmlrpc/xmlrpc.cgi: XMLRPC サーバを追加 2005-03-15 TAKEUCHI Hitoshi <hitoshi@namaraii.com> * misc/plugin/00default.rb, misc/plugin/*/00default.rb: パスワード 変更時、パスワード間違っている場合にエラーメッセージを表示するよう に修正 thanks to Kouhei Yanagita * misc/plugin/keyword.rb: <h2> から <h3>へ変更 * misc/plugin/referer.rb: ファイル名をuntaintするように修正 by NOB 2005-03-14 Kazuhiko <kazuhiko@fdiary.net> * misc/plugin/attach/attach.cgi: ファイル名を保存時にエスケープする ように修正 by Yazawa 2005-03-06 Kazuhiko <kazuhiko@fdiary.net> * misc/plugin/auth_typekey.rb: token を設定するまでは auth が true になるように修正 * misc/plugin/ja/auth_typekey.rb: リソースの分離 * misc/plugin/math.rb: 設定画面の出力をエスケープするように修正 2005-03-06 TAKEUCHI Hitoshi <hitoshi@namaraii.com> * hiki/auth/typekey.rb: conf_proc への対応 * hiki/session.rb: セション有効期間を変更可能に 2005-03-05 TAKEUCHI Hitoshi <hitoshi@namaraii.com> * hiki/command.rb hiki/config.rb plugin/00default.rb style/default/html_formatter.rb theme/hiki/hiki.css misc/plugin/auth_typekey.rb hiki/auth/typekey.rb: TypeKey 認証の サポート。 * misc/plugin/note.rb: 認証されていない場合はメニューを出さない * misc/plugin/bbs.rb misc/plugin/comment.rb: 認証されている場合 名前欄に設定。 2005-03-04 Kazuhiko <kazuhiko@fdiary.net> * misc/plugin/ja/attach.rb misc/plugin/ja/bbs.rb misc/plugin/ja/comment.rb misc/plugin/ja/frozenmark.rb misc/plugin/ja/history.rb misc/plugin/ja/referer.rb misc/plugin/ja/src.rb misc/plugin/ja/template.rb: 日本語リソースを 分離 * hiki/plugin.rb (Plugin::load_plugin): プラグイン本体のロードをリ ソースのロードよりも先に行うように修正 → この変更はキャンセル 2005-03-03 Kazuhiko <kazuhiko@fdiary.net> * misc/plugin/rss.rb: 出力のフォーマットに従来の unified diff に加 えて word diff (ダイジェスト) と word diff (全文) を選べるようにし て、管理画面での設定に対応 * hiki/util.rb (Util::word_diff): 第 3 引数を digest モードの真偽に 変更 (デフォルトは偽) (Util::word_diff_text): plain text 用 word_diff メソッドを移動 * hiki/docdiff/view.rb (View::apply_style_digest): 差分が無いときは 空 Array を返すように変更 (View::html_tags): <ul>...</ul> 内の <hr /> を削除 * misc/plugin/incremental_search.rb: ajaxsearch.rb から改名 2005-03-02 Kazuhiko <kazuhiko@fdiary.net> * misc/plugin/footnote.rb: view 時以外は add_*_proc を実行しないよ うに修正 * misc/plugin/ajaxsearch.rb: 新プラグインの追加 by Michitaka Ohno * hiki/plugin.rb (Plugin::add_plugin_command): display_text が偽の 時は plugin_menu に追加しないように変更 * hiki/command.rb (Command::dispatch): プラグインの提供するコマンド を優先するように変更 2005-03-01 Kazuhiko <kazuhiko@fdiary.net> * hiki/plugin.rb (Plugin::initialize): インスタンス変数 '@cookies' を追加 (Plugin::cookie_path): 新メソッドの追加 * hiki/page.rb (Page::page): クッキーがあれば出力するように変更 * template/adminform.html: セッション ID をクエリーで渡すのを廃止 * hiki/command.rb (Command::cmd_admin): セッションの管理をクッキー で行うように変更 (Command::cmd_logout): ログアウトの追加 * plugin/00default.rb (hiki_menu): ログアウトの追加 * hiki/session.rb (Session::delete): 新メソッドの追加 (Session::initialize): 有効期限が切れたセッションファイルのみ削除す るように変更 * plugin/en/00default.rb, messages/en.rb: メッセージの修正 by Steve Brumbaugh 2005-02-28 Kazuhiko <kazuhiko@fdiary.net> * hiki/command.rb (cmd_create): 新規作成時に CGI 変数 'text' でデフォ ルトのテキストを指定できるように変更 * misc/plugin/note.rb: 新プラグインの追加 thanks to joesaisan 2005-02-21 Kazuhiko <kazuhiko@fdiary.net> * misc/plugin/rss.rb (rss_body): diff が空の時は先頭を出力するよう に変更 2005-02-16 Kazuhiko <kazuhiko@fdiary.net> * misc/plugin/rss.rb (rss_body), misc/plugin/src.rb (src), misc/plugin/history.rb (history_src): 空白を ' ' で出力する用 に修正 2005-02-15 Kazuhiko <kazuhiko@fdiary.net> * misc/plugin/src.rb (src), misc/plugin/history.rb (history_src, history_diff): 出力を <pre> から <div> に変更 (parse_history): require 'time' の追加 2005-02-14 Kazuhiko <kazuhiko@fdiary.net> * hiki/command.rb (cmd_edit, cmd_diff), template/diff.html, template/edit.html, misc/plugin/rss.rb: diff の出力を <pre> から <div> に変更 * hiki/pluginutil.rb (Hiki::Util::methodwords): パースの修正 by Masao Mutoh * misc/plugin/comment.rb (rcomment): 逆順コメント用メソッド 'rcomment' の追加 by KADO Masanori 2005-02-08 Kazuhiko <kazuhiko@fdiary.net> * misc/plugin/history.rb: リンクの追加 by Kouhei Sutou 2005-02-01 Kazuhiko <kazuhiko@fdiary.net> * misc/plugin/diffmail.rb: プラグインによる更新時に、タイトルやキー ワードが変化したように報告される不具合を修正 2005-01-31 Kazuhiko <kazuhiko@fdiary.net> * plugin/en/00default.rb, plugin/fr/00default.rb, plugin/it/00default.rb, plugin/ja/00default.rb: プルダウンの設定項 目をあらかじめ選択するように修正 report by GOTO Naohisa * hiki/command.rb (admin_config), hiki/page.rb (page): save_config の呼び出し条件を確認するように修正 * hiki/plugin.rb (initialize): 例外時にプラグインのファイル名が表示 されるように修正 by U.Nakamura * hiki/storage.rb (load_cache, save_cache, delete_cache): パ−サ キャッシュの処理を command.rb から移動 (save, delete): delete_cache を呼ぶように変更 * hiki/command.rb (cmd_view): 上記を使うように変更 (cmd_save): キャッシュの削除は上記で行うように変更 2005-01-30 Kazuhiko <kazuhiko@fdiary.net> * misc/plugin/diffmail.rb: タイトル比較のエスケープを修正 * style/default/html_formatter.rb (apply_tdiary_theme): H2 がない場 合に本文が出力されない不具合の修正 report by kdmsnr * hiki/plugin.rb (load_plugin): 言語リソースがない時に英語または日 本語のリソースをロードするように変更 * template/hiki.conf: options2 の保存に TMarshal::dump を使うように 変更 2005-01-29 Kazuhiko <kazuhiko@fdiary.net> * hiki/command.rb (load_plugin): Hiki::Plugin クラスに移動 * plugin/01sp.rb, plugin/en/01sp.rb, plugin/fr/01sp.rb, plugin/it/01sp.rb, plugin/ja/01sp.rb: tDiary のプラグイン選択プラグ インを導入 (fr, it は未訳) * style/math/html_formatter.rb, style/math/latex.rb, misc/plugin/math.rb: style/math/parser.rb: Math スタイルの拡張 by Kenta MURATA * hiki/config.rb, template/hiki.conf: tDiary 風にプラグインのオプショ ンを保存できるように変更 2005-01-28 Kazuhiko <kazuhiko@fdiary.net> * plugin/00default.rb (hiki_header): タイトルが二度 escapeHTML され ているのを修正 * style/default/html_formatter.rb (auto_link): オートリンクのページ 名が二度 escapeHTML されているのを修正 * style/default/html_formatter.rb: より tDiary 風の HTML を出力する ように修正 by す * data/text/InterWikiName, misc/text/default/InterWikiName, misc/text/rd+/InterWikiName: RWiki のリンクを更新 by す 2005-01-27 Kazuhiko <kazuhiko@fdiary.net> * misc/plugin/diffmail.rb: diffmail2.rb の内容で上書き * hiki/command.rb (cmd_edit): conflict 時の diff を word_diff に変更 * hiki/util.rb (diff_t, diff): 削除 (unified_diff): DocDiff::EditScript#unidiff に変更 * hiki/storage.rb (diff): 削除 2005-01-26 Kazuhiko <kazuhiko@fdiary.net> * hiki/command.rb (cmd_view): parser の出力をキャッシュ (cmd_save): parser キャッシュを削除 2005-01-24 Kazuhiko <kazuhiko@fdiary.net> * hiki/command.rb, hiki/page.rb, hiki/util.rb: Amrita の代わりに erb を使用するように変更 * hiki/config.rb: lang 設定によらず共通のテンプレートファイルを使用 するように変更 * hiki/plugin.rb, plugin/00default.rb: conf_proc に対応 * plugin/en/00default.rb, plugin/ja/00default.rb: 追加 2005-01-23 Kazuhiko <kazuhiko@fdiary.net> * style/default/html_formatter.rb (apply_tdiary_theme): 見出し行連 続時に出力されない不具合の修正 by す 2005-01-21 Kazuhiko <kazuhiko@fdiary.net> * hiki/repos/cvs.rb, hiki/repos/svn.rb: 開設者の IP アドレスをイン ポート時のコミットログに記すように変更 2005-01-15 Kazuhiko <kazuhiko@fdiary.net> * style/default/html_formatter.rb (token_to_s, tdiary_section): 不 要な改行の削除 report by ibs 2005-01-14 Kazuhiko <kazuhiko@fdiary.net> * misc/plugin/rss.rb (rss_body): <language> を <dc:language> に、 <copyright> を <dc:rights> に変更 by Masahiro Sakai * hiki/util.rb: Hash#key が無い場合に定義するように変更 * hiki/aliaswiki.rb, style/default/html_formatter.rb: Hash#index の 代わりに Hash#key を使うように変更 2005-01-10 Kazuhiko <kazuhiko@fdiary.net> * misc/plugin/attach/attach.cgi: hiki/ を $: に追加するように変更 * hiki/util.rb (Hiki::Util::euc_to_utf8, Hiki::Util::utf8_to_euc): 追加 2005-01-08 Kazuhiko <kazuhiko@fdiary.net> * hiki/command.rb (Hiki::Command::cmd_edit): コンフリクト時の バグの修正 2005-01-07 Kazuhiko <kazuhiko@fdiary.net> * misc/plugin/footnote.rb (render): footnote プラグイン内部ではプラ グインを無効にするように修正 * hiki/docdiff/charstring.rb: 今のところ Hiki では不要な require 'iconv' を削除 * hiki/config.rb (Hiki::Config::bot?): 追加 * plugin/00default.rb (hiki_menu): bot アクセス時はページ一覧以外の メニューを出さないように変更 * template/en/view.html, template/fr/view.html, template/it/view.html, template/ja/view.html: page_title のリンクを 削除 2005-01-06 Kazuhiko <kazuhiko@fdiary.net> * hiki/docdiff: 追加 <http://raa.ruby-lang.org/project/docdiff/> * hiki/util.rb (Hiki::Util::word_diff): 追加 * hiki/command.rb (Hiki::Command::cmd_diff): word_diff を使うように 変更 * misc/plugin/history.rb: word_diff を使うように変更 * hiki.cgi: hiki/ を $: に追加するように変更 2005-01-04 Kazuhiko <kazuhiko@fdiary.net> * misc/plugin/rss.rb (rss_body): 差分を content:encoded として出力 するように変更 * hiki/util.rb (Hiki::Util::diff): 引数を「差分、旧、HTML フラグ」 から「旧、新、HTML フラグ」に変更 * hiki/command.rb (Hiki::Command::cmd_edit, Hiki::Command::cmd_diff): Hiki::Util::diff の仕様にあわせて変更 * hiki/util.rb (Hiki::Util::unified_diff): 追加 * misc/plugin/diffmail2.rb (updating_mail): Hiki::Util::unified_diff を使うように変更 * misc/plugin/diffmail.rb (updating_mail): Hiki::Util::diff を使う ように変更 * hiki/db/ptstore.rb: ruby-1.8.2 の pstore.rb に追従 2005-01-03 Kazuhiko <kazuhiko@fdiary.net> * hiki/db/tmarshal.rb: 標準クラスに dump_text を追加するのを廃止 (TMarshal::dump_text): 追加。Hash の出力を key でソートするように変 更 (TMarshal::load): String の場合は read を呼ばないように変更 * hiki/db/flatfile.rb (Hiki::HikiDB::touch): 削除 2004-12-31 Kazuhiko <kazuhiko@fdiary.net> * misc/plugin/attach/attach.rb: 強制的にダウンロードされるように修 正 report by Kazuhiro NISHIYAMA 2004-12-26 KOMATSU Shinichiro <koma2@ms.u-tokyo.ac.jp> * hiki/command.rb: hiki/hiki_formatter.rb は使われていないので、 require しない。 2004-12-25 Kazuhiko <kazuhiko@fdiary.net> * hiki/parser.rb: 使われていないので削除 2004-12-24 KOMATSU Shinichiro <koma2@ms.u-tokyo.ac.jp> * misc/plugin/quote_page.rb: s/Parser/@conf.parser/; s/HTMLFormatter/@conf.formatter/ * misc/plugin/about.rb: s/Parser/Parser_default/; s/HTMLFormatter/HTMLFormatter_default/ reported by Kouhei Yanagita ([Hiki-dev:00615]) 2004-12-22 Kazuhiko <kazuhiko@fdiary.net> * style/default/html_formatter.rb, style/default/parser.rb: コード の整理 by Kenta MURATA * style/math/html_formatter.rb, style/math/latex.rb, misc/plugin/math.rb: style/math/parser.rb: Math スタイルの追加 by Kenta MURATA 2004-12-19 Kazuhiko <kazuhiko@fdiary.net> * hiki/util.rb (Hiki::Util::send_updating_mail): HTTP 認証時は REMOTE_USER 情報を付加するように変更 by Zaki 2004-12-18 Kazuhiko <kazuhiko@fdiary.net> * misc/plugin/attach/attach.cgi: アップロードするファイルサイズの最 大値を @options['attach_size'] で指定できるように修正 (無指定時は 1MB) 2004-12-18 KOMATSU Shinichiro <koma2@ms.u-tokyo.ac.jp> * hiki/db/flatfile.rb (Hiki::HikiDB), hiki/config.rb (Hiki::Config): Hiki::Config の @pages_path, @backup_path, @info_db は Hiki::HikiDB に移動。@pages_path のみ attr_reader として 外部から読むことを可能にする。 * misc/plugin/history.rb: 上記の変更に対応 * hiki/db/flatfile.rb (Hiki::HikiDB::create_infodb): private メソッドに変更。 * hiki/db/flatfile.rb (Hiki::HikiDB::create_missing_dirs): 追加(private)。@pages_path, @backup_path が存在しない時は作成する。 * hiki/db/flatfile.rb (Hiki::HikiDB::textdir, Hiki::HikiDB::backupdir): File::join を使用。 2004-12-18 Kazuhiko <kazuhiko@fdiary.net> * hiki/util.rb (Hiki::Util::diff): テキスト用の差分出力に対応 * style/default/html_formatter.rb, style/rd+/html_formatter.rb: diff メソッドを Hiki::Util モジュールに移動 2004-12-16 Kazuhiko <kazuhiko@fdiary.net> * hiki/db/ptstore.rb (PTStore::transaction): 確実にアンロックするよ うに修正 2004-12-15 Kazuhiko <kazuhiko@fdiary.net> * misc/plugin/footnote.rb: 不具合の修正 2004-12-14 Kazuhiko <kazuhiko@fdiary.net> * hiki.cgi: コードの整理 * messages/en.rb, messages/fr.rb, messages/it.rb, messages/ja.rb: 個別のモジュール名で定義するように変更 * hiki/command.rb, hiki/config.rb, hiki/storage.rb, hiki/util.rb, misc/plugin/recent2.rb: それにあわせた変更 * hiki/command.rb, hiki/config.rb, misc/plugin/footnote.rb, misc/plugin/history.rb: conf.parser と conf.formatter を String で はなく Class で保存するように変更 * misc/plugin/footnote.rb: 脚注の中身をパースするように変更 * misc/plugin/attach/attach.cgi: $SAFE = 1 向け修正 by KAKUTANI Shintaro * misc/plugin/attach/attach.rb: 拡張子に sql と yaml を追加 2004-12-14 KOMATSU Shinichiro <koma2@ms.u-tokyo.ac.jp> * misc/hikifarm/index.cgi, hiki/config.rb, hiki/repos/cvs.rb hiki/repos/default.rb hiki/repos/svn.rb, hiki.cgi, plugin/00default.rb: hikifarm と plugin の中の リポジトリ回りのコードを hiki/repos/ に移動 ([Hiki-dev:00600])。 2004-12-07 Kazuhiko <kazuhiko@fdiary.net> * data/text/EnglishTextFormattingRules, misc/text/default/EnglishTextFormattingRules: 英語版の追加 thanks to Steve Brumbaugh 2004-10-31 Kazuhiko <kazuhiko@fdiary.net> * misc/plugin/history.rb (Hiki::History::history_diff): svn での不 具合の修正 by zaki * misc/plugin/history.rb (Hiki::History::history): svn での不具合 の修正 by 滝沢 * misc/hikifarm/index.cgi: $SAFE = 1 向け修正 by 柳田 2004-09-28 Kazuhiko <kazuhiko@fdiary.net> * theme/hiki/hiki.css: IE5 向けに @media screen に div.main を追加 * misc/plugin/rss.rb: RSS Auto Discovery に対応 by 柳田 * misc/hikifarm/index.cgi: $SAFE = 1 の追加 by 柳田 2004-09-23 Kazuhiko <kazuhiko@fdiary.net> * misc/plugin/referer.rb: escapeHTML するように修正 thanks to みや ざわ * misc/hikifarm/index.cgi: POST メソッドか判定するように修正 2004-09-22 Kazuhiko <kazuhiko@fdiary.net> * misc/plugin/attach/attach.cgi: ページ名の escape しすぎを修正 $defout.binmode の追加 2004-09-14 Kazuhiko <kazuhiko@fdiary.net> * misc/plugin/attach/attach.rb (attach_src): @options['attach.show_linenum] が true なら行番号を表示するように 変更 * hikiconf.rb.sample, hiki/config.rb, style/default/html_formatter.rb: WikiName によるリンクを使うかどう かを @use_wikiname で制御できるように変更 2004-09-13 Kazuhiko <kazuhiko@fdiary.net> * hiki/util.rb (Hiki::Util::shorten): 追加 * misc/plugin/trackback.rb: TrackBack 受信時刻の表示を追加。長すぎ る excerpt を shorten するように変更 * hiki/config.rb, hiki/util.rb: Hiki::Util::base_url から Hiki::Config::base_url に移動 * hiki/config.rb: index_page を廃止し、かわりに index_url を追加。 base_url と cgi_name から自動生成 * hikiconf.rb.sample, misc/hikifarm/hiki.conf, misc/plugin/attach/attach.cgi, misc/plugin/rss.rb, misc/plugin/trackback.rb: 上記の変更に伴う修正 2004-09-10 Kazuhiko <kazuhiko@fdiary.net> * hiki.cgi, misc/plugin/trackback.rb: {{trackback}} と書いたページ に trackback URI を表示するように変更 * misc/plugin/trackback.rb: tdiary テーマ向け修正 by MACHIDA Hideki * hiki/command.rb (Hiki::Command::get_recent): 各ページの差分への リンクを追加 * hiki.cgi: TrackBack 向けの変更 * misc/plugin/trackback.rb: TrackBack プラグインの追加 * hiki/util.rb (Hiki::Util::set_conf): @conf 設定用メソッドを追加 (Hiki::Util::base_url): 追加 * misc/plugin/attach/attach.rb: [重要] HikiFarm 使用時に、個別の Hiki 毎に attach.cgi を設置するように変更。hidden 属性の cache_path と index_page を廃止。 * misc/plugin/attach/attach.cgi: config を読むように変更。 2004-09-09 Kazuhiko <kazuhiko@fdiary.net> * misc/plugin/history.rb (Hiki::History::history_diff): ヘッダを除 く処理が gsub! だったのを sub! に修正 * hiki/db/flatfile.rb (Hiki::HikiDB::set_attribute): db に情報が内 場合にエラーにならないように修正 * hiki/command.rb (Hiki::Command::cmd_save): @options['freeeze'] も参照するように修正 * misc/plugin/diffmail2.rb: 差分周辺だけを通知する diffmail.rb の 改良版。タイトルやキーワードの変更も通知 thanks to zunda 2004-09-08 Kazuhiko <kazuhiko@fdiary.net> * hiki/command.rb (Hiki::Command::cmd_edit): @options['freeeze'] が true の場合、強制的に凍結されるように変更 2004-09-07 Kazuhiko <kazuhiko@fdiary.net> * misc/plugin/rss.rb: rss_anchor の削除、rss の body 作成を rss_body に分離 2004-09-06 Kazuhiko <kazuhiko@fdiary.net> * plugin/00default.rb (hiki_anchor): FrontPage の場合はページ名を URI に付加しないように変更 * misc/hikifarm/index.cgi (ReposSvn::import): svn import の前に svnadmin create を呼ぶように修正 (ReposSvn::imported): trunk/ 以外のディレクトリが含まれていても動 作するように修正 * misc/plugin/history.rb (Hiki::History::history): time のパースで locale による出力を削除するように修正 2004-09-01 Kazuhiko <kazuhiko@fdiary.net> * hiki/command.rb, hiki/util.rb, misc/plugin/history.rb: eval では なく Mudule#const_get を使用するように変更 2004-08-31 Kazuhiko <kazuhiko@fdiary.net> * misc/plugin/en/history.rb: 英語リソースを追加 * misc/hikifarm/hiki.conf: @repos_type の設定を追加 * misc/hikifarm/index.cgi: Wiki 数とページ数の合計を出力するように 変更、最終更新ページの差分へのリンクを追加、@repos.update を呼ばな いように変更 * hiki/config.rb: @style に応じて @parser および @formatter を定義 * hiki/command.rb, hiki/util.rb, misc/plugin/history.rb: conf.parser および conf.formatter を使うように変更 * style/default/html_formatter.rb: クラス名を HTMLFormatter_default に変更し、HikiFormatter を継承 * style/rd+/html_formatter.rb: クラス名を HTMLFormatter_rd に変更 し、HikiFormatter を継承 * misc/hikifarm/index.cgi (ReposCvs::import): 数字で始まる wiki を import できるように、vendor-tag の先頭に 'T' を追加 2004-08-12 Kazuhiko <kazuhiko@fdiary.net> * hiki/pluginutil.rb: lstrip を ruby-1.6 で動くように修正 2004-08-09 Kazuhiko <kazuhiko@fdiary.net> * hiki/session.rb (check): 「最初に認証した時から 10 分ではなく、 最後にそのセッションが有効だと確認してから 10 分」に変更 by FUKUOKA Tomoyuki * template/: <div class="recentsubtitles">〜</div> を削除 by MACHIDA Hideki 2004-08-07 Kazuhiko <kazuhiko@fdiary.net> * misc/plugin/attach/attach.rb: page を escapeHTML するように修正 thanks to yoggy * misc/plugin/bbs.rb, misc/plugin/comment.rb, misc/plugin/template.rb: page を escapeHTML するように修正 2004-07-26 Kazuhiko <kazuhiko@fdiary.net> * misc/plugin/attach/attach.rb (attach_src): page を untaint する ように修正 thanks to MACHIDA Hideki * hiki/plugin.rb (initialize): @conf を再作成しないように修正 thanks to MACHIDA Hideki 2004-07-03 Kazuhiko <kazuhiko@fdiary.net> * hiki/util.rb (sendmail): from_addr を untaint するように修正 2004-07-01 TAKEUCHI Hitoshi <hitoshi@namaraii.com> * hiki/db/flatfile.rb, ptstore.rb, misc/plugin/referer.rb : mod_ruby時のキャッシュファイル開放漏れ修正 2004-06-30 TAKEUCHI Hitoshi <hitoshi@namaraii.com> * hiki/db/ptstore.rb: 読み込み時のキャッシュ対応 by matsui 2004-06-30 Kazuhiko <kazuhiko@fdiary.net> * hiki/config.rb (load_cgi_conf): Thread を join するように修正 thanks to yoggy 2004-06-28 TAKEUCHI Hitoshi <hitoshi@namaraii.com> * misc/plugin/history.rb: r を escapeHTML するように修正 thanks to Kouhei Sutou 2004-06-27 Kazuhiko <kazuhiko@fdiary.net> * hiki/config.rb (load_cgi_conf): $SAFE=4 で評価するように変更 2004-06-26 Kazuhiko <kazuhiko@fdiary.net> * template/en/edit.html, template/fr/edit.html, it/edit.html, template/ja/edit.html: 書き方へのリンクを修正 2004-06-23 Kazuhiko <kazuhiko@fdiary.net> * hiki/session.rb (session_path): NetBSD 対策のため末尾に '/' を付 けないように修正 thanks to zunda * misc/plugin/attach/attach.rb (attach_form): page を escapeHTML するように修正し、出力される HTML を修正 * misc/plugin/local_css.rb (about_local_css): theme_url と local_theme_url をescapeHTML するように修正 * plugin/00default.rb (hiki_header): base_css と theme_url を escapeHTML するように修正 * hiki/storage.rb (search): 検索結果を escapeHTML するように修正 * hiki/command.rb (cmd_edit): pagename を escapeHTML するように修 正 * misc/plugin/pagerank.rb: title と stylesheet を escapeHTML し、 URI を escape するように修正 * hiki/command.rb (cmd_diff), hiki/util.rb (title): escapeHTML し すぎなバグを修正 2004-06-22 Kazuhiko <kazuhiko@fdiary.net> * hiki/config.rb (save_config): String の際は dump を使うように修 正 thanks to akira yamada / やまだあきら * hiki/page.rb (page): HEAD アクセス時のみ Last-Modified を返すよ うに修正 * hiki/config.rb (load): 旧フォーマットの hikiconf.rb 使用時にエラー を出すように修正 * hiki/command.rb (admin_save_config): パスワード無しの場合もセッ ションを確認するように修正 thanks to sheepman * misc/plugin/history.rb: @options['history.hidelog'] に対応、テー ブルのスタイルシートはテーマに任せるように修正 2004-06-18 Kazuhiko <kazuhiko@fdiary.net> * hiki/config.rb: 設定項目のデフォルト値を用意するように修正 * hiki/config.rb (default), hiki/util.rb, plugin/00default.rb: generator の定義を Config クラスに移動 * plugin/00default.rb (hiki_header): title 出力を escapeHTMLするよ うに修正 thanks to Yuya Yamaguchi 2004-06-17 Kazuhiko <kazuhiko@fdiary.net> * hiki/session.rb: 新ファイル * hiki/command.rb, template/en/adminform.html, template/fr/adminform.html, it/adminform.html, template/ja/adminform.html: 管理モードでセッション管理するように修 正 * hiki/command.rb (admin_config): title をつけるように修正 2004-06-16 Kazuhiko <kazuhiko@fdiary.net> * misc/hikifarm/index.cgi: title 取得の修正、title 出力を escapeHTMLするように修正 2004-06-15 Kazuhiko <kazuhiko@fdiary.net> * hiki.cgi: load を require に修正 * misc/plugin/attach/attach.cgi: $cgi_name を './' に変更 * hiki/config.rb: hiki.conf の前にデフォルト設定を読み込むように修 正 thanks to m_t * hiki/parser.rb, hiki/storage.rb, misc/plugin/src.rb: mod_ruby 対 応の修正 * style/default/html_formatter.rb: auto_link まわりの mod_ruby 対 応の修正 thanks to OZAWA Sakuro 2004-06-12 Kazuhiko <kazuhiko@fdiary.net> * misc/hikifarm/hikifarm.conf, misc/hikifarm/index.cgi: 設定項目 'cgi_name' を新設 * misc/hikifarm/index.cgi: 生成する Hiki CGI の require 'hiki' を load 'hiki.cgi' に修正 * hiki.cgi, hiki/aliaswiki.rb, hiki/command.rb, hiki/hiki_formatter.rb, hiki/interwiki.rb, hiki/page.rb, hiki/plugin.rb, hiki/pluginutil.rb, hiki/util.rb, hiki/db/flatfile.rb, misc/hikifarm/hiki.conf, misc/hikifarm/hikifarm.conf, misc/hikifarm/index.cgi, misc/plugin/bbs.rb, misc/plugin/comment.rb, misc/plugin/cvs.rb, misc/plugin/history.rb, misc/plugin/local_css.rb, misc/plugin/pagerank.rb, misc/plugin/rss.rb, misc/plugin/search.rb, misc/plugin/svn.rb, misc/plugin/attach/attach.cgi, misc/plugin/attach/attach.rb, plugin/00default.rb, style/default/html_formatter.rb, style/default/parser.rb, style/rd+/html_formatter.rb, style/rd+/parser.rb, style/rd+/rd2html.rb: mod_ruby 対応 * hiki/config.rb: Config クラス用ファイルを新設 * hiki/global.rb: Config#default に移行したため消去 * hikiconf.rb.sample, doc/INSTALL.txt, doc/VERSIONUP.txt: ドキュメ ントの修正 2004-06-11 Kazuhiko <kazuhiko@fdiary.net> * misc/plugin/rss.rb: site_name, author_name をエスケープするよう に修正 * misc/plugin/pagerank.rb, misc/plugin/rss.rb, misc/plugin/src.rb: CGI ヘッダの後に不要な改行の出力をしないように修正 2004-06-10 Kazuhiko <kazuhiko@fdiary.net> * hiki/util.rb (save_config): エスケープして保存するように修正 2004-05-12 Kazuhiko <kazuhiko@fdiary.net> * misc/plugin/attach/attach.rb: $SAFE=1 向けの修正 2004-04-18 Kazuhiko <kazuhiko@fdiary.net> * hiki/db/flatfile.rb: プラグインからのフォーム入力中の改行正規化 by さく <http://hiki.ex-machina.jp/crouton/?2004-03-29> * misc/plugin/attach/attach.rb: Last-Modified の出力 by matsui 2004-04-07 Kazuhiko <kazuhiko@fdiary.net> * misc/plugin/history.rb: $SAFE=1 向けの修正 by Kouhei Sutou * misc/plugin/cvs.rb: $SAFE=1 向けの修正 * misc/plugin/svn.rb: $SAFE=1 向けの修正 * hiki/pluginutil.rb: プラグイン評価用ファイル by Masao Mutoh * style/rd+/rd2html.rb: セキュリティバグの修正 by Masao Mutoh 2004-04-03 Kazuhiko <kazuhiko@fdiary.net> * misc/plugin/rss-show.rb (rss_show): $SAFE=1 向けの修正 by MACHIDA Hideki 2004-04-02 TAKEUCHI Hitoshi <hitoshi@namaraii.com> * style/default/html_formatter.rb, messages/en.rb, messages/ja.rb: 存在しないページを作成するアンカー ? にtitle属性をつける by OZAWA Sakuro 2004-03-17 Kazuhiko <kazuhiko@fdiary.net> * misc/plugin/attach/attach.rb: $SAFE=1 向けの修正 by HOSONO Hidetomo 2004-03-16 Kazuhiko <kazuhiko@fdiary.net> * misc/plugin/amazon.rb: $SAFE=1 向けの修正 2004-03-11 TAKEUCHI Hitoshi <hitoshi@namaraii.com> * style/default+/html_formatter.rb, style/rd+/html_formatter.rb: XSS脆弱性の修正 * template/en/edit.html: 英語テンプレートの修正 by mput 2004-03-09 Kazuhiko <kazuhiko@fdiary.net> * plugin/00default.rb (hiki_footer): 不要な <div> の削除 2004-03-05 TAKEUCHI Hitoshi <hitoshi@namaraii.com> * misc/plugin/pagerank.rb: 追加 by ichiyama ryoichi * hiki.cgi, hiki/command.rb, hiki/db/flatfile.rb, misc/plugin/attach/attach.rb, misc/plugin/amazon.rb: $SAFE=1 2004-03-04 Kazuhiko <kazuhiko@fdiary.net> * template/: テンプレートの整理 2004-03-04 TAKEUCHI Hitoshi <hitoshi@namaraii.com> * style/default/html_formatter.rb: XSS脆弱性の対処 thanks to SHIMADA Keiki <k-ki@a01.itscom.net> 2004-03-02 TAKEUCHI Hitoshi <hitoshi@namaraii.com> * misc/plugin/similarity.rb: 追加 2004-03-01 TAKEUCHI Hitoshi <hitoshi@namaraii.com> * v0_6ブランチのマージ 2004-03-01 Kazuhiko <kazuhiko@fdiary.net> * messages/en.rb: 不足しているリソースの追加 * template/en/adminform.html, template/en/edit.html, template/en/form.html: hiki.cgi → @cgi_name 2004-02-29 TAKEUCHI Hitoshi <hitoshi@namaraii.com> * misc/plugin/*.rb: Copytight表示の追加 * misc/plugin/splitpagename.rb: ページ名、タイトルなどの見直しに伴 い一時削除 * doc/*.txt: 文字コードをEUCに統一 * hikiconf.rb.sample: 設定例の変更 * plugin/remap_headings.rb: misc/pluginへ移動 * misc/hiki-farm/*: hiki-modeの同梱 by Hideaki Hori * theme/hiki/hiki.css: hilight時のCSSを追加 * hikiconf.rb.sample: キーワードハイライトをデフォルトの動作に変更 * misc/plugin/recent2.rb: 新規追加 by not * Version 0.6 リリース * misc/hikifarm/hiki.conf: $hilight_keysの追加 2004-02-15 TAKEUCHI Hitoshi <hitoshi@namaraii.com> * misc/plugin/local_css.rb, quote_page.rb, remap_headings.rb, about.rb: 新規追加 by OZAWA Sakuro * hiki/command.rb: preview時に空行がpreになるバグの対処 * misc/hikifarm/index.cgi, misc/plugin/svn.rb: history.rb対応の修 正 by Yasuo Itabashi * misc/plugin/history.rb: 新規追加。by Hajime BABA and Yasuo Itabashi * hikiconf.rb.sample: $repos_rootなどの追加、デフォルト値の変更 * style/default/parser.rb, style/default/html_formatter.rb: 英文が 入力したテキストの行をまたがっている場合に、単語間の空白がなくなっ てしまうバグの修正 by zunda * doc/VERSIONUP.txt: 新規追加 * data/text/TextFormattingRules, FrontPage: hiki.pngへのリンク削除、 文言の修正 * doc/README.txt, INSTALL.txt: 現状に合わせて文言を修正 2004-02-14 TAKEUCHI Hitoshi <hitoshi@mail.namaraii.com> * misc/plugin/amazon.rb, footnote.rb, highlight.rb: パッケージへ同 梱。tDiaryのconf_procはHikiでは未サポートのため、その修正も入って いる。 * amrita/*: amrita-1.0.2をパッケージへ同梱 * hiki.cgi: バージョン番号の変更 * v0_5_branchをトランクへマージした。 2004-01-25 TAKEUCHI Hitoshi <hitoshi@namaraii.com> * template/*/view.html: 更新日時が表示されないバグの修正 thanks to Yoshio TAKAEDA 2004-01-24 TAKEUCHI Hitoshi <hitoshi@namaraii.com> * hiki/command.rb, hiki/page.rb: c=recentで最も新しいページの更新 日時を返却するようにした。 * misc/plugin/rss.rb: 最も新しいページの更新日時を返却することにし た(last-modifiedとdc:date) * theme/hiki/*: @mediaを正しく扱えないブラウザでメニュー、サイド バー、フッタなどが表示されない問題の対処。cloverテーマをベースに書 き直し。 2004-01-22 Hideaki Hori <yowaken@cool.ne.jp> * hiki-mode.el (hiki-edit-mode): hiki-site-list で指定したスタイル が反映されていなかったのを修正。 http://yowaken.dip.jp/hiki/hiki.cgi?CommentForHikiMode 2004-01-14 TAKEUCHI Hitoshi <hitoshi@namaraii.com> * style/rd+/rd2html.rb: HeadlineでModuleNamesに登録されたモジュー ルが不正に展開されるバグの修正 by Masao Mutoh 2004-01-14 TAKEUCHI Hitoshi <hitoshi@namaraii.com> * misc/plugin/it/*, template/it/*, messages/it.rb: イタリア語リソー スの追加 by Luigi Maselli via Masao Mutoh 2004-01-12 TAKEUCHI Hitoshi <hitoshi@namaraii.com> * misc/plugin/en/frozenmark.rb, fr/frozenmark.rb: frozenmark.rbの 英仏リソースを追加 by OZAWA Sakuro Sun Jan 11 16:29:09 2004 Hideaki Hori <yowaken@cool.ne.jp> * hiki-mode.el (hiki-read-site-name): ミニバッファに デフォルト値を入れないようにした。 Mon Dec 08 23:06:41 2003 Hideaki Hori <yowaken@cool.ne.jp> * hiki-mode.el (hiki-fetch-source): bug fix. Wed Dec 03 21:25:16 2003 Hideaki Hori <yowaken@cool.ne.jp> * hiki-mode.el (hiki-fetch-index): bug fix. タイトルとキーワードの 実体参照を置換していなかった。 * (hiki-fetch-source): ditto. * (hiki-replace-entity-refs): ' -> '(シングルクォート) を追加。 * (hiki-do-replace-entity-ref): (save-match-data ...) でくくった。 2003-11-16 Kazuhiko <kazuhiko@fdiary.net> * hiki/plugin.rb, plugin/00default.rb: menu_proc のサポート * hiki.cgi: '$defout.binmode' の追加 thanks to Atsushi Koga 2003-11-16 Kazuhiko <kazuhiko@fdiary.net> * misc/plugin/attach/attach.rb: 例外を無視するように修正 by Hajime BABA 2004-11-15 Kazuhiko <kazuhiko@fdiary.net> * hiki/util.rb (Hiki::Util::sendmail): Content-Type ヘッダの追加 thanks to vette 2003-11-14 Kazuhiko <kazuhiko@fdiary.net> * style/default/parser.rb: 定義リストの前の部分を最小マッチに thanks to TADA Tadashi * hiki/command.rb: 検索キーワードのハイライト by Junichiro Kita 2003-11-13 Kazuhiko <kazuhiko@fdiary.net> * misc/plugin/attach/attach.rb: プラグインの使い方の表示、 attach_view で Flash に対応 (image_size.rb が使えるならサイズを埋め込む) by たむらけんいち XSS 脆弱性の修正、日本語ファイル名の扱いの修正 by Hajime BABA 2003-11-13 Kazuhiko <kazuhiko@fdiary.net> * plugin/00default.rb: ブラウザキャッシュ無効の META タグ追加 by Hajime BABA * misc/plugin/cvs.rb: $cvsroot -> $repos_root by Hajime BABA Wed Nov 12 04:32:09 2003 Hideaki Hori <yowaken@cool.ne.jp> * hiki-mode.el: bug fix. XEmacs での不具合に対応。 by simm <http://pure.fan.gr.jp/simm/d/20031110.html#p02>、 <http://yowaken.dip.jp/tdiary/20031111.html#c01>参照。 Mon Nov 10 22:55:59 2003 Hideaki Hori <yowaken@cool.ne.jp> * hiki-mode.el (hiki-index-setup-keys): [RET] を消した。 * (require 'poem) するようにした。 (http://kitaj.no-ip.com/tdiary/20031110.html#p06 より。Thx.) Sat Oct 25 10:42:02 2003 Hideaki Hori <yowaken@cool.ne.jp> * hiki-mode.el (hiki-read-char-with-retry): bug fix. navi2ch-read-char -> hiki-read-char [[yowaHiki:CommentForHikiMode]]のレポートより。Thanks. Sun Oct 19 00:58:09 2003 Hideaki Hori <yowaken@cool.ne.jp> * hiki-mode.el (hiki-edit-quit): hiki-page-buffer-alist の中身をク リアする。 * (hiki-index-quit): ditto. 表示しているサイト以外のバッファは kill しない。 2003-10-17 Kazuhiko <kazuhiko@fdiary.net> * hiki/storage.rb: 検索結果に表示されるキーワードが Regexp::quote されていたのを修正 by ょゎ Thu Oct 16 05:43:59 2003 Hideaki Hori <yowaken@cool.ne.jp> * hiki-mode.el (hiki-edit-mode): case-fold-search をローカル変数に しない。 * hiki-mode.el (hiki-edit): bug fix. 編集中の hiki-edit がうまく行っ てなかった。 * hiki-mode.el (hiki-index-refetch-index): 表示位置がリセットされ ていたのを修正。 * hiki-mode.el: メッセージ関係。 (hiki-display-{page,index}): "Loading... done." を表示。 (hiki-index-sort-by): メッセージを削除、↓へ。 (hiki-index-sort): "Sorting... done." を表示。 Thu Oct 16 04:21:16 2003 Hideaki Hori <yowaken@cool.ne.jp> * hiki-mode.el (hiki-index-sort-by): bug fix. buffer-modified-p の 変更し忘れ。 Thu Oct 16 04:15:46 2003 Hideaki Hori <yowaken@cool.ne.jp> * hiki-mode.el (hiki-display-index): bug fix. ソート時の point 位 置がズレていたのを修正。 Thu Oct 16 03:58:51 2003 Hideaki Hori <yowaken@cool.ne.jp> * hiki-mode.el: 一覧のソート。 (hiki-index-sort-key): 新変数。ソートのキーを記憶。 (hiki-read-char, hiki-read-char-with-retry): 新関数。キー入力。同 名の navi2ch-* を参考にした。 (hiki-index-sort, hiki-index-sort-by, hiki-index-sort-subr): 新関数。ソートする。 2003-10-16 Kazuhiko <kazuhiko@fdiary.net> * plugin/00default.rb: Content-Language として $lang を返すように 修正 by Masao Mutoh Tue Oct 14 21:31:10 2003 Hideaki Hori <yowaken@cool.ne.jp> * hiki-mode.el (hiki-edit-reload): 新関数。編集中のページをリロード。 (hiki-edit): hiki-edit-reload 対応。 Tue Oct 14 20:15:58 2003 Hideaki Hori <yowaken@cool.ne.jp> * hiki-mode.el (hiki-edit-newpage): 新変数。新規ページ編集中に non-nil。 * hiki-mode.el (hiki-edit-quit): 新規ページを作成した時は index を 必ず fetch する。 * hiki-mode.el: bug fix. hiki-edit がうまく動いてなかった。 (hiki-edit, hiki-display-page): 対応。 (hiki-index-edit-page-current-line): 新関数。 (hiki-index-edit-page): PAGENAME が指定されなければミニバッファか ら読む。 * hiki-mode.el (hiki-index-page-info): 新関数。page-info を返す。 * hiki-mode.el (hiki-fetch-index): bug fix. Tue Oct 14 17:54:02 2003 Hideaki Hori <yowaken@cool.ne.jp> * hiki-mode.el: 初期化を必ず行うようにした。 (hiki-initialize): 新関数。初期化を行う。 (hiki-init): 新変数。初期化してなければ nil。 * hiki-mode.el (hiki-index-display-page-next): 次行のページへ移動する処理をコメントアウト。 Tue Oct 14 03:41:00 2003 Hideaki Hori <yowaken@cool.ne.jp> * hiki-mode.el (hiki-edit-quit): バッファが変更されてたら警告を出 す。 * hiki-mode.el (hiki-index-display-page): hiki-index-page-info-current-line を使うよう修正。 * hiki-mode.el (hiki-index-display-page-next): 新関数。 該当行のページを表示。既に表示してあるならスクロール。 これ以上スクロール出来ないなら、次行のページを表示。 * hiki-mode.el (hiki-index-suspend): bug fix. * hiki-mode.el (hiki-display-page): 必ずページ先頭に移動する。 バッファを hiki-edit-mode にする。 Tue Oct 14 02:36:16 2003 Hideaki Hori <yowaken@cool.ne.jp> * hiki-mode.el (hiki-site-name-history): 新変数。 * hiki-mode.el (hiki-read-site-name): hiki-read-site-info から名称 変更。 * hiki-mode.el (hiki-index-suspend): 旧 hiki-index-quit。 bury-bufferする。 (hiki-index-quit): kill-bufferする。 Tue Oct 14 01:44:48 2003 Hideaki Hori <yowaken@cool.ne.jp> * hiki-mode.el (hiki-edit-quit): 一覧を表示しているウィンドウが あるならウィンドウ分割を保存。なければ、1-pane で一覧表示。 * hiki-mode.el (hiki-edit): 2-pane で一覧を表示し、該当行で recenter 。 * hiki-mode.el (hiki-index-page-info-string): マイナーチェンジ。 * hiki-mode.el (hiki-index-edit-page): 一覧表示の表示位置を保持。 Mon Oct 13 06:46:14 2003 Hideaki Hori <yowaken@cool.ne.jp> * hiki-mode.el (hiki-anchor-regexp-match-beginning, hiki-anchor-regexp-match-end): 使っていないので削除。 * hiki-mode.el (hiki-edit): bug fix. カッコの対応が変だった。 Sun Oct 12 23:13:14 2003 Hideaki Hori <yowaken@cool.ne.jp> * hiki-mode.el: 変更。 hiki-list -> hiki-site-list hiki-index-list -> hiki-index-page-info-list (toggle-read-only 〜) -> (setq buffer-read-only 〜) (recenter) -> (recenter t) * hiki-mode.el (hiki-index): 表示を hiki-display-index に分離。 (hiki-display-index): 新関数。一覧表示。 (hiki-index-get-buffer-create): 新関数。一覧表示用バッファを返す。 (hiki-index-page-info-string): 新関数。一覧表示の一行分。 * hiki-mode.el (hiki-index-edit-page): 一部を hiki-index-page-info-current-line に追い出した。 (hiki-index-page-info-current-line): 新関数。現在行のページ情報を返す。 2003-10-12 Kazuhiko <kazuhiko@fdiary.net> * misc/hikifarm/index.cgi: 配下の Hiki の中の最新のページの Last-Modified を HikiFarm の Last-Modified として返すようにした。 2003-10-10 Kazuhiko <kazuhiko@fdiary.net> * misc/plugin/en/template.rb: 英語リソース追加。 2003-10-10 Hideaki Hori <yowaken@cool.ne.jp> * hiki-mode.el: 名称変更。 hiki-index-edit -> hiki-index-edit-page hiki-index-refetch -> hiki-index-refetch-index * hiki-mode.el (hiki-page-buffer-alist): 新変数。バッファを保持。 * hiki-mode.el (hiki-index): optional 引数 refetch, pagename 追加。 * hiki-mode.el (hiki-index-display-page): 新関数。一覧から選んでペー ジを表示。 * hiki-mode.el (hiki-display-page): 新関数。ページを表示。 (hiki-edit-page): fetch 回りを hiki-display-page に移動。 * hiki-mode.el (hiki-page-buffer-name): 新関数。すでに存在する時、 ページ表示バッファ名を返す。 (hiki-index-buffer-name): 新関数。一覧表示バッファ名を返す。 動作が別なのに名前が対称なのが気になるのでなんとかしたい。 Fri Oct 10 05:44:32 2003 Hideaki Hori <yowaken@cool.ne.jp> * hiki-mode.el: 名称変更。 hiki-mode -> hiki-edit-mode hiki-setup-keys -> hiki-edit-setup-keys hiki-next-anchor -> hiki-edit-next-anchor hiki-rename-buffer -> hiki-edit-rename-buffer hiki-save -> hiki-edit-save-page Wed Oct 8 16:21:52 2003 Hideaki Hori <yowaken@cool.ne.jp> * hiki-mode.el: キーワード対応。 (hiki-keywords): 削除。 (hiki-edit-page, hiki-save): キーワード対応。 * hiki-mode.el (hiki-propertize): 新関数。navi2ch-propertize を参考。 * hiki-mode.el (hiki-fetch-source): bug fix. 古い(キーワード機能の ない) Hiki 相手の時、キーワードを誤判定していた。 Wed Oct 8 14:38:49 2003 Hideaki Hori <yowaken@cool.ne.jp> * hiki-mode.el (hiki-save): パスワード間違いの検出を行うようにした。 1. <pre> があればコンフリクト。 2. そうでなくて、<textarea>があればパスワード間違い。 3. そうでなければ、送信成功。 Wed Oct 8 04:29:29 2003 Hideaki Hori <yowaken@cool.ne.jp> * hiki-mode.el (hiki-save): 成功時は hiki-edit-quit を呼ぶようにし た。 Wed Oct 8 03:54:33 2003 Hideaki Hori <yowaken@cool.ne.jp> * hiki-mode.el (hiki-index): 引数に site-info を取るようにした。表 示も変更。delete-other-windows するようにした。(うれしいのか?) * hiki-mode.el (hiki-index-refetch): 新関数。一覧を再取得する。 * hiki-mode.el (hiki-index-quit): 新関数。 * hiki-mode.el (hiki-edit-quit): 編集モードを抜け、一覧モードへ。 * hiki-mode.el (hiki-prefix): 新関数。 * hiki-mode.el (http-url-unhexify-string): bug fix. '+' を SPC に 変換していなかった。 Wed Oct 8 01:31:45 2003 Hideaki Hori <yowaken@cool.ne.jp> * hiki-mode.el (hiki-edit-page): bug fix. hiki-read-pagename の completion でエラーが出ていた(hiki-pagename-history がおかしかった)。 * hiki-mode.el (hiki-index-edit): 新関数。一覧から選択して編集モー ドへ。 * hiki-mode.el (hiki-index-setup-keys): 新関数。 * hiki-mode.el (hiki-index): 同サイトのバッファを上書きするようにした。 Tue Oct 07 23:21:40 2003 Hideaki Hori <yowaken@cool.ne.jp> * hiki-mode.el (hiki-index): 新関数。一覧を表示する。 * (hiki-index-mode): 一部の処理を hiki-index に移動。 Tue Oct 7 03:57:46 2003 Hideaki Hori <yowaken@cool.ne.jp> * hiki-mode.el (hiki-read-site-name): 廃止。hiki-read-site-info へ。 * (hiki-read-site-info): 新関数。 * hiki-mode.el (hiki-http-request): 引数の pagename を省略可に。 * hiki-mode.el (hiki-fetch-index): 新関数。ページ一覧を取得する。 * hiki-mode.el (http-url-unhexify-string): bug fix. * hiki-mode.el (hiki-index-mode): 一覧用モード。 2003-09-02 Kazuhiko <kazuhiko@fdiary.net> * style/default/html_formatter.rb: インライン画像の alt をファイル 名だけにした。 2003-08-28 TAKEUCHI Hitoshi <hitoshi@namaraii.com> * misc/hikifarm/hiki.conf, misc/hikifarm/hikifarm.conf, misc/hikifarm/index.cgi, misc/plugin/svn.rb: Subversion バックエン ドへの対応 by koichiro koichiro 2003-08-24 TAKEUCHI Hitoshi <hitoshi@namaraii.com> * hiki/command.rb, plugin/00default.rb: ページ編集後にリダイレクトする URL をプラグインで指定できるようにした thanks to zunda 2003-08-23 TAKEUCHI Hitoshi <hitoshi@namaraii.com> * hiki/command.rb, hiki/plugin.rb: プラグイン中で export_plugin_methods がコールされた場合、指定された*以外*のメソッ ドをWikiページ中からコールできないようにした。by むらけん * hiki/util.rb, style/default/html_formatter.rb: $plugin_debug の場合 にスタックトレースが二重に出力されるバグの修正 2003-08-18 Kazuhiko <kazuhiko@fdiary.net> * plugin/00default.rb: $author_name をエスケープするようにした thanks to zunda * messages/fr.rb, template/fr/*.html, misc/plugin/fr/*.rb: フラン ス語リソースの更新 via Masao Mutoh 2003-08-16 TAKEUCHI Hitoshi <hitoshi@namaraii.com> * hiki/command.rb, style/default/html_formatter.rb: $plugin_debugが trueの場合にプラグイン内のスタックトレースを表示するように変更した thanks to 高林哲 2003-08-16 Kazuhiko <kazuhiko@fdiary.net> * misc/hikifarm/hiki.conf: $cache_path の値を修正。 2003-08-12 TAKEUCHI Hitoshi <hitoshi@namaraii.com> * template/*/view.html: div.footerをbodyの小要素に変更した thanks to Kiyo * messages/fr.rb, template/fr/*.html, misc/plugin/fr/*.rb: フランス語リソースの追加 by Laurent Sansonetti via Masao Mutoh 2003-08-12 TAKEUCHI Hitoshi <hitoshi@namaraii.com> * misc/plugin/attach/attach.rb: MIME Typeにapplication/pdf追加 * hiki/command.rb: 新規ページ作成時にtouchするのをやめた * misc/hikifarm/index.cgi: cvsrootのデフォルト値をnilに変更 thanks to かくたに * misc/text/rd+/TextFormattingRules: 文字コードを EUC-JP に変更 thanks to Masao Mutoh * plugin/00default.rb: CVS関連処理の分離(cvs.rbへ) * misc/plugin/cvs.rb: 新規作成 2003-08-11 Kazuhiko <kazuhiko@fdiary.net> * misc/plugin/referer.rb: @options['referer_limit'] に対応。 2003-08-10 Kazuhiko <kazuhiko@fdiary.net> * misc/plugin/attach/attach.rb: ruby-1.8 でエラーにならないように 修正 thanks to 高枝佳男。 2003-07-30 Kazuhiko <kazuhiko@fdiary.net> * misc/hikifarm/index.cgi: 任意の場所にディレクトリが作成可能なセ キュリティバグの修正 by 西山和広。 * plugin/00default.rb: 任意のコマンドを実行可能なセキュリティバグ の修正 by 西山和広。 * hiki/util.rb: eval にファイル名を指定 by 西山和広。 * hiki.cgi: 'require' を rescue 対象に by 西山和広。 2003-07-28 Kazuhiko <kazuhiko@fdiary.net> * misc/hikifarm/index.cgi: ruby-1.8 でエラーにならないように修正。 ファイルサイズがゼロのページを無視するように変更。 2003-07-27 Kazuhiko <kazuhiko@fdiary.net> * hiki/plugin.rb: ruby-1.8 で 'warning: tried to create Proc object without a block' が出ないように修正。 2003-07-26 TAKEUCHI Hitoshi <hitoshi@namaraii.com> * misc/plugin/frozenmark.rb: page_attribute_procへ移動。凍結されて いない場合にも凍結メッセージのspan要素(中身は空)が出力されてしまう 問題の修正。by さく 2003-07-24 TAKEUCHI Hitoshi <hitoshi@namaraii.com> * style/rd+/anchorlist.rb, style/rd+/html_formatter.rb, style/rd+/rd2html.rb: default style と同様にStringクラスのescape, escapeHTMLを利用するように変更 by 上美谷 2003-07-21 TAKEUCHI Hitoshi <hitoshi@namaraii.com> * misc/text/rd+/TextFormattingRules, doc/rd+/README, style/rd+/rd2html.rb:headlineのレベルをオプションで設定できるよう に変更 by Masao Mutoh 2003-07-17 TAKEUCHI Hitoshi <hitoshi@namaraii.com> * plugin/00default.rb: cvs_delete の追加。commit_cvs のメソッド名 変更。 2003-07-17 TAKEUCHI Hitoshi <hitoshi@namaraii.com> * hiki/command.rb, hiki/plugin.rb: delete_procのサポート 2003-07-14 Kazuhiko <kazuhiko@fdiary.net> * misc/hikifarm/hiki.conf, misc/hikifarm/hikifarm.conf, misc/hikifarm/index.cgi: cvs のサポート with むらけん * plugin/00default.rb: commit_cvs の追加 2003-07-13 TAKEUCHI Hitoshi <hitoshi@namaraii.com> * hiki/command.rb, style/*/html_formatter.rb: diffの出力形式を変更 * plugin/00default.rb: 編集画面に表示している参照用ページへのアン カが escapeHTML しすぎなバグを修正 2003-07-13 TAKEUCHI Hitoshi <hitoshi@namaraii.com> * hiki/interwiki.rb, style/default/*.rb: ブラケットネームで WikiName、ページ名に対しても表示用ラベルを使えるようにした。[[ほげ ほげ|TextFormattingRules]], [[ほげほげ|整形ルール]] など 2003-07-10 TAKEUCHI Hitoshi <hitoshi@namaraii.com> * misc/plugin/template.rb: template.autoinsert == true の場合のみ 自動的にテンプレートを適用するように変更。 * plugin/00default.rb: ページ新規作成時の更新メールにページソース も含まれるように変更 by しまだ みつのぶ 2003-07-09 TAKEUCHI Hitoshi <hitoshi@namaraii.com> * style/rd+/rd2html.rb: headerのレベルをRDToolと同じにした。 by Masao Mutoh * misc/plugin/en/attach.rb: 英語リソース漏れ対処 by Masao Mutoh 2003-07-09 TAKEUCHI Hitoshi <hitoshi@namaraii.com> * misc/plugin/frozenmark.rb: 凍結マークプラグイン by さく * misc/plugin/diffmail.rb: diffメールプラグイン by しまだ みつのぶ * hiki/command.rb, interwiki.rb, storage.rb, util.rb, algorithm/diff.rb, db/flatfile.rb, misc/plugin/todo.rb, style/default/parser.rb: Ruby 1.8でのwarning修正 by ょゎ 2003-07-07 Kazuhiko <kazuhiko@fdiary.net> * misc/plugin/referer.rb: escape 漏れの修正 by 猫罰 Sun Jul 6 03:43:04 2003 Hideaki Hori <yowaken@cool.ne.jp> * hiki-mode.el: <http://pure.fan.gr.jp/simm/d/20030703.html#p01> を 取り込んだ。内容は以下の通り。 * 編集ページのレイアウト変更に対応 * [bug fix] hiki-edit時のポイント復元 * ページ名補完 * タイトル変更をモードラインに反映させる対応 * [bug fix] WikiName取得 2003-07-05 TAKEUCHI Hitoshi <hitoshi@namaraii.com> * style/default/parser.rb: ブラケットネームのパース方法改善 by ょゎ 2003-07-05 TAKEUCHI Hitoshi <hitoshi@namaraii.com> * hiki/interwiki.rb, style/default/parser.rb, style/rd+/anchorlist.rb: aタグのレンダリング対象にfile://を追加 by かくたに 2003-07-05 TAKEUCHI Hitoshi <hitoshi@namaraii.com> * hiki/command.rb, misc/template/template.rb: テンプレートが一つし か定義されていない場合は自動的にロードするようにした。 template.default オプションの追加。 2003-07-05 TAKEUCHI Hitoshi <hitoshi@namaraii.com> * hiki/command.rb: 編集画面ではPlugin.page_nameを呼ばないようにし た。 2003-07-05 TAKEUCHI Hitoshi <hitoshi@namaraii.com> * style/default/html_formatter.rb, parser.rb, hiki/db/flatfile.rb: ブラケットネームでページタイトルを指定できるように変更。WikiNameは ページタイトルへ展開しないよう変更。 * hiki/command.rb, messages/*.rb: ページ新規作成時、別名として定義 されている名前、存在するページタイトルはページ名として指定できない ようにした * hiki/command.rb: 編集画面のH1はページIDを表示するように変更した。 2003-07-01 TAKEUCHI Hitoshi <hitoshi@namaraii.com> * style/default/html_formatter.rb, theme/hiki/hiki.css: 未作成ペー ジ名を表すWikiNameの後ろにつく?を印刷しないようにした thanks to い ちやま * misc/plugin/attach/attach.rb: ファイル添付フォームにnodispクラス を追加 * misc/plugin/template.rb: テンプレート対象になるページが存在しな い場合、フォームを表示しないようにした thanks to ふゆひこ * plugin/00default.rb: update_procが呼び出されないバグの修正 * misc/plugin/referer.rb: 存在しないページのリファラを記録しないよ うにした by かずひこ * misc/plugin/attach/attach.rb: ファイル添付フォームのタグ不正を修 正 by 猫罰 * misc/plugin/splitpagename.rb: WikiNameを空白で分割して表示するプ ラグイン by さく 2003-06-27 TAKEUCHI Hitoshi <hitoshi@namaraii.com> * hiki/command.rb, hiki/plugin.rb, hiki/db/flatfile.rb, plugin/00defualt.rb, misc/plugin/template.rb: テンプレートのサポー ト * plugin/00default.rb: 編集画面へ元ページへのリンク用アンカ追加 * misc/plugin/cd.rb, isbn.rb, referer.rb, rss-show.rb: make_anchor 対応 by 猫罰 * misc/plugin/hikifarm/index.cgi: ページ名をCGI::escapeHTMLするよ うにした * hiki/util.rb, plugin/00defualt.rb: HTMLヘッダのgenerator出力不正 の修正 thanks to かずひこ * hiki/command.rb, hiki/storage.rb. messages/*.rb: 複数キーワード のand検索サポート by かずひこ 2003-06-26 TAKEUCHI Hitoshi <hitoshi@namaraii.com> * template/ja/diff.html: 余分なheadタグを削除 thanks to baba 2003-06-22 TAKEUCHI Hitoshi <hitoshi@namaraii.com> * plugin/00default.rb: フッタ変更(RubyとAmritaへの公式ページへのリンク追加) 2003-06-22 TAKEUCHI Hitoshi <hitoshi@namaraii.com> * misc/hikifarm/hikifarm.conf, index.cgi: HikiFarmをDirectoryIndex 固定以外でも対応できるように変更。インストール後に参照するHikiの場 所を変更できるようにした。 http://yowaken.dip.jp/tdiary/20030613.html#p02 by ょゎ 2003-06-22 TAKEUCHI Hitoshi <hitoshi@namaraii.com> * hiki/command.rb, plugin.rb, util.rb, plugin/00default.rb, misc/plugin/attach/attach.rb, template/*/*.html: footer_proc, header_proc, form_procのサポート、edit_procの仕様変更 * style/default/parser.rb: [[http://www.namaraii.com/images/hoge.gif]]のパターンでIMGに展開す るようにした * style/default/html_formatter.rb, template/*/view.html: Heading近 辺にページ先頭に戻るためのアンカ追加 * template/*/edit.html: レイアウトの変更 * plugin/00default.rb: ページ更新時の処理を別メソッド化。 * misc/plugin/attach/attach.cgi: 複数ファイルを添付した場合の添付 ファイル削除バグFix * hiki/command.rb, plugin.rb: プラグイン未使用時でもプラグインのロー ドを行い、header_proc, footer_procのプラグインは実行するようにした。 Thu Jun 12 04:37:07 2003 Hideaki Hori <yowaken@cool.ne.jp> * hiki-mode.el (hiki-http-request): post-data をまとめて url-hexify することにした。 (http-url-hexify-alist): 新関数。 Thu Jun 12 03:27:22 2003 Hideaki Hori <yowaken@cool.ne.jp> * 凍結されているページの更新に対応。 <URL:http://pure.fan.gr.jp/simm/d/20030604.html#p03> * (hiki-conflict-show-diff): タイミングにより失敗することがあった のを修正。 <URL:http://pure.fan.gr.jp/simm/d/20030605.html#p01> * ページタイトルとキーワードに対応。(Hiki のCVS先端の機能) <URL:http://pure.fan.gr.jp/simm/d/20030611.html#p03> 2003-06-12 TAKEUCHI Hitoshi <hitoshi@namaraii.com> * style/default/html_formatter.rb, style/rd+/html_formatter.rb, template/en/diff.html, template/ja/diff.html, theme/hiki_base.css: 差分出力を<ins><del>を使うように変更 by ょゎ 2003-06-09 TAKEUCHI Hitoshi <hitoshi@namaraii.com> * hiki/command.rb: h1要素のエスケープに関するバグFix 2003-06-08 TAKEUCHI Hitoshi <hitoshi@namaraii.com> * misc/plugin/bbs.rb, misc/plugin/comment.rb: メッセージが空の場合 は追加しないように修正 thanks to smbd 2003-06-08 TAKEUCHI Hitoshi <hitoshi@namaraii.com> * template/*/*.html: media="all" の追加 * hiki/command.rb, hiki/page.rb: CSSのURL指定サポート 2003-06-08 TAKEUCHI Hitoshi <hitoshi@namaraii.com> * theme/hiki/hiki.css: div.sidebar formのmargin変更。 2003-06-08 TAKEUCHI Hitoshi <hitoshi@namaraii.com> * misc/plugin/search.rb: キーワードというラベルがキーワード機能と 誤解されそうなので検索語句に変更した。<br>の追加。 2003-06-08 TAKEUCHI Hitoshi <hitoshi@namaraii.com> * hiki/command.rb, hiki/util.rb, style/*/view.html: h1要素をページ タイトルの変更用アンカに変更し、ページタイトルを表示するように変更 * hiki/command.rb: プレビューするとページタイトルが消えるバグの修 正 by ほそのひでとも * misc/hiki.conf, misc/plugin/attach/attach.cgi, attach.rb: HikiFarm 対応、削除機能のサポート by しまだ みつのぶ 2003-06-07 SHIMADA Mitsunobu <simm@isoternet.org> * misc/plugin/attach/attach.cgi: 自動リロード先を $cgi_name を用いて決定するよう変更 2003-06-06 Kazuhiko <kazuhiko@fdiary.net> * misc/plugin/search.rb: 新規。thanks to baba 2003-06-06 Kazuhiko <kazuhiko@fdiary.net> * style/default/html_formatter.rb: escapeHTML しすぎの修正。thanks to kad 2003-06-06 SHIMADA Mitsunobu <simm@isoternet.org> * misc/plugin/attach/attach.cgi, attach.rb: 添付ファイル削除対応 Thu Jun 5 02:36:03 2003 Hideaki Hori <yowaken@cool.ne.jp> * hiki-mode.el: type fix. (hiki-md5sum -> hiki-md5hex) * hiki-mode.el (hiki-edit-page): kill-buffer するタイミングを変更。 2003-06-05 SHIMADA Mitsunobu <simm@isoternet.org> * misc/plugin/attach/attach.rb(attach_anchor_string): 新規作成 * misc/plugin/attach/attach.cgi: 添付後自動的に元ページ戻 る際のURLがおかしかったので修正 2003-06-03 SHIMADA Mitsunobu <simm@isoternet.org> * misc/plugin/attach/attach.rb: 添付ファイル転送時に適用す るattach.cgiのパスを変更できるようにした * misc/plugin/attach/attach.cgi, attach.rb: 辻褄があうようパスを変更 2003-06-01 Kazuhiko <kazuhiko@fdiary.net> * misc/plugin/attach/attach.cgi: リダイレクト先に $cgi_name を使う ように修正。 2003-06-01 TAKEUCHI Hitoshi <hitoshi@namaraii.com> * plugin/00default.rb: フッタの表示をModified byからFounded byに変 更。thanks to さく * style/default/html_formatter.rb: Aliasしたページのオートリンク出 力に関するバグFix * hiki/command.rb: h1要素を当該ページへのアンカにした * style/default/parser.rb: プラグインのパースバグ Fix 2003-05-31 TAKEUCHI Hitoshi <hitoshi@namaraii.com> * hiki/command.rb, hiki/plugin.rb, hiki/storage.rb, hiki/util.rb, hiki/db/flatfile.rb, messages/*.rb, misc/plugin/orphan.rb, referer.rb, rss.rb, plugin/00default.rb, style/default/html_formatter.rb: ページタイトル・キーワード機能の 追加 * theme/hiki_base.css: キーワード用form対応の修正 * theme/hiki/hiki.css: 印刷に対応 * misc/plugin/keyword.rb: キーワードプラグインの新規追加 * hiki/storage.rb: 検索機能の拡張(ページタイトルとキーワードを検 索対象にした。マッチした行を表示するようにした) * hiki/interwiki.rb, style/*/html_formatter.rb, plugin/00default.rb: アンカ出力を全てmake_anchor経由で行うように変 更した。 * misc/plugin/rss_show.rb: 変数名の変更 * hiki/hiki_formatter.rb: <h2>が連続する場合に出力されないバグを修正 * style/default/parser.rb : [[ [hogehoge] hoge|http://www.hogehoge.com/]]のように'[' ']'を含むアンカ生成のバ グを修正 * style/default/parser.rb : プラグインのパラメタに'}'が存在する場 合のバグを修正 2003-05-29 Kazuhiko <kazuhiko@fdiary.net> * misc/hikifarm/index.cgi: 一つも Wiki のないときにエラーになるバ グを修正 2003-05-29 Kazuhiko <kazuhiko@fdiary.net> * misc/plugin/isbn.rb: Amazon のアソシエイト ID を追加するように変 更 2003-05-25 Kazuhiko <kazuhiko@fdiary.net> * misc/hikifarm/index.cgi: 更新時刻順に表示するように変更 2003-05-25 TAKEUCHI Hitoshi <hitoshi@namaraii.com> * theme/hiki/hiki.css: デフォルトテーマの変更 2003-05-22 Kazuhiko <kazuhiko@fdiary.net> * hiki/command.rb: main_class, sidebar_class の無指定時のバグ修正 2003-05-18 TAKEUCHI Hitoshi <hitoshi@namaraii.com> * hiki/hiki_formatter.rb, command.rb, util.rb: tDiaryテーマ向けの HTML変更を全スタイルに適用するように変更 2003-05-17 TAKEUCHI Hitoshi <hitoshi@namaraii.com> * plugin/00default.rb: accesskey の追加 by さく * plugin/00default.rb: メニュー間スペース追加 by ょゎ * plugin/00default.rb: フッタの Copyright 表示削除 * hiki/storage.rb, hiki/db/flatfile.rb, hiki/command.rb, plugin/00default.rb: 更新のタイミングでプラグインを呼び出してメー ル送信するように変更 * style/default/html_formatter.rb, template/*/view.html, edit.html, adminform.html: tDiary スタイル互換性向上 * style/rd+/parser.rb, rd2html.rb: シンタックスエラー時の文字列に% が含まれる場合にエラー結果画面が不正表示される不具合の修正、 html_anchorプラグインを書き換えたとき編集画面を指すアンカが不正に なる不具合の修正 by Masao Mutoh * hiki/page.rb: HEADの場合だけLast-Modifiedを返却するように変更 thanks to をゐなり and 岩月 * plugin/00default.rb: XREAでの無限ループ対処 by Masao Mutoh * style/default/parser.rb: 先頭行がプラグインで、かつ同一行に他の プラグインが存在する場合のparse不正修正 * hiki/plugin.rb: footnoteプラグイン対応の修正(@modeをlatestから dayに変更) * style/default/html_formatter.rb: 強調の前後にスペースが入らない ように修正 * theme/hiki/hiki.css: Cloverベースに修正 2003-05-15 Hideaki Hori <yowaken@cool.ne.jp> * hiki-mode.el (hiki-http-request): typo fix. 2003-05-15 Hideaki Hori <yowaken@cool.ne.jp> * hiki-mode.el: サイト情報をバッファローカルにした。 (hiki-site-{url,name,style}}: 削除。 (hiki-site-info): 新変数。 (hiki-site-{url,name,style}}: 新関数。 * hiki-mode.el: concat -> format に書き換え。("%" を 含む文字列へ の対応) * hiki-mode.el (hiki-edit-page): 存在しないページを編集する時に 新規作成するか確認するようにした。 2003-05-11 TAKEUCHI Hitoshi <hitoshi@namaraii.com> * template/*/adminform.html, diff.html, edit.html, form.html, list.html, success.html: ロボット避けメタタグの追加 by ょゎ * hiki/util.rb, hikiconf.rb.sample: 更新時メールのFromとToを別に指 定できるように変更 2003-05-07 TAKEUCHI Hitoshi <hitoshi@namaraii.com> * plugin/00default.rb: anchor() で#が二重に出力されるバグの修正 by ょゎ * hiki/util.rb, template/en/adminform.html, edit.html, form.html, ja/adminform.html, edit.html, form.html: $cgi_nameを変えても反映さ れないテンプレートの修正 by ただただし 2003-05-06 Hideaki Hori <yowaken@cool.ne.jp> * hiki-mode.el: サイト情報関係のコードを整理。 (hiki-site-{name,url,style}): hiki-{name,url,style} から名称変更。 (hiki-setup-url): 削除。 (hiki-read-site-name): 新関数。 * hiki-mode.el (hiki-edit): 表示しているのと同一ページを 編集する時は、カーソル位置を保存するようにした。 2003-05-05 Hideaki Hori <yowaken@cool.ne.jp> * hiki-mode.el: コンフリクト時に diff を表示するようになった。 (hiki-conflict-show-diff): 新関数。 2003-05-05 TAKEUCHI Hitoshi <hitoshi@namaraii.com> * misc/plugin/rss.rb, misc/plugin/rss-show.rb: 取得したRSSから得ら れるページ名が自サイトのAliasWikiNameで展開されるバグをFix, RSSで 出力するページ名をAliasされたものに変更 2003-05-04 Hideaki Hori <yowaken@cool.ne.jp> * hiki-mode.el (http-url-unhexify-string): 新関数。 (hiki-edit-url): %xx 形式のURLに対応。 2003-05-03 Hideaki Hori <yowaken@cool.ne.jp> * hiki-mode.el: スタイルのアンカーの違いに対応。 (hiki-style, hiki-style-anchor-regexp-alist): 新変数。 (hiki-search-anchor): 新関数。 2003-05-03 Hideaki Hori <yowaken@cool.ne.jp> * hiki-mode.el (hiki-setup-url): Bug fix. 二回目の hiki-edit で SITE が変わっていたの訂正。 * hiki-mode.el (hiki-edit): コードを整理。 (hiki-edit-page, hiki-fetch-source): 新関数。 * hiki-mode.el (hiki-edit-url): 新関数。 URL を直接指定して編集。 2003-05-03 Hideaki Hori <yowaken@cool.ne.jp> * FONTLOCK をマージ。 2003-05-02 TAKEUCHI Hitoshi <hitoshi@namaraii.com> * misc/plugin/attach/attach.rb: attach_view メソッドの追加 by yoshimi * hiki/command.rb, hiki/plugin.rb: プラグインへcommandを渡すように 変更 * misc/plugin/attach/attach.rb, misc/plugin/attach/attach.cgi: 編 集画面からも添付できるように変更 * style/rd+/rd2html.rb:プラグイン使用時にエラーが発生した場合の表 示内容の改善。$plugin_debug対応。コードクリーンアップ。by Masao Mutoh 2003-05-01 TAKEUCHI Hitoshi <hitoshi@namaraii.com> * misc/plugin/attach/attach.rb: attach_src メソッドの追加 by yoshimi * hiki/command.rb, misc/plugin/bbs.rb, comment.rb, referer.rb, rss.rb, src.rb: pluginのi18n対応 * template/en/view.html: 不要なbody_leaveを削除 * template/*/edit.html: TextFormattingRulesの削除とedit_proc展開用 エリアの追加 * hiki/plugin.rb, hiki/command.rb, template/*/edit.html: edit_proc の追加 2003-04-30 TAKEUCHI Hitoshi <hitoshi@namaraii.com> * hiki/command.rb: 新規作成時にページ名を渡すように修正 by Masao Mutoh * misc/plugin/attach/attach.rb: MIMEタイプの追加 by Masao Mutoh * plugin/00default.rb: FrontPageがaliasされている場合のメニュー表 示変更 by さく 2003-04-30 TAKEUCHI Hitoshi <hitoshi@namaraii.com> * style/rd+/rd2html.rb, anchorlist.rb: InterWikiNameを使ったリンク で表示文字列が不正になるバグの修正 by Masao Mutoh 2003-04-30 TAKEUCHI Hitoshi <hitoshi@namaraii.com> * hiki/plugin.rb, plugin/00default.rb, misc/plugin/rss.rb: add_plugin_command されたコマンドを自動的にメニューバーへ追加する ようにした * misc/plugin/src.rb: srcプラグインの追加 2003-04-30 TAKEUCHI Hitoshi <hitoshi@namaraii.com> * style/default/html_formatter.rb: プラグイン実行結果に<div><span> を付加しないようにした。 * style/default/html_formatter.rb: 最終トークンが:normal_textだっ た場合にバッファに残り出力されない不具合の修正 by さく * misc/plugin/referer.rb: URLの置換をサポート 2003-04-29 TAKEUCHI Hitoshi <hitoshi@namaraii.com> * style/default/parser.rb: inlineメソッドをpublicに変更 * style/rd+/rd2html.rb: hiki_anchor仕様変更対応 by Masao Mutoh 2003-04-29 TAKEUCHI Hitoshi <hitoshi@namaraii.com> * hiki/command.rb, hiki/util.rb: sendmailメソッドの汎用化 by さく 2003-04-29 TAKEUCHI Hitoshi <hitoshi@namaraii.com> * misc/plugin/referer.rb: omit_urlを指定するとrefererが記録されな い不具合の修正 2003-04-28 Hideaki Hori <yowaken@cool.ne.jp> * hiki-mode.el (hiki-current-anchor): Should not use font-lock feature. * hiki-mode.el (hiki-anchor-regexp-match-beginning, hiki-anchor-regexp-match-end): New function. * hiki-mode.el (hiki-current-anchor-string): Renamed from hiki-current-anchor. 2003-04-27 TAKEUCHI Hitoshi <hitoshi@namaraii.com> * plugin/00defualt.rb: recent中のescape漏れ 2003-04-27 TAKEUCHI Hitoshi <hitoshi@namaraii.com> * hiki/command.rb, hiki/aliaswiki.rb: Aliasしたページ名を直接URLで 指定して編集した場合に、ページが空になる不具合の修正 by yoshimi * hiki/util.rb: CGI名の指定漏れ patch from yoshimi * style/rd+/rd2html.rb: Rubyのメソッド表記で最後に';'が入っている 場合にリンク対象になってしまう不具合の修正 patch from Masao Mutoh * style/rd+/rd2html.rb: メソッド表記で'|'をメソッドとして認識する ようにした patch from Masao Mutoh * misc/plugin/attach/attach.rb: ページ名のescape漏れ。 by りた * hiki/command.rb, misc/plugin/category.rb, misc/plugin/orphan.rb, misc/plugin/rank.rb, misc/plugin/sitemap.rb, misc/plugin/attach/attach.rb, plugin/00default.rb, style/default/html_formatter.rb: hiki_anchor仕様変更に伴う修正 * hikiconf.rb.sample: $cgi_nameをglobal.rbから移動 * hikiconf.rb.sample, hiki/util.rb: $plugin_debugの追加 by さく 2003-04-22 TAKEUCHI Hitoshi <hitoshi@namaraii.com> * misc/plugin/rd+/status.rb: 削除 * style/rd+/* patch from Masao Mutoh * style/rd+/html_formatter.rb, rd2html.rb: tocサポートのエンハンス * style/rd+/anchorlist.rb: InterWikiNameのデフォルト表示方法で余計 な:がついてしまう不具合の修正 * style/rd+/rd2html.rb: <=>, ==, []メソッドのパースに対応。 Headline,MethodList/DescListをアンカーにした * style/rd+/*.rb: Pluginのhiki_anchorに対応(一部) * style/rd+/parser.rb: エラー時にエラー箇所を表示するようにした * misc/plugin/attach/attach.rb: MIME タイプが正しく渡らないバグの 修正 by Kazuhiko * hiki/command.rb: ページ名が0バイトの場合のチェック漏れ by yoshimi 2003-04-22 Kazuhiko <kazuhiko@fdiary.net> * plugin/00default.rb (hiki_anchor): title 属性の追加。 * plugin/00default.rb (recent): hiki_anchor の使用。 2003-04-21 TAKEUCHI Hitoshi <hitoshi@namaraii.com> * misc/plugin/attach/attach.rb: ページ毎の添付ファイル一覧出力バグ Fix 2003-04-21 TAKEUCHI Hitoshi <hitoshi@namaraii.com> * hiki/db/flatfile.rb: info.db 読み出し用メソッドの追加 * template/*/view.html: attach プラグイン対応 * misc/plugin/rss.rb: 出力形式の変更 * misc/plugin/orphan.rb: 追加 * misc/plugin/sitemap.rb: 追加 * misc/plugin/attach/attach.(cgi|rb): 追加 2003-04-15 Kazuhiko <kazuhiko@fdiary.net> * plugin/00default.rb (hiki_menu): hiki_anchor および cgi_name を 使うようにした。 2003-04-15 TAKEUCHI Hitoshi <hitoshi@namaraii.com> * misc/plugin/rss.rb: 指定した出力件数を見るように修正 * hiki/command.rb: プラグインのPOST後にリダイレクトするように修正 2003-04-15 TAKEUCHI Hitoshi <hitoshi@namaraii.com> * plugin/00default.rb: 新規作成で例外になるバグFix 2003-04-15 TAKEUCHI Hitoshi <hitoshi@namaraii.com> * plugin/00default.rb: メニュー中のページ名のescape漏れFix 2003-04-14 TAKEUCHI Hitoshi <hitoshi@namaraii.com> * plugin/00default.rb, hiki/command.rb, hiki/page.rb hiki/util.rb, template/*/*, message/*.rb: ツール、フッタ出力のプラグイン化 * hiki/command.rb, hiki/plugin.rb: プラグインコマンドの追加 * hiki/global.rb, hiki/command.rb, hiki/util.rb, template/*/adminform.html, hikiconf.rb.sample: 複数設置対応でテー マが存在するディレクトリを管理画面で設定できるようにした。 * misc/plugin/entityref.rb: entityrefプラグインの追加 --- by yoshimi * misc/plugin/readlirs.rb: readlirsプラグインの追加 --- by yoshimi * misc/plugin/isbn.rb: ISBNプラグインの追加 --- by 中村のりつぐ * misc/plugin/cd.rb: CDプラグインの追加 --- by のとや * misc/plugin/rss.rb: RSSプラグインの追加 * misc/plugin/rss-show.rb: RSS表示プラグインの追加 2003-04-13 TAKEUCHI Hitoshi <hitoshi@namaraii.com> * hiki/interwiki.rb: エンコード判定漏れのバグFix 2003-04-13 TAKEUCHI Hitoshi <hitoshi@namaraii.com> * hiki/interwiki.rb, style/default/html_formatter.rb: 外部URLへの エイリアスに対応させた。 * hiki/command.rb: 別名でのページリクエストに対応させた。 2003-04-12 TAKEUCHI Hitoshi <hitoshi@namaraii.com> * hiki/command.rb, hiki/global.rb, hiki/aliaswiki.rb, style/default/html_formatter.rb, plugin/00default.rb, misc/plugin/category.rb, misc/plugin/rank.rb, hiki/plugin.rb: ブラ ケットネームのエイリアス * hiki/html_formatter.rb, hiki/util.rb, hiki/command.rb, template/*/adminform.html: オートリンク * hiki/util.rb, hiki/command.rb, template/*/*: CSSのクラス名変更 * style/rd+/html_formatter.rb: 複数Hiki設置対応 * style/rd+/html_formatter.rb, style/rd+/rd2html.rb: RD+スタイルで のtoc対応 by usa 2003-04-10 TAKEUCHI Hitoshi <hitoshi@namaraii.com> * misc/plugin/comment.rb: コメント挿入位置指定のパラメタ追加 2003-04-10 TAKEUCHI Hitoshi <hitoshi@namaraii.com> * hiki/util.rb, misc/plugin/rank.rb: hiki_anchorの表示形式対応 2003-04-09 TAKEUCHI Hitoshi <hitoshi@namaraii.com> * dot.htaccess: 複数Hiki設置対応 by かずひこ 2003-04-09 Kazuhiko <kazuhiko@fdiary.net> * misc/plugin/category.rb: hiki_anchorを使うように変更。 2003-04-08 TAKEUCHI Hitoshi <hitoshi@namaraii.com> * hiki.cgi, hiki/command.rb, hiki/util.rb, hiki/global.rb: require '/home/hoge/hiki/hiki.rb'対応。 * hikiconf.rb.sample, hiki/command.rb, hiki/util.rb, : テーマURLの 管理画面からの変更対応。 * hiki/command.rb, hiki/util.rb: ページ更新後のリダイレクト対応。 * hiki/db/flatfile.rb: ページ一覧でフラットファイルのみを対象にす るよう変更。 * style/default/parser.rb: レンダリングバグFix(テーブル、定義リス ト、箇条書き) * data/text/default/*, data/text/rd+/*: ページデータ保存パス変更に 伴いmisc/text/配下へ移動。 * style/rd+/anchorlist.rb: InterWikiNameを利用したリンクの修正。by usa <usa@dm4lab.to> 2003-04-05 TAKEUCHI Hitoshi <hitoshi@namaraii.com> * Hiki/RD+ のマージ : contributed by Masao Mutoh * テーブルのサポート: by かずひこ * 定義リスト中に':'がある場合のレンダリングバグFix: by ょゎ * 更新後にredirectするようにした * [[hoge|URL]]で相対パスも指定できるようにした 2003-03-30 TAKEUCHI Hitoshi <hitoshi@namaraii.com> * POST系プラグインのサポート * 掲示板プラグイン、コメントプラグインの追加 2003-03-23 TAKEUCHI Hitoshi <hitoshi@namaraii.com> * InterWikiNameのバグFix * プレビュー時のescapeに関するバグFix * TextFormattingRulesの記述変更 * InterWikiNameの記述変更(google) 2003-03-22 TAKEUCHI Hitoshi <hitoshi@namaraii.com> * charset出力のバグFix * サイドバーの送出順を変更(メインコンテンツの後へ) * 英語版テンプレート、メッセージの取り込み * mailto: にもアンカが設定されるように変更 * 1行に[hoge]と[[hoge|http://www.hoge.com/]]があるパターンのレンダ リングバグFix * ページ名に+などがある場合のバグFix * TextFormattingRulesの記述変更(強調の記述誤り) 2003-03-01 TAKEUCHI Hitoshi <hitoshi@namaraii.com> * blockquoteの終了条件に関するバグFix * [や]があるパラグラフ展開に関するバグFix * emとstrongの解釈をtDiaryのWikiモードに合わせた 2003-02-26 TAKEUCHI Hitoshi <hitoshi@namaraii.com> * ページの削除機能 * blockquoteの扱いをtDiaryのWikiスタイルに合わせた * ul,ol中のliに関するバグFix 2003-02-26 TAKEUCHI Hitoshi <hitoshi@namaraii.com> * 0.4.1.1 * 更新時の送信メールにREMOTE_ADDR,REMOTE_HOSTが入らないバグの修正 2003-02-26 TAKEUCHI Hitoshi <hitoshi@namaraii.com> * 0.4.1 * ライセンスをRuby'sからGPL2に変更 * WikiNameの解釈を変更 * doc/配下のドキュメントをHTMLからWiki形式に変更 * HTML 4.01 Transitional Validにした(少なくともTextFormattingRulesは) * メール送信時にX-Mailerを出力するように変更 * 編集でテキストを読み込む際のescape漏れ修正 * 編集画面のtextareaの属性変更(wrap削除、accesskey追加) * 引用のレンダリング不正を修正 * URLで使用できる文字として#を追加 * ドキュメントのtypo修正 ��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������hiki-1.0.0/Gemfile����������������������������������������������������������������������������������0000664�0000000�0000000�00000000455�12125333563�0013736�0����������������������������������������������������������������������������������������������������ustar�00root����������������������������root����������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������source 'https://rubygems.org' gem 'rack' gem 'thin' gem 'docdiff' gem 'hikidoc' gem 'sequel' gem 'mysql2' group :development do gem 'foreman' end group :development, :test do gem 'capybara', '< 2' gem 'test-unit' gem 'test-unit-rr' gem 'test-unit-notify' gem 'test-unit-capybara' end �������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������hiki-1.0.0/Gemfile.lock�����������������������������������������������������������������������������0000664�0000000�0000000�00000002533�12125333563�0014664�0����������������������������������������������������������������������������������������������������ustar�00root����������������������������root����������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������GEM remote: https://rubygems.org/ specs: capybara (1.1.4) mime-types (>= 1.16) nokogiri (>= 1.3.3) rack (>= 1.0.0) rack-test (>= 0.5.4) selenium-webdriver (~> 2.0) xpath (~> 0.1.4) childprocess (0.3.9) ffi (~> 1.0, >= 1.0.11) daemons (1.1.9) docdiff (0.5.0) eventmachine (1.0.3) ffi (1.6.0) foreman (0.62.0) thor (>= 0.13.6) hikidoc (0.0.6) json (1.7.7) mime-types (1.21) multi_json (1.7.2) mysql2 (0.3.11) nokogiri (1.5.9) rack (1.5.2) rack-test (0.6.2) rack (>= 1.0) rr (1.0.4) rubyzip (0.9.9) selenium-webdriver (2.31.0) childprocess (>= 0.2.5) multi_json (~> 1.0) rubyzip websocket (~> 1.0.4) sequel (3.45.0) test-unit (2.5.4) test-unit-capybara (1.0.2) capybara (>= 1.1.2) json test-unit (>= 2.4.4) test-unit-notify (1.0.0) test-unit (>= 2.4.9) test-unit-rr (1.0.2) rr (>= 1.0.2) test-unit (>= 2.5.2) thin (1.5.1) daemons (>= 1.0.9) eventmachine (>= 0.12.6) rack (>= 1.0.0) thor (0.18.0) websocket (1.0.7) xpath (0.1.4) nokogiri (~> 1.3) PLATFORMS ruby DEPENDENCIES capybara (< 2) docdiff foreman hikidoc mysql2 rack sequel test-unit test-unit-capybara test-unit-notify test-unit-rr thin ���������������������������������������������������������������������������������������������������������������������������������������������������������������������hiki-1.0.0/Procfile���������������������������������������������������������������������������������0000664�0000000�0000000�00000000060�12125333563�0014121�0����������������������������������������������������������������������������������������������������ustar�00root����������������������������root����������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������web: bundle exec thin start -p $PORT -R hiki.ru ��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������hiki-1.0.0/contrib/���������������������������������������������������������������������������������0000775�0000000�0000000�00000000000�12125333563�0014077�5����������������������������������������������������������������������������������������������������ustar�00root����������������������������root����������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������hiki-1.0.0/contrib/plugin/��������������������������������������������������������������������������0000775�0000000�0000000�00000000000�12125333563�0015375�5����������������������������������������������������������������������������������������������������ustar�00root����������������������������root����������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������hiki-1.0.0/contrib/plugin/en/�����������������������������������������������������������������������0000775�0000000�0000000�00000000000�12125333563�0015777�5����������������������������������������������������������������������������������������������������ustar�00root����������������������������root����������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������hiki-1.0.0/contrib/plugin/en/rast-register.rb�������������������������������������������������������0000664�0000000�0000000�00000000306�12125333563�0021116�0����������������������������������������������������������������������������������������������������ustar�00root����������������������������root����������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������@rast_register_conf_label = 'Rast Search' @rast_register_conf_header = 'Rebuild Rast search index' @rast_register_conf_description = 'To rebuild Rast search index, check the box and submit \'OK\'.' ��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������hiki-1.0.0/contrib/plugin/ja/�����������������������������������������������������������������������0000775�0000000�0000000�00000000000�12125333563�0015767�5����������������������������������������������������������������������������������������������������ustar�00root����������������������������root����������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������hiki-1.0.0/contrib/plugin/ja/rast-register.rb�������������������������������������������������������0000664�0000000�0000000�00000000465�12125333563�0021114�0����������������������������������������������������������������������������������������������������ustar�00root����������������������������root����������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������# -*- coding: utf-8 -*- @rast_register_conf_label = 'Rast罎膣' @rast_register_conf_header = 'Rast罎膣≪ゃ潟鴻罕膀' @rast_register_conf_description = 'Rast罎膣≪ゃ潟鴻罕膀翫с鴻сOK若' �����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������hiki-1.0.0/contrib/plugin/rast-register.rb����������������������������������������������������������0000664�0000000�0000000�00000005736�12125333563�0020530�0����������������������������������������������������������������������������������������������������ustar�00root����������������������������root����������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������require 'rast' def rast_register( page = @page, force = false ) db_path = ( @conf.options['rast-register.db_path'] || "#{@cache_path}/rast" ).untaint rast_make_db( db_path ) unless File.exist?( db_path ) uri = "#{@conf.index_url}?#{page.escape}" last_modified = @db.get_attribute( page, :last_modified ).strftime( "%FT%T" ) options = {"properties" => ['last_modified']} Rast::DB.open( db_path, Rast::DB::RDWR, "sync_threshold_chars" => 500000) do |db| result = db.search( "uri = #{uri}", options ) item, = result.items if item if force || item.properties[0] < last_modified db.delete( item.doc_id ) else return end end end title = @db.get_attribute( page, :title ) body = '' body << "#{page} " unless title.empty? || title == page body << @db.load(page) properties = { "title" => title, "uri" => uri, "last_modified" => last_modified, } Rast::DB.open( db_path, Rast::DB::RDWR, "sync_threshold_chars" => 500000) do |db| db.register( body, properties ) end end def rast_delete db_path = ( @conf.options['rast-register.db_path'] || "#{@cache_path}/rast" ).untaint options = {"properties" => ['uri']} return unless File.exist?( db_path ) uri = "#{@conf.index_url}?#{@page.escape}" Rast::DB.open( db_path, Rast::DB::RDWR, "sync_threshold_chars" => 500000) do |db| result = db.search("uri = #{uri}", options) result.items.each do |item| db.delete(item.doc_id) end end end def rast_make_db( db_path ) db_options = { 'encoding' => 'euc_jp', 'preserve_text' => true, 'properties' => [ { 'name' => 'uri', 'type' => Rast::PROPERTY_TYPE_STRING, 'search' => true, 'text_search' => true, 'full_text_search' => false, 'unique' => false, }, { 'name' => 'title', 'type' => Rast::PROPERTY_TYPE_STRING, 'search' => false, 'text_search' => true, 'full_text_search' => true, 'unique' => false, }, { 'name' => 'last_modified', 'type' => Rast::PROPERTY_TYPE_DATE, 'search' => true, 'text_search' => false, 'full_text_search' => false, 'unique' => false, } ] } Rast::DB.create( db_path, db_options ) end add_update_proc do rast_register end add_delete_proc do rast_delete end if !@conf['rast_register.hideconf'] && (@mode == 'conf' || @mode == 'saveconf') add_conf_proc('rast_register', @rast_register_conf_label) do str = <<-HTML <h3 class="subtitle">#{@rast_register_conf_header}</h3> <p> <input type="checkbox" name="rast_register_rebuild" value="1"> #{@rast_register_conf_description} </p> HTML if @mode == 'saveconf' unless @cgi['rast_register_rebuild'].empty? encoding = @conf.options['rast.encoding'] || 'euc_jp' @db.page_info.each do |i| page = i.keys[0] rast_register( page, true ) end str << "<p>Done.</p>\n" end end str end end ����������������������������������hiki-1.0.0/contrib/plugin/rast-search.rb������������������������������������������������������������0000664�0000000�0000000�00000010532�12125333563�0020137�0����������������������������������������������������������������������������������������������������ustar�00root����������������������������root����������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������require 'rast' module Hiki class RastSearch < Command MAX_PAGES = 10 NUM = 10 def rast_output(s) title_str = @key.empty? ? @conf.msg_search : @conf.msg_search_result str = <<-EOS <form class="update" action="./"> <h2>#{@conf.site_name.escapeHTML} - #{title_str.escapeHTML}</h2> <p>#{@conf.msg_search_comment.escapeHTML}</p> <p><input type="text" name="key" size="20" value="#{@key.escapeHTML}"> <input type="hidden" name="c" value="search"> <input type="submit" name="search" value="#{@conf.msg_search.escapeHTML}"></p> </form> EOS parser = @conf.parser::new(@conf) tokens = parser.parse('') formatter = @conf.formatter::new(tokens, @db, @plugin, @conf) @page = Page::new(@cgi, @conf) data = Util::get_common_data(@db, @plugin, @conf) @plugin.hiki_menu(data, @cmd) data[:title] = title(title_str) data[:view_title] = title_str data[:body] = formatter.apply_tdiary_theme(str + s) @cmd = 'plugin' # important!!! generate_page(data) # private method inherited from Command class end def search db_list = @conf.options['rast-search.db_list'] || [@conf.options['rast-search.db_path'] || "#{@conf.cache_path}/rast"] @key = @cgi['key'] if @key.empty? rast_output('') else @start = @cgi["start"].to_i begin rast_db_list = db_list.collect do |db_name| Rast::DB.open(db_name.untaint, Rast::DB::RDONLY) end Rast::Merger.open(rast_db_list) do |db| options = create_search_options @result = db.search(@key, options) if @result.hit_count ==0 rast_output("<p>#{(@conf.msg_search_not_found % @key).escapeHTML}</p>") else rast_output(format_result) end end rescue rast_output("<p>Error : #{$!.message.escapeHTML}</p>") ensure rast_db_list.each do |db| db.close if db end end end end def format_result head = "<p>#{(@conf.msg_search_hits % [@key, @db.page_info.size, @result.hit_count]).escapeHTML} (#{@start + 1} - #{@start + @result.items.size})</p>\n" ret = %Q(<dl class="search">\n) @result.items.each do |item| uri, title, last_modified = *item.properties title = uri if title.empty? summary = item.summary.escapeHTML || '' for term in @result.terms summary.gsub!(Regexp.new(Regexp.quote(term.term.escapeHTML), true, "e"), "<strong>\\&</strong>") end ret << %Q|<dt><a href="#{uri.escapeHTML}">#{title.escapeHTML}</a></dt>\n| ret << %Q|<dd>#{summary}<br><a href="#{uri.escapeHTML}">#{uri.escapeHTML}</a></dd>\n| end ret << "</dl>\n" head + ret + format_links end def format_links page_count = (@result.hit_count - 1) / NUM + 1 current_page = @start / NUM + 1 first_page = current_page - (MAX_PAGES / 2 - 1) if first_page < 1 first_page = 1 end last_page = first_page + MAX_PAGES - 1 if last_page > page_count last_page = page_count end buf = %Q|<p id="navi" class="infobar">\n| if current_page > 1 buf.concat(format_link("<", @start - NUM, NUM)) end if first_page > 1 buf.concat("... ") end for i in first_page..last_page if i == current_page buf.concat("#{i} ") else buf.concat(format_link(i.to_s, (i - 1) * NUM, NUM)) end end if last_page < page_count buf.concat("... ") end if current_page < page_count buf.concat(format_link(">", @start + NUM, NUM)) end buf.concat("</p>\n") return buf end def format_link(label, start, num) return format(%Q|<a href="%s?c=search;key=%s;start=%d">%s</a> |, @conf.cgi_name, @key.escape, start, label) end def create_search_options options = { "properties" => [ "uri", "title", "last_modified" ], "need_summary" => true, "summary_nchars" => 200, "start_no" => @start, "num_items" => NUM, } end end end def search Hiki::RastSearch.new(@cgi, @db, @conf).search end add_body_enter_proc do add_plugin_command('search', nil) end ����������������������������������������������������������������������������������������������������������������������������������������������������������������������hiki-1.0.0/data/������������������������������������������������������������������������������������0000775�0000000�0000000�00000000000�12125333563�0013350�5����������������������������������������������������������������������������������������������������ustar�00root����������������������������root����������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������hiki-1.0.0/data/backup/�����������������������������������������������������������������������������0000775�0000000�0000000�00000000000�12125333563�0014615�5����������������������������������������������������������������������������������������������������ustar�00root����������������������������root����������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������hiki-1.0.0/data/backup/.deletethis������������������������������������������������������������������0000664�0000000�0000000�00000000000�12125333563�0016736�0����������������������������������������������������������������������������������������������������ustar�00root����������������������������root����������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������hiki-1.0.0/data/text/�������������������������������������������������������������������������������0000775�0000000�0000000�00000000000�12125333563�0014334�5����������������������������������������������������������������������������������������������������ustar�00root����������������������������root����������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������hiki-1.0.0/data/text/FrontPage����������������������������������������������������������������������0000664�0000000�0000000�00000001514�12125333563�0016145�0����������������������������������������������������������������������������������������������������ustar�00root����������������������������root����������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������! Wiki潟吾[[Hiki|http://hikiwiki.org/ja/]]FrontPageс 若吾荀ゃ潟鴻若障c障紊(^^; !篏帥紮鐚荀鐚 若娯[膊∞]≪潟膊∞鴻若荐絎 若吾腟鐚膊∞篁ュ贋違罩≪鐚茹iゃ膊∞粋с障 !Hiki後ゃ Hiki後吾Wiki篌若障с吾後ャc鴻 鴻若冴潟潟潟荐菴違сс筝≦宍 後障с荅括完ゃTextFormattingRulesс ������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������hiki-1.0.0/data/text/InterWikiName������������������������������������������������������������������0000664�0000000�0000000�00000001157�12125333563�0016771�0����������������������������������������������������������������������������������������������������ustar�00root����������������������������root����������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������*[[AsWiki|http://www.assist.media.nagoya-u.ac.jp/ASDP/aswiki.cgi/]] euc *[[GoogleJ|http://www.google.com/search?num=50&lr=lang_ja&q=]] sjis *[[Hiki|http://hikiwiki.org/ja/$1.html]] euc *[[Image|http://images.google.co.jp/images?hl=ja;btnG=Google?hl=ja;btnG=Google+%8C%9F%8D%F5;q=]] sjis *[[ruby-list|http://blade.nagaokaut.ac.jp/cgi-bin/scat.rb/ruby/ruby-list/]] *[[RAA|http://raa.ruby-lang.org/project/$1/]] *[[RWiki|http://pub.cozmixng.org/~the-rwiki/?cmd=view;name=]] euc *[[Tiki|http://todo.is.os-omicron.org/tiki.cgi?c=v;p=]] euc *[[WikiWikiWeb|http://www.c2.com/cgi/wiki?]] *[[Ruby|http://www.ruby-lang.org/]] alias �����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������hiki-1.0.0/data/text/SideMenu�����������������������������������������������������������������������0000664�0000000�0000000�00000000033�12125333563�0015764�0����������������������������������������������������������������������������������������������������ustar�00root����������������������������root����������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������!違20篁 {{recent}} �����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������hiki-1.0.0/data/text/TextFormattingRules������������������������������������������������������������0000664�0000000�0000000�00000017436�12125333563�0020264�0����������������������������������������������������������������������������������������������������ustar�00root����������������������������root����������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������{{toc}} !違 *g茲域g1ゃ違障 *腥肴(壕帥障鴻若鴻帥茵)違阪障 *荐菴遺 箴違 蘂荐菴違茵 1ゃ違翫就障 *阪箴 箴違 蘂荐菴違茵 1ゃ違翫就障 !潟 !!WikiName *紊ф絖怨у障絨絖怨障医1絖篁ヤ膓 *>散2篁ヤ膵違菴茯WikiName潟障 *荐菴遺 WikiName - WikiName HogeRule1 - WikiName NOTWIKINAME - 紊ф絖WikiNameс WikiNAME - NAME紊ф絖WikiNameс *fooWikiName - 絨絖怨fooWikiNameс *阪箴 **WikiName - WikiName **HogeRule1 - WikiName **NOTWIKINAME - 紊ф絖WikiNameс **WikiNAME - NAME紊ф絖WikiNameс **fooWikiName - 絨絖怨fooWikiNameс !!若吾吾潟 若後鐚ゃ潟у蚊若吾吾潟障 *荐菴遺 箴[[綣Ruby]]若吾吾潟障 *阪箴 箴[[綣Ruby]]若吾吾潟障 !!篁紙URL吾潟 茯|URL鐚ゃ潟у蚊篁紙URL吾潟障 *荐菴遺 [[Yahoo!|http://www.yahoo.co.jp/]]с障 *阪箴 [[Yahoo!|http://www.yahoo.co.jp/]]с障 URL絨障jpg,jpeg,png,gifIMG帥違絮障鐚絎茯ALT荐絎鐚 *荐菴遺 [[若|http://jp.rubyist.net/theme/clover/clover_h1.png]] *阪箴 [[若|http://jp.rubyist.net/theme/clover/clover_h1.png]] 違筝URLc純潟障 *荐菴遺 Hiki若吾http://hikiwiki.org/ja/с *阪箴 Hiki若吾http://hikiwiki.org/ja/с !!InterWiki [[Tiki:Tiki]]InterWiki泣若障泣若菴遵 InterWikiName若吾膩障 *荐菴遺 *[[Hiki:綣Ruby]] *[[ruby-list:1]] *[[GoogleJ:ruby wiki]] *阪箴 **[[Hiki:綣Ruby]] **[[ruby-list:1]] **[[GoogleJ:ruby wiki]] InterWikiouter alias若違膂≦紊潟罘純絲上障outer aliasInterWikiNamealias若若篁泣若菴遵障 *荐菴遺 * [[Ruby|http://www.ruby-lang.org/]] alias 筝сalias荐絎茯鐚ゃ潟у蚊潟障 *荐菴遺 *[[Ruby]] *阪箴 **[[Ruby]] !翫就羝帥鴻 *茵鴻若鴻障帥у障c茵翫就羝帥宴障 *阪箴 require 'cgi' cgi = CGI::new cgi.header puts <<EOS <html> <head> <title>Hello!

Hello!

EOS *障<<< >>> с障茵鴻若鴻翫就羝帥宴障 *荐菴遺 <<< 綵 羝 >>> *阪箴 <<< 綵 羝 >>> !絖篆蕋 *'2с綣決帥障 *'3с綣決帥障 *=2с羔膩障 *荐菴遺 ''綣決''障 '''綣決'''障 ====羔膩泣若障 *阪箴 ''綣決''障 '''綣決'''障 ====羔膩泣若障 !荀冴 *!茵吾荀冴障 *!1ゃ5ゃ障ц菴違純с

紊障 *荐菴遺 !荀冴1 !!荀冴2 !!!荀冴3 !!!!荀冴4 !!!!!荀冴5 *阪箴 !荀冴1 !!荀冴2 !!!荀冴3 !!!!荀冴4 !!!!!荀冴5 !羂翫抗膩 ゃ壕垩-茵4ゆ吾羂翫抗膩障 *荐菴遺 ---- *阪箴 ---- !膊≧吾 **茵吾膊≧吾障 **鐚ゃ鐚ゃ障ц菴違純уャ絖с障 *#茵吾垬膊≧吾障 *荐菴遺 *≪ゃ1 **≪ゃ1.1 **≪ゃ1.2 ***≪ゃ1.2.1 ***≪ゃ1.2.2 ***≪ゃ1.2.3 **≪ゃ1.3 **≪ゃ1.4 *≪ゃ2 #1 #2 ##2.1 ##2.2 ##2.3 #3 ##3.1 ###3.1.1 ###3.1.2 *阪箴 *≪ゃ1 **≪ゃ1.1 **≪ゃ1.2 ***≪ゃ1.2.1 ***≪ゃ1.2.2 ***≪ゃ1.2.3 **≪ゃ1.3 **≪ゃ1.4 *≪ゃ2 #1 #2 ##2.1 ##2.2 ##2.3 #3 ##3.1 ###3.1.1 ###3.1.2 !綣 "茵鐚ゆ吾綣障 *荐菴遺 ""綣с ""綣障 ""膓綣障綣g翫 ""筝ゃ綣 ""絮障 *阪箴 ""綣с ""綣障 ""膓綣障綣g翫 ""筝ゃ綣 ""絮障 !茯茹h 潟潟:茵吾膓茯:茹h茯茹h障 茯茹h茵篏с障 *荐菴遺 ::apple :眼:gorilla :: ::camel *阪箴 ::apple :眼:gorilla :: ::camel !茵 茵(若)||у障 祉!ゃ荀冴祉障 茵g^g>g違祉ゃ *荐菴遺 ||!茵荀冴鐚弱荀冴||!-A||!-B||!-C||!>-D-E鐚罔g鐚 ||!茵-1||A1||B1||^C1-C2鐚膰g鐚||D1||E1 ||!茵-2||A2||B2||^>D2-E2-D3-E3鐚膰罔g鐚 ||!茵-3||>>A3-C3鐚罔鐚g鐚 *阪箴 ||!茵荀冴鐚弱荀冴||!-A||!-B||!-C||!>-D-E鐚罔g鐚 ||!茵-1||A1||B1||^C1-C2鐚膰g鐚||D1||E1 ||!茵-2||A2||B2||^>D2-E2-D3-E3鐚膰罔g鐚 ||!茵-3||>>A3-C3鐚罔鐚g鐚 !潟<潟茵 //茵茵潟<潟茵阪障 *荐菴遺 // 潟<潟с *阪箴鐚茵腓冴障鐚 // 潟<潟с !違ゃ {鐚ゃ}鐚ゃу蚊違ゃ潟若喝冴с障 <若帥茲域吾純с 違ゃ潟帥茵吾翫違ゃ潟緇

篁障 *荐菴遺 {{recent(3)}} *茲域荐菴遺 {{pre( <若随 <若随 <若随 )}} hiki-1.0.0/debian/000077500000000000000000000000001212533356300136615ustar00rootroot00000000000000hiki-1.0.0/debian/.cvsignore000066400000000000000000000000131212533356300156530ustar00rootroot00000000000000files hiki hiki-1.0.0/debian/README.Debian000066400000000000000000000002241212533356300157200ustar00rootroot00000000000000hiki for Debian --------------- You can run 'hikisetup' to setup hiki easily. -- Taku YASUI , Sat, 28 Jun 2003 11:01:05 +0900 hiki-1.0.0/debian/changelog000066400000000000000000000012471212533356300155370ustar00rootroot00000000000000hiki (0.4.2a-4) unstable; urgency=low * More dependency fix (closes: #215429) -- Taku YASUI Mon, 13 Oct 2003 21:35:34 +0900 hiki (0.4.2a-3) unstable; urgency=low * Fix dependency (closes: #212363) * Force to use /usr/bin/ruby1.6 (closes: #212428) -- Taku YASUI Fri, 26 Sep 2003 11:05:16 +0900 hiki (0.4.2a-2) unstable; urgency=low * Fix: Cannot execute install.rb (closes: #201055) -- Taku YASUI Thu, 17 Jul 2003 10:25:48 +0900 hiki (0.4.2a-1) unstable; urgency=low * Initial Release. (closes: #199125) -- Taku YASUI Sun, 6 Jul 2003 23:28:18 +0900 hiki-1.0.0/debian/compat000066400000000000000000000000021212533356300150570ustar00rootroot000000000000004 hiki-1.0.0/debian/control000066400000000000000000000014151212533356300152650ustar00rootroot00000000000000Source: hiki Section: web Priority: optional Maintainer: Taku YASUI Build-Depends-Indep: debhelper (>> 4.0.0), ruby1.6 Standards-Version: 3.6.1 Package: hiki Architecture: all Depends: ruby1.6, libalgorithm-diff-ruby1.6, libstrscan-ruby1.6, libamrita-ruby1.6 Suggests: httpd, tdiary-theme Description: Wiki Engine written in Ruby Hiki is one of WikiWiki Web clone (Wiki Engine) written in programming language Ruby. WikiWikiWeb is web base collaboration tool. Hiki has following features: . * Simple syntax like original Wiki. * Theme function by CSS(Cascading Style Sheet). You can use a lot of tDiary themes (http://www.tdiary.net/theme.rhtml). * Plugin function, you can add various functions. * InterWiki support. * Categorize. hiki-1.0.0/debian/copyright000066400000000000000000000020071212533356300156130ustar00rootroot00000000000000This package was debianized by Taku YASUI on Sat, 28 Jun 2003 11:01:05 +0900. It was downloaded from Upstream Author: Hitoshi TAKEUCHI Copyright: This package is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; version 2 dated June, 1991. This package is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this package; if not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. On Debian systems, the complete text of the GNU General Public License can be found in `/usr/share/common-licenses/GPL'. hiki-1.0.0/debian/dirs000066400000000000000000000000271212533356300145440ustar00rootroot00000000000000usr/bin usr/share/hiki hiki-1.0.0/debian/docs000066400000000000000000000000171212533356300145320ustar00rootroot00000000000000doc/README.txt hiki-1.0.0/debian/examples000066400000000000000000000000401212533356300154140ustar00rootroot00000000000000dot.htaccess hikiconf.rb.sample hiki-1.0.0/debian/hikisetup000077500000000000000000000065301212533356300156200ustar00rootroot00000000000000#!/usr/bin/ruby1.6 # # hikisetup - setup hiki for debian systems # Copyright (C) Taku YASUI # require 'getoptlong' require 'ftools' SRCDIR = '/usr/share/hiki' def parse_options options = Hash.new parser = GetoptLong.new parser.set_options(['--help', '-h', GetoptLong::NO_ARGUMENT], ['--copy', '-c', GetoptLong::NO_ARGUMENT]) parser.each_option { |name, arg| options[name.sub(/^--/, "")] = arg } show_usage if options['help'] return options end def setup_symlink(dir) File.makedirs("#{dir}/plugin", "#{dir}/theme") Dir.glob("#{SRCDIR}/plugin/*.rb") do |file| filename = File.basename(file) next if ( File.exist?("#{dir}/plugin/#{filename}") && ! File.symlink?("#{dir}/plugin/#{filename}") ) File.unlink("#{dir}/plugin/#{filename}") if ( File.exist?("#{dir}/plugin/#{filename}") ) system('ln', '-sf', file, "#{dir}/plugin") end Dir.glob("#{SRCDIR}/theme/*") do |file| filename = File.basename(file) next if ( File.exist?("#{dir}/theme/#{filename}") && ! File.symlink?("#{dir}/theme/#{filename}") ) File.unlink("#{dir}/theme/#{filename}") if ( File.exist?("#{dir}/theme/#{filename}") ) system('ln', '-sf', file, "#{dir}/theme") end if ( File.directory?("#{dir}/messages") ) STDERR.puts "Warning: directory #{dir}/messages already exists." else system('ln', '-sf', "#{SRCDIR}/messages", dir) end if ( File.directory?("#{dir}/template") ) STDERR.puts "Warning: directory #{dir}/template already exists." else system('ln', '-sf', "#{SRCDIR}/template", dir) end if ( File.directory?("#{dir}/style") ) STDERR.puts "Warning: directory #{dir}/style already exists." else system('ln', '-sf', "#{SRCDIR}/style", dir) end File.unlink("#{dir}/hiki.cgi") if ( File.exist?("#{dir}/hiki.cgi") ) File.symlink("#{SRCDIR}/hiki.cgi", "#{dir}/hiki.cgi") end def setup_copy(dir) system('cp', '-dfR', "#{SRCDIR}/plugin", dir) system('cp', '-dfR', "#{SRCDIR}/theme", dir) system('cp', '-dfR', "#{SRCDIR}/messages", dir) system('cp', '-dfR', "#{SRCDIR}/template", dir) system('cp', '-dfR', "#{SRCDIR}/style", dir) File.unlink("#{dir}/hiki.cgi") if ( File.exist?("#{dir}/hiki.cgi") ) File.cp("#{SRCDIR}/hiki.cgi", dir) end def show_usage print <<_EOT Usage: hikisetup [OPTIONS] [directory] OPTIONS: --help, -h: Show this help --copy, -c: Copy CGI and some files instead of symlink _EOT end def main begin opts = parse_options dir = ARGV[0] || '.' File.makedirs(dir) if ( ! File.directory?("#{dir}/data") ) system('cp', '-r', "#{SRCDIR}/data", dir) end if ( ! File.exist?("#{dir}/hikiconf.rb") ) File.cp("#{SRCDIR}/hikiconf.rb", dir) end if ( opts['copy']) setup_copy(dir) else setup_symlink(dir) end if ( File.directory?('/var/www/tdiary/theme') ) Dir.glob("/var/www/tdiary/theme/*") do |file| filename = File.basename(file) next if ( File.exist?("#{dir}/theme/#{filename}") && ! File.symlink?("#{dir}/theme/#{filename}") ) File.unlink("#{dir}/theme/#{filename}") if ( File.exist?("#{dir}/theme/#{filename}") ) system('ln', '-sf', file, "#{dir}/theme") end end puts "hikisetup succeeded!" puts "Please edit #{dir}/hikiconf.rb" rescue puts 'Error: ' + $! puts "hikisetup failed!" end end main if __FILE__ == $0 hiki-1.0.0/debian/hikisetup.1000066400000000000000000000021771212533356300157570ustar00rootroot00000000000000.\" hikisetup manpage for Debian GNU/Linux .\" written by Taku YASUI .TH HIKI 1 .\" NAME should be all caps, SECTION should be 1-8, maybe w/ subsection .\" other parms are allowed: see man(7), man(1) .SH NAME hikisetup \- hiki setup utility for Debian .SH SYNOPSIS .B hikisetup .RI [--copy] .RI [directory] .SH DESCRIPTION This manual page documents briefly the support commands for .BR hiki . It was written for the Debian GNU/Linux distribution because the original program does not have a manual page. .PP .B hikisetup is a program that make directory and create configuration file for Hiki. If directory is specified, it setup to the directory. If not, to current directory. .SH OPTIONS .TP .B --copy copy various files instead of symlink. It symlinks some files and directories by default. Then, cgi and some files to use are upgraded automatically when the package is upgraded. But if your web server does not allow to run CGI which is symlink, you should copy CGI file. .SH AUTHOR hikisetup and this manual page was written by Taku YASUI , for the Debian GNU/Linux system (but may be used by others). hiki-1.0.0/debian/install.rb000077500000000000000000000007321212533356300156610ustar00rootroot00000000000000#!/usr/bin/env ruby require "rbconfig" require "ftools" include Config DSTPATH = ENV['DESTDIR'] + CONFIG["rubylibdir"] File.makedirs(DSTPATH) def join( *arg ) File.join( *arg ) end def base( name ) File.basename( name ) end begin Dir.glob('hiki/**/*.rb').each do | name | File.makedirs(join(DSTPATH, File.dirname(name))) File.install(name, join(DSTPATH, name), 0644, true ) end puts "install succeed!" rescue puts "install failed!" puts $! end hiki-1.0.0/debian/patches/000077500000000000000000000000001212533356300153105ustar00rootroot00000000000000hiki-1.0.0/debian/patches/10_use_anoter_packages_algorithm_diff.dpatch000077500000000000000000000136601212533356300260460ustar00rootroot00000000000000#!/bin/sh -e ## 10_use_anoter_packages_algorithm_diff.dpatch ## by Taku YASUI ## ## All lines beginning with `## DP:' are a description of the patch. ## DP: No description. if [ $# -ne 1 ]; then echo >&2 "`basename $0`: script expects -patch|-unpatch as argument" exit 1 fi [ -f debian/patches/00patch-opts ] && . debian/patches/00patch-opts patch_opts="${patch_opts:--f --no-backup-if-mismatch}" case "$1" in -patch) patch $patch_opts -p1 < $0;; -unpatch) patch $patch_opts -p1 -R < $0;; *) echo >&2 "`basename $0`: script expects -patch|-unpatch as argument" exit 1;; esac exit 0 @DPATCH@ diff -urNad hiki.old/hiki/algorithm/diff.rb hiki/hiki/algorithm/diff.rb --- hiki.old/hiki/algorithm/diff.rb 2003-02-22 13:39:31.000000000 +0900 +++ hiki/hiki/algorithm/diff.rb 1970-01-01 09:00:00.000000000 +0900 @@ -1,220 +0,0 @@ -# -# algorith/diff - a Ruby module to compute difference sets between two -# objects. Copyright (c) 2001-2002 Lars Christensen. -# -# This program is free software; you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation; either version 2 of the License, or -# (at your option) any later version. -# -# This program is distributed in the hope that it will be useful, but -# WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -# General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with this program; if not, write to the Free Software -# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA -# 02111-1307, USA. -# - -module Diff - - VERSION = 0.4 - - attr_reader :diffs - - def Diff.lcs(a, b) - astart = 0 - bstart = 0 - afinish = a.length-1 - bfinish = b.length-1 - mvector = [] - - # First we prune off any common elements at the beginning - while (astart <= afinish && bstart <= afinish && a[astart] == b[bstart]) - mvector[astart] = bstart - astart += 1 - bstart += 1 - end - - # now the end - while (astart <= afinish && bstart <= bfinish && a[afinish] == b[bfinish]) - mvector[afinish] = bfinish - afinish -= 1 - bfinish -= 1 - end - - bmatches = b.reverse_hash(bstart..bfinish) - thresh = [] - links = [] - - (astart..afinish).each { |aindex| - aelem = a[aindex] - next unless bmatches.has_key? aelem - k = nil - bmatches[aelem].reverse_each { |bindex| - if k && (thresh[k] > bindex) && (thresh[k-1] < bindex) - thresh[k] = bindex - else - k = thresh.replacenextlarger(bindex, k) - end - links[k] = [ k!=0 && links[k-1], aindex, bindex ] if k - } - } - - if !thresh.empty? - link = links[thresh.length-1] - while link - mvector[link[1]] = link[2] - link = link[0] - end - end - - return mvector - end - - def Diff.makediff(a, b) - mvector = Diff.lcs(a, b) - ai = bi = 0 - while ai < mvector.length - bline = mvector[ai] - if bline - while bi < bline - yield :+, bi, b[bi] - bi += 1 - end - bi += 1 - else - yield :-, ai, a[ai] - end - ai += 1 - end - while ai < a.length - yield :-, ai, a[ai] - ai += 1 - end - while bi < b.length - yield :+, bi, b[bi] - bi += 1 - end - 1 - end - - def Diff.diff(a, b, &block) - isstring = b.kind_of? String - diffs = [] - - block ||= proc { |action, index, element| - prev = diffs[-1] - if prev && prev[0] == action && - prev[1] + prev[2].length == index - prev[2] << element - else - diffs.push [ action, index, isstring ? element.chr : [element] ] - end - } - - Diff.makediff(a, b, &block) - - return diffs - end - -end - -module Diffable - def diff(b) - Diff.diff(self, b) - end - - # Create a hash that maps elements of the array to arrays of indices - # where the elements are found. - - def reverse_hash(range = (0...self.length)) - revmap = {} - range.each { |i| - elem = self[i] - if revmap.has_key? elem - revmap[elem].push i - else - revmap[elem] = [i] - end - } - return revmap - end - - # Replace the first element which is larger than value. Assumes that - # the element indexed by high, if given is larger than value. - - def replacenextlarger(value, high = nil) - high ||= length - low = 0 - index = found = nil - while low < high - index = (high+low) >> 1 - found = self[index] - if value > found # this first, most common case - low = index + 1 - elsif value == found - return nil - else - high = index - end - end - self[low] = value - return low - end - - # Patches self with the given set of differences. - - def patch(diffs) - newary = nil - kindofstring = kind_of? String - if kindofstring - newary = self.class.new('') - else - newary = self.class.new - end - ai = 0 - bi = 0 - diffs.each { |action,position,elements| - case action - when :- - while ai < position - newary << self[ai] - ai += 1 - bi += 1 - end - ai += elements.length - when :+ - while bi < position - newary << self[ai] - ai += 1 - bi += 1 - end - if kindofstring - newary << elements - else - newary.push *elements - end - bi += elements.length - else - raise "Unknown diff action" - end - } - while ai < self.length - newary << self[ai] - ai += 1 - bi += 1 - end - return newary - end -end - -class Array - include Diffable -end - -class String - include Diffable -end diff -urNad hiki.old/hiki/util.rb hiki/hiki/util.rb --- hiki.old/hiki/util.rb 2003-02-26 21:02:16.000000000 +0900 +++ hiki/hiki/util.rb 2003-06-28 14:17:15.000000000 +0900 @@ -6,7 +6,7 @@ require 'net/smtp' require 'time' require 'amrita/template' -require 'hiki/algorithm/diff' +require 'algorithm/diff' class String def to_euc hiki-1.0.0/debian/prepare-cvs.sh000077500000000000000000000011031212533356300164420ustar00rootroot00000000000000#!/bin/sh # prepare-cvs.sh - prepare to create hiki deb package from cvs VERSION=0.5 BRANCH=v0_5_branch if [ -z "$1" ]; then DESTDIR=. else DESTDIR=$1 fi cd ${DESTDIR} DEBVERSION=${VERSION}+`date '+%Y%m%d'` DIR=hiki-${DEBVERSION} if [ -d ${DIR} ]; then echo "Directory ${DIR} already exists." exit 1 fi cvs -Q -d:pserver:anonymous@cvs.sourceforge.jp:/cvsroot/hiki co -r ${BRANCH} -d ${DIR} hiki cp -a ${DIR} ${DIR}.orig cd ${DIR} dch -D experimental -v ${DEBVERSION}-1 'New upstream release (cvs snapshot)' echo Please type \"cd ${DESTDIR}/${DIR}\" and debuild hiki-1.0.0/debian/rules000077500000000000000000000040471212533356300147460ustar00rootroot00000000000000#!/usr/bin/make -f # Sample debian/rules that uses debhelper. # GNU copyright 1997 to 1999 by Joey Hess. # Uncomment this to turn on verbose mode. #export DH_VERBOSE=1 # This is the debhelper compatability version to use. # export DH_COMPAT=3 # This is the versions of upstream UPSTREAM = hiki UPSTREAM_VERSION = 0.4.2a build: # noting to do clean: dh_testdir dh_testroot # Clean build and stamps rm -rf build rm -rf unpack-stamp patch-stamp patch-stampTMP patches-stamp dh_clean install: build dh_testdir dh_testroot dh_clean -k dh_installdirs # Add here commands to install the package into debian/hiki. #mv hikiconf.rb.sample hikiconf.rb DESTDIR=$(CURDIR)/debian/hiki ruby1.6 $(CURDIR)/debian/install.rb cp -r data messages misc plugin style template theme $(CURDIR)/debian/hiki/usr/share/hiki find $(CURDIR)/debian/hiki -type d -name CVS -print | xargs rm -rf find $(CURDIR)/debian/hiki -name \*.rb -print | xargs chmod 644 find $(CURDIR)/debian/hiki -type d -path '*/hiki/algorithm' -print | xargs rm -rf install -m 755 hiki.cgi $(CURDIR)/debian/hiki/usr/share/hiki/hiki.cgi install -m 644 hikiconf.rb.sample $(CURDIR)/debian/hiki/usr/share/hiki/hikiconf.rb install -m 755 debian/hikisetup $(CURDIR)/debian/hiki/usr/bin/hikisetup perl -i -npe 's!hiki/algorithm/diff!algorithm/diff!' `find $(CURDIR)/debian/hiki -name '*.rb' -print` perl -i -npe 's!/usr/bin/env ruby!/usr/bin/ruby1.6!' `find $(CURDIR)/debian/hiki -name '*.cgi' -print` # Build architecture-independent files here. binary-indep: build install dh_testdir dh_testroot dh_installchangelogs -i ChangeLog dh_installdocs -i dh_installexamples -i # dh_install -i # dh_installmenu -i # dh_installdebconf -i # dh_installlogrotate -i # dh_installemacsen -i # dh_installpam -i # dh_installmime -i # dh_installinit -i # dh_installcron -i # dh_installinfo -i dh_installman -i debian/hikisetup.1 dh_link -i dh_compress -i dh_fixperms -i dh_installdeb -i dh_gencontrol -i dh_md5sums -i dh_builddeb -i binary: binary-indep .PHONY: build clean binary-indep binary install patch unpack hiki-1.0.0/doc/000077500000000000000000000000001212533356300132045ustar00rootroot00000000000000hiki-1.0.0/doc/COPYING000066400000000000000000000431051212533356300142420ustar00rootroot00000000000000 GNU GENERAL PUBLIC LICENSE Version 2, June 1991 Copyright (C) 1989, 1991 Free Software Foundation, Inc. 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA Everyone is permitted to copy and distribute verbatim copies of this license document, but changing it is not allowed. Preamble The licenses for most software are designed to take away your freedom to share and change it. By contrast, the GNU General Public License is intended to guarantee your freedom to share and change free software--to make sure the software is free for all its users. This General Public License applies to most of the Free Software Foundation's software and to any other program whose authors commit to using it. (Some other Free Software Foundation software is covered by the GNU Library General Public License instead.) You can apply it to your programs, too. When we speak of free software, we are referring to freedom, not price. Our General Public Licenses are designed to make sure that you have the freedom to distribute copies of free software (and charge for this service if you wish), that you receive source code or can get it if you want it, that you can change the software or use pieces of it in new free programs; and that you know you can do these things. To protect your rights, we need to make restrictions that forbid anyone to deny you these rights or to ask you to surrender the rights. These restrictions translate to certain responsibilities for you if you distribute copies of the software, or if you modify it. For example, if you distribute copies of such a program, whether gratis or for a fee, you must give the recipients all the rights that you have. You must make sure that they, too, receive or can get the source code. And you must show them these terms so they know their rights. We protect your rights with two steps: (1) copyright the software, and (2) offer you this license which gives you legal permission to copy, distribute and/or modify the software. Also, for each author's protection and ours, we want to make certain that everyone understands that there is no warranty for this free software. If the software is modified by someone else and passed on, we want its recipients to know that what they have is not the original, so that any problems introduced by others will not reflect on the original authors' reputations. Finally, any free program is threatened constantly by software patents. We wish to avoid the danger that redistributors of a free program will individually obtain patent licenses, in effect making the program proprietary. To prevent this, we have made it clear that any patent must be licensed for everyone's free use or not licensed at all. The precise terms and conditions for copying, distribution and modification follow. GNU GENERAL PUBLIC LICENSE TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION 0. This License applies to any program or other work which contains a notice placed by the copyright holder saying it may be distributed under the terms of this General Public License. The "Program", below, refers to any such program or work, and a "work based on the Program" means either the Program or any derivative work under copyright law: that is to say, a work containing the Program or a portion of it, either verbatim or with modifications and/or translated into another language. (Hereinafter, translation is included without limitation in the term "modification".) Each licensee is addressed as "you". Activities other than copying, distribution and modification are not covered by this License; they are outside its scope. The act of running the Program is not restricted, and the output from the Program is covered only if its contents constitute a work based on the Program (independent of having been made by running the Program). Whether that is true depends on what the Program does. 1. You may copy and distribute verbatim copies of the Program's source code as you receive it, in any medium, provided that you conspicuously and appropriately publish on each copy an appropriate copyright notice and disclaimer of warranty; keep intact all the notices that refer to this License and to the absence of any warranty; and give any other recipients of the Program a copy of this License along with the Program. You may charge a fee for the physical act of transferring a copy, and you may at your option offer warranty protection in exchange for a fee. 2. You may modify your copy or copies of the Program or any portion of it, thus forming a work based on the Program, and copy and distribute such modifications or work under the terms of Section 1 above, provided that you also meet all of these conditions: a) You must cause the modified files to carry prominent notices stating that you changed the files and the date of any change. b) You must cause any work that you distribute or publish, that in whole or in part contains or is derived from the Program or any part thereof, to be licensed as a whole at no charge to all third parties under the terms of this License. c) If the modified program normally reads commands interactively when run, you must cause it, when started running for such interactive use in the most ordinary way, to print or display an announcement including an appropriate copyright notice and a notice that there is no warranty (or else, saying that you provide a warranty) and that users may redistribute the program under these conditions, and telling the user how to view a copy of this License. (Exception: if the Program itself is interactive but does not normally print such an announcement, your work based on the Program is not required to print an announcement.) These requirements apply to the modified work as a whole. If identifiable sections of that work are not derived from the Program, and can be reasonably considered independent and separate works in themselves, then this License, and its terms, do not apply to those sections when you distribute them as separate works. But when you distribute the same sections as part of a whole which is a work based on the Program, the distribution of the whole must be on the terms of this License, whose permissions for other licensees extend to the entire whole, and thus to each and every part regardless of who wrote it. Thus, it is not the intent of this section to claim rights or contest your rights to work written entirely by you; rather, the intent is to exercise the right to control the distribution of derivative or collective works based on the Program. In addition, mere aggregation of another work not based on the Program with the Program (or with a work based on the Program) on a volume of a storage or distribution medium does not bring the other work under the scope of this License. 3. You may copy and distribute the Program (or a work based on it, under Section 2) in object code or executable form under the terms of Sections 1 and 2 above provided that you also do one of the following: a) Accompany it with the complete corresponding machine-readable source code, which must be distributed under the terms of Sections 1 and 2 above on a medium customarily used for software interchange; or, b) Accompany it with a written offer, valid for at least three years, to give any third party, for a charge no more than your cost of physically performing source distribution, a complete machine-readable copy of the corresponding source code, to be distributed under the terms of Sections 1 and 2 above on a medium customarily used for software interchange; or, c) Accompany it with the information you received as to the offer to distribute corresponding source code. (This alternative is allowed only for noncommercial distribution and only if you received the program in object code or executable form with such an offer, in accord with Subsection b above.) The source code for a work means the preferred form of the work for making modifications to it. For an executable work, complete source code means all the source code for all modules it contains, plus any associated interface definition files, plus the scripts used to control compilation and installation of the executable. However, as a special exception, the source code distributed need not include anything that is normally distributed (in either source or binary form) with the major components (compiler, kernel, and so on) of the operating system on which the executable runs, unless that component itself accompanies the executable. If distribution of executable or object code is made by offering access to copy from a designated place, then offering equivalent access to copy the source code from the same place counts as distribution of the source code, even though third parties are not compelled to copy the source along with the object code. 4. You may not copy, modify, sublicense, or distribute the Program except as expressly provided under this License. Any attempt otherwise to copy, modify, sublicense or distribute the Program is void, and will automatically terminate your rights under this License. However, parties who have received copies, or rights, from you under this License will not have their licenses terminated so long as such parties remain in full compliance. 5. You are not required to accept this License, since you have not signed it. However, nothing else grants you permission to modify or distribute the Program or its derivative works. These actions are prohibited by law if you do not accept this License. Therefore, by modifying or distributing the Program (or any work based on the Program), you indicate your acceptance of this License to do so, and all its terms and conditions for copying, distributing or modifying the Program or works based on it. 6. Each time you redistribute the Program (or any work based on the Program), the recipient automatically receives a license from the original licensor to copy, distribute or modify the Program subject to these terms and conditions. You may not impose any further restrictions on the recipients' exercise of the rights granted herein. You are not responsible for enforcing compliance by third parties to this License. 7. If, as a consequence of a court judgment or allegation of patent infringement or for any other reason (not limited to patent issues), conditions are imposed on you (whether by court order, agreement or otherwise) that contradict the conditions of this License, they do not excuse you from the conditions of this License. If you cannot distribute so as to satisfy simultaneously your obligations under this License and any other pertinent obligations, then as a consequence you may not distribute the Program at all. For example, if a patent license would not permit royalty-free redistribution of the Program by all those who receive copies directly or indirectly through you, then the only way you could satisfy both it and this License would be to refrain entirely from distribution of the Program. If any portion of this section is held invalid or unenforceable under any particular circumstance, the balance of the section is intended to apply and the section as a whole is intended to apply in other circumstances. It is not the purpose of this section to induce you to infringe any patents or other property right claims or to contest validity of any such claims; this section has the sole purpose of protecting the integrity of the free software distribution system, which is implemented by public license practices. Many people have made generous contributions to the wide range of software distributed through that system in reliance on consistent application of that system; it is up to the author/donor to decide if he or she is willing to distribute software through any other system and a licensee cannot impose that choice. This section is intended to make thoroughly clear what is believed to be a consequence of the rest of this License. 8. If the distribution and/or use of the Program is restricted in certain countries either by patents or by copyrighted interfaces, the original copyright holder who places the Program under this License may add an explicit geographical distribution limitation excluding those countries, so that distribution is permitted only in or among countries not thus excluded. In such case, this License incorporates the limitation as if written in the body of this License. 9. The Free Software Foundation may publish revised and/or new versions of the General Public License from time to time. Such new versions will be similar in spirit to the present version, but may differ in detail to address new problems or concerns. Each version is given a distinguishing version number. If the Program specifies a version number of this License which applies to it and "any later version", you have the option of following the terms and conditions either of that version or of any later version published by the Free Software Foundation. If the Program does not specify a version number of this License, you may choose any version ever published by the Free Software Foundation. 10. If you wish to incorporate parts of the Program into other free programs whose distribution conditions are different, write to the author to ask for permission. For software which is copyrighted by the Free Software Foundation, write to the Free Software Foundation; we sometimes make exceptions for this. Our decision will be guided by the two goals of preserving the free status of all derivatives of our free software and of promoting the sharing and reuse of software generally. NO WARRANTY 11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION. 12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. END OF TERMS AND CONDITIONS How to Apply These Terms to Your New Programs If you develop a new program, and you want it to be of the greatest possible use to the public, the best way to achieve this is to make it free software which everyone can redistribute and change under these terms. To do so, attach the following notices to the program. It is safest to attach them to the start of each source file to most effectively convey the exclusion of warranty; and each file should have at least the "copyright" line and a pointer to where the full notice is found. Copyright (C) 19yy This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA Also add information on how to contact you by electronic and paper mail. If the program is interactive, make it output a short notice like this when it starts in an interactive mode: Gnomovision version 69, Copyright (C) 19yy name of author Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'. This is free software, and you are welcome to redistribute it under certain conditions; type `show c' for details. The hypothetical commands `show w' and `show c' should show the appropriate parts of the General Public License. Of course, the commands you use may be called something other than `show w' and `show c'; they could even be mouse-clicks or menu items--whatever suits your program. You should also get your employer (if you work as a programmer) or your school, if any, to sign a "copyright disclaimer" for the program, if necessary. Here is a sample; alter the names: Yoyodyne, Inc., hereby disclaims all copyright interest in the program `Gnomovision' (which makes passes at compilers) written by James Hacker. , 1 April 1989 Ty Coon, President of Vice This General Public License does not permit incorporating your program into proprietary programs. If your program is a subroutine library, you may consider it more useful to permit linking proprietary applications with the library. If this is what you want to do, use the GNU Library General Public License instead of this License. hiki-1.0.0/doc/HACKING.en000066400000000000000000000014641212533356300146010ustar00rootroot00000000000000! Mailing lists Mailing lists for talking about Hiki are prepared. See their web page to subscribe. hiki-users A mailing list for Hiki users. http://lists.sourceforge.jp/mailman/listinfo/hiki-users hiki-dev A mailing list for Hiki developers. http://lists.sourceforge.jp/mailman/listinfo/hiki-dev ! How to make a patch Unified diff format is recommended. Add a -u option to the diff command. If you get files via Git, type the following command. $ git diff You also can pull request to http://github.com/hiki/hiki. ! Create the original version control backend 1. put a script to "hiki/repos/#{repos_type}.rb" 2. Define "HikifarmRepos#{repos_type.capitalize}" class and "Repos#{repos_type.capitalize}" class which is derived from HikifarmReposBase and ReposBase. 3. Override methods properly. hiki-1.0.0/doc/HACKING.txt000066400000000000000000000032621212533356300150140ustar00rootroot00000000000000Hiki 筝с篋荐障 ========================================================== <若潟違鴻 Hiki 荅演<若潟違鴻障 莖取号<若潟違鴻若吾荀 hiki-users 若九<若潟違鴻с http://lists.sourceforge.jp/mailman/listinfo/hiki-users hiki-dev 肴<若潟違鴻с http://lists.sourceforge.jp/mailman/listinfo/hiki-dev ========================================================== 篏 unified diff 綵√ィ絅障 diff 潟潟 -u 激с潟篁 git с純若鴻c翫 $ git diff тс障 http://github.com/hiki/hiki pull request 号с障障 筝羈鴻筝荐荐篋障 羂ゃ鴻 http://d.hatena.ne.jp/higepon/20050629/1120024153 ========================================================== 若吾с括∞潟絎臂 潟絎臂 1. "hiki/repos/#{repos_type}.rb" <ゃ鴻吾 2. "HikifarmRepos#{repos_type.capitalize}" 鴻 "Repos#{repos_type.capitalize}" 鴻篏 HikifarmReposBase ReposBase 膓帥 3. <純若若ゃ 障 hiki-1.0.0/doc/INSTALL.en000066400000000000000000000041561212533356300146440ustar00rootroot00000000000000Hiki Installation Guide ! Requirement * Ruby 1.8 or later. (1.8.2 or later is recommended.) ! How to install We use following settings as the example to explain the installation. * Hiki URL: http://www.example.com/~foo/hiki/ * path of the Hiki URL: /home/foo/public_html/hiki/ * data storing path: /home/foo/hiki/ !! CGI script settings Extract the package and copy the all contents to /home/foo/public_html/hiki/. hiki.cgi is the main CGI script so set its permittion to make WWW Server executable it. If you can't invoke ruby with /usr/bin/env, you must change the first line of the scripts to the path of ruby. !! creating .htaccess Rename ''dot.htaccess'' to ''.htaccess'' and modify it to suitable for the environment. Options +ExecCGI AddHandler cgi-script .cgi DirectoryIndex hiki.cgi deny from all This setting means * Enable CGI execution. * Recognize the files which ends with `.cgi' as CGI scripts. * The default file is hiki.cgi. * Prohibit the reference of hikiconf.rb. !! creating the data storing directory. There is a `data' directory in the archive. Copy it to somewhere, which is recommended not to be accessible from WWW. $ cp -r data /home/foo/hiki The `data' directory has Japanese text. If you'd like to use English version, copy `misc/text/default.en/*' to `/home/foo/hiki/text/'. German version is in `misc/text/default.de/'. All of the files in the data storing directory should be writable by WWW server. $ chmod -R og+w /home/foo/hiki !! creating hikiconf.rb Next, rename ''hikiconf.rb.sample'' to ''hikiconf.rb'' and modify it. This file is directly loaded by CGI as a ruby script. If you need English version, use `misc/i18n/hikiconf.rb.sample.en'. Popular settings of Hiki is configurable via web interface, so you only need to change ''@data_path'' at least. @data_path = '/home/foo/hiki' You can put various settings in ''hikiconf.rb''. See comments in ''hikiconf.rb.sample'' for details. ! Execute Hiki Open the URL where you install Hiki. (e.g. http://www.example.com/~foo/hiki/ ) If the FrontPage is shown, the installation is succeeded. hiki-1.0.0/doc/INSTALL.txt000066400000000000000000000135601212533356300150600ustar00rootroot00000000000000 Hikiゃ潟鴻若荐絎 Hiki篏障Ruby (若吾с1.8篁ラ) 綽荀с [[Ruby若若|http://www.ruby-lang.org/ja/]]潟若ゃ 鴻若 箴絖ゃゃ潟鴻若 Ruby 若吾с潟 1.8.2 医сtrackback.rb 障 rss-show.rb 篏帥篁ヤゃ潟鴻若綽荀 若吾с 1.8.2 篁ラс筝荀с * uconv http://www.yoshidam.net/Ruby_ja.html#uconv * rbuconv http://www.yoshidam.net/Ruby_ja.html#rbuconv ゃ潟鴻若箴у医 筝CGI絎茵荐怨ISP潟帥泣若筝у翫喝 篁ヤ医箴茯障 * WWW泣若: Apache HTTP server 2.0.x * 若九: foo * HikiURL: http://www.hoge.example.org/~foo/hiki/ * 筝荐URL: /home/foo/public_html/hiki/ * 若炊主: /home/foo/hiki/ CGI鴻荐絎 絽≪若ゃ絮筝荳鴻/home/foo/public_html/hiki/潟若 障hiki.cgiCGI鴻篏сWWW泣若罔у茵純 若激с潟荐絎 障/usr/bin/env篏帥c莎桁с医с<ゃRuby 鴻吾綽荀с .htaccess篏 膓CGI絎茵医眼障dot.htaccess .htaccess 医吾障羞私泣潟篁ヤc 障 Options +ExecCGI AddHandler cgi-script .cgi DirectoryIndex hiki.cgi deny from all с * CGI絎茵純 * 泣c鴻.cgi<ゃCGI茯茘 * hiki.cgi<ゃ荐絎 * hikiconf.rbс胼罩 荐絎c障 若炊主c篏 絮c筝datac障c 吾潟若c贋WWW腟宴с≪祉 с (箴 public_html 篁ヤс) 贋с $ cp -r data /home/foo/hiki 若炊主c筝<ゃWWW泣若罔ф吾 莨若若激с潟鏆荀障 $ chmod -R og+w /home/foo/hiki/data hikiconf.rb篏 罨<hikiconf.rb.sample hikiconf.rb 若絎鴻吾 障Ruby鴻CGI贋・茯粋昭障障 Hiki筝肢荐絎CGI腟宴цс篏吾鴻 @data_path с @data_path = '/home/foo/hiki/data' hikiconf.rb 篁荐絎荐菴違с障荅括完ゃ hikiconf.rb.sample 筝潟<潟с Hiki絎茵 Hikiゃ潟鴻若URL (箴сhttp://www.hoge.example.org/~foo/hiki/) 吟ч帥FrontPage茵腓冴違ゃ潟鴻若 с /-荀---------------------------------------- | ゃ潟鴻若膊∞脂≪ | 膊∞鴻若荐絎 `------------------------------------------------- 若吾筝篁ヤ<ャ若茵腓冴с 域鋎 膩 綏 FrontPage 若娯荀 罎膣 贋医吋罩 膊∞ 篁ヤ<ャ若ゃ茯障 域鋎 域鋎≪潟域鋎脂≪檎欠Щ違若 菴遵с障 膩 膩≪潟с若吾絎鴻膩 с障 綏 綏≪潟с若吾亥筝ゅ 絎鴻綏сс障 FrontPage FrontPage≪潟Hiki若吾欠Щ障 若娯荀 若娯荀с≪潟篏若吾筝荀сц;腓 障筝荀х脂≪с若吾腟贋井ユ腟 с障 罎膣 罎膣≪≪潟罎膣≪脂≪欠Щ障罎膣∝脂≪ф膣 若若ュ罎膣≪帥潟寂若娯賢 ュ若若若吾筝荀с障 贋医吋罩 贋医吋罩眼≪潟篏若吾贋井ユ 筝恰帥筝荀ц;腓冴障 膊∞ 膊∞鴻若荐絎緇若九 'admin' 違ゃ潟 膊∞<ャ若憗違ゃ潟御腮荐絎 с障障若吾膩脂≪с若吾腟 (膩胼罩) 茵障 ャ<潟tDiary絽宴若吾doc/README.html 障tDiary篏茗障 hiki-1.0.0/doc/NEWS.en000066400000000000000000000070641212533356300143130ustar00rootroot00000000000000! Changes in 1.0.0 * Fix DoS vulnerabilities in the process of Wiki style's parser. * Support Ruby-1.9. * Support Rack. * Support Bundler. * Use docdiff Gem. * Use hikidoc Gem. * Fix wrong condition for If-Modified-Since. ** Pull Request by Makoto Kitaichi [GitHub #7] * Fix NameError in misc/plugin/attach.rb ** Pull Request by Keisuke SOGAWA [GitHub #20] * We can run Hiki to run "ruby hiki.rb". ** Pull Request by Tomohiko Himura [GitHub #21] * Support RDBMS by Sequel [Experimental] * Support Heroku [Experimental] * Add a script to convert wiki text encoding. ! Changes in 0.8.8 * use [[HikiDoc|http://rubyforge.org/projects/hikidoc/]] as Wiki style's parser. * support API authentication in amazon plugin. * add the spam filter feature. * support git repositories. * fix miscellaneous bugs. ! Changes in 0.8.7 * fix an arbitrary file delete vulnerabilities. * Add Content-Length header field in downloading attached files. * Add Vary header field. * $SAFE=1 is set in Hikilet. * XMLRPC is supported in Hikilet. * fix the bug that text in a title is escaped twice. * the amazon plugin of tDiary is imported. * file scheme URI is converted to a link. * use status 500 on error. * the postable? method is added in plugins. * enable adding a comment and changing properties with a single post in the its.rb plugin. * session management without login is supported. * nested inline modifier is supported. * fix miscellaneous bugs. ! Changes in 0.8.6 * fix DoS vulnerabilities in the process of getting a difference between pages. * fix the bug of unlocking without lock. * support WILLCOM's mobile agents. * fix the bug of breaking the path of the cookie when base_url is specified. * The page editing support script now supports Safari. * suppress the width/height attributes when the size of an image is unknown. * options['attach.cache_url'] is introduced. DO NOT use this unless all attached files are safe. * Do not consider WikiName inside of pre elements. ! Changes in 0.8.5 * support multiple addresses to notify changes. * support a pure-ruby version control repository. * add an 'Issue Tracking System' plugin (misc/plugin/its.rb). * add 'Rast Search' plugins (contrib/plugin/rast-register.rb, contrib/plugin/rast-search.rb). * fix miscellaneous bugs. ! Changes in 0.8.4 * use the HikiDoc library in the default style. * change the charset of XML-RPC interfaces to UTF-8. * support whole HTML output in RSS (rss.rb plugin). * support setting up attach.cgi in hikifarm. * support WEBrick (misc/webrick/). * fix miscellaneous bugs. ! Changes in 0.8.3 * fix 'Cross-Site Scripting' vulnerabilities. * fix a bug of possible losing a configuration file. * XML-RPC interfaces are now available via hiki.cgi. xmlrpc.cgi is removed. * German resources are added. * fix a hang up bug of 'hiki-mode.el'. ! Changes in 0.8.2 * fix 'Cross-Site Scripting' vulnerabilities in some plugins. * revise 'hiki-mode.el' to work correctly. * fix a bug in a redirection of 'hikifarm'. ! Changes in 0.8.1 * fix 'Cross-Site Request Forgeries' vulnerabilities. * set @lang automatically when @lang is not set. * fix a bug in saving with XML-RPC. * fix miscellaneous bugs. ! Changes in 0.8.0 * support mod_ruby. * support TrackBack (trackback.rb plugin). * support mobile agents. * add 'math' style (style/math/). * use ERB for the template engine instead of Amrita. * support selection and configuration of plugins via web. * store session informations in cookies. * support authentication of several users (edit_user.rb plugin). * the administrator's name becomes 'admin'. * support XML-RPC interfaces (misc/xmlrpc/). * much faster. hiki-1.0.0/doc/NEWS.txt000066400000000000000000000143231212533356300145240ustar00rootroot00000000000000! 1.0.0 с紊雁 * Wiki鴻帥ゃ若泣 DoS 綣掩с篆罩c障 * Ruby-1.9絲上障 * 絖潟若UTF-8紊眼障 * Rack絲上障 * Bundler絲上障 * docdiffGem篏帥障 * hikidocGem篏帥障 * If-Modified-Since ゅ>散茯ゃc違篆罩c障 ** Makoto Kitaichi Pull Request [GitHub #7] * misc/plugin/attach.rb NameError 篆罩c障 ** Keisuke SOGAWA Pull Request [GitHub #20] * ruby hiki.rb у篏障 ** Tomohiko Himura PUll Request [GitHub #21] * Sequel RDBMS 潟菴遵障[絎薑] * Heroku 筝у障[絎薑] * Wiki 鴻絖潟若紊眼鴻菴遵障 ! 0.8.8 с紊雁 * Wiki鴻帥ゃ若泣[[HikiDoc|http://rubyforge.org/projects/hikidoc/]]障 * amazon違ゃ潟AmazonAPI茯荐若絲上障 * 鴻c炊純菴遵障 * git吾絲上障 * 篁膣違違篆罩c茵障 ! 0.8.7 с紊雁 * Hiki 絎茵罔ゅ純篁紙<ゃゃс綣掩с篆罩c障 * 羞私<ゃ潟若HTTP Content-Length c若冴障 * HTTP Vary c若冴障 * Hikilet $SAFE=1 荐絎障 * Hikilet XMLRPC 泣若障 * 帥ゃ篋鴻宴若篆罩c障 * tDiary amazon 違ゃ潟莨若帥障 * 潟紊 URI file 鴻若障 * 惹鴻若帥鴻潟若 500 菴障 * 違ゃ潟 postable? <純菴遵障鴻 POST <純с障 * its 違ゃ潟1 腮帥с潟<潟菴遵c紊眼茵障 * 鴻絲丞違ゃ恰祉激с括∞茵荐絎с障 * ゃ潟ゃ活羈鴻с障 * 篁膣違違篆罩c茵障 ! 0.8.6 с紊雁 * 若吾贋医勲緇 DoS 綣掩сc篆罩c障 * <ゃ筝絎c篆罩c障 * WILLCOM ≪ゃ腴絲上障 * base_url 絎若 path c篆罩c障 * ュ茖鴻 Safari 絲上障 * 糸顙若ゃ糸紊с絎c篆罩c障 * 羞私<ゃhiki 鴻篁≪祉鴻с障(羞私<ゃ絎篆荐若с翫推戎) * pre 筝с WikiName 潟宴障 ! 0.8.5 с紊雁 * 贋育ュ<若≪鴻茲井絎с障 * 紊潟潟綽荀絮ユ雁∞с障 * Issue Tracking System 違ゃ潟菴遵障 (misc/plugin/its.rb) * Rast 罎膣≪違ゃ潟菴遵障 (contrib/plugin/rast-register.rb, contrib/plugin/rast-search.rb) * 膣違遺信罩c障 ! 0.8.4 с紊雁 * 鴻帥ゃ HikiDoc ゃ若泣紊眼障 * XML-RPC ゃ潟帥сゃ鴻ュ阪 EUC-JP UTF-8 紊眼障 * RSS 違ゃ潟у HTML 阪с障 * HikiFarm с<ゃ羞私 CGI 祉≪с障 * WEBrick 絲上障 (misc/webrick/) * 膣違遺信罩c障 ! 0.8.3 с紊雁 * 鴻泣ゃ祉鴻c潟域綣掩с篆罩c障 * 荐絎篆絖若c荐絎<ゃ羔筝桁篆罩c障 * hiki.cgi XML-RPC ゃ潟帥сゃ鴻сxmlrpc.cgi ゃ障 * ゃ茯純若鴻菴遵障 * hiki-mode.el 潟違翫c篆罩c障 ! 0.8.2 с紊雁 * 筝違ゃ潟с鴻泣ゃ祉鴻c潟域綣掩с篆罩c障 * hiki-mode.el 罩c篏c違篆罩c障 * hikifarm ф域 hiki 篏ゃсc違篆罩c障 ! 0.8.1 с紊雁 * 鴻泣ゃ祉鴻祉若吾с綣掩с篆罩c障 * @lang 荐絎荐茯純若鴻帥障 * XML-RPC т絖сc違篆罩c障 * 篁膣違遺信罩c障 ! 0.8.0 с紊雁 * mod_ruby 絲上障 * TrackBack 絲上障 (trackback.rb 違ゃ) * 阪遣腴≪祉鴻絲上障 * 医ゃ鴻帥ゃ菴遵障 (style/math/) * 潟若潟吾潟 Amrita ERB 紊眼障 * с違ゃ潟御荐絎純障 * 祉激с潟篆絖若ц障 * 茲違若吟茯荐若純障 (edit_user.rb 違ゃ) * 膊∞若九 'admin' 障 * XML-RPC ゃ潟帥сゃ鴻菴遵障 (misc/xmlrpc/) * 蕭障 hiki-1.0.0/doc/README-attach.txt000066400000000000000000000011721212533356300161450ustar00rootroot00000000000000! 篏帥 hiki.cgi c misc/plugin/attach/attach.cgi 潟若障 緇膊∞->違ゃ渇御 attach.rb 鴻筝 !! HikiFarm hikifarm.conf attach_cgi_name <ゃ羞私 CGI <ゃ 絎違 Hiki 篏 Hiki c 絎<ゃс<ゃ羞私 CGI 障 # Hiki<ゃ羞私CGI<ゃ # nil <ゃ羞私CGI篏 attach_cgi_name = nil hiki-1.0.0/doc/README.en000066400000000000000000000016701212533356300144710ustar00rootroot00000000000000! About Hiki Hiki is a powerful and fast wiki clone written by Ruby. Hiki has following features. !! Simple formatting rules based on the original Wiki See TextFormattingRules for the details. !! Customizable appearance by CSS themes Hiki supports various themes for [[tDiary|http://www.tdiary.org/]]. !! Plugins You can enhance features of Hiki by plugins. !! HikiFarm With HikiFarm, you can create new hikis by web browsers. ! Copyright Hiki is a free software under the terms of the GNU General Public License version 2. Hiki was originally developed by Hitoshi Takeuchi, and is now developed by Hiki development team. Hiki includes some files by other authors. :hiki/db/tmarshal.rb:base of a Rubikitch's script posted on [[ruby-list:30305]]. Its license is Ruby's. :hiki/docdiff/*:by Hisashi Morita. Its license is modified BSD. :hiki/image_size.rb:by Keisuke Minami. Its license is Ruby's. We will support you at http://hikiwiki.org/en/. hiki-1.0.0/doc/README.txt000066400000000000000000000060271212533356300147070ustar00rootroot00000000000000 Hiki Hiki蚊ゃWiki潟吾潟сHiki篁ヤ劫彰障 吾Wiki篌若激潟後 Hiki吾Wiki篌若激潟後泣若障荅括完 http://hikiwiki.org/ja/TextFormattingRules.html с CSS篏帥c若罘 鴻帥ゃ激若篏帥c膂≦荀紊с若若 障Hikiс篏ヨ激鴻tDiary莟絲若 篏睡с障 違ゃ潟罘醇≦宍 違ゃ潟罘純菴遵с障tDiary鐚ヨ箴絖鐚 違ゃ活c紊ч劫у茖蚊障 HikiFarm絲上 HikiFarm筝よ┃臀違銀膂≦違Hikiゃ篏 с障荅潟 misc/hikifarm/README 荀с 阪HTML荵紊翫 Hikiс後莨若Ruby鴻ERB篏帥c 阪HTML綵√荵紊眼с障 InterWiki泣若 InterWiki泣若障InterWikiWiki泣若守 ゃ罘純c鐚鐚с篏帥鴻cWiki泣若寂札紊 潟с障InterWikiName若吾篁ヤ 吾緇 *[[ruby-list|http://blade.nagaokaut.ac.jp/cgi-bin/scat.rb/ruby/ruby-list/]] *[[Hiki|http://hikiwiki.org/ja/?]] euc 篁紙若吾 [[Hiki:HikiFarm]] 吾http://hikiwiki.org/ja/HikiFarm 若吾吾潟障 罕 [[ruby-list:1]] 吾ruby-list<若潟違鴻1<若吾潟障 若吾眼篁с 罔羣ф箴違ゃ(category.rb障keyword.rb)若吾 眼篁眼篏с若吾宴с障 篏罔泣若 HikiGNU GPL2 ч絽劫荐怨若純с≪сHiki篏 <蚊с憜сHiki冴若冴障 絽<ゃ>札筝篏篏罔障 hiki/db/tmarshal.rb 潟<ruby-list:30305鴻鴻ュ慌篆罩cRuby ゃ祉潟鴻ч絽 hiki/docdiff/* 罍医篏篆罩BSDゃ祉潟鴻ч絽 hiki/image_size.rb Keisuke Minami 篏Ruby ゃ祉潟鴻ч絽 Hiki http://hikiwiki.org/ja/ с泣若茵c障 頳祉荀<吾 hiki-1.0.0/doc/VERSIONUP.txt000066400000000000000000000074171212533356300153500ustar00rootroot00000000000000! 0.6.x 篁ュ 0.7-devel-20040618 篁ュ若吾с潟≪ !! 荐絎<ゃ 荐絎<ゃ後紊眼障hikiconf.rb$紊医鴻 @紊医紊眼 !! 違ゃ 篏違ゃ括ゃ$紊医鴻@conf.紊医紊眼 !! 潟若 潟若潟吾潟 Amrita ERB 紊眼c篌眼潟 <ゃ紊с鎀眼障 障0.6 膤祉с template/ja/view.html 荐茯ャc障 template/view.html 荐茯潟若<ゃ篏帥 障潟若鴻帥ゃ冴翫0.6 膤祉篆 罩c 0.8 罔羣潟若篏鴻腆阪障 !! CGI 紊 (hikifarm 篏睡) hikifarm篏帥c篋冴hikifarmhiki.conf罕紊眼筝с hikifarmc篏hikiCGIcindex.cgi hikiconf.rb篁ヤ紊眼 * index.cgi #!/usr/bin/ruby hiki='' eval( open( '../hikifarm.conf' ){|f|f.read.untaint} ) $:.unshift "#{hiki}" load "#{hiki}/hiki.cgi" * hikiconf.rb hiki='' eval( open( '../hikifarm.conf' ){|f|f.read.untaint} ) __my_wiki_name__ = 'wiki' eval( File::open( "#{hiki}/hiki.conf" ){|f| f.read.untaint} ) ! 若吾с潟≪筝 若吾с潟≪号罸莠膂≦с篏鴻ц牡若帥 紊宴hikiconf.rb@data_pathф絎c筝<ゃ ≪ с若吾с潟≪腓冴障 !! ≪若ゃ絮 $ tar zxf hiki-0.x.x.tar.gz ≪若ゃ絮 ≪若ゃ絮hikicсс !! 違Hiki潟 絮≪若ゃсゃ潟鴻若ゃHiki筝娯吾障 с/home/foo/public_html/hiki/ゃHikiゃ潟鴻若 障 $ cd hiki $ cp -R * /home/foo/public_html/hiki !! 若炊主c吾潟 ≪若ゃ筝data/text/TextFormattingRules<ゃ後紊眼 菴遵у眼醇с障<ゃhikiconf.rb @data_pathф絎若炊主c筝吾潟若障 @data_path'/home/foo/hiki'絎 $ cp data/text/TextFormattingRules /home/foo/hiki/text/ 障 !! hikiconf.rb篆罩 障憟吟hikiconf.rb≪ 罨<≪若ゃ筝hikiconf.rb.samplehikiconf.rb吾潟若 ≪hikiconf.rb絎鴻с篆罩c障 若吾с潟≪篌眼hikiconf.rbс荐絎紜羝醇с с !! 激ャ若 !!! 若吾с潟≪Internal Server Errorc障 hiki.cgi1茵腆肴泣若c/usr/bin/env篏帥 宴若鴻障翫 #!/usr/local/bin/ruby #!C:\ruby\bin\ruby.exe Rubyゃ潟鴻若鴻腓冴綽荀障 hiki-1.0.0/doc/rd+/000077500000000000000000000000001212533356300136645ustar00rootroot00000000000000hiki-1.0.0/doc/rd+/README000066400000000000000000000034441212533356300145510ustar00rootroot00000000000000= rd+ style rd+ style篏帥違HikiRD篏帥c腴吾с障 Ruby-GNOME2 Project Site(http://ruby-gnome2.sourceforge.jp/)т戎喝篏API<潟鴻吾吾RDュ慌≦宍障 鐚罘純篏帥違祉主膕RD篏帥障 吾鴻ゃTextFormattingRulesс == RD RDRuby鴻<ゃ筝莨若篋潟絎臂ャ<潟若с 膣蚊蕭綺荐菴医ゃ絽吾篏帥障HikiWiki若cャ鴻荅帥 == ゃ潟鴻若号 (1) RDTool(http://raa.ruby-lang.org/list.rhtml?name=rdtool)ゃ潟鴻若 (RDTool綽荀ゃゃ潟鴻若) (2) Hikiゃ潟鴻若(Hiki綽荀ゃゃ潟鴻若) (3) Hiki篏腆肴 (4) hikiconf.rb@style篁ヤ紊眼 @style = 'rd+' (5) rd+ style篏腆肴 == 激с RD鴻帥ゃс篁ヤ激с潟障hikiconf.rb荐菴違 --- @options['rd.header_depth'] 絮ゃ絎с障'='h2'=='h3翫篁ヤ障 @options['rd.header_depth'] = 2 '='h1障帥ゃ茵腓咲h1сц;腓坂潟鴻茯炊眼篏帥障 == 篏 Masao Mutoh hiki-1.0.0/dot.htaccess000066400000000000000000000001641212533356300147450ustar00rootroot00000000000000Options +ExecCGI AddHandler cgi-script .cgi DirectoryIndex hiki.cgi deny from all hiki-1.0.0/hiki.cgi000077500000000000000000000033441212533356300140560ustar00rootroot00000000000000#!/usr/bin/env ruby # $Id: hiki.cgi,v 1.36 2008-01-24 15:42:11 znz Exp $ # Copyright (C) 2002-2004 TAKEUCHI Hitoshi BEGIN { $stdout.binmode } begin # FIXME encoding can be different (eg. iso-8859-1 in # hikiconf.rb.sample.en). Encoding.default_external = 'utf-8' rescue NameError $KCODE = 'e' end begin if FileTest::symlink?( __FILE__ ) org_path = File.dirname( File.expand_path( File.readlink( __FILE__ ) ) ) else org_path = File.dirname( File.expand_path( __FILE__ ) ) end $:.unshift( org_path.untaint, "#{org_path.untaint}/hiki" ) $:.delete(".") if File.writable?(".") require 'hiki/config' conf = Hiki::Config.new request = Hiki::Request.new(ENV) if ENV['CONTENT_TYPE'] =~ %r!\Atext/xml!i and ENV['REQUEST_METHOD'] =~ /\APOST\z/i require 'hiki/xmlrpc' server = Hiki::XMLRPCServer.new(conf, request) server.serve else # FIXME encoding can be different (eg. iso-8859-1 in # hikiconf.rb.sample.en). #cgi = CGI.new(:accept_charset=>"euc-jp") response = nil db = conf.database db.open_db { cmd = Hiki::Command.new(request, db, conf) response = cmd.dispatch } print response.header print response.body end rescue Exception => err if request print request.cgi.header( 'status' => '500 Internal Server Error', 'type' => 'text/html' ) else print "Status: 500 Internal Server Error\n" print "Content-Type: text/html\n\n" end require 'cgi' puts 'Hiki Error' puts '

Hiki Error

' puts '
'
  puts CGI.escapeHTML( "#{err} (#{err.class})\n" )
  puts CGI.escapeHTML( err.backtrace.join( "\n" ) )
  puts '
' puts "
#{' ' * 500}
" puts '' end hiki-1.0.0/hiki.rb000066400000000000000000000006601212533356300137120ustar00rootroot00000000000000#!/usr/bin/env ruby $LOAD_PATH.unshift(File.dirname(__FILE__)) require 'hiki/app' require 'rubygems' require 'rack' app = Rack::Builder.new{ use Rack::Lint use Rack::ShowExceptions #use Rack::ShowStatus use Rack::CommonLogger use Rack::Static, :urls => ['/theme'], :root => '.' run Hiki::App.new }.to_app options = { :Port => 9292, :Host => '0.0.0.0', :AccessLog => [] } Rack::Handler.default.run(app, options) hiki-1.0.0/hiki.ru000077500000000000000000000006251212533356300137410ustar00rootroot00000000000000#!/usr/bin/env rackup # -*- ruby -*- $LOAD_PATH.unshift '.' require 'hiki/app' require 'hiki/attachment' use Rack::Lint use Rack::ShowExceptions use Rack::Reloader #use Rack::Session::Cookie #use Rack::ShowStatus use Rack::CommonLogger use Rack::Static, :urls => ['/theme'], :root => '.' map '/' do run Hiki::App.new('hikiconf.rb') end map '/attach' do run Hiki::Attachment.new('hikiconf.rb') end hiki-1.0.0/hiki/000077500000000000000000000000001212533356300133635ustar00rootroot00000000000000hiki-1.0.0/hiki/aliaswiki.rb000066400000000000000000000012101212533356300156570ustar00rootroot00000000000000# $Id: aliaswiki.rb,v 1.5 2005-06-15 03:10:16 fdiary Exp $ # Copyright (C) 2003 TAKEUCHI Hitoshi module Hiki class AliasWiki require 'hiki/util' ALIASWIKI_NAME_RE = /\[\[(.+):(.+)\]\]/ attr_reader :aliaswiki_names def initialize(str) @aliaswiki_names = {} (str || '').scan( ALIASWIKI_NAME_RE ) do |i| @aliaswiki_names[i[0]] = i[1] end end def aliaswiki(name) @aliaswiki_names.has_key?(name) ? @aliaswiki_names[name] : name end def original_name(alias_name) orig = @aliaswiki_names.key(alias_name) orig ? orig : alias_name end end end hiki-1.0.0/hiki/app.rb000066400000000000000000000020321212533356300144650ustar00rootroot00000000000000 require 'rubygems' require 'rack' require 'hiki/config' require 'hiki/xmlrpc' $LOAD_PATH.unshift(File.dirname(__FILE__)) module Hiki class App def initialize(config_path = 'hikiconf.rb') @config_path = config_path end def call(env) request = Rack::Request.new(env) # TODO use Rack::Request#env or other methods instead of ENV # HACK replace ENV values to web application environment env.each{|k,v| ENV[k] = v.to_s unless /\Arack\./ =~ k } conf = Hiki::Config.new(@config_path) response = nil if %r|text/xml| =~ request.content_type and request.post? server = Hiki::XMLRPCServer.new(conf, request) response = server.serve else db = conf.database db.open_db do command = Hiki::Command.new(request, db, conf) response = command.dispatch end end # [body, status, headers] # Rack::Response.new(*response){|r| # }.finish response.header.delete('status') response.finish end end end hiki-1.0.0/hiki/attachment.rb000066400000000000000000000061451212533356300160460ustar00rootroot00000000000000 require 'rubygems' require 'rack' require 'hiki/config' require 'hiki/util' $LOAD_PATH.unshift(File.dirname(__FILE__)) module Hiki class Attachment include ::Hiki::Util def initialize(config_path) @config_path = config_path end def call(env) request = Hiki::Request.new(env) # HACK replace ENV values to web application environment env.each{|k,v| ENV[k] = v.to_s unless /\Arack\./ =~ k } conf = Hiki::Config.new(@config_path) response = attach_file(request, conf) response.finish end private def attach_file(request, conf) set_conf(conf) params = request.params page = params['p'] ? params['p'] : 'FrontPage' command = params['command'] ? params['command'] : 'view' command = 'view' unless ['view', 'edit'].include?(command) case when params['attach'] attach(request, page, command) when params['detach'] detach(request, page, command) else raise 'must specify parameter "attach"/"detach".' end redirect(request, "#{@conf.index_url}?c=#{command}&p=#{escape(page)}") rescue Exception => ex Hiki::Response.new(ex.message, 500, 'type' => 'text/plain') end def attach(request, page, command) params = request.params raise 'Invalid request.' unless params['p'] && params['attach_file'] attach_file = params['attach_file'] filename = File.basename(attach_file[:filename].gsub(/\\/, '/')) cache_path = "#{@conf.cache_path}/attach" attach_path = "#{cache_path}/#{escape(page)}" Dir.mkdir(cache_path) unless test(?e, cache_path.untaint) Dir.mkdir(attach_path) unless test(?e, attach_path.untaint) path = "#{attach_path}/#{escape(filename)}" max_size = @conf.options['attach_size'] || 1048576 # 1 MB if attach_file[:tempfile].size > max_size raise "File size is larger than limit (#{max_size} bytes)." end unless filename.empty? content = attach_file[:tempfile].read if (!@conf.options['attach.allow_script']) && (/ # License under GPL-2 # # original is Adam Bregenzer()'s python version # http://adam.bregenzer.net/python/typekey/TypeKey.py # # note: # nick name field must be sent as utf-8 url_encoded string. # # 2005-03-05 use CGI.escape instead of URI.escape by TAKEUCHI Hitoshi # # sample code: =begin token="your_site_token" tk = TypeKey.new(token,'1.1') if request.params['tk'] == "1" ts = request.params["ts"] email = request.params["email"] name = request.params["name"] nick = request.params["nick"] sig = request.params["sig"] if tk.verify(email, name, nick, ts, sig) puts "verify!" else puts "not!" end end return_url = "http://localhost/cgi-bin/tk_test.cgi" url_sign_in = tk.getLoginUrl(return_url + "?tk=1") url_sign_out = tk.getLogoutUrl(return_url) puts "sign in
"; puts "sign out
"; =end require 'uri' require 'cgi' unless Object.const_defined?(:Rack) require 'open-uri' require 'base64' require 'openssl' class TypeKey """This class handles TypeKey logins. """ attr_accessor(:base_url,:key_url,:key_cache_path,:key_cache_timeout,:login_timeout) def initialize(token, version = '1.1') # Base url for generating login and logout urls. @base_url = 'https://www.typekey.com/t/typekey/' # Url used to download the public key. @key_url = 'http://www.typekey.com/extras/regkeys.txt' # Location for caching the public key. @key_cache_path = '/tmp/tk_key_cache' # Length of time to wait before refreshing the public key cache, in seconds. # Defaults to two days. @key_cache_timeout = 60 * 60 * 48 # Length of time logins remain valid, in seconds. # Defaults to five minutes. @login_timeout = 60 * 5 @token = token @version = version end def verify(email, name, nick, ts, sig, key = nil) """Verify a typekey login """ #sig isn't urlencoded. sig.gsub!(/ /,"+") unless key key = getKey() end if @version == '1.1' message =[email, name, nick, ts.to_s, @token].join('::') else message =[email, name, nick, ts.to_s].join('::') end if dsaVerify(message, sig, key) if (Time.now.to_i - ts.to_i) > @login_timeout return false end return true else return false end end def getLoginUrl(return_url, email = false) """Return a URL to login to TypeKey """ if email email = '&need_email=1' else email = '' end url = @base_url url += 'login?t=' + @token url += email url += '&v=' + @version url += '&_return=' + Hiki::Util.escape(return_url) return url end def getLogoutUrl(return_url) """Return a URL to logout of TypeKey """ return @base_url + 'logout?_return=' + URI.escape(return_url) end def getKey(url = nil) """Return the TypeKey public keys, cache results unless a url is passed """ unless url begin mod_time = File.mtime(@key_cache_path).to_i rescue SystemCallError mod_time = 0 end if (Time.now.to_i - mod_time) < @key_cache_timeout File.open(@key_cache_path, 'r') {|fh| @key_string = fh.read } else open(@key_url) {|fh| @key_string = fh.read } File.open(@key_cache_path, 'w') {|fh| fh.puts(@key_string) } end else open(url) {|fh| @key_string = fh.read } end tk_key = {} for pair in @key_string.strip.split(' ') key, value = pair.split('=') tk_key[key] = value.to_i end return tk_key end def dsaVerify(message, sig, key) """Verify a DSA signature """ r_sig, s_sig = sig.split(':') r_sig = Base64.decode64(r_sig).unpack("H*")[0].hex s_sig = Base64.decode64(s_sig).unpack("H*")[0].hex sign = OpenSSL::ASN1::Sequence.new( [OpenSSL::ASN1::Integer.new(r_sig), OpenSSL::ASN1::Integer.new(s_sig)] ).to_der dsa = OpenSSL::PKey::DSA.new dsa.p = key["p"] dsa.q = key["q"] dsa.g = key["g"] dsa.pub_key = key["pub_key"] dss1 = OpenSSL::Digest::DSS1.new return dsa.verify(dss1, sign, message) end end hiki-1.0.0/hiki/command.rb000066400000000000000000000476341212533356300153440ustar00rootroot00000000000000# $Id: command.rb,v 1.92 2008-02-12 15:06:08 hiraku Exp $ # Copyright (C) 2002-2004 TAKEUCHI Hitoshi require 'timeout' require 'hiki/page' require 'hiki/util' require 'hiki/plugin' require 'hiki/aliaswiki' require 'hiki/cookie' require 'hiki/session' require 'hiki/filter' module Hiki class PermissionError < StandardError; end class SessionError < StandardError def initialize(msg = nil) msg = 'Invalid Session (maybe timeout)' unless msg super end end class Command include Hiki::Util def initialize(request, db, conf) @db = db @request = request @cgi = @request.dup # for backward compatibility # HACK for backward compatibility # @request.params['key'] == @cgi.params['key'][0] == @params['key'][0] # TODO remove this logic ASAP def @cgi.params result = {} super.each do |key, value| result[key] = [value] end result end @params = @cgi.params @cookies = @request.cookies @conf = conf code_conv # for TrackBack if %r|/tb/(.+)$| =~ @request.env['REQUEST_URI'] @request.params['p'] = unescape($1) @request.params['c'] = 'plugin' @request.params['plugin'] = 'trackback_post' end @cmd = @request.params['c'] @p = case @request.params.keys.size when 0 'FrontPage' when 1 @cmd ? nil : @request.params.keys.first else if @cmd == "create" @request.params['key'] ? @request.params['key'] : nil else @request.params['p'] ? @request.params['p'] : nil end end if /\A\.{1,2}\z/ =~ @p redirect(@request, @conf.index_url) return end @aliaswiki = AliasWiki.new( @db.load( @conf.aliaswiki_name ) ) @p = @aliaswiki.original_name(@p) if @p options = @conf.options || Hash.new( '' ) options['page'] = @p options['db'] = @db options['request'] = @request options['cgi'] = @cgi # for backward compatibility options['alias'] = @aliaswiki options['command'] = @cmd ? @cmd : 'view' options['params'] = @params @plugin = Plugin.new( options, @conf ) session_id = @cookies['session_id'] if session_id session = Hiki::Session.new( @conf, session_id ) if session.check @plugin.user = session.user @plugin.session_id = session_id end end if @conf.use_session && !@plugin.session_id session = Hiki::Session.new( @conf ) session.save @plugin.session_id = session.session_id @plugin.add_cookie( session_cookie( @plugin.session_id )) end @body_enter = @plugin.body_enter_proc Filter.init(@conf, @request, @plugin, @db) end def dispatch begin Timeout.timeout(@conf.timeout) { if @request.post? raise PermissionError, 'Permission denied' unless @plugin.postable? end @cmd = 'view' unless @cmd raise if !@p && ['view', 'edit', 'diff', 'save'].index( @cmd ) if @cmd == 'edit' raise PermissionError, 'Permission denied' unless @plugin.editable? cmd_edit( @p ) elsif @cmd == 'save' raise PermissionError, 'Permission denied' unless @plugin.editable? if @request.params['save'] cmd_save(@p, @request.params['contents'], @request.params['md5hex'], @request.params['update_timestamp']) elsif @request.params['edit_form_button'] @cmd = 'edit' cmd_plugin(false) cmd_edit( @p, @plugin.text ) else cmd_preview end elsif @cmd == 'create' raise PermissionError, 'Permission denied' unless @plugin.editable? send( "cmd_#{@cmd}" ) else if @conf.use_plugin and @plugin.plugin_command.index(@cmd) and @plugin.respond_to?(@cmd) @plugin.send( @cmd ) else send( "cmd_#{@cmd}" ) end end } rescue NoMethodError, PermissionError, SessionError, Timeout::Error data = get_common_data(@db, @plugin, @conf) data[:message] = h($!.message) generate_error_page(data) end end private def generate_page( data, status = 'OK' ) @plugin.hiki_menu(data, @cmd) @plugin.title = data[:title] data[:cmd] = @cmd data[:cgi_name] = @conf.cgi_name data[:body_enter] = @body_enter data[:lang] = @conf.lang data[:header] = @plugin.header_proc data[:body_leave] = @plugin.body_leave_proc data[:page_attribute] ||= '' data[:footer] = @plugin.footer_proc data.update( @plugin.data ) if @plugin.data if data[:toc] data[:body] = data[:toc] + data[:body] if @plugin.toc_f == :top data[:body].gsub!( Regexp.new( Regexp.quote( Plugin::TOC_STRING ) ), data[:toc] ) end @page = Hiki::Page.new( @request, @conf ) @page.command = @cmd @page.template = @conf.read_template( @cmd ) @page.contents = data data[:last_modified] = Time.now unless data[:last_modified] @page.process( @plugin ) @page.out( 'status' => status ) end def generate_error_page( data ) @plugin.hiki_menu(data, @cmd) @plugin.title = title( 'Error' ) data[:cgi_name] = @conf.cgi_name data[:view_title] = 'Error' data[:header] = @plugin.header_proc data[:frontpage] = @plugin.page_name( 'FrontPage' ) @page = Hiki::Page.new( @request, @conf ) @page.template = @conf.read_template( 'error' ) @page.contents = data @page.process( @plugin ) @page.out( 'status' => 'NOT_FOUND' ) end def cmd_preview raise SessionError if @plugin.session_id && @plugin.session_id != @request.params['session_id'] @cmd = 'preview' cmd_edit( @p, @request.params['contents'], @conf.msg_preview, @request.params['page_title'] ) end def cmd_view unless @db.exist?( @p ) @cmd = 'create' return cmd_create( @conf.msg_page_not_exist ) end tokens = @db.load_cache( @p ) unless tokens text = @db.load( @p ) parser = @conf.parser.new( @conf ) tokens = parser.parse( text ) @db.save_cache( @p, tokens ) end formatter = @conf.formatter.new( tokens, @db, @plugin, @conf ) contents, toc = formatter.to_s, formatter.toc if @conf.hilight_keys word = @request.params['key'] if word && word.size > 0 contents = hilighten(contents, unescape(word).split) end end old_ref = @db.get_attribute( @p, :references ) new_ref = formatter.references @db.set_references( @p, new_ref ) if new_ref != old_ref ref = @db.get_references( @p ) data = get_common_data( @db, @plugin, @conf ) pg_title = @plugin.page_name(@p) data[:page_title] = @plugin.hiki_anchor(escape(@p), h(@p)) data[:view_title] = pg_title data[:title] = title(unescape_html(pg_title)) data[:toc] = @plugin.toc_f ? toc : nil data[:body] = formatter.apply_tdiary_theme(contents) data[:references] = ref.collect! {|a| "[#{@plugin.hiki_anchor(escape(a), @plugin.page_name(a))}] " }.join data[:keyword] = @db.get_attribute(@p, :keyword).collect {|k| "[#{view_title(k)}]"}.join(' ') data[:last_modified] = @db.get_last_update( @p ) data[:page_attribute] = @plugin.page_attribute_proc generate_page( data ) end def hilighten(str, keywords) hilighted = str.dup keywords.each do |key| re = Regexp.new('(' << Regexp.escape(key) << ')', Regexp::IGNORECASE) hilighted.gsub!(/([^<]*)(<[^>]*>)?/) { body, tag = $1, $2 body.gsub(re) { %Q[#{$1}] } << ( tag || "" ) } end hilighted end def cmd_index list = @db.page_info.sort_by {|e| k,v = e.to_a.first if v[:title] && !v[:title].empty? v[:title].downcase else k.downcase end }.collect {|f| k = f.keys[0] editor = f[k][:editor] ? "by #{f[k][:editor]}" : '' display_text = h((f[k][:title] and f[k][:title].size > 0) ? f[k][:title] : k) display_text << " [#{@aliaswiki.aliaswiki(k)}]" if k != @aliaswiki.aliaswiki(k) %Q!#{@plugin.hiki_anchor(escape(k), display_text)}: #{format_date(f[k][:last_modified] )} #{editor}#{@conf.msg_freeze_mark if f[k][:freeze]}! } data = get_common_data( @db, @plugin, @conf ) data[:title] = title( @conf.msg_index ) data[:updatelist] = list generate_page( data ) end def cmd_recent list, last_modified = get_recent data = get_common_data( @db, @plugin, @conf ) data[:title] = title( @conf.msg_recent ) data[:updatelist] = list data[:last_modified] = last_modified generate_page( data ) end def get_recent list = @db.page_info.sort_by {|e| k,v = e.to_a.first v[:last_modified] }.reverse last_modified = list[0].values[0][:last_modified] list.collect! {|f| k = f.keys[0] tm = f[k][:last_modified] editor = f[k][:editor] ? "by #{f[k][:editor]}" : '' display_text = (f[k][:title] and f[k][:title].size > 0) ? f[k][:title] : k display_text = h(display_text) display_text << " [#{@aliaswiki.aliaswiki(k)}]" if k != @aliaswiki.aliaswiki(k) %Q|#{format_date( tm )}: #{@plugin.hiki_anchor(escape(k), display_text)} #{h(editor)} (#{@conf.msg_diff})| } [list, last_modified] end def cmd_edit( page, text=nil, msg=nil, d_title=nil ) page_title = d_title ? h(d_title) : @plugin.page_name(page) save_button = @cmd == 'edit' ? '' : nil preview_text = nil differ = nil link = nil formatter = nil data = get_common_data( @db, @plugin, @conf ) if @db.is_frozen?( page ) || @conf.options['freeze'] data[:freeze] = ' checked' else data[:freeze] = '' end if @cmd == 'preview' p = @conf.parser.new( @conf ).parse( text.gsub(/\r/, '') ) formatter = @conf.formatter.new( p, @db, @plugin, @conf ) preview_text, toc = formatter.to_s, formatter.toc save_button = '' data[:keyword] = h(@request.params['keyword'] || '') data[:update_timestamp] = @request.params['update_timestamp'] ? ' checked' : '' data[:freeze] = @request.params['freeze'] ? ' checked' : '' elsif @cmd == 'conflict' old = text.gsub(/\r/, '') new = @db.load( page ) || '' differ = word_diff( old, new ).gsub( /\n/, "
\n" ) link = @plugin.hiki_anchor(escape(page), h(page)) end @cmd = 'edit' if rev = @request.params['r'] text = @conf.repos.get_revision(page, rev.to_i) raise 'No such revision.' if text.empty? else text = ( @db.load( page ) || '' ) unless text end md5hex = @request.params['md5hex'] || @db.md5hex( page ) @plugin.text = text data[:title] = title( page ) data[:toc] = @plugin.toc_f ? toc : nil data[:pagename] = h(page) data[:md5hex] = md5hex data[:edit_proc] = @plugin.edit_proc data[:contents] = h(@plugin.text) data[:msg] = msg data[:button] = save_button data[:preview_button] = save_button data[:link] = link data[:differ] = differ data[:body] = preview_text ? formatter.apply_tdiary_theme(preview_text) : nil data[:keyword] ||= h(@db.get_attribute(page, :keyword).join("\n")) data[:update_timestamp] ||= ' checked' data[:page_title] = page_title data[:form_proc] = @plugin.form_proc data[:session_id] = @plugin.session_id generate_page( data ) end def cmd_diff old = @db.load_backup( @p ) || '' new = @db.load( @p ) || '' begin differ = word_diff( old, new ).gsub( /\n/, "
\n" ) rescue # FIXME word_diff() can raise Encoding::CompatibilityError in # Ruby-1.9. differ = unified_diff( old, new ).gsub( /\n/, "
\n" ) end data = get_common_data( @db, @plugin, @conf ) data[:title] = title("#{@p} #{@conf.msg_diff}") data[:differ] = differ generate_page( data ) end def cmd_save( page, text, md5hex, update_timestamp = true ) raise SessionError if @plugin.session_id && @plugin.session_id != @request.params['session_id'] subject = '' if text.empty? @db.delete( page ) @plugin.delete_proc data = get_common_data( @db, @plugin, @conf ) data[:title] = @conf.msg_delete data[:msg] = @conf.msg_delete_page data[:link] = h(page) generate_page(data) else title = @request.params['page_title'] ? @request.params['page_title'].strip : page title = title.size > 0 ? title : page if exist?(title) @cmd = 'edit' return cmd_edit( page, text, @conf.msg_duplicate_page_title ) end if Filter.new_page_is_spam?(page, text, title) @cmd = 'is_spam' return cmd_edit( page, text, @conf.msg_input_is_spam ) end if @plugin.save( page, text, md5hex, update_timestamp, false ) keyword = @request.params['keyword'].split("\n").collect {|k| k.chomp.strip}.delete_if{|k| k.size == 0} attr = [[:keyword, keyword.uniq], [:title, title]] attr << [:editor, @plugin.user] @db.set_attribute(page, attr) else @cmd = 'conflict' return cmd_edit( page, text, @conf.msg_save_conflict ) end @db.freeze_page( page, @request.params['freeze'] ? true : false) if @plugin.admin? return redirect(@request, @conf.base_url + @plugin.hiki_url(page)) end end def cmd_search word = @request.params['key'] if word && word.size > 0 total, l = @db.search(word) if @conf.hilight_keys l.collect! {|p| @plugin.make_anchor("#{@conf.cgi_name}?cmd=view&p=#{escape(p[0])}&key=#{escape(word.split.join('+'))}", @plugin.page_name(p[0])) + " - #{p[1]}"} else l.collect! {|p| @plugin.hiki_anchor(escape(p[0]), @plugin.page_name(p[0])) + " - #{p[1]}"} end data = get_common_data( @db, @plugin, @conf ) data[:title] = title( @conf.msg_search_result ) data[:msg2] = @conf.msg_search + ': ' data[:button] = @conf.msg_search data[:key] = %Q|value="#{h(word)}"| word2 = word.split.join("', '") if l.size > 0 data[:msg1] = sprintf(@conf.msg_search_hits, h(word2), total, l.size) data[:list] = l else data[:msg1] = sprintf(@conf.msg_search_not_found, h(word2)) data[:list] = nil end else data = get_common_data( @db, @plugin, @conf ) data[:title] = title( @conf.msg_search ) data[:msg1] = @conf.msg_search_comment data[:msg2] = @conf.msg_search + ': ' data[:button] = @conf.msg_search data[:key] = 'value=""' data[:list] = nil data[:method] = 'get' end generate_page( data ) end def cmd_create( msg = nil ) p = @request.params['key'] if p @p = @aliaswiki.original_name(p) if /^\./ =~ @p || @p.size > @conf.max_name_size || @p.size == 0 @request.params['key'] = nil cmd_create( @conf.msg_invalid_filename( @conf.max_name_size) ) return end @cmd = 'edit' orig_page = exist?(@p) if orig_page or @db.exist?(@p) s = @db.load( @p ) cmd_edit( orig_page || @p, s, @conf.msg_already_exist ) else cmd_edit( @p, @request.params['text'] ) end else data = get_common_data( @db, @plugin, @conf ) data[:title] = title( @conf.msg_create ) data[:msg1] = msg data[:msg2] = @conf.msg_create + ': ' data[:button] = @conf.msg_newpage data[:key] = %Q|value="#{msg ? h(@p) : ''}"| data[:list] = nil data[:method] = 'get' generate_page( data ) end end def cmd_login name = @request.params['name'] password = @request.params['password'] page = @request.params['p'] msg_login_result = nil status = 'OK' if name && password session = Hiki::Session.new( @conf ) @plugin.login( name, password ) if @plugin.user session.user = @plugin.user session.save if page && !page.empty? url = @conf.base_url + @plugin.hiki_url( page ) else url = @conf.index_url end cookies = [session_cookie(session.session_id)] return redirect(@request, url, cookies) else msg_login_result = @conf.msg_login_failure status = '403 Forbidden' end end data = get_common_data( @db, @plugin, @conf ) data[:title] = title( @conf.msg_login ) data[:button] = @conf.msg_ok data[:login_result] = msg_login_result data[:page] = h(page || '') generate_page( data, status ) end def cmd_admin raise PermissionError, 'Permission denied' unless @plugin.admin? data = get_common_data( @db, @plugin, @conf ) data[:key] = h(@request.params['conf'] || 'default') data[:title] = title( @conf.msg_admin ) data[:session_id] = @plugin.session_id if @request.params['saveconf'] raise SessionError if @plugin.session_id && @plugin.session_id != @request.params['session_id'] data[:save_config] = true end generate_page( data ) end def exist?( page ) tmp = @aliaswiki.aliaswiki(page) if page != tmp and @p != page return @p end tmp = @aliaswiki.original_name(page) if page != tmp and @p != tmp return tmp end p = (@db.select {|p| p[:title] and unescape(p[:title]) == page})[0] if p != @p and p != nil return p end if @db.exist?(page) and @p != page return page end false end def cmd_plugin(redirect_mode = true) return unless @conf.use_plugin plugin = @request.params['plugin'] result = true if @plugin.respond_to?( plugin ) && !Object.method_defined?( plugin ) result = @plugin.send( plugin ) return result if result.instance_of? Hiki::Response else raise PluginException, 'not plugin method' end if redirect_mode and result redirect(@request, @conf.base_url + @plugin.hiki_url(@p)) end end def cmd_logout if session_id = @cookies['session_id'] cookies = [session_cookie(session_id, -1)] Hiki::Session.new( @conf, session_id ).delete end redirect(@request, @conf.index_url, cookies) end def cookie(name, value, max_age = Session::MAX_AGE) Hiki::Cookie.new( { 'name' => name, 'value' => value, 'path' => @plugin.cookie_path, 'expires' => Time.now.gmtime + max_age } ) end def session_cookie(session_id, max_age = Session::MAX_AGE) cookie('session_id', session_id, max_age) end def code_conv if @conf.mobile_agent? && /EUC-JP/i =~ @conf.charset @request.params.each_key do |k| @request.params[k].each do |v| v.replace(v.to_euc) if v end end end end end end hiki-1.0.0/hiki/config.rb000066400000000000000000000210151212533356300151540ustar00rootroot00000000000000# $Id: config.rb,v 1.127 2008-02-07 15:44:11 yanagita Exp $ # Copyright (C) 2004-2005 Kazuhiko # # TADA Tadashi holds the copyright of Config class. module Hiki VERSION = '1.0.0' RELEASE_DATE = '2013-03-30' end # For backward compatibility HIKI_VERSION = Hiki::VERSION HIKI_RELEASE_DATE = Hiki::RELEASE_DATE require 'cgi' unless Object.const_defined?(:Rack) require 'hiki/request' require 'hiki/response' require 'hiki/util' require 'hiki/command' module Hiki PATH = "#{File.dirname(File.dirname(__FILE__))}" class Config include ::Hiki::Util def initialize(config_path = 'hikiconf.rb') load(config_path) load_cgi_conf load_messages require "style/#{@style}/parser" require "style/#{@style}/html_formatter" require "hiki/repos/#{@repos_type}" require "hiki/db/#{@database_type}" # parser class and formatter class style = @style.gsub( /\+/, '' ) @parser = Hiki.const_get( "Parser_#{style}" ) @formatter = Hiki.const_get( "HTMLFormatter_#{style}" ) # repository class @repos = Hiki.const_get("Repos#{@repos_type.capitalize}").new(@repos_root, @data_path) self.class.__send__ :attr_accessor, *instance_variables.map{|v| v.to_s.sub('@', '') } bot = ["googlebot", "Hatena Antenna", "moget@goo.ne.jp"] bot += @options['bot'] || [] @bot = Regexp.new( "(#{bot.uniq.join( '|' )})", true ) end def database @database ||= Hiki.const_get( "HikiDB_#{database_type}" ).new( self ) end def bot? @bot =~ ENV['HTTP_USER_AGENT'] end def mobile_agent? %r[(DoCoMo|J-PHONE|Vodafone|WILLCOM|MOT-|UP\.Browser|DDIPOCKET|ASTEL|PDXGW|Palmscape|Xiino|sharp pda browser|Windows CE|L-mode)]i =~ ENV['HTTP_USER_AGENT'] end # # get/set/delete plugin options # def []( key ) @options[key] end def []=( key, val ) @options2[key] = @options[key] = val end def delete( key ) @options.delete( key ) @options2.delete( key ) end def save_config conf = ERB.new( File.open( "#{@template_path}/hiki.conf" ){|f| f.read }.untaint ).result( binding ) File.open(@config_file, "w") do |f| f.print conf end end def base_url return '' if Object.const_defined?(:Rack) unless @base_url if !ENV['SCRIPT_NAME'] @base_url = '' elsif ENV['HTTPS'] && /off/i !~ ENV['HTTPS'] port = (ENV['SERVER_PORT'] == '443') ? '' : ':' + ENV['SERVER_PORT'].to_s @base_url = "https://#{ ENV['SERVER_NAME'] }#{ port }#{File.dirname(ENV['SCRIPT_NAME'])}/".sub(%r|/+$|, '/') else port = (ENV['SERVER_PORT'] == '80') ? '' : ':' + ENV['SERVER_PORT'].to_s @base_url = "http://#{ ENV['SERVER_NAME'] }#{ port }#{File.dirname(ENV['SCRIPT_NAME'])}/".sub(%r|/+$|, '/') end end @base_url end def index_url unless @index_url @index_url = (base_url + cgi_name).sub(%r|/\./|, '/') end @index_url end def read_template( cmd ) if mobile_agent? template = File.join(@template_path, 'i.' + @template[cmd]) else template = File.join(@template_path, @template[cmd]) end if FileTest.file?(template) File.read(template).untaint else raise Errno::ENOENT, "Template file for \"#{cmd}\" not found." end end def read_layout if mobile_agent? path = File.join(@template_path, "i.layout.html") else path = File.join(@template_path, "layout.html") end File.read(path) end private # loading hikiconf.rb in current directory def load(config_path = 'hikiconf.rb') @options = {} eval( File.open(config_path){|f| f.read }.untaint, binding, "(#{config_path})", 1 ) formaterror if $data_path raise 'No @data_path variable.' unless @data_path @data_path += '/' if /\/$/ !~ @data_path # default values @smtp_server ||= 'localhost' @use_plugin = true if @use_plugin.nil? @site_name ||= 'Hiki' @author_name ||= '' @mail_on_update||= false @mail ||= [] @theme ||= 'hiki' @theme_url ||= 'theme' @theme_path ||= 'theme' @use_sidebar ||= false @main_class ||= 'main' @sidebar_class ||= 'sidebar' @auto_link ||= false @cache_path ||= "#{@data_path}/cache" @style ||= 'default' @hilight_keys = true if @hilight_keys.nil? @plugin_debug ||= false @charset ||= 'UTF-8' @database_type ||= 'flatfile' @cgi_name = './' if !@cgi_name || @cgi_name.empty? @admin_name ||= 'admin' @repos_type ||= 'default' @use_wikiname = true if @use_wikiname.nil? @use_session = true if @use_session.nil? @options = {} unless @options.class == Hash @xmlrpc_enabled = true unless defined?(@xmlrpc_enabled) @template_path ||= "#{PATH}/template" @plugin_path ||= "#{PATH}/plugin" @side_menu ||= 'SideMenu' @interwiki_name ||= 'InterWikiName' @aliaswiki_name ||= 'AliasWikiName' @formatting_rule ||= 'TextFormattingRules' template_default = { 'view' => 'view.html', 'index' => 'list.html', 'edit' => 'edit.html', 'recent' => 'list.html', 'diff' => 'diff.html', 'search' => 'form.html', 'create' => 'form.html', 'admin' => 'adminform.html', 'save' => 'success.html', 'login' => 'login.html', 'plugin' => 'plugin.html', 'error' => 'error.html' } if @template @template.update(template_default){|k, s, o| s} else @template = template_default end @max_name_size ||= 50 @password ||= '' @generator ||= "Hiki #{Hiki::VERSION}" @timeout ||= 30 Dir.mkdir(@cache_path) unless File.directory?(@cache_path) # following variables are not configurable. @config_file = "#{@data_path}/hiki.conf" end # loading hiki.conf in @data_path. def load_cgi_conf raise 'Do not set @data_path as same as Hiki system directory.' if @data_path == "#{PATH}/" variables = [:site_name, :author_name, :mail, :theme, :password, :theme_url, :sidebar_class, :main_class, :theme_path, :mail_on_update, :use_sidebar, :auto_link, :use_wikiname, :xmlrpc_enabled, :options2] begin cgi_conf = File.open( @config_file ){|f| f.read }.untaint cgi_conf.gsub!( /^[@$]/, '' ) def_vars1 = '' def_vars2 = '' variables.each do |var| def_vars1 << "#{var} = nil\n" def_vars2 << "@#{var} = #{var} unless #{var} == nil\n" end b = binding.taint eval( def_vars1, b ) Thread.start { $SAFE = 4 eval( cgi_conf, b, "(hiki.conf)", 1 ) }.join eval( def_vars2, b ) rescue IOError, Errno::ENOENT end @mail = [@mail].flatten # for backward compatibility if @options2 then @options.update( @options2 ) else @options2 = {}.taint end formaterror if $site_name end def method_missing( *m ) if m.length == 1 then instance_eval( <<-SRC def #{m[0]} @#{m[0]} end def #{m[0]}=( p ) @#{m[0]} = p end SRC ) end nil end def load_messages candidates = @lang ? [@lang] : [] if ENV['HTTP_ACCEPT_LANGUAGE'] accept_language = ENV['HTTP_ACCEPT_LANGUAGE'].split(',').collect{|entry| lang, quality = entry.split(';') lang.strip! if /^q=(.+)/ =~ quality quality = $1.to_f else quality = 1.0 end [lang, quality] }.sort_by{|i| -i[1]}.map{|i| i[0][0...2].untaint} candidates.concat(accept_language) end candidates << 'en' candidates.each do |lang| begin require "messages/#{lang}" extend(Hiki.const_get("Messages_#{lang}")) @lang = lang return rescue LoadError end end raise "No message resource file is found. Please put one in the messages/ directory." end def formaterror raise "*** NOTICE ***\n\nThe format of configuration files (i.e. hikiconf.rb and hiki.conf) has changed.\nSee 'doc/VERSIONUP.txt' for more details.\n\n" end end end hiki-1.0.0/hiki/cookie.rb000066400000000000000000000005361212533356300151650ustar00rootroot00000000000000 module Hiki if Object.const_defined?(:Rack) class Cookie attr_reader :name, :value, :path, :expires def initialize(options) @name = options['name'] @value = options['value'] @path = options['path'] @expires = options['expires'] end end else Cookie = ::CGI::Cookie end end hiki-1.0.0/hiki/db/000077500000000000000000000000001212533356300137505ustar00rootroot00000000000000hiki-1.0.0/hiki/db/flatfile.rb000066400000000000000000000124651212533356300160730ustar00rootroot00000000000000# coding: utf-8 # $Id: flatfile.rb,v 1.24 2007-09-25 06:23:41 fdiary Exp $ # Copyright (C) 2002-2003 TAKEUCHI Hitoshi require 'fileutils' require 'hiki/db/ptstore' require 'hiki/storage' require 'hiki/util' module Hiki class HikiDB_flatfile < HikiDBBase attr_reader :pages_path def initialize(conf) @conf = conf @pages_path = File.join(@conf.data_path, "text") @backup_path = File.join(@conf.data_path, "backup") @info_db = File.join(@conf.data_path, "info.db") create_missing_dirs create_infodb unless test(?e, @info_db) @info = PTStore.new(@info_db) end def close_db true end def store(page, text, md5, update_timestamp = true) backup(page) filename = textdir(page) if exist?(page) return nil if md5 != md5hex(page) if update_timestamp FileUtils.copy(filename, backupdir(page), { :preserve => true }) end end create_info_default(page) unless info_exist?(page) if update_timestamp set_last_update(page, Time.now) end File.open(filename, 'wb') do |f| f.write(text.gsub(/\r\n/, "\n")) end true end def unlink(page) if exist?(page) begin FileUtils.copy(textdir(page), backupdir(page), { :preserve => true }) delete_info(page) File.unlink(textdir(page)) rescue end end end def load(page) return nil unless exist?(page) File.read(textdir(page)) end def load_backup(page) return nil unless backup_exist?(page) File.read(backupdir(page)) end def exist?(page) test(?e, textdir(page)) end def backup_exist?(page) test(?e, backupdir(page)) end def pages Dir.glob("#{@pages_path}/*").delete_if {|f| !test(?f, f.untaint)}.collect! {|f| unescape(File.basename(f)) } end def rename(old_page, new_page) raise ArgumentError, "#{new_page} has already existed." if exist?(new_page) text = load(old_page) store(new_page, text, md5hex(text)) unlink(old_page) end # ============== # info DB # ============== def info_exist?(page) f = escape(page) @info.transaction(true) do @info.root?(f) end end def infodb_exist? test(?e, @info_db) end def info(page) f = escape(page) @info.transaction(true) do @info.root?(f) ? @info[f] : nil end end def page_info h = [] @info.transaction(true) do @info.roots.each { |a| h << { unescape(a) => @info[a]} } end h end def set_attribute(page, attr) f = escape(page) @info.transaction do @info[f] = default unless @info[f] attr.each do |attribute, value| @info[f][attribute] = value end end end def get_attribute(page, attribute) f = escape(page) @info.transaction(true) do if @info.root?(f) @info[f][attribute] || default[attribute] else default[attribute] end end end def select result = [] @info.transaction(true) do @info.roots.each do |a| result << unescape(a) if yield(@info[a]) end end result end def increment_hitcount(page) f = escape(page) @info.transaction do @info[f][:count] = @info[f][:count] + 1 end end def get_hitcount(page) get_attribute(page, :count) end def freeze_page(page, freeze) set_attribute(page, [[:freeze, freeze]]) end def is_frozen?(page) get_attribute(page, :freeze) end def set_last_update(page, t) set_attribute(page, [[:last_modified, t]]) end def get_last_update(page) get_attribute(page, :last_modified) end def set_references(page, r) set_attribute(page, [[:references, r]]) end def get_references(page) ref = [] page_info.each do |a| r = a.values[0][:references] if String === r # for compatibility r = r.split(',') set_references(a.keys[0], r) end ref << a.keys[0] if r.include?(page) end ref end private def create_missing_dirs [@pages_path, @backup_path].each {|d| FileUtils.mkdir_p(d) unless FileTest.exist?(d) } end def delete_info(page) f = escape(page) begin @info.transaction do @info.delete(f) end rescue end end def create_infodb @info = PTStore.new(@info_db) @info.transaction do pages.each do |a| r = default r[:last_modified] = File.mtime("#{@pages_path}/#{escape(a)}".untaint) @info[escape(a)] = r end end end def create_info_default(page) f = escape(page) @info.transaction do @info[f] = default end end def default { :count => 0, :last_modified => Time.now, :freeze => false, :references => [], :keyword => [], :title => '', } end def textdir(s) File.join(@pages_path, escape(s)).untaint end def backupdir(s) File.join(@backup_path, escape(s)).untaint end end end hiki-1.0.0/hiki/db/ptstore.rb000066400000000000000000000010511212533356300157720ustar00rootroot00000000000000# coding: utf-8 # $Id: ptstore.rb,v 1.12 2006-08-07 02:10:27 fdiary Exp $ # # ptstore.rb # based on pstore.rb contained in Ruby 1.8.2 # # How to use: # # db = PTStore.new("/tmp/foo") # db.transaction do # p db.roots # ary = db["root"] = [1,2,3,4] # ary[0] = [1,1.5] # end # db.transaction do # p db["root"] # end require 'pstore' require "hiki/db/tmarshal" class PTStore < PStore def dump(table) TMarshal.dump(table) end def load(content) TMarshal.load(content) end def load_file(file) TMarshal.load(file) end endhiki-1.0.0/hiki/db/rdb.rb000066400000000000000000000127211212533356300150470ustar00rootroot00000000000000# $Id: flatfile.rb,v 1.23 2005/11/01 14:21:00 yanagita Exp $ # Copyright (C) 2007 Kazuhiko require "hiki/storage" require "hiki/util" require "hiki/db/tmarshal" require "sequel" module Hiki class HikiDB_rdb < HikiDBBase attr_reader :db, :wiki def initialize(conf) @conf = conf @wiki = @conf.database_wiki @cache = {} end def open_db if block_given? begin @db = Sequel.connect(ENV['DATABASE_URL'] || @conf.database_url) yield ensure close_db end else true end true end def close_db @db.disconnect end def store(page, body, md5, update_timestamp = true) if exist?(page) return nil if md5 != md5hex(page) if update_timestamp backup(page) end end last_modified = Time::now revisions = @db[:page_backup].where(wiki: @wiki, name: page).select(:revision).to_a.map{|record| record[:revision]} revision = if revisions.empty? 1 else max(revisions) end @db[:page_backup].insert(body: body, last_modified: last_modified, wiki: @wiki, name: page, revision: revision) record = @db[:page].where(wiki: @wiki, name: page) if record.first record.update(body: body, last_modified: last_modified) else @db[:page].insert(body: body, last_modified: last_modified, wiki: @wiki, name: page, count: 0) end @cache[page] = body true end def unlink(page) @db[:page].where(wiki: @wiki, name: page).delete end def load(page) return @cache[page] if @cache.has_key?(page) if res = @db[:page].where(wiki: @wiki, name: page).select(:body).first @cache[page] = res[:body] else @cache[page] = nil end @cache[page] end def load_backup(page) @db[:page_backup].where(wiki: @wiki, name: page).order(:revision).limit(1, 1).to_a.first end def save(page, src, md5) raise "DB#save is obsoleted. Please use Plugin#save instead." end def exist?(page) return page_info.find{|i| i.to_a[0][0] == page} ? true : false end def pages @db[:page].where(wiki: @wiki).select(:name).to_a.map{|page| page[:name]} end def info(page) res = page_info.find{|i| i.to_a[0][0] == page}.to_a[0][1] rescue nil if res return res else return default end end def page_info @info_db ||= @db[:page].where(wiki: @wiki).select(:name, :title, :last_modified, :keyword, :references, :editor, :freeze, :count).to_a.map{|page| {page[:name] => make_info_hash(page)}} end def set_attribute(page, attr) attr.each do |attribute, value| attribute = attribute.to_s.chomp case value when Array value = value.join("\n") when TrueClass value = 1 when FalseClass value = 0 end @db[:page].where(wiki: @wiki, name: page).update(attribute => value) unless %w(references count freeze).include?(attribute) @db[:page_backup].where(wiki: @wiki, name: page).order(:revision).limite(1).update(attribute => value) end end end def get_attribute(page, attribute) return info(page)[attribute] end def select result = [] page_info.each do |e| name, info = e.to_a.first result << name if yield(info) end result end def increment_hitcount(page) @db[:page].where(wiki: @wiki, name: page).update(count: count + 1) end def get_hitcount(page) get_attribute(page, :count) end def freeze_page (page, freeze) set_attribute(page, [[:freeze, freeze]]) end def is_frozen? (page) get_attribute(page, :freeze) end def set_last_update (page, t) set_attribute(page, [[:last_modified, t]]) end def get_last_update(page) get_attribute(page, :last_modified) end def set_references(page, r) set_attribute(page, [[:references, r]]) end def get_references(page) ref = [] page_info.each do |a| r = a.values[0][:references] if String === r # for compatibility r = r.split(",") set_references(a.keys[0], r) end ref << a.keys[0] if r.include?(page) end ref end private def create_missing_dirs [@pages_path, @backup_path].each {|d| FileUtils.mkdir_p(d) unless FileTest.exist?(d) } end def default { :count => 0, :last_modified => Time::now, :freeze => false, :references => [], :keyword => [], :title => "", } end def make_info_hash(hash) { :title => hash[:title] || "", :last_modified => make_time(hash[:last_modified]), :keyword => (hash[:keyword] || "").split(/\n/), :references => (hash[:references] || "").split(/\n/), :editor => hash[:editor], :freeze => (hash[:freeze] == 1), :count => hash[:count], } end def make_time(time) if time Time.local(time.year, time.month, time.day, time.hour, time.min, time.sec) else Time.now end end def textdir(s) File::join(@pages_path, s.escape).untaint end def backupdir(s) File::join(@backup_path, s.escape).untaint end end end hiki-1.0.0/hiki/db/tmarshal.rb000066400000000000000000000020641212533356300161120ustar00rootroot00000000000000# Original Copyright (C) Rubikichi # Modified by TAKEUCHI Hitoshi # You can redistribute it and/or modify it under the terms of # the Ruby's licence. module TMarshal module_function def dump(obj, port = nil) dumped = dump_text(obj) if port port.write dumped end dumped end def load(port) case port when String eval port.untaint when IO, StringIO eval port.read.untaint else raise 'Wrong type!' end end def restore(port) load(port) end def dump_text(obj) case obj when String obj.dump when Array "[\n"+obj.collect{|x| dump_text(x)+",\n"}.join+"]" when Hash "{\n"+obj.sort_by{|e| e[0].inspect}.collect{|k,v| "#{dump_text(k)} => #{dump_text(v)},\n"}.join+"}" when Numeric, Module, Regexp, Symbol, TrueClass, FalseClass, NilClass, Range obj.inspect when Time "Time.at(#{obj.to_i})" else raise 'Wrong type!' end end end if __FILE__ == $0 puts TMarshal.dump({:age => 22, :lang => 'Ruby', :man => true, :day => Time.now}) end hiki-1.0.0/hiki/farm.rb000066400000000000000000000036351212533356300146440ustar00rootroot00000000000000# -*- coding: utf-8 -*- require 'hiki/farm/config' require 'hiki/farm/wiki' require 'hiki/farm/manager' require 'hiki/farm/dispatcher' require 'hiki/farm/page' module Hiki module Farm VERSION = '1.0.0' RELEASE_DATE = '2013-03-30' end end # for backward compatibility HIKIFARM_VERSION = Hiki::Farm::VERSION HIKIFARM_RELEASE_DATE = Hiki::Farm::RELEASE_DATE module Hiki module Farm class App def initialize(conf) @conf = conf end def call(env) manager = ::Hiki::Farm::Manager.new(@conf) request = Rack::Request.new(env) # rss, index, error? response = run(manager, request) response.finish end private def run(manager, request) case when request.get? && %r!\A/#{::Hiki::Farm::RSSPage.page_name}\z! =~ request.path_info body = ::Hiki::Farm::RSSPage.new(@conf, manager, File.dirname(request.url)).to_s ::Hiki::Response.new(body, 200, { }) when request.get? && 'rss' == request.params[manager.command_key] body = ::Hiki::Farm::RSSPage.new(@conf, manager, File.dirname(request.url)).to_s ::Hiki::Response.new(body, 200, { }) when request.post? && request.params['wiki'] && !request.params['wiki'].empty? begin name = request.params['wiki'] raise 'invalid wiki name' unless /\A[a-zA-Z0-9]+\z/ =~ name manager.create_wiki(name) ::Hiki::Response.new('post', 302, { 'Location' => request.url }) rescue puts $!.message puts $!.backtrace.join("\n") body = ::Hiki::Farm::IndexPage.new(@conf, manager, request.url, $!.message).to_s ::Hiki::Response.new(body, 200, { }) end else body = ::Hiki::Farm::IndexPage.new(@conf, manager, request.url, '').to_s ::Hiki::Response.new(body, 200, { }) end end end end end hiki-1.0.0/hiki/farm/000077500000000000000000000000001212533356300143105ustar00rootroot00000000000000hiki-1.0.0/hiki/farm/config.rb000066400000000000000000000011071212533356300161010ustar00rootroot00000000000000# -*- coding: utf-8 -*- module Hiki module Farm class Config attr_reader(:ruby, :hiki, :hikifarm_description, :farm_root, :default_pages_path, :data_root, :repos_type, :repos_root, :title, :css, :author, :mail, :cgi_name, :attach_cgi_name, :header, :footer, :cgi, :hikifarm_template_dir, :charset) attr_writer :repos_type def self.load(path) c = new() c.instance_eval(File.read(path)) # set default values c.repos_type ||= 'default' c end end end end hiki-1.0.0/hiki/farm/dispatcher.rb000066400000000000000000000007271212533356300167710ustar00rootroot00000000000000 module Hiki module Farm class Dispatcher def call(env) request = Hiki::Request.new(env) conf = ::Hiki::Farm::Config.load(File.join(Hiki::PATH, 'hikifarm_conf.rb')) case request.path_info when '/', "/#{Hiki::Farm::RSSPage.page_name}" Hiki::Farm::App.new(conf).call(env) when %r!\A/(\w+)/! Hiki::App.new(File.join(conf.farm_root, $1, 'hikiconf.rb')).call(env) end end end end end hiki-1.0.0/hiki/farm/manager.rb000066400000000000000000000060721212533356300162540ustar00rootroot00000000000000# -*- coding: utf-8 -*- require 'hiki/util' module Hiki module Farm class Manager attr_reader :wikilist def initialize(conf) @conf = conf farm_pub_path = @conf.farm_root ruby = @conf.ruby repos_type = @conf.repos_type repos_root = @conf.repos_root data_root = @conf.data_root require "hiki/repos/#{repos_type}" @repos = Hiki.const_get("HikifarmRepos#{repos_type.capitalize}").new(repos_root, data_root) @ruby = ruby @wikilist = [] @farm_pub_path = farm_pub_path Dir["#{@farm_pub_path}/*"].each do |wiki| wiki.untaint next if not FileTest.directory?(wiki) next if FileTest.symlink?(wiki) next if not FileTest.file?("#{wiki}/hikiconf.rb") begin @wikilist << Wiki.new(File.basename(wiki), data_root) rescue end end end def wikis_num @wikilist.size end def pages_num @wikilist.inject(0){|result, wiki| result + wiki.pages_num } end def create_wiki(name) Dir.mkdir("#{@farm_pub_path}/#{name.untaint}") unless Object.const_defined?(:Rack) # create index.cgi File.open("#{@farm_pub_path}/#{name}/#{@conf.cgi_name}", 'w') do |f| f.puts(index(name, @conf.hiki)) f.chmod(0744) end # create attach.cgi if attach_cgi_name File.open("#{@farm_pub_path}/#{name}/#{@conf.attach_cgi_name}", 'w') do |f| f.puts(attach(name, @conf.hiki)) f.chmod(0744) end end end # create hikiconf.rb File.open("#{@farm_pub_path}/#{name}/hikiconf.rb", 'w') do |f| f.puts(conf(name, @conf.hiki)) end # TODO: use fileutils Dir.mkdir("#{@conf.data_root}/#{name}") Dir.mkdir("#{@conf.data_root}/#{name}/text") Dir.mkdir("#{@conf.data_root}/#{name}/backup") Dir.mkdir("#{@conf.data_root}/#{name}/cache") require 'fileutils' Dir["#{@conf.default_pages_path}/*"].each do |f| f.untaint FileUtils.cp(f, "#{@conf.data_root}/#{name}/text/#{File.basename(f)}") if File.file?(f) end @repos.import(name) end def command_key "c" end def command_query(name) "?#{command_key}=#{Hiki::Util.escape(name)}" end private def conf(wiki, hiki) __my_wiki_name__ = wiki # FIXME: maybe wrong path to template file return ERB.new(File.read("#{hiki}/hiki.conf.erb")).result(binding) end # not in use def index(wiki, hiki) <<-INDEX #!#{@ruby} hiki='' eval( open( '../hikifarm.conf' ){|f|f.read.untaint} ) $:.unshift "\#{hiki}" load "\#{hiki}/hiki.cgi" INDEX end # not in use def attach(wiki, hiki) <<-INDEX #!#{@ruby} hiki='' eval( open( '../hikifarm.conf' ){|f|f.read.untaint} ) $:.unshift "\#{hiki}" load "\#{hiki}/misc/plugin/attach/attach.cgi" INDEX end end end end hiki-1.0.0/hiki/farm/page.rb000066400000000000000000000113441212533356300155540ustar00rootroot00000000000000# -*- coding: utf-8 -*- require 'erb' require 'uri' require 'hiki/util' module Hiki module Farm class Page include ::Hiki::Util attr_reader :headings def initialize(template_dir) @headings = { 'type' => 'text/html; charset=UTF-8' } @template_dir = template_dir end def to_s erb = ERB.new(template.untaint) erb.result(binding) end private def template File.read("#{@template_dir}/#{template_name}".untaint) end end class ErrorPage < Page def initialize(template_dir, author, mail, css, title, msg) super(template_dir) @author = author @mail = mail @css = css @title = title @msg = msg end private def template_name 'error.html' end end class IndexPage < Page def initialize(conf, manager, hikifarm_uri, message) super(conf.hikifarm_template_dir) @conf = conf @manager = manager @hikifarm_uri = hikifarm_uri @author = conf.author @mail = conf.mail @css = conf.css @title = conf.title @header_content = load_part(conf.header) @footer_content = load_part(conf.footer) @msg = message end private def load_part(file) if file if File.exist?(file) File.read(file).untaint else error_msg("!! #{file} does not exist !!") end end end def error_msg(msg) if msg then %Q|

#{msg}

\n| else '' end end def rss_href URI.join(@hikifarm_uri, RSSPage.page_name) end def template_name 'index.html' end def wikilist_table r = '' r = "

#{@manager.wikis_num} Wiki / #{@manager.pages_num} 若 (* 綏吾潟)

\n" r << "\n" r << %Q!! wikilist = @manager.wikilist.sort{ |a,b| a.mtime <=> b.mtime }.reverse wikilist.each do |wiki| page = escape_html(unescape(wiki.last_modified_page)) r << %Q!! r << %Q!! r << %Q!\n! end # @headings['Last-Modified'] = CGI::rfc1123_date( wikilist[0].mtime ) unless wikilist.empty? r << "
Wiki 腟贋井 / 腟贋違若
#{escape_html(wiki.title)}#{wiki.mtime.strftime("%Y/%m/%d %H:%M")}! r << %Q! *\n! r << %Q! #{page}
\n" end end class RSSPage include ::Hiki::Util class << self def command_name 'rss' end def page_name 'hikifarm.rss' end end def initialize(conf, manager, hikifarm_uri) @conf = conf @manager = manager @hikifarm_uri = hikifarm_uri end def to_s make_rss.to_s end private def make_rss require 'rss' rss = RSS::Maker.make("1.0") do |maker| maker.channel.about = URI.join(@hikifarm_uri, self.class.page_name).to_s maker.channel.title = @conf.title maker.channel.description = @conf.hikifarm_description maker.channel.link = @hikifarm_uri maker.items.do_sort = true maker.items.max_size = 15 @manager.wikilist.each do |wiki| maker.items.new_item do |item| item.link = URI.join(@hikifarm_uri, wiki.name) item.title = wiki.title item.date = wiki.mtime item.description = wiki.description content = %Q!
\n! content << "
    \n" wiki.pages.each do |page| content << "
  1. " content << %Q!*! content << %Q!#{escape_html(unescape(page[:name]))}! content << %Q!(#{escape_html(modified(page[:mtime]))})! content << "
  2. \n" end content << "
\n" content << %Q!
! item.content_encoded = content end end end end # from RWiki def modified(t) return '-' unless t dif = (Time.now - t).to_i dif = dif / 60 return "#{dif}m" if dif <= 60 dif = dif / 60 return "#{dif}h" if dif <= 24 dif = dif / 24 return "#{dif}d" end end end end hiki-1.0.0/hiki/farm/wiki.rb000066400000000000000000000024411212533356300156010ustar00rootroot00000000000000require 'hiki/util' module Hiki module Farm class Wiki include ::Hiki::Util attr_reader :name, :title, :mtime, :last_modified_page, :pages_num, :pages def initialize(name, data_root) @name = name @pages_num = 0 begin File.readlines("#{data_root}/#{name}/hiki.conf").each do |line| if /^[@\$]?site_name\s*=\s*(".*")\s*$/ =~ line @title = eval($1.untaint) end end rescue @title = "#{name}'s Wiki" end pages = Dir["#{data_root}/#{name}/text/*"] pages.delete_if{|f| File.basename(f) == 'CVS' or File.basename(f) == '.svn' or File.size?(f.untaint).nil? } pages = pages.sort_by{|f| File.mtime(f) } if pages.empty? @last_modified_page = "FrontPage" @mtime = Time.at(0) else @last_modified_page = File.basename(pages[-1]) @mtime = File.mtime(pages[-1]) end @pages_num = pages.size @pages = pages.reverse[0..9].collect do |page| { :name => File.basename(page), :mtime => File.mtime(page), } end end def description "#{unescape(last_modified_page)} was updated." end end end end hiki-1.0.0/hiki/filter.rb000066400000000000000000000040421212533356300151750ustar00rootroot00000000000000# Copyright (C) 2008, KURODA Hiraku # You can redistribute it and/or modify it under GPL2. module Hiki module Filter class PageData attr_reader :page, :text, :title, :keyword, :remote_addr def initialize(page=nil, text=nil, title=nil, keyword=nil, remote_addr=nil) @page = page @text = text @title = title==page ? nil : title keyword = keyword.split("\n") if keyword.is_a?(String) @keyword = keyword || [] @remote_addr = remote_addr end def title @title || @page end end def self.require_filters dir = File.dirname(__FILE__) Dir["#{dir}/filter/*_filter.rb"].each do |f| next unless n = f[/\A#{Regexp.escape(dir)}\/filter\/(.*_filter)\.rb\z/, 1] require "hiki/filter/#{n}" end end def self.init(conf, request, plugin, db) @conf = conf @request = request @plugin = plugin @db = db end def self.plugin; @plugin; end def self.add_filter(&proc) @filters ||= [] @filters << proc if proc end def self.new_page_is_spam?(page, text, title=nil) posted_by_user = @plugin.user and not @plugin.user.empty? title = @db.get_attribute(page, :title) || "" unless title title = page if title.empty? new_page = PageData.new(page, text.gsub(/\r\n/, "\n"), title, (@request.params["keyword"] || "").gsub(/\r\n/, "\n").split(/\n/), @request.remote_addr) old_title = @db.get_attribute(page, :title) || "" old_title = page if old_title.empty? old_page = PageData.new(page, @db.load(page)||"", old_title, @db.get_attribute(page, :keyword)||[]) is_spam = false @filters.each do |proc| begin is_spam ||= proc.call(new_page, old_page, posted_by_user) rescue Exception end end return !posted_by_user && is_spam end end end Hiki::Filter.require_filters hiki-1.0.0/hiki/filter/000077500000000000000000000000001212533356300146505ustar00rootroot00000000000000hiki-1.0.0/hiki/filter/bayes_filter.rb000066400000000000000000000144631212533356300176550ustar00rootroot00000000000000# Copyright (C) 2008, KURODA Hiraku # You can redistribute it and/or modify it under GPL2. require "fileutils" require "hiki/filter/bayes_filter/bayes.rb" require "hiki/util" module Hiki::Filter module BayesFilter @@hiki_conf = nil module Key PREFIX = "bayes_filter" THRESHOLD = "#{PREFIX}.threshold" THRESHOLD_HAM = "#{PREFIX}.threshold_ham" TYPE = "#{PREFIX}.type" USE = "#{PREFIX}.use" REPORT = "#{PREFIX}.report" SHARED_DB_PATH = "#{PREFIX}.shared_db_path" SHARE_DB = "#{PREFIX}.share_db" LIMIT_OF_SUBMITTED_PAGES = "#{PREFIX}.limit_of_submitted_pages" end def self.init(conf) @@hiki_conf = conf @db = nil self end def self.threshold (@@hiki_conf[Key::THRESHOLD] || "0.9").to_f end def self.threshold_ham (@@hiki_conf[Key::THRESHOLD_HAM] || "0.1").to_f end def self.db_shared? @@hiki_conf[Key::SHARED_DB_PATH] and @@hiki_conf[Key::SHARE_DB] end def self.data_path db_shared? ? @@hiki_conf[Key::SHARED_DB_PATH] : @@hiki_conf.data_path end def self.db_name "#{data_path}/bayes.db" end def self.db case @@hiki_conf["bayes_filter.type"] when /graham/i @db ||= Bayes::PaulGraham.new(db_name) else @db ||= Bayes::PlainBayes.new(db_name) end @db end def self.new_db FileUtils.rm_f(db_name) @db = nil db end def self.cache_path r = db_shared? ? "#{data_path}/cache/bayes" : "#{@@hiki_conf.cache_path}/bayes" FileUtils.mkpath(r) r end def self.filter(new_page, old_page, posted_by_user) pd = PageData.new(new_page, old_page) if posted_by_user unless pd.ham? token = pd.token db.ham << token 10.times do break if pd.ham? db.ham << token end db.save end return end pd.cache_save subject = "#{REPORT_PREFIX[pd.ham?]} at '#{new_page.page}' of '#{@@hiki_conf.site_name}'" body = <"H", false=>"S", nil=>"D"} def cache_file_name "#{cache_path}/#{CACHE_HEADER[ham?]}#{file_name}" end def corpus_file_name(ham) "#{corpus_path}/#{ham ? "H" : "S"}#{file_name}" end def corpus_file_name_ham; corpus_file_name(true); end def corpus_file_name_spam; corpus_file_name(false); end FILE_CREATE_RETRY = 10 def open(method) f = nil last_error = nil FILE_CREATE_RETRY.times do begin f = Kernel.open(send(method), File::WRONLY|File::CREAT|File::EXCL) break if f rescue Errno::EEXIST => last_error @time = Time.local(@time.year, @time.mon, @time.day, @time.hour, @time.min, @time.sec, @time.usec+1) end end unless f @time = Time.local(@time.year, @time.mon, @time.day, @time.hour, @time.min, @time.sec, @time.usec-FILE_CREATE_RETRY) raise last_error end yield(f) ensure f.close if f end def cache_save open(:cache_file_name) do |f| Marshal.dump(self, f) end end def corpus_save(ham) open(ham ? :corpus_file_name_ham : :corpus_file_name_spam) do |f| Marshal.dump(self, f) end end def diff_text ((@new_page.text||"").split("\n")-(@old_page.text||"").split("\n")).join("\n") end def diff_keyword (@new_page.keyword||[])-(@old_page.keyword||[]) end def get_unified_diff unified_diff(@old_page.text||"", @new_page.text||"") end end end REPORT_PREFIX = {true=>"HAM", false=>"SPAM", nil=>"DOUBT"} add_filter do |new_page, old_page, posted_by_user| next unless @conf['bayes_filter.use'] BayesFilter.init(@conf).filter(new_page, old_page, posted_by_user) end end hiki-1.0.0/hiki/filter/bayes_filter/000077500000000000000000000000001212533356300173205ustar00rootroot00000000000000hiki-1.0.0/hiki/filter/bayes_filter/bayes.rb000066400000000000000000000107771212533356300207640ustar00rootroot00000000000000# coding: ASCII-8BIT # Copyright (C) 2007, KURODA Hiraku # You can redistribute it and/or modify it under GPL2. require "pstore" module Bayes module CHARSET def self.setup_re(m) o = $KCODE $KCODE = m::KCODE m.const_set(:RE_MESSAGE_TOKEN, Regexp.union(m::RE_KATAKANA, m::RE_KANJI, /[a-zA-Z]+/)) $KCODE=o end module EUC KCODE = "e" KATAKANA = "\xa5\xa2-\xa5\xf3" BAR = "\xa1\xbc" KANJI = "\xb0\xa1-\xfc\xfe" RE_KATAKANA = /[#{KATAKANA}#{BAR}]{2,}/eo RE_KANJI = /[#{KANJI}]{2,}/eo CHARSET.setup_re(self) end module UTF8 KCODE = "u" def self.c2u(c) [c].pack("U") end def self.utf_range(a, b) "#{c2u(a)}-#{c2u(b)}" end KATAKANA = utf_range(0x30a0, 0x30ff) BAR = c2u(0x30fc) KANJI = utf_range(0x4e00, 0x9faf) RE_KATAKANA = /[#{KATAKANA}#{BAR}]{2,}/uo RE_KANJI = /[#{KANJI}]{2,}/uo CHARSET.setup_re(self) end end class TokenList < Array attr_reader :charset def initialize(charset=nil) unless charset charset = case $KCODE when /^e/i CHARSET::EUC else CHARSET::UTF8 end end @charset = charset end alias _concat concat def concat(array, prefix=nil) if prefix _concat(array.map{|i| "#{prefix} #{i.to_s}"}) else _concat(array) end end alias _push push def push(item, prefix=nil) if prefix _push("#{prefix} #{item.to_s}") else _push(item) end end def add_host(host, prefix=nil) if /^(?:\d{1,3}\.){3}\d{1,3}$/ =~ host while host.size>0 push(host, prefix) host = host[/^(.*?)\.?\d+$/, 1] end else push(host, prefix) h = host while /^(.*?)[-_.](.*)$/=~h h = $2 push($1, prefix) push(h, prefix) end end self end def add_url(url, prefix=nil) if %r[^(?:https?|ftp)://(.*?)(?::\d+)?/(.*?)\/?(\?.*)?$] =~ url host, path = $1, $2 add_host(host, prefix) if path.size>0 push(path, prefix) p = path re = %r[^(.*)[-_./](.*?)$] while re=~p p = $1 push($2, prefix) push(p, prefix) end end end self end def add_message(message, prefix=nil) concat(message.scan(@charset::RE_MESSAGE_TOKEN), prefix) self end def add_mail_addr(addr, prefix=nil) push(addr, prefix) name, host = addr.split(/@/) return self if (name||"").empty? host ||= "" push(name, prefix) add_host(host, prefix) self end end class FilterBase attr_reader :spam, :ham, :db_name, :charset def initialize(db_name=nil, charset=nil) @spam = self.class::Corpus.new @ham = self.class::Corpus.new @charset = charset @db_name = db_name if db_name && File.exist?(db_name) PStore.new(db_name).transaction(true) do |db| @spam = db["spam"] @ham = db["ham"] @charset = db["charset"] end end end def save(db_name=nil) db_name ||= @db_name @db_name ||= db_name return unless @db_name PStore.new(@db_name).transaction do |db| db["spam"] = @spam db["ham"] = @ham db["charset"] = @charset yield(db) if block_given? end end def [](token) score(token) end end class PlainBayes < FilterBase class Corpus < Hash def initialize super(0.0) end def <<(src) s = src.size.to_f src.each do |i| self[i] += 1/s end end end def score(token) return nil unless @spam.include?(token) || @ham.include?(token) s = @spam[token] h = @ham[token] s/(s+h) end def estimate(tokens, take=15) s = tokens.uniq.map{|i| score(i)}.compact.sort{|a, b| (0.5-a).abs <=> (0.5-b)}.reverse[0...take] return nil if s.empty? || s.include?(1.0) && s.include?(0.0) prod = s.inject(1.0){|r, i| r*i} return prod/(prod+s.inject(1.0){|r, i| r*(1-i)}) end end class PaulGraham < FilterBase class Corpus < Hash attr_reader :count def initialize super(0) @count = 0 end def <<(src) @count += 1 src.each do |i| self[i] += 1 end end end def score(token) return 0.4 unless @spam.include?(token) or @ham.include?(token) g = @ham.count==0 ? 0.0 : [1.0, 2*@ham[token]/@ham.count.to_f].min b = @spam.count==0 ? 0.0 : [1.0, @spam[token]/@spam.count.to_f].min r = [0.01, [0.99, b/(g+b)].min].max r end def estimate(tokens, take=15) s = tokens.uniq.map{|i| score(i)}.compact.sort{|a, b| (0.5-a).abs <=> (0.5-b)}.reverse[0...take] return nil if s.empty? || s.include?(1.0) && s.include?(0.0) prod = s.inject(1.0){|r, i| r*i} return prod/(prod+s.inject(1.0){|r, i| r*(1-i)}) end end end hiki-1.0.0/hiki/filter/word_filter.rb000066400000000000000000000011641212533356300175170ustar00rootroot00000000000000# Copyright (C) 2008, KURODA Hiraku # You can redistribute it and/or modify it under GPL2. module Hiki::Filter add_filter do |new_page, old_page, posted_by_user| next if posted_by_user next unless @conf['word_filter.use'] spam = false @conf['word_filter.words'].split(/\n/).each do |w| next if w.empty? re = /#{w.chomp}/ [:page, :title, :text, :keyword].each do |m| str = (new_page.send(m)||"") str = str.join("\n") if str.is_a?(Array) next if str.empty? spam = true if str=~re end next if spam end spam end end hiki-1.0.0/hiki/hiki_formatter.rb000066400000000000000000000016631212533356300167250ustar00rootroot00000000000000# $Id: hiki_formatter.rb,v 1.8 2008-01-06 05:49:30 znz Exp $ # Copyright (C) 2003 TAKEUCHI Hitoshi module Hiki class HikiFormatter H2_RE = /^

.* #{title}
#{section}
EOS end end end hiki-1.0.0/hiki/image_size.rb000066400000000000000000000213101212533356300160210ustar00rootroot00000000000000# Copyright (c) 2004 Keisuke Minami # License: Ruby's # http://raa.ruby-lang.org/project/image_size/ class ImageSize # Image Type Constants module Type OTHER = "OTHER" GIF = "GIF" PNG = "PNG" JPEG = "JPEG" BMP = "BMP" PPM = "PPM" # PPM is like PBM, PGM, & XV PBM = "PBM" PGM = "PGM" # XV = "XV" XBM = "XBM" TIFF = "TIFF" XPM = "XPM" PSD = "PSD" PCX = "PCX" SWF = "SWF" end JpegCodeCheck = [ "\xc0", "\xc1", "\xc2", "\xc3", "\xc5", "\xc6", "\xc7", "\xc9", "\xca", "\xcb", "\xcd", "\xce", "\xcf", ] # image type list def ImageSize.type_list Type.constants end # receive image & make size # argument is image String or IO def initialize(img_data, img_type = nil) @img_data = img_data.dup @img_wedth = nil @img_height = nil if @img_data.is_a?(IO) @img_top = @img_data.read(512) @img_data.seek(0, 0) # define Singleton-method definition to IO (byte, offset) def @img_data.read_o(length = 1, offset = nil) self.seek(offset, 0) if offset ret = self.read(length) raise "cannot read!!" unless ret ret end elsif @img_data.is_a?(String) @img_top = @img_data[0, 512] # define Singleton-method definition to String (byte, offset) def @img_data.read_o(length = 1, offset = nil) @img_offset = 0 if !(defined?(@img_offset)) @img_offset = offset if offset ret = self[@img_offset, length] @img_offset += length ret end else raise "argument class error!! #{img_data.type}" end if img_type.nil? @img_type = check_type() else match = false Type.constants.each do |t| match = true if img_type == t end raise("img_type is failed. #{img_type}\n") if match == false @img_type = img_type end eval("@img_width, @img_height = measure_" + @img_type + "()") if @img_type != Type::OTHER end # get parameter def get_type; @img_type; end def get_height if @img_type == Type::OTHER then nil else @img_height end end def get_width if @img_type == Type::OTHER then nil else @img_width end end def get_size if get_height && get_width {:width => get_width, :height => get_height} else nil end end def mime_type case @img_type when 'SWF' ret = 'application/x-shockwave-flash' when 'PBM' ref = 'image/x-portable-bitmap' when 'PGM' ret = 'image/x-portable-graymap' when 'PPM' ret = 'image/x-portable-pixmap' when 'XBM' ret = 'image/x-xbitmap' when 'XPM' ret = 'image/x-xpixmap' when 'GIF', 'PNG', 'JPEG', 'BMP', 'TIFF' ret = "image/#{@img_type.downcase}" else ret = 'application/octet-stream' end ret end def check_type() if /<\s*[a-z]+/i =~ @img_top then Type::OTHER # html? elsif @img_top =~ /^GIF8[7,9]a/ then Type::GIF elsif @img_top[0, 8] == "\x89PNG\x0d\x0a\x1a\x0a" then Type::PNG elsif @img_top[0, 2] == "\xFF\xD8" then Type::JPEG elsif @img_top[0, 2] == 'BM' then Type::BMP elsif @img_top =~ /^P[1-7]/ then Type::PPM elsif @img_top =~ /\#define\s+\S+\s+\d+/ then Type::XBM elsif @img_top[0, 4] == "MM\x00\x2a" then Type::TIFF elsif @img_top[0, 4] == "II\x2a\x00" then Type::TIFF elsif @img_top =~ /\/\* XPM \*\// then Type::XPM elsif @img_top[0, 4] == "8BPS" then Type::PSD elsif @img_top[0, 3] == "FWS" then Type::SWF elsif @img_top[0] == 10 then Type::PCX else Type::OTHER end end private(:check_type) def measure_GIF() @img_data.read_o(6) @img_data.read_o(4).unpack('vv') end private(:measure_GIF) def measure_PNG() @img_data.read_o(12) raise "This file is not PNG." unless @img_data.read_o(4) == "IHDR" @img_data.read_o(8).unpack('NN') end private(:measure_PNG) def measure_JPEG() c_marker = "\xFF" # Section marker. @img_data.read_o(2) while(true) marker, code, length = @img_data.read_o(4).unpack('aan') raise "JPEG marker not found!" if marker != c_marker if JpegCodeCheck.include?(code) height, width = @img_data.read_o(5).unpack('xnn') return([width, height]) end @img_data.read_o(length - 2) end end private(:measure_JPEG) def measure_BMP() @img_data.read_o(26).unpack("x18VV"); end private(:measure_BMP) def measure_PPM() header = @img_data.read_o(1024) header.gsub!(/^\#[^\n\r]*/m, "") header =~ /^(P[1-6])\s+?(\d+)\s+?(\d+)/m width = $2.to_i; height = $3.to_i case $1 when "P1", "P4" then @img_type = "PBM" when "P2", "P5" then @img_type = "PGM" when "P3", "P6" then @img_type = "PPM" # when "P7" # @img_type = "XV" # header =~ /IMGINFO:(\d+)x(\d+)/m # width = $1.to_i; height = $2.to_i end [width, height] end private(:measure_PPM) alias :measure_PGM :measure_PPM private(:measure_PGM) alias :measure_PBM :measure_PPM private(:measure_PBM) def measure_XBM() @img_data.read_o(1024) =~ /^\#define\s*\S*\s*(\d+)\s*\n\#define\s*\S*\s*(\d+)/mi [$1.to_i, $2.to_i] end private(:measure_XBM) def measure_XPM() width = height = nil while(line = @img_data.read_o(1024)) if line =~ /"\s*(\d+)\s+(\d+)(\s+\d+\s+\d+){1,2}\s*"/m width = $1.to_i; height = $2.to_i break end end [width, height] end private(:measure_XPM) def measure_PSD() @img_data.read_o(26).unpack("x14NN") end private(:measure_PSD) def measure_TIFF() endian = if (@img_data.read_o(4) =~ /II\x2a\x00/o) then 'v' else 'n' end # 'v' little-endian 'n' default to big-endian packspec = [ nil, # nothing (shouldn't happen) 'C', # BYTE (8-bit unsigned integer) nil, # ASCII endian, # SHORT (16-bit unsigned integer) endian.upcase, # LONG (32-bit unsigned integer) nil, # RATIONAL 'c', # SBYTE (8-bit signed integer) nil, # UNDEFINED endian, # SSHORT (16-bit unsigned integer) endian.upcase, # SLONG (32-bit unsigned integer) ] offset = @img_data.read_o(4).unpack(endian.upcase)[0] # Get offset to IFD ifd = @img_data.read_o(2, offset) num_dirent = ifd.unpack(endian)[0] # Make it useful offset += 2 num_dirent = offset + (num_dirent * 12); # Calc. maximum offset of IFD ifd = width = height = nil while(width.nil? || height.nil?) ifd = @img_data.read_o(12, offset) # Get first directory entry break if (ifd.nil? || (offset > num_dirent)) offset += 12 tag = ifd.unpack(endian)[0] # ...and decode its tag type = ifd[2, 2].unpack(endian)[0] # ...and the data type # Check the type for sanity. next if (type > packspec.size + 0) || (packspec[type].nil?) if tag == 0x0100 # Decode the value width = ifd[8, 4].unpack(packspec[type])[0] elsif tag == 0x0101 # Decode the value height = ifd[8, 4].unpack(packspec[type])[0] end end raise "#{if width.nil? then 'width not defined.' end} #{if height.nil? then 'height not defined.' end}" if width.nil? || height.nil? [width, height] end private(:measure_TIFF) def measure_PCX() header = @img_data.read_o(128) head_part = header.unpack('C4S4') width = head_part[6] - head_part[4] + 1 height = head_part[7] - head_part[5] + 1 [width, height] end private(:measure_PCX) def measure_SWF() header = @img_data.read_o(9) raise("This file is not SWF.") unless header.unpack('a3')[0] == 'FWS' bit_length = Integer("0b#{header.unpack('@8B5')}") header << @img_data.read_o(bit_length*4/8+1) str = header.unpack("@8B#{5+bit_length*4}")[0] last = 5 x_min = Integer("0b#{str[last,bit_length]}") x_max = Integer("0b#{str[(last += bit_length),bit_length]}") y_min = Integer("0b#{str[(last += bit_length),bit_length]}") y_max = Integer("0b#{str[(last += bit_length),bit_length]}") width = (x_max - x_min)/20 height = (y_max - y_min)/20 [width, height] end private(:measure_PCX) end if __FILE__ == $0 print "TypeList: #{ImageSize.type_list.inspect}\n" ARGV.each do |file| print "#{file} (string)\n" open(file, "rb") do |fh| img = ImageSize.new(fh) print <<-EOF type: #{img.get_type.inspect} width: #{img.get_width.inspect} height: #{img.get_height.inspect} EOF end end end hiki-1.0.0/hiki/interwiki.rb000066400000000000000000000032611212533356300157170ustar00rootroot00000000000000# $Id: interwiki.rb,v 1.10 2005-12-28 23:42:18 fdiary Exp $ # Copyright (C) 2002-2003 TAKEUCHI Hitoshi require 'hiki/util' module Hiki class InterWiki include Hiki::Util URL = '(?:http|https|ftp|mailto|file):[a-zA-Z0-9;/?:@&=+$,\-_.!~*\'()#%]+' INTERWIKI_NAME_RE = /\[\[([^|]+)\|(#{URL})\]\](?:\s+(sjis|euc|utf8|alias))?/ attr_reader :interwiki_names def initialize( str ) @interwiki_names = {} (str || '').scan( INTERWIKI_NAME_RE ) do |i| e = i.size > 2 ? i[2] : 'none' @interwiki_names[i[0]] = {:url => i[1], :encoding => e} end end def interwiki(s, p, display_text = h("#{s}:#{p}")) if @interwiki_names.has_key?(s) encoding = @interwiki_names[s][:encoding] page = case encoding when 'sjis' escape(p.to_sjis) when 'euc' escape(p.to_euc) when 'utf8' escape(p.to_utf8) else p end if @interwiki_names[s][:url].index('$1') [h(@interwiki_names[s][:url].dup.sub(/\$1/, page)), display_text] else [h("#{@interwiki_names[s][:url]}#{page}"), display_text] end else nil end end def outer_alias(s) if @interwiki_names.has_key?(s) && @interwiki_names[s][:encoding] == 'alias' return [h(@interwiki_names[s][:url]), h(s)] else return nil end end end end # *[[Hiki|http://hikiwiki.org/ja/?]] euc # *[[YukiWiki|http://www.hyuki.com/yukiwiki/wiki.cgi?]] euc # *[[GoogleJ|http://www.google.co.jp/search?hl=ja&btnG=Google+%8C%9F%8D%F5&lr=lang_ja&q=]] sjis hiki-1.0.0/hiki/page.rb000066400000000000000000000053161212533356300146310ustar00rootroot00000000000000# $Id: page.rb,v 1.15 2007-05-23 07:20:04 znz Exp $ # Copyright (C) 2002-2004 TAKEUCHI Hitoshi # Copyright (C) 2004-2005 Kazuhiko require 'cgi' unless Object.const_defined?(:Rack) require 'nkf' module Hiki class Page begin require 'erb_fast' rescue LoadError require 'erb' end attr_accessor :command, :template, :contents def initialize(request, conf) @request = request @conf = conf @layout = @conf.read_layout @command = nil @template = '' @contents = nil end def to_html if @conf.mobile_agent? content_method_name = "render_mobile_#{@command}" content_name = "i.#{@command}.html" layout_method_name = "render_mobile_layout" layout_name = "i.layout.html" else content_method_name = "render_#{@command}" content_name = "#{@command}.html" layout_method_name = "render_layout" layout_name = "layout.html" end unless respond_to?(layout_method_name) erb = ERB.new(@layout) erb.def_method(self.class, layout_method_name, layout_name) end unless respond_to?(content_method_name) erb = ERB.new(@template) erb.def_method(self.class, content_method_name, content_name) end __send__(layout_method_name){ __send__(content_method_name) } end def process( plugin ) @plugin = plugin @body = to_html @conf.save_config if @contents[:save_config] @headers = {} if @contents[:last_modified] and 'HEAD' == @request.request_method @headers['Last-Modified'] = CGI.rfc1123_date(@contents[:last_modified]) end @headers['type'] = 'text/html' if @conf.mobile_agent? @body = NKF.nkf( '-sE', @body ) if /EUC-JP/i =~ @conf.charset @headers['charset'] = 'Shift_JIS' else @headers['charset'] = @conf.charset @headers['Content-Language'] = @conf.lang @headers['Pragma'] = 'no-cache' @headers['Cache-Control'] = 'no-cache' end @headers['Vary'] = 'User-Agent,Accept-Language' @headers['Content-Length'] = @body.bytesize.to_s rescue @body.size.to_s @headers['cookie'] = @plugin.cookies unless @plugin.cookies.empty? end def out( headers = nil ) @headers.update( headers ) if headers response = Hiki::Response.new(@body, 200, @headers) if Object.const_defined?(:Rack) cookies = @headers.delete('cookie') if cookies cookies.each do |cookie| response.set_cookie(cookie.name, cookie.value) end end end response end end end hiki-1.0.0/hiki/plugin.rb000066400000000000000000000226511212533356300152140ustar00rootroot00000000000000# $Id: plugin.rb,v 1.37 2008-02-12 15:06:08 hiraku Exp $ # Copyright (C) 2002-2003 TAKEUCHI Hitoshi # Copyright (C) 2004-2005 Kazuhiko # # TADA Tadashi holds the copyright of Config class. require 'cgi' unless Object.const_defined?(:Rack) require 'uri' require 'erb' require 'hiki/util' module Hiki class PluginError < StandardError; end class Plugin include Hiki::Util attr_reader :toc_f, :plugin_command attr_accessor :text, :title, :cookies, :user, :data, :session_id TOC_STRING = "\000\000[Table of Contents]" def initialize( options, conf ) @options = options @conf = conf set_tdiary_env @cookies = [] @plugin_method_list = [] @header_procs = [] @update_procs = [] @delete_procs = [] @body_enter_procs = [] @body_leave_procs = [] @page_attribute_procs = [] @footer_procs = [] @edit_procs = [] @form_procs = [] @menu_procs = [] @conf_keys = [] @conf_procs = {} @mode = '' options.each do |opt, val| instance_variable_set("@#{opt}", val) unless opt.index('.') end @toc_f = false @context = nil @plugin_command = [] @plugin_menu = [] @text = '' @mode = 'conf' if @request.params['c'] == 'admin' @mode = 'saveconf' if @request.params['saveconf'] # loading plugins @plugin_files = [] plugin_path = @conf.plugin_path || "#{PATH}/plugin" plugin_file = '' begin Dir::glob( "#{plugin_path}/*.rb" ).sort.each do |file| plugin_file = file load_plugin( file ) @plugin_files << file end rescue Exception raise PluginError, "Plugin error in '#{File::basename( plugin_file )}'.\n#{$!}\n#{$!.backtrace[0]}" end end def block_context? @context == :block end def inline_context? @context == :inline end def block_context( &proc ) in_context( :block, &proc ) end def inline_context( &proc ) in_context( :inline, &proc ) end def cookie_path path = URI.parse(@conf.base_url).path if path[-1] == ?/ path else File.dirname(path) + '/' end end def header_proc r = [] @header_procs.each do |proc| begin r << proc.call rescue Exception r << plugin_error( 'header_proc', $! ) end end r.join.chomp end def update_proc @update_procs.each do |proc| begin proc.call rescue Exception end end end def delete_proc @delete_procs.each do |proc| begin proc.call rescue Exception end end end def body_enter_proc r = [] @body_enter_procs.each do |proc| begin r << proc.call( @date ) rescue Exception r << plugin_error( 'body_enter_proc', $! ) end end r.join end def body_leave_proc r = [] @body_leave_procs.each do |proc| begin r << proc.call( @date ) rescue Exception r << plugin_error( 'body_leave_proc', $! ) end end r.join end def page_attribute_proc r = [] @page_attribute_procs.each do |proc| begin r << proc.call( @date ) rescue Exception r << plugin_error( 'page_attribute_proc', $! ) end end r.join end def footer_proc r = [] @footer_procs.each do |proc| begin r << proc.call rescue Exception r << plugin_error( 'footer_proc', $! ) end end r.join end def edit_proc r = [] @edit_procs.each do |proc| begin r << proc.call rescue Exception r << plugin_error( 'edit_proc', $! ) end end r.join end def form_proc r = [] @form_procs.each do |proc| begin r << proc.call rescue Exception r << plugin_error( 'form_proc', $! ) end end r.join end def menu_proc r = [] @menu_procs.each do |proc| begin r << proc.call rescue Exception r << plugin_error( 'menu_proc', $! ) end end r.compact end def add_cookie( cookie ) @cookies << cookie end def singleton_method_added(name) @defined_method_list.push(name) end def load_file(filename) open(filename) do |src| instance_eval(src.read.untaint, filename, 1) end end def send(name, *args) name = name.intern if name.is_a?(String) if not name.is_a?(Symbol) raise ArgumentError, "#{name.inspect} is not a symbol" end if not @plugin_method_list.include?(name) method_missing(name, *args) else __send__(name, *args) end end def each_conf_key @conf_keys.each do |key| yield key end end def conf_proc( key ) r = '' label, block = @conf_procs[key] r = block.call if block r end def conf_label( key ) label, block = @conf_procs[key] label end def load_plugin( file ) file.untaint @defined_method_list = [] @export_method_list = nil @resource_loaded = false dirname, basename = File.split( file ) [@conf.lang, 'en', 'ja'].uniq.each do |lang| begin load_file( File.join( dirname, lang, basename ) ) @resource_loaded = true break rescue IOError, Errno::ENOENT end end load_file( file ) if @export_method_list @plugin_method_list.concat(@export_method_list) else @plugin_method_list.concat(@defined_method_list) end end def load( page ) @db.load( page ) end def load_backup( page ) @db.load_backup( page ) end def save( page, src, md5, update_timestamp = true, filtering = true ) return false if filtering and Filter.new_page_is_spam?(page, src) src.gsub!(/\r/, '') src.sub!(/\A\n*/, '') src.sub!(/\n*\z/, "\n") result = @db.store(page, src, md5, update_timestamp) if result @db.set_attribute( page, :editor => @user ) @db.delete_cache( page ) begin update_proc rescue Exception end end result end def admin? ( @user == @conf.admin_name ) || @conf.password.empty? end def login( name, password ) return if @user return nil unless password name ||= @conf.admin_name if @conf.password.empty? || password.crypt( @conf.password ) == @conf.password && name == @conf.admin_name @user = @conf.admin_name elsif @conf['user.list'] if @conf['user.list'].has_key?(name) && @conf['user.list'][name] == password.crypt(@conf['user.list'][name]) @user = name end end end private def in_context(context) begin @context = context yield ensure @context = nil end end def export_plugin_methods(*names) @export_method_list = names.collect do |name| name = name.intern if name.is_a?(String) if not name.is_a?(Symbol) raise TypeError, "#{name.inspect} is not a symbol" end name end end def add_header_proc( block = Proc.new ) @header_procs << block end def add_footer_proc( block = Proc.new ) @footer_procs << block end def add_update_proc( block = Proc.new ) @update_procs << block end def add_delete_proc( block = Proc.new ) @delete_procs << block end def add_body_enter_proc( block = Proc.new ) @body_enter_procs << block end def add_page_attribute_proc( block = Proc.new ) @page_attribute_procs << block end def add_body_leave_proc( block = Proc.new ) @body_leave_procs << block end def add_edit_proc( block = Proc.new ) @edit_procs << block end def add_form_proc( block = Proc.new ) @form_procs << block end def add_menu_proc( block = Proc.new ) @menu_procs << block end def add_plugin_command(command, display_text, option = {}) @plugin_command << command @plugin_menu << {:command => command, :display_text => display_text, :option => option} if display_text nil end def add_conf_proc( key, label, block = Proc.new ) return unless @mode =~ /^(conf|saveconf)$/ @conf_keys << key unless @conf_keys.index( key ) @conf_procs[key] = [label, block] end def set_tdiary_env @date = Time.now @cookies = [] @options['cache_path'] = @conf.cache_path @options['mode'] = "day" # @options['author_name'] = @conf.author_name || 'anonymous' # @options['author_mail'] = @conf.mail # @options['index_page'] = @conf.index_page # @options['html_title'] = @conf.site_name @options['years'] = {} @options['diaries'] = nil, @options['date'] = Time.now %w(cache_path mode years diaries date).each do |p| instance_variable_set("@#{p}", @options[p]) end end end end hiki-1.0.0/hiki/pluginutil.rb000066400000000000000000000077071212533356300161170ustar00rootroot00000000000000# $Id: pluginutil.rb,v 1.10 2008-01-06 05:49:30 znz Exp $ # # apply_plugin(str): # Eval the string as a plugin. # # methodwords(str): # Separte a string to a method and arguments for plugins. # # Copyright (C) 2004 Masao Mutoh # # Based on shellwords.rb(in ruby standard library). require 'cgi' unless Object.const_defined?(:Rack) require 'erb' module Hiki module Util DIGIT_RE = /^[-+]?\d+(\.\d+)?$/ STRING_RE = /\A"(.*)"\z/m NIL_RE = /^\s*nil\s*$/ LSTRIP_RE = /\A\s+/ module_function def apply_plugin(str, plugin, conf) return str unless conf.use_plugin set_conf(conf) method, *args = methodwords(str) begin method.untaint if plugin.respond_to?(method) && !Object.method_defined?(method) if args plugin.send(method, *args) else plugin.send(method) end else raise PluginException, 'not plugin method' end rescue Exception raise PluginException, plugin_error('inline plugin', $!) end end def convert_value(field, escape = false) if DIGIT_RE =~ field $1 ? field.to_f : field.to_i elsif STRING_RE =~ field $1 elsif NIL_RE =~ field nil elsif field.size > 0 field = ERB::Util.h(field) if escape field else :no_data end end ARG_REG_A = /\A\[/ ARG_REG_B = /\A\]/ ARG_REG_C = /\A"(([^"\\]|\\.)*)"/ ARG_REG_D = /\\(.)/ ARG_REG_E = /\A"/ ARG_REG_F = /\A'([^']*)'/ ARG_REG_G = /\A'/ ARG_REG_H = /\A(\(|\)|,)/ ARG_REG_I = /\A\\(.)/ ARG_REG_J = /\A([^\s\\'"\(\),\]]+)/ def argwords(args, escape = false) args= String.new(args) rescue raise(ArgumentError, "Argument must be a string") args.sub!(LSTRIP_RE, '') words = [] is_ary = false until args.empty? field = '' loop do if args.sub!(ARG_REG_A, '') then child_words, args = argwords(args) words << child_words elsif args.sub!(ARG_REG_B, '') then val = convert_value(field, escape) words.push(val) unless val == :no_data return [words, args] elsif args.sub!(ARG_REG_C, '') then snippet = %Q|"#{$1.gsub(ARG_REG_D, '\1').gsub(/"/, '"')}"| elsif args =~ ARG_REG_E then raise ArgumentError, "Unmatched double quote: #{args}" elsif args.sub!(ARG_REG_F, '') then snippet = %Q|"#{$1.gsub(/"/, '"')}"| elsif args =~ ARG_REG_G then raise ArgumentError, "Unmatched single quote: #{args}" elsif args.sub!(ARG_REG_H, '') then snippet = nil break elsif args.sub!(ARG_REG_I, '') then snippet = $1 elsif args.sub!(ARG_REG_J, '') then snippet = $1 else args.sub!(LSTRIP_RE, '') break end field.concat(snippet) if snippet end val = convert_value(field, escape) words.push(val) unless val == :no_data end [words, args] end METHOD_REG_A = /\A([^\s\\'"\(\)]+)/ def methodwords(line) line = String.new(line) rescue raise(ArgumentError, "Argument must be a string") line.sub!(LSTRIP_RE, '') words = [] meth = '' while ! line.empty? if line.sub!(METHOD_REG_A, '') then meth.concat($1) words.push(meth) else child_words, = argwords(line) words += child_words break end end words end end end if __FILE__ == $0 p Hiki::Util.methodwords("foo") p Hiki::Util.methodwords(%Q[foo "bar", "a iueo| kaki"]) p Hiki::Util.methodwords(%Q[foo('ba"r', "a'iueo" )]) p Hiki::Util.methodwords(%Q[foo File, ["h]oge", "f[uga"], "bar", [1, 2.0, 0.4]]) p Hiki::Util.methodwords(%Q[foo [[0,1],[2,3]]]) p Hiki::Util.methodwords(%Q[foo nil, nil, "hoge"]) end hiki-1.0.0/hiki/repos/000077500000000000000000000000001212533356300145135ustar00rootroot00000000000000hiki-1.0.0/hiki/repos/cvs.rb000066400000000000000000000052551212533356300156420ustar00rootroot00000000000000# $Id: cvs.rb,v 1.11 2005-12-28 22:38:30 fdiary Exp $ # Copyright (C) 2003, Koichiro Ohba # Copyright (C) 2003, Yasuo Itabashi # You can distribute this under GPL. require 'hiki/repos/default' # CVS Repository Backend module Hiki class HikifarmReposCvs < HikifarmReposBase def setup Dir.chdir( @data_root ) do system( "cvs -d #{@root} init > /dev/null 2>&1" ) if not File.directory?(".CVSROOT") system( "cvs -d #{@root} co -d .CVSROOT CVSROOT > /dev/null 2>&1" ) end Dir.chdir( ".CVSROOT" ) do system( "cvs -d #{@root} update > /dev/null 2>&1" ) end end end def imported?( wiki ) return File.directory?( "#{@root}/#{wiki}" ) end def import( wiki ) Dir.chdir( "#{@data_root}/#{wiki}/text" ) do system( "cvs -d #{@root} import -m 'Starting #{wiki} from #{ENV['REMOTE_ADDR']} - #{ENV['REMOTE_HOST']}' #{wiki} hiki start > /dev/null 2>&1".untaint ) Dir.chdir( '..' ) do system( "cvs -d #{@root} co -d text #{wiki} > /dev/null 2>&1" ) end end end def update( wiki ) Dir.chdir( "#{@data_root}/#{wiki}/text" ) do system( "cvs -d #{@root} update > /dev/null 2>&1" ) end end end class ReposCvs < ReposBase include Hiki::Util def commit(page, msg = default_msg) Dir.chdir( "#{@data_path}/text" ) do system( "cvs -d #{@root} add -- #{escape(page)} > /dev/null 2>&1".untaint ) system( "cvs -d #{@root} ci -m '#{msg}' > /dev/null 2>&1".untaint ) end end def delete(page, msg = default_msg) Dir.chdir( "#{@data_path}/text" ) do system( "cvs -d #{@root} remove -- #{escape(page)} > /dev/null 2>&1".untaint ) system( "cvs -d #{@root} ci -m '#{msg}' > /dev/null 2>&1".untaint ) end end def rename(old_page, new_page) raise NotImplementedError end def get_revision(page, revision) ret = '' Dir.chdir("#{@data_path}/text") do open("|cvs -Q up -p -r 1.#{revision.to_i} #{escape(page).untaint}") do |f| ret = f.read end end ret end def revisions(page) require 'time' log = '' revs = [] Dir.chdir("#{@data_path}/text") do open("|cvs -Q log #{escape(page).untaint}") do |f| log = f.read end end log.split(/----------------------------/).each do |tmp| if /revision 1.(\d+?)\ndate: (.*?); author: (?:.*?); state: (?:.*?);(.*?)?(?:;.*?)?\n(.*)/m =~ tmp then revs << [$1.to_i, Time.parse("#{$2}Z").localtime.to_s, $3, $4.chomp] end end revs end end end hiki-1.0.0/hiki/repos/default.rb000066400000000000000000000056521212533356300164740ustar00rootroot00000000000000# $Id: default.rb,v 1.7 2005-07-16 04:24:33 yanagita Exp $ # Copyright (C) 2003, Koichiro Ohba # Copyright (C) 2003, Yasuo Itabashi # You can distribute this under GPL. require 'hiki/util' module Hiki class HikifarmReposBase def initialize(root, data_root) @root = root @data_root = data_root end def setup raise "Please override this function." end def imported?( wiki ) raise "Please override this function." end def import( wiki ) raise "Please override this function." end def update( wiki ) raise "Please override this function." end end class ReposBase def initialize(root, data_path) @root = root @data_path = data_path @text_dir = File.join(data_path, "text") end def commit(page, log = nil) raise "Please override this function." end def commit_with_content(page, content, log = nil) raise "Please override this function." end def delete(page, log = nil) raise "Please override this function." end def rename(old_page, new_page) raise "Please override this function." end def get_revision(page, revision) raise "Please override this function." end def revisions(page) raise "Please override this function." end def pages entries = Dir.entries(File.join(@data_path, "text")).reject{|entry| entry =~ /\A\./ || File.directory?(entry) }.map{|entry| unescape(entry) } if block_given? entries.each do |entry| yield entry end else entries end end private def default_msg "#{ENV['REMOTE_ADDR']} - #{ENV['REMOTE_HOST']}" end end # Null Repository Backend class HikifarmReposDefault < HikifarmReposBase def setup end def imported?(wiki) return true end def import(wiki) end def update(wiki) end end class ReposDefault < ReposBase include Hiki::Util def commit(page, log = nil) end def commit_with_content(page, content, log = nil) end def delete(page, log = nil) end def rename(old_page, new_page) end def get_revision(page, revision) revision = revision.to_i begin File::read("#{rev_path(revision)}/#{escape(page).untaint}") rescue '' end end def revisions(page) rev = [] rev << [2, File.mtime("#{rev_path(2)}/#{escape(page).untaint}").localtime.strftime('%Y/%m/%d %H:%M:%S'), '', 'current'] rev << [1, File.mtime("#{rev_path(1)}/#{escape(page).untaint}").localtime.strftime('%Y/%m/%d %H:%M:%S'), '', 'backup'] if File.exist?("#{rev_path(1)}/#{escape(page).untaint}") rev end private def rev_path(revision) case revision when 2 "#{@data_path}/text" when 1 "#{@data_path}/backup" end end end end hiki-1.0.0/hiki/repos/git.rb000066400000000000000000000041321212533356300156230ustar00rootroot00000000000000require 'hiki/repos/default' require 'English' module Hiki class ReposGit < ReposBase include Hiki::Util def commit(page, msg = default_msg) escaped_page = escape(page).untaint Dir.chdir(@text_dir) do system("git add -- #{escaped_page}".untaint) system("git commit -q -m \"#{msg.untaint}\" -- #{escaped_page}") end end def commit_with_content(page, content, message = default_msg) escaped_page = escape(page).untaint File.open(File.join(@text_dir, escaped_page), "w+") do |file| file.write(content) end commit(page) end def delete(page, msg = default_msg) escaped_page = escape(page).untaint Dir.chdir(@text_dir) do system("git rm -q -- #{escaped_page}") system("git commit -q -m \"#{msg.untaint}\" #{escaped_page}") end end def rename(old_page, new_page) old_page = escape(old_page.untaint) new_page = escape(new_page.untaint) Dir.chdir(@text_dir) do raise ArgumentError, "#{new_page} has already existed." if File.exist?(new_page) system("git", "mv", old_page, new_page) system("git", "commit", "-q", "-m", "'Rename #{old_page} to #{new_page}'") end end def get_revision(page, revision) ret = '' Dir.chdir(@text_dir) do open("|git cat-file blob #{revision}".untaint) do |f| ret = f.read end end ret end def revisions(page) require 'time' all_log = '' revs = [] Dir.chdir(@text_dir) do open("|git log --raw -- #{escape(page).untaint}") do |f| all_log = f.read end end all_log.split(/^commit (?:[a-fA-F\d]+)\n/).each do |log| if /\AAuthor:\s*(.*?)\nDate:\s*(.*?)\n(.*?) \n:\d+\s\d+\s[a-fA-F\d]+\.{3}\s([a-fA-F\d]+)\.{3}\s\w \s+#{Regexp.escape(escape(page))}\n+\z/xm =~ log revs << [$4, Time.parse("#{$2}Z").localtime.strftime('%Y/%m/%d %H:%M:%S'), "", # $1, $3.strip] end end revs end end end hiki-1.0.0/hiki/repos/hg.rb000066400000000000000000000044301212533356300154370ustar00rootroot00000000000000# $Id: hg.rb,v 1.1 2008-08-06 10:48:25 hiraku Exp $ # Copyright (C) 2008, KURODA Hiraku # This code is modified from "hiki/repos/git.rb" by Kouhei Sutou # You can distribute this under GPL. require 'hiki/repos/default' module Hiki class ReposHg < ReposBase include Hiki::Util def commit(page, msg = default_msg) escaped_page = escape(page).untaint Dir.chdir(@text_dir) do system("hg addremove -q #{escaped_page}") system("hg ci -m \"#{msg}\" #{escaped_page}") end end def commit_with_content(page, content, msg = default_msg) escaped_page = escape(page).untaint File.open(File.join(@text_dir, escaped_page), "w+") do |file| file.write(content) end commit(page) end def delete(page, msg = default_msg) escaped_page = escape(page).untaint Dir.chdir(@text_dir) do system("hg rm #{escaped_page}") system("hg ci -m \"#{msg}\" #{escaped_page}") end end def rename(old_page, new_page) old_page = escape(old_page.untaint) new_page = escape(new_page.untaint) Dir.chdir(@text_dir) do raise ArgumentError, "#{new_page} has already existed." if File.exist?(new_page) system("hg", "mv", "-q", old_page, new_page) system("hg", "commit", "-q", "-m", "'Rename #{old_page} to #{new_page}'") end end def get_revision(page, revision) r = "" escaped_page = escape(page).untaint Dir.chdir(@text_dir) do open("|hg cat -r #{revision.to_i-1} #{escaped_page}".untaint) do |f| r = f.read end end r end def revisions(page) require 'time' escaped_page = escape(page).untaint all_log = '' revs = [] original_lang = ENV["LANG"] ENV["LANG"] = "C" Dir.chdir(@text_dir) do open("|hg log #{escaped_page}") do |f| all_log = f.read end end ENV["LANG"] = original_lang all_log.split(/\n\n(?=changeset:\s+\d+:)/).each do |l| rev = l[/^changeset:\s+(\d+):.*$/, 1].to_i+1 date = Time.parse(l[/^date:\s+(.*)$/, 1]).localtime.strftime('%Y/%m/%d %H:%M:%S') summary = l[/^summary:\s+(.*)$/, 1] revs << [rev, date, "", summary] end revs end end end hiki-1.0.0/hiki/repos/plain.rb000066400000000000000000000057241212533356300161530ustar00rootroot00000000000000require 'hiki/repos/default' require 'fileutils' module Hiki class HikifarmReposPlain < HikifarmReposBase def setup Dir.mkdir(@root) if not File.exists?(@root) end def imported?(wiki) File.directory?("#{@root}/#{wiki}") end def import(wiki) FileUtils.mkdir("#{@root}/#{wiki}") Dir.glob("#{@data_root}/#{wiki}/text/*") do |orig| orig.untaint FileUtils.mkdir("#{@root}/#{wiki}/#{File.basename(orig)}") FileUtils.cp(orig, "#{@root}/#{wiki}/#{File.basename(orig)}/1") end File.open("#{@data_root}/#{wiki}/text/.wiki", 'w') do |f| f.print wiki end end def update(wiki) raise NotImplementedError end end class ReposPlain < ReposBase include Hiki::Util def commit(page, log = nil) wiki = File.read("#{@data_path}/text/.wiki") dir = "#{@root}/#{wiki.untaint}/#{escape(page).untaint}" Dir.mkdir(dir) if not File.exists?(dir) FileUtils.rm("#{dir}/.removed", {:force => true}) rev = last_revision(page) + 1 FileUtils.cp("#{@data_path}/text/#{escape(page).untaint}", "#{dir}/#{rev}") end # This is a utility method for command line tools def commit_with_content(page, content, log = nil) escaped_page = escape(page) wiki = File.read(File.join(@data_path, "text", ".wiki")) dir = File.join(@root, wiki, escaped_page).untaint revision = last_revision(page) + 1 page_path = File.join(@data_path, "text", escaped_page).untaint FileUtils.mkdir_p(dir) FileUtils.rm_f(File.join(dir, ".removed")) File.open(page_path, "w+") do |file| file.write(content) end FileUtils.cp(page_path, File.join(dir, revision.to_s)) end def delete(page, log = nil) wiki = File.read("#{@data_path}/text/.wiki") File.open("#{@root}/#{wiki.untaint}/#{escape(page).untaint}/.removed", 'w'){|f|} end def rename(old_page, new_page) wiki = File.read("#{@data_path}/text/.wiki") old_dir = "#{@root}/#{wiki.untaint}/#{escape(old_page).untaint}" new_dir = "#{@root}/#{wiki.untaint}/#{escape(new_page).untaint}" raise ArgumentError, "#{new_page} has already existed." if File.exist?(new_dir) FileUtils.mv(old_dir, new_dir) end def get_revision(page, revision) wiki = File.read("#{@data_path}/text/.wiki") File.read("#{@root}/#{wiki.untaint}/#{escape(page).untaint}/#{revision.to_i}") end def revisions(page) wiki = File.read("#{@data_path}/text/.wiki") revs = [] Dir.glob("#{@root}/#{wiki.untaint}/#{escape(page).untaint}/*").each do |file| revs << [File.basename(file).to_i, File.mtime(file.untaint).localtime.to_s, '', ''] end revs.sort_by{|e| -e[0]} end private def last_revision(page) wiki = File.read("#{@data_path}/text/.wiki") Dir.glob("#{@root}/#{wiki.untaint}/#{escape(page).untaint}/*").map{|f| File.basename(f)}.sort_by{|f| -f.to_i}[0].to_i end end end hiki-1.0.0/hiki/repos/rdb.rb000066400000000000000000000037031212533356300156120ustar00rootroot00000000000000# $Id: svn.rb,v 1.14 2005/09/11 10:10:30 fdiary Exp $ # Copyright (C) 2003, Koichiro Ohba # Copyright (C) 2003, Yasuo Itabashi # You can distribute this under GPL. require "hiki/repos/default" require 'sequel' module Hiki class HikifarmReposRdb < HikifarmReposBase def initialize(root, data_root) @data_root = data_root @db = Sequel.connect(root) end def setup # do nothing end def imported?(wiki) true end def import(wiki) Dir["#{@data_root}/#{wiki}/text/*"].each do |f| if File.file?(f.untaint) @db[:page_backup].insert(wiki: wiki, name: File.basename(f), body: File.read(f), last_modified: File.mtime(f), revision: 1) @db[:page].insert(wiki: wiki, name: File.basename(f), body: File.read(f), last_modified: File.mtime(f)) end end end def update(wiki) # do nothing end end class ReposRdb < ReposBase attr_writer :db def initialize(root, data_path) # do nothing end def commit(page, msg = default_msg) # do nothing end def delete(page, msg = default_msg) # do nothing end def get_revision(page, revision) record = @db.db[:page_backup].where(wiki: @db.wiki, name: page, revision: revision).select(:body).first if record && record[:body] record[:body] else "" end end def revisions(page) records = @db.db[:page_backup].where(wiki: @db.wiki, name: page).order(:revision).select(:revision, :last_modified, :editor) records.map do |record| [ record[:revision], "%04d/%02d/%02d %02d:%02d:%02d" % [record[:last_modified].year, record[:last_modified].month, record[:last_modified].day, record[:last_modified].hour, record[:last_modified].min, record[:last_modified].sec], nil, record[:editor] || "Anonymous" ] end end end end hiki-1.0.0/hiki/repos/svn.rb000066400000000000000000000077601212533356300156600ustar00rootroot00000000000000# $Id: svn.rb,v 1.14 2005-09-11 10:10:30 fdiary Exp $ # Copyright (C) 2003, Koichiro Ohba # Copyright (C) 2003, Yasuo Itabashi # You can distribute this under GPL. require 'hiki/repos/default' require 'fileutils' # Subversion Repository Backend module Hiki class HikifarmReposSvnBase < HikifarmReposBase def initialize(root, data_root) super if /^[a-z]:/i =~ @root @base_uri = "file:///#{@root}" else @base_uri = "file://#{@root}" end @base_uri += '/' if %r|/$| !~ @base_uri end def imported?(wiki) s = '' open("|svn ls #{@base_uri}#{wiki}") do |f| s << (f.gets( nil ) ? $_ : '') end if %r|^trunk/$| =~ s then return true else return false end end def import(wiki) Dir.chdir("#{@data_root}/#{wiki}/text") do system("svn import -q -m \"Starting #{wiki} from #{ENV['REMOTE_ADDR']} - #{ENV['REMOTE_HOST']}\" . #{@base_uri}#{wiki}/trunk".untaint) end Dir.chdir("#{@data_root}/#{wiki}") do FileUtils.rm_rf('text') system("svn checkout -q #{@base_uri}#{wiki}/trunk text") system("svn propdel -q svn:mime-type -R text") end end def update(wiki) Dir.chdir("#{@data_root}/#{wiki}/text") do system("svn update -q") end end end # Independent repositories for each wiki class HikifarmReposSvn < HikifarmReposSvnBase def setup begin Dir.mkdir(@root) rescue end end def import(wiki) system("svnadmin create #{@root}/#{wiki}") super end end class ReposSvn < ReposBase include Hiki::Util def initialize(root, data_path) super if /^[a-z]:/i =~ @root @base_uri = "file:///#{@root}" else @base_uri = "file://#{@root}" end @base_uri += '/' if %r|/$| !~ @base_uri end def commit(page, msg = default_msg) escaped_page = escape(page).untaint Dir.chdir(@text_dir) do found = system("svn status -q -- #{escaped_page} | grep -q #{escaped_page}") system("svn add -q -- #{escaped_page}") unless found system("svn propdel -q svn:mime-type -- #{escaped_page}") system("svn ci -q --force-log -m \"#{msg}\"") end end def commit_with_content(page, content, msg = default_msg) escaped_page = escape(page).untaint File.open(File.join(@text_dir, escaped_page), "w+") do |file| file.write(content) end commit(page) end def delete(page, msg = default_msg) escaped_page = escape(page).untaint Dir.chdir(@text_dir) do system("svn remove -q -- #{escaped_page}") system("svn ci -q --force-log -m \"#{msg}\"".untaint) end end def rename(old_page, new_page) old_page = escape(old_page.untaint) new_page = escape(new_page.untaint) Dir.chdir(@text_dir) do raise ArgumentError, "#{new_page} has already existed." if File.exist?(new_page) system("svn", "mv", "-q", old_page, new_page) system("svn", "commit", "-q", "-m", "'Rename #{old_page} to #{new_page}'") end end def get_revision(page, revision) ret = '' escaped_page = escape(page).untaint Dir.chdir(@text_dir) do open("|svn cat -r #{revision.to_i} #{escaped_page}") do |f| ret = f.read end end ret end def revisions(page) require 'time' escaped_page = escape(page).untaint log = '' revs = [] Dir.chdir(@text_dir) do open("|svn log #{escaped_page}") do |f| log = f.read end end log.split(/------------------------------------------------------------------------/).each do |tmp| if /(?:\D+)(\d+?)[\s:\|]+[(?:\s)*](?:.*?) \| (.*?)(?: \(.+\))? \| (.*?)\n\n(.*?)\n/m =~ tmp then revs << [$1.to_i, Time.parse("#{$2}Z").localtime.strftime('%Y/%m/%d %H:%M:%S'), $3, $4] end end revs end end end hiki-1.0.0/hiki/repos/svnsingle.rb000066400000000000000000000003661212533356300170550ustar00rootroot00000000000000require 'hiki/repos/svn' module Hiki # The hikifarm has only one repository class HikifarmReposSvnsingle < HikifarmReposSvnBase def setup system("svnadmin create #{@root}") end end class ReposSvnsingle < ReposSvn; end end hiki-1.0.0/hiki/request.rb000066400000000000000000000076021212533356300154050ustar00rootroot00000000000000# -*- coding: utf-8 -*- module Hiki if Object.const_defined?(:Rack) Request = ::Rack::Request class ::Rack::Request alias remote_addr ip end else raise RuntimeError, 'Do not use CGI class!' if Object.const_defined?(:Rack) # CGI Rack::Request c純ゃ潟帥若сゃ鴻紊 class Request attr_reader :env, :cgi def initialize(env) @cgi = CGI.new @env = env end def params return @params if @params @params = { } @cgi.params.each{|k, v| v = v.uniq case v.size when 0 @params[k] = nil when 1 @params[k] = v[0] else @params[k] = v end } @params end def [](key) params[key.to_s] end def []=(key, val) params[key.to_s] = val end def request_method @env['REQUEST_METHOD'] end def header(header) @cgi.header(header) end def get? request_method == 'GET' end def head? request_method = 'HEAD' end def post? request_method == 'POST' end def put? request_method == 'PUT' end def delete? request_method == 'DELETE' end def xhr? raise NameError, 'not implemented : xhr?' end def accept_encoding raise NameError, 'not implemented : accept_encoding' end def body raise NameError, 'not implemented : body' end def content_charset @env['CONTENT_CHARSET'] end def content_length @env['CONTENT_LENGTH'] end def content_type @env['CONTENT_TYPE'] end def remote_addr @env['REMOTE_ADDR'] end def cookies return @cookies if @cookies @cookies = { } @cgi.cookies.each{|k, v| case v.size when 0 @cookies[k] = nil when 1 @cookies[k] = v[0] else @cookies[k] = v end } @cookies end def form_data? raise NameError, 'not implemented : form_data?' end def fullpath raise NameError, 'not implemented : fullpath' end def host # Remove port number.from Rack::Response (@env["HTTP_HOST"] || @env["SERVER_NAME"]).gsub(/:\d+\z/, '') end def ip raise NameError, 'not implemented : ip' end def media_type raise NameError, 'not implemented : madia_type' end def media_type_params raise NameError, 'not implemented : media_type_params' end def openid_request raise NameError, 'not implemented : openid_request' end def openid_response raise NameError, 'not implemented : openid_response' end def parseable_data? raise NameError, 'not implemented : parseable_data?' end def path raise NameError, 'not implemented : path' end def path_info @env['PATH_INFO'].to_s end def path_info=(s) raise NameError, 'not implemented : path_info=' end def port raise NameError, 'not implemented : port' end def query_string raise NameError, 'not implemented : query_string' end def referer raise NameError, 'not implemented : referer' end alias referrer referer def schema raise NameError, 'not implemented : schema' end def script_name @env['SCRIPT_NAME'] end def session_options raise NameError, 'not implemented : session_options' end def url raise NameError, 'not implemented : url' end def values_at(*keys) raise NameError, 'not implemented : values_at' end end end end hiki-1.0.0/hiki/response.rb000066400000000000000000000006621212533356300155520ustar00rootroot00000000000000 module Hiki if Object.const_defined?(:Rack) Response = ::Rack::Response else class Response attr_reader :body, :status, :headers def initialize(body = [], status = 200, headers = {}, &block) @cgi = CGI.new @body = body @status = status @headers = headers yield self if block_given? end def header @cgi.header(@headers) end end end end hiki-1.0.0/hiki/session.rb000066400000000000000000000037111212533356300153750ustar00rootroot00000000000000# $Id: session.rb,v 1.11 2007-06-24 13:28:49 yanagita Exp $ # Copyright (C) 2004 Kazuhiko module Hiki class Session MAX_AGE = 60 * 60 attr_reader :session_id attr_writer :user def initialize( conf, session_id = nil, max_age = MAX_AGE ) @conf = conf @max_age = max_age if session_id if /\A[0-9a-f]{16}\z/ =~ session_id @session_id = session_id else @session_id = nil end else @session_id = create_new_id # remove old session files Dir.mkdir( session_path ) unless test( ?e, session_path ) Dir.glob( "#{session_path}/*" ).each do |file| file.untaint File.delete( file ) if Time.now - File.mtime( file ) > @max_age end end end def save File.open( session_file, 'w' ) do |file| file.print @user.to_s end end def user return nil unless check begin user = File.read( session_file ) user = nil if user.empty? rescue user = nil end user end def check return false unless @session_id # a session will expire in 10 minutes if test( ?e, session_file ) && Time.now - File.mtime( session_file ) < @max_age now = Time.now File.utime( now, now, session_file ) return true end false end def delete begin File.delete( session_file ) rescue Errno::ENOENT end end private def session_path "#{@conf.data_path}session" end def session_file "#{session_path}/#{@session_id}".untaint end # (from cgi/session.rb) def create_new_id require 'digest/md5' md5 = Digest::MD5.new now = Time.now md5.update(now.to_s) md5.update(String(now.usec)) md5.update(String(rand(0))) md5.update(String($$)) md5.update('foobar') md5.hexdigest[0,16] end end end hiki-1.0.0/hiki/storage.rb000066400000000000000000000052711212533356300153610ustar00rootroot00000000000000# $Id: storage.rb,v 1.17 2006-11-25 22:13:28 fdiary Exp $ # Copyright (C) 2002-2003 TAKEUCHI Hitoshi require 'digest/md5' require 'hiki/util' module Hiki class HikiDBBase attr_accessor :text include Hiki::Util def open_db if block_given? yield close_db else true end true end def close_db true end def pages ['page1', 'page2', 'page3'] end def backup( page ) @text = load( page ) || '' end def delete( page ) backup( page ) unlink( page ) delete_cache( page ) begin send_updating_mail(page, 'delete', text) if @conf.mail_on_update rescue end end def md5hex( page ) s = load( page ) Digest::MD5.hexdigest( s || '' ) end def search( w ) result = [] keys = w.split p = pages total = pages.size page_info.sort_by {|e| e.values[0][:last_modified]}.reverse_each do |i| page = i.keys[0] info = i.values[0] keyword = info[:keyword] title = info[:title] status = '' keys.each do |key| quoted_key = Regexp.quote(key) if keyword and keyword.join("\n").index(/#{quoted_key}/i) status << @conf.msg_match_keyword.gsub(/\]/, " #{h(key)}]") elsif title and title.index(/#{quoted_key}/i) status << @conf.msg_match_title.gsub(/\]/, " #{h(key)}]") elsif load( page ).index(/^.*#{quoted_key}.*$/i) status << '[' + h($&).gsub(/#{Regexp.quote(h(key))}/i) { "#{$&}"} + ']' else status = nil break end end result << [page, status] if status end [total, result] end def load_cache( page ) Dir.mkdir( @conf.cache_path ) unless test( ?e, @conf.cache_path ) cache_path = "#{@conf.cache_path}/parser" Dir.mkdir( cache_path ) unless test( ?e, cache_path ) begin tmp = Marshal.load( File.open( "#{cache_path}/#{escape(page)}".untaint, 'rb' ) {|f| f.read} ) if tmp[0] == Hiki::RELEASE_DATE return tmp[1] else return nil end rescue return nil end end def save_cache( page, tokens ) begin File.open( "#{@conf.cache_path}/parser/#{escape(page)}".untaint, 'wb') do |f| Marshal.dump([Hiki::RELEASE_DATE, tokens], f) end rescue end end def delete_cache( page ) begin File.unlink("#{@conf.cache_path}/parser/#{escape(page)}".untaint) rescue Errno::ENOENT end end end end hiki-1.0.0/hiki/util.rb000066400000000000000000000266701212533356300147000ustar00rootroot00000000000000# -*- coding: utf-8 -*- # $Id: util.rb,v 1.44 2005-12-25 07:03:06 yanagita Exp $ # Copyright (C) 2002-2003 TAKEUCHI Hitoshi require 'nkf' require 'cgi' unless Object.const_defined?(:Rack) require 'erb' require 'docdiff/difference' require 'docdiff/document' require 'docdiff/view' require 'docdiff/diff/unidiff' class String # all instance methods added in String class will be obsoleted in the # future release. def to_euc NKF.nkf('-m0 -e', self) end def to_sjis NKF.nkf('-m0 -s', self) end def to_jis NKF.nkf('-m0 -j', self) end def to_utf8 NKF.nkf('-m0 -w', self) end def escape Hiki::Util.escape(self) end def unescape Hiki::Util.unescape(self) end def escapeHTML Hiki::Util.escape_html(self) end def unescapeHTML Hiki::Util.unescape_html(self) end def sanitize self end end class Hash alias :key :index unless method_defined?(:key) end module Hiki class PluginException < Exception; end module Util include ERB::Util # dead copy from cgi.rb (Ruby1.8) # URL-encode a string. # url_encoded_string = escape("'Stop!' said Fred") # # => "%27Stop%21%27+said+Fred" def escape(string) string.gsub(/([^ a-zA-Z0-9_.-]+)/n) do '%' + $1.unpack('H2' * $1.bytesize).join('%').upcase end.tr(' ', '+') end # dead copy from cgi.rb (Ruby1.8) # URL-decode a string. # string = unescape("%27Stop%21%27+said+Fred") # # => "'Stop!' said Fred" def unescape(string) string.tr('+', ' ').gsub(/((?:%[0-9a-fA-F]{2})+)/n) do [$1.delete('%')].pack('H*') end end # dead copy from cgi.rb (Ruby1.8) # Escape special characters in HTML, namely &\"<> # escapeHTML('Usage: foo "bar" ') # # => "Usage: foo "bar" <baz>" def escapeHTML(string) string.gsub(/&/n, '&').gsub(/\"/n, '"').gsub(/>/n, '>').gsub(/ "Usage: foo \"bar\" " def unescapeHTML(string) string.gsub(/&(amp|quot|gt|lt|\#[0-9]+|\#x[0-9A-Fa-f]+);/n) do match = $1.dup case match when 'amp' then '&' when 'quot' then '"' when 'gt' then '>' when 'lt' then '<' when /\A#0*(\d+)\z/n then if Integer($1) < 256 Integer($1).chr else if Integer($1) < 65536 and $KCODE[0] == ?U [Integer($1)].pack("U") else "&##{$1};" end end when /\A#x([0-9a-f]+)\z/ni then if $1.hex < 256 $1.hex.chr else if $1.hex < 65536 and $KCODE[0] == ?U [$1.hex].pack("U") else "&#x#{$1};" end end else "&#{match};" end end end alias escape_html escapeHTML alias h escapeHTML alias unescape_html unescapeHTML module_function :escape, :unescape, :escape_html, :h, :unescape_html def plugin_error(method, e) msg = "#{e.class} (#{h(e.message)}): #{h(method)}
" msg << "#{e.backtrace.join("
\n")}
" if @conf.plugin_debug msg end def cmdstr( cmd, param ) "?c=#{cmd};#{param}" end def title(s) h("#{@conf.site_name} - #{s}") end def view_title( s ) %Q!
#{h(s)}! end def format_date( tm ) tm.strftime(@conf.msg_time_format).sub(/#DAY#/, "(#{@conf.msg_day[tm.wday]})") end def get_common_data( db, plugin, conf ) data = {} data[:author_name] = conf.author_name data[:view_style] = conf.use_sidebar ? h(conf.main_class) : 'hiki' # for tDiary theme data[:cgi_name] = conf.cgi_name if conf.use_sidebar t = db.load_cache( conf.side_menu ) unless t m = db.load( conf.side_menu ) || '' parser = conf.parser.new( conf ) t = parser.parse( m ) db.save_cache( conf.side_menu, t ) end f = conf.formatter.new( t, db, plugin, conf, 's' ) data[:sidebar] = f.to_s data[:main_class] = conf.main_class data[:sidebar_class] = h(conf.sidebar_class) else data[:sidebar] = nil end data end def word_diff( src, dst, digest = false ) src_doc = Document.new( src, @charset, CharString.guess_eol($/) ) dst_doc = Document.new( dst, @charset, CharString.guess_eol($/) ) diff = compare_by_line_word( src_doc, dst_doc ) overriding_tags = { :start_common => '', :end_common => '', :start_del => '', :end_del => '', :start_add => '', :end_add => '', :start_before_change => '', :end_before_change => '', :start_after_change => '', :end_after_change => '', } if digest return View.new( diff, src.encoding, src.eol ).to_html_digest(overriding_tags, false).join.gsub( %r|
|, '' ).gsub( %r|\n|, "\n" ) #" else return View.new( diff, src.encoding, src.eol ).to_html(overriding_tags, false).join.gsub( %r|
|, '' ).gsub( %r|\n|, "\n" ) #" end end def word_diff_text( src, dst, digest = false ) src_doc = Document.new( src, @charset) dst_doc = Document.new( dst, @charset) diff = compare_by_line_word( src_doc, dst_doc ) if digest return View.new( diff, src.encoding, src.eol ).to_wdiff_digest({}, false).join.gsub( %r|\n\+\}|, "+}\n" ) else return View.new( diff, src.encoding, src.eol ).to_wdiff({}, false).join.gsub( %r|\n\+\}|, "+}\n" ) end end def unified_diff( src, dst, context_lines = 3 ) return h(Diff.new(src.split(/^/), dst.split(/^/)).ses.unidiff( '', context_lines )) end def redirect(request, url, cookies = nil) url.sub!(%r|/\./|, '/') header = {} header['cookie'] = cookies if cookies header['type'] = 'text/html' body = %Q[ moving... Wait or Click here! ] response = Hiki::Response.new(body, 200, header) if Object.const_defined?(:Rack) cookies = response.header.delete('cookie') if cookies cookies.each do |cookie| response.set_cookie(cookie.name, cookie.value) end end end response end def sendmail(subject, body) require 'net/smtp' require 'time' if @conf.mail && !@conf.mail.empty? && @conf.smtp_server Net::SMTP.start(@conf.smtp_server, 25) do |smtp| from_addr = @conf.mail_from ? @conf.mail_from : @conf.mail[0] from_addr.untaint to_addrs = @conf.mail to_addrs.each{|a| a.untaint} smtp.send_mail <= 1.8.2, or install either uconv or rbuconv." end return Uconv.euctou8(str) end end # TODO remove this method in future release def utf8_to_euc(str) if NKF.const_defined?(:UTF8) return NKF.nkf('-m0 -e', str) else begin require 'uconv' rescue LoadError raise "Please update to Ruby >= 1.8.2, or install either uconv or rbuconv." end return Uconv.u8toeuc(str) end end # TODO remove this method in future release def to_native(str, charset=nil) # XXX to_charset will be 'utf-8' in the future version begin Iconv.conv(@charset, charset || 'utf-8', str) rescue from = case charset when /^utf-8$/i 'W' when /^shift_jis/i 'S' when /^EUC-JP/i 'E' else '' end to = case @charset when /^utf-8$/i 'w' when /\Ashift_jis\z/i 's' when /\Aeuc-jp\z/i 'e' else 'e' # XXX what should we use? end NKF.nkf("-m0 -#{from}#{to}", str) end end end def compare_by_line(doc1, doc2) Difference.new(doc1.split_to_line, doc2.split_to_line) end def compare_by_line_word(doc1, doc2) lines = compare_by_line(doc1, doc2) words = Difference.new lines.each{|line| if line.first == :change_elt before_change = Document.new((line[1] || []).join, doc1.encoding, doc1.eol) after_change = Document.new((line[2] || []).join, doc2.encoding, doc2.eol) Difference.new(before_change.split_to_word, after_change.split_to_word).each{|word| words << word } else # :common_elt_elt, :del_elt, or :add_elt words << line end } words end end end hiki-1.0.0/hiki/xmlrpc.rb000066400000000000000000000071631212533356300152240ustar00rootroot00000000000000# $Id: xmlrpc.rb,v 1.9 2007-09-25 06:23:41 fdiary Exp $ require 'xmlrpc/server' require 'hiki/plugin' module Hiki module XMLRPCHandler module_function def init_handler(server, conf, request) server.add_handler('wiki.getPage') do |page| page = utf8_to_euc( page ) db = conf.database ret = db.load( page ) unless ret raise XMLRPC::FaultException.new(1, "No such page was found.") end XMLRPC::Base64.new( euc_to_utf8( ret ) ) end server.add_handler('wiki.getPageInfo') do |page| page = utf8_to_euc( page ) db = conf.database title = db.get_attribute( page, :title ) title = page if title.nil? || title.empty? { 'title' => XMLRPC::Base64.new( euc_to_utf8( title ) ), 'keyword' => db.get_attribute( page, :keyword ).collect { |k| XMLRPC::Base64.new( euc_to_utf8( k ) ) }, 'md5hex' => db.md5hex( page ), 'lastModified' => db.get_attribute( page, :last_modified ).getutc, 'author' => XMLRPC::Base64.new( db.get_attribute( page, :editor ) || '' ) } end server.add_handler('wiki.putPage') do |page, content, attributes| page = utf8_to_euc( page ) content = utf8_to_euc( content ) attributes ||= {} attributes.each_pair { |k, v| case v when String v.replace( utf8_to_euc( v ) ) when Array v.map!{ |s| s.replace( utf8_to_euc( s ) ) } end } request.params['c'] = 'save' request.params['p'] = page db = conf.database options = conf.options || Hash.new('') options['page'] = page options['request'] = request options['cgi'] = request # for backward compatibility options['db'] = db options['params'] = Hash.new('') plugin = Hiki::Plugin.new( options, conf ) plugin.login( attributes['name'], attributes['password'] ) Hiki::Filter.init(conf, request, plugin, db) unless plugin.editable?( page ) raise XMLRPC::FaultException.new(10, "can't edit this page.") end md5hex = attributes['md5hex'] || db.md5hex( page ) update_timestamp = !attributes['minoredit'] unless plugin.save( page, content.gsub( /\r/, '' ), md5hex, update_timestamp ) raise XMLRPC::FaultException.new(11, "save failed.") end keyword = attributes['keyword'] || db.get_attribute( page, :keyword ) title = attributes['title'] attr = [[:keyword, keyword.uniq], [:editor, plugin.user]] attr << [:title, title] if title db.set_attribute(page, attr) if plugin.admin? && attributes.has_key?( 'freeze' ) db.freeze_page( page, attributes['freeze'] ? true : false) end true end server.add_handler('wiki.getAllPages') do db = conf.database db.pages.collect{|p| XMLRPC::Base64.new( euc_to_utf8( p ) )} end #add_multicall #add_introspection end end class XMLRPCServer include XMLRPCHandler def initialize(conf, request) return unless conf.xmlrpc_enabled case when Object.const_defined?(:Rack) require 'hiki/xmlrpc/rackserver.rb' @server = XMLRPC::RackServer.new(request) when Object.const_defined?(:MOD_RUBY) @server = XMLRPC::ModRubyServer.new when Object.const_defined?(:CGI) @server = XMLRPC::CGIServer.new else raise 'must not happen!' end init_handler(@server, conf, request) end def serve @server.serve end end end hiki-1.0.0/hiki/xmlrpc/000077500000000000000000000000001212533356300146705ustar00rootroot00000000000000hiki-1.0.0/hiki/xmlrpc/rackserver.rb000066400000000000000000000021721212533356300173660ustar00rootroot00000000000000 module XMLRPC class RackServer < BasicServer def initialize(request, class_delim = '.') @request = request super(class_delim) end def serve return error_response(405, "Method Not Allowed") unless @request.post? return error_response(400, "Bad Request") unless %r|text/xml| =~ @request.content_type return error_response(411, "Length Required") unless @request.content_length.to_i > 0 data = "" @request.body.read(nil, data) return error_response(400, "Bad Request") if data.nil? or data.size != @request.content_length.to_i Hiki::Response.new(process(data), 200, "Content-Type" => "text/xml; charset=utf-8") end private def error_response(status, message = "") error = "#{status} #{message}" body=<<-BODY #{error}

#{error}

Unexpected error occured while processing XML-RPC request!

BODY Hiki::Response.new(body, status, "Content-Type" => "text/html") end end end hiki-1.0.0/hikiconf.rb.sample000066400000000000000000000135541212533356300160460ustar00rootroot00000000000000# $Id: hikiconf.rb.sample,v 1.20 2006-07-31 13:43:20 fdiary Exp $ # Copyright (C) 2002-2003 TAKEUCHI Hitoshi #============================ # 紊眼綽荀 #============================ # 若帥篆絖c綽 # 若吾絎鴻贋井ユ篆絖cс # c絽吾WWW腟宴с≪祉鴻с(public_html筝с) # c絎障 # c<ゃcWWW泣若 # 罔ф吾莨若若激с潟鏆荀障 @data_path = 'path to data' # <若泣若激с潟 # <若泣若絎障@mail_on_updatetrue翫鴻с @smtp_server = 'localhost' # 違ゃ潟篏帥絎激с潟 # 篏睡翫 true篏睡翫 false 絎障 @use_plugin = true # 違ゃ恰 Cookie 祉激с括∞茵絎 # 絲丞 true сCookie 篏帥腴с # 悟隈イ腓堺帥違ゃ潟腮帥綽荀翫 false # 絎障 @use_session = true #==================================================================== # 膊∞脂≪紊眼с # 綽荀吾筝綺膊∞脂≪ц┃絎障 # <<ゃ膩障 #==================================================================== # 泣ゃ # 泣ゃ腱違絎障若吾帥ゃ茵腓冴障 @site_name = 'hoge hoge' # 泣ゃ膊∞ # 泣ゃ膊∞絎障帥茵腓冴障 @author_name = '<' # <若ャ # true若吾贋井@smtp_server泣若@mail絎 # 紊翫絎鴻<若ч篆<障 @mail_on_update = false # 贋育ュ<若≪ # 贋医絎鴻篆<<若≪ # 茲違≪鴻絎с障 @mail = ['hoge@example.net'] # 若 # 篏睡若 @theme = 'hiki' # 若URL @theme_url = 'theme' # 若絖 @theme_path = 'theme' # 泣ゃ # 泣ゃ若泣若若篏睡翫 # false荐絎障 @use_sidebar = true # <ゃ潟≪劫(CSS) # <ゃ潟≪劫荐絎障 @main_class = 'main' # 泣ゃ若劫(CSS) # 泣ゃ若劫荐絎障 @sidebar_class = 'sidebar' # 若潟 # √若後潟罘純篏睡翫 true 絎障 @auto_link = false # WikiName 潟罘純篏帥絎激с潟 # WikiName 潟罘純篏帥翫 false 絎障 @use_wikiname = true # XML-RPC # XML-RPC ゃ潟帥сゃ鴻鴻荐絎障 @xmlrpc_enabled = true #========================================= # 紊翫初 #========================================= # URI 茵 CGI <ゃ ( "")激с潟 # DirectoryIndex CGI <ゃ 絎翫絽吾 # 絎綽荀障с翫 XREA.com ц┃臀 # CGI <ゃ絎 #@cgi_name = 'hiki.cgi' # 若 URL激с潟 # Hiki 臀 URL CGI ゃ箴 # http://example.com/hiki/hiki.cgi http://example.com/hiki/ # 絎障 # 絽吾ц┃絎障若鴻激翫罩c頥絎 # 翫絎 #@base_url = "http://example.com/hiki/" # c激ャc激с潟 # 違ゃ潟т戎c激ョc絎 #@cache_path = "#{@data_path}/cache" # 潟若c激с潟 # 潟若<ゃ絖c絎 #@template_path = 'template' # 鴻帥ゃ激с潟 # 篁ュ鴻帥ゃ篏帥翫鴻帥ゃ絎障 # 憟 default rd+ 絎с障 #@style = 'default' # 贋育ュ<若≪鴻激с潟 # 贋育ャ<若 From 絎≪鴻с #@mail_from = 'from@mail.address.hoge' # 若若ゃゃ激с潟 #@hilight_keys = true # 若吾c帥祉激с潟 #@charset = 'UTF-8' # 帥ゃ≪腱違激с潟 #@timeout = 30 # 違ゃ潟井 true 障激с潟 #@plugin_debug = false @options = {} # 茵紊眼с # 違ゃ潟羝<激с潟荐菴違障 激с潟 # 違ゃ潟c激с潟羝<ф紊с障 # 荅潟違ゃ潟ャ<潟с # # 荐菴遺 # @options['amazon.aid'] = 'amazon-01' hiki-1.0.0/hikifarm.ru000066400000000000000000000005371212533356300146060ustar00rootroot00000000000000#!/usr/bin/env rackup # -*- ruby -*- require 'hiki/farm' require 'hiki/app' require 'hiki/attachment' use Rack::Lint use Rack::ShowExceptions use Rack::Reloader #use Rack::Session::Cookie #use Rack::ShowStatus use Rack::CommonLogger use Rack::Static, :urls => ['/theme', '/favicon.ico'], :root => '.' map '/' do run Hiki::Farm::Dispatcher.new end hiki-1.0.0/messages/000077500000000000000000000000001212533356300142465ustar00rootroot00000000000000hiki-1.0.0/messages/de.rb000066400000000000000000000106021212533356300151620ustar00rootroot00000000000000# de.rb # # Copyright (C) 2005 Kashia Buch # You can redistribute it and/or modify it under the terms of # the Ruby's licence. # # Original file is ja.rb: # Copyright (C) 2002-2003 TAKEUCHI Hitoshi # You can redistribute it and/or modify it under the terms of # the Ruby's licence. # module Hiki module Messages_de def msg_recent; 'Neu' end def msg_create; 'Erstellen' end def msg_diff; 'Diff' end def msg_edit; 'Editieren' end def msg_search; 'Suchen' end def msg_admin; 'Admin' end def msg_login; 'Login' end def msg_logout; 'Logout' end def msg_search_result; 'Suchergebnisse' end def msg_search_hits; '%3$d Seite(n) mit der Phrase \'%1$s\' wurden in %2$d Seiten gefunden.' end def msg_search_not_found; 'Es wurden keine Seiten mit der Phrase \'%s\' gefunden.' end def msg_search_comment; 'Durchsucht alle Seiten, ignoriert Groß- und Kleinschreibung und liefert alle Seiten die die Wörter in der Anfrage enthalten.' end def msg_frontpage; 'Top' end def msg_hitory; 'Verlauf' end def msg_index; 'Index' end def msg_recent_changes; 'Veränderungen' end def msg_newpage; 'Neu' end def msg_no_recent; '

Keine Daten.

' end def msg_thanks; 'Danke fü das Update.' end def msg_save_conflict; 'Es gibt einen Konflikt mit Ihrem Update. Kopieren Sie den Inhalt unten in ein Textverarbeitungsprogramm und editieren Sie die Seite neu indem Sie erneut auf "Editieren" klicken.' end def msg_time_format; "%Y-%m-%d #DAY# %H:%M:%S" end def msg_date_format; "%Y-%m-%d " end def msg_day; %w(Son Mon Die Mit Don Fre Sam) end def msg_preview; 'Überprüfen sie die Eingabe. Wenn keine Probleme vorhanden sind, sichern Sie die Seite indem sie auf "Speichern" klicken. ->Formular' end def msg_mail_on; 'Sende Email bei veränderungen' end def msg_mail_off; 'Keine Email bei veränderungen' end def msg_use; 'Benutze' end def msg_unuse; 'Benutze kein' end def msg_login_info; 'Wenn Sie sich als Administrator anmelden wollen, tippen Sie \'admin\' in das Namensfeld.' end def msg_login_failure; 'Falscher Benutzername oder Passwort.' end def msg_name; 'Name' end def msg_password; 'Passwort' end def msg_ok; 'OK' end def msg_invalid_password; 'Falsches Passwort, Ihre Änderungen wurden nicht gespeichert.' end def msg_save_config; 'Ihre Konfigurations-Änderungen wurden gespeichert.' end def msg_freeze; 'Diese Seite ist eingefrohren. Sie brauchen ein Administratorpasswort um diese Seite zu verändern.' end def msg_freeze_mark; '[Eingefrohren]' end def msg_already_exist; 'Diese Seite existiert bereits.' end def msg_page_not_exist; 'Diese Seite existiert noch nicht, Sie können sie aber ohne weiteres erstellen.' end def msg_invalid_filename(s); "Der Seitenname entält ungültige Zeichen oder ist größer als die maximale anzahl von #{s} Zeichen. Bitte wählen Sie einen anderen Seitennamen." end def msg_delete; 'Gelöscht' end def msg_delete_page; 'Die Seite wurde gelöscht.' end def msg_follow_link; 'Klicken Sie den folgenden Link um Ihre Seite zu sehen: ' end def msg_match_title; '(Übereinstimmung im Titel)' end def msg_match_keyword; '(Übereinstimmung im Stichwort)' end def msg_duplicate_page_title; 'Dieser Seitentitel existiert bereits.' end def msg_missing_anchor_title; 'Erstelle und bearbeite Seite %s.' end # (config) def msg_config; 'Hiki Configuration'; end # (diff) def msg_diff_add; 'Hinzgefügte Teile werden wie hier angezeigt.'; end def msg_diff_del; 'Entfernte Teile werden wie hier angezeigt.'; end # (edit) def msg_title; 'Titel'; end def msg_keyword_form; 'Stichwörter (ein Stichwort pro Zeile)'; end def msg_freeze_checkbox; 'Seite einfrieren.'; end def msg_preview_button; 'Vorschau'; end def msg_save; 'Speichern'; end def msg_update_timestamp; 'Timestamp updaten'; end def msg_latest; 'Neueste Version'; end def msg_rules; "Siehe Formatierungsregeln für Hilfe beim Editieren."; end # (view) def msg_last_modified; 'Zuletzt geändert'; end def msg_keyword; 'Stichworte'; end def msg_reference; 'Referenzen'; end end end hiki-1.0.0/messages/en.rb000066400000000000000000000101101212533356300151660ustar00rootroot00000000000000# $Id: en.rb,v 1.20 2008-08-07 09:54:21 hiraku Exp $ # en.rb # # Copyright (C) 2003 Masao Mutoh # You can redistribute it and/or modify it under the terms of # the Ruby's licence. # # Original file is ja.rb: # Copyright (C) 2002-2003 TAKEUCHI Hitoshi # You can redistribute it and/or modify it under the terms of # the Ruby's licence. # module Hiki module Messages_en def msg_recent; 'Recent' end def msg_create; 'Create' end def msg_diff; 'Diff' end def msg_edit; 'Edit' end def msg_search; 'Search' end def msg_admin; 'Admin' end def msg_login; 'Login' end def msg_logout; 'Logout' end def msg_search_result; 'Search Results' end def msg_search_hits; '%3$d page(s) containing the phrase \'%1$s\' were found in a set of %2$d pages.' end def msg_search_not_found; 'No pages containing the phrase \'%s\' were found.' end def msg_search_comment; 'Searches all pages, ignore case, and return pages that contain all words in your query.' end def msg_frontpage; 'Top' end def msg_hitory; 'History' end def msg_index; 'Index' end def msg_recent_changes; 'Changes' end def msg_newpage; 'New' end def msg_no_recent; '

There is no data.

' end def msg_thanks; 'Thank you for your update.' end def msg_save_conflict; 'There is a conflict with your updates. Copy the content below to a text editor and edit the page after referring to the latest version.' end def msg_time_format; "%Y-%m-%d #DAY# %H:%M:%S" end def msg_date_format; "%Y-%m-%d " end def msg_day; %w(Sun Mon Tue Wed Thr Fri Sat) end def msg_preview; 'Confirm the content below. If there are no problems, save it with the save button. ->Form' end def msg_mail_on; 'Send update e-mails' end def msg_mail_off; 'Do not send update e-mails' end def msg_use; 'Use' end def msg_unuse; 'Don\'t use' end def msg_login_info; 'If you want to login as an administrator, type \'admin\' in the Name field.' end def msg_login_failure; 'Wrong name or password.' end def msg_name; 'Name' end def msg_password; 'Password' end def msg_ok; 'OK' end def msg_invalid_password; 'Your password is not correct. Your changes have not yet been saved.' end def msg_save_config; 'Your configuration changes have been saved.' end def msg_freeze; 'This page is frozen. You will need an admin password to change this page.' end def msg_freeze_mark; '[Frozen]' end def msg_already_exist; 'That page already exists.' end def msg_page_not_exist; 'This page does not exist. Feel free to create it yourself :-)' end def msg_invalid_filename(s); "The page name contains an invalid character or is over the maximum length of #{s} bytes. Please fix the page name." end def msg_delete; 'Deleted' end def msg_delete_page; 'The page has been deleted.' end def msg_follow_link; 'Click the following link to view your page: ' end def msg_match_title; '(matched in title)' end def msg_match_keyword; '(matched in keyword)' end def msg_duplicate_page_title; 'That page title already exists.' end def msg_missing_anchor_title; 'Create and edit the page %s.' end # (config) def msg_config; 'Hiki Configuration'; end # (diff) def msg_diff_add; 'Added parts are displayed like this.'; end def msg_diff_del; 'Deleted parts are displayed like this.'; end # (edit) def msg_title; 'Title'; end def msg_keyword_form; 'Keyword(s) (one keyword per line)'; end def msg_freeze_checkbox; 'Freeze the current page.'; end def msg_preview_button; 'Preview'; end def msg_save; 'Save'; end def msg_update_timestamp; 'Update timestamp'; end def msg_latest; 'Latest version'; end def msg_rules; %Q|See TextFormattingRules for formatting help.|; end # (view) def msg_last_modified; 'Last modified'; end def msg_keyword; 'Keyword(s)'; end def msg_reference; 'References'; end def msg_input_is_spam; 'Input is treated as SPAM.'; end end end hiki-1.0.0/messages/fr.rb000066400000000000000000000107401212533356300152040ustar00rootroot00000000000000# -*- coding: utf-8 -*- # $Id: fr.rb,v 1.15 2005-07-14 01:50:25 fdiary Exp $ # fr.rb # # Copyright (C) 2003 Laurent Sansonetti # You can redistribute it and/or modify it under the terms of # the Ruby's licence. # # Original file is ja.rb: # Copyright (C) 2002-2003 TAKEUCHI Hitoshi # You can redistribute it and/or modify it under the terms of # the Ruby's licence. # module Hiki module Messages_fr def msg_recent; 'Modifications r辿centes' end def msg_create; 'Cr辿er' end def msg_diff; 'Diff辿rences' end def msg_edit; 'Editer' end def msg_search; 'Chercher' end def msg_admin; 'Administration' end def msg_login; 'Login' end def msg_logout; 'Logout' end def msg_search_result; 'R辿sultats de la recherche' end def msg_search_hits; '\'%1$s\': %3$d page(s) trouv辿es dans %2$d pages.' end def msg_search_not_found; '\'%s\' introuvable.' end def msg_search_comment; 'Rechercher sur le site entier. Ignore la casse. Hiki renvoie les pages contenant tous les mots de votre requ棚te.' end def msg_frontpage; 'Accueil' end def msg_hitory; 'Historique' end def msg_index; 'Index' end def msg_recent_changes; 'Changements' end def msg_newpage; 'Nouveau' end def msg_no_recent; '

Pas de donn辿es.

' end def msg_thanks; 'Merci.' end def msg_save_conflict; 'Il y a eu des conflits lors de la mise--jour. Vos modifications n\'ont pas 辿t辿 sauv辿es. Sauvez temporairement vos modifications dans un 辿diteur, rechargez la page et r辿-essayez l\'辿dition nouveau.' end def msg_time_format; "%Y-%m-%d #DAY# %H:%M:%S" end def msg_date_format; "%Y-%m-%d " end def msg_day; %w(Dimanche Lundi Mardi Mercredi Jeudi Vendredi Samedi) end def msg_preview; 'Ceci est une pr辿visualisation de la page. Si tout est correct, veuillez confirmer en cliquant sur le bouton Sauver. ->Formulaire' end def msg_mail_on; 'Envoyer un e-mail de notification' end def msg_mail_off; 'Ne pas envoyer un e-mail de notification' end def msg_use; 'Utiliser' end def msg_unuse; 'Ne pas utiliser' end def msg_login_info; '(TRANSLATE PLEASE) If you want to login as an administrator, type \'admin\' in the Name field.' end def msg_login_failure; '(TRANSLATE PLEASE) Wrong name or password.' end def msg_name; 'Nom' end def msg_password; 'Mot de passe' end def msg_ok; 'OK' end def msg_invalid_password; 'Mot de passe incorrect. Vos modifications n\'ont pas encore 辿t辿 sauvegard辿es.' end def msg_save_config; 'Modifications sauv辿es' end def msg_freeze; 'Cette page est gel辿e. Vous avez besoin du mot de passe administrateur pour continuer.' end def msg_freeze_mark; '[Geler]' end def msg_already_exist; 'Cette page a existe d辿j.' end def msg_page_not_exist; 'Cette page n\'existe pas. Veuillez la remplir par vous-m棚me ;-)' end def msg_invalid_filename(s); "Caract竪re invalide d辿tect辿, ou taille maximale d辿pass辿e (#{s} octets). Veuillez choisir un nouveau titre pour la page." end def msg_delete; 'Supprim辿.' end def msg_delete_page; 'Cette page est supprim辿e.' end def msg_follow_link; 'Cliquez sur le lien ci-dessous pour afficher votre page: ' end def msg_match_title; '[correspondance dans le titre]' end def msg_match_keyword; '[correspondance dans un mot clef]' end def msg_duplicate_page_title; 'Une page portant le m棚me nom existe d辿j.' end def msg_missing_anchor_title; 'Create new %s and edit.' end # (config) def msg_config; 'Configuration du Hiki'; end # (diff) def msg_diff_add; 'Les lignes ajout辿es sont affich辿es comme ceci.'; end def msg_diff_del; 'Les lignes retir辿es sont affich辿es comme cela.'; end # (edit) def msg_title; 'Titre de la page'; end def msg_keyword_form; 'Mot clef (veuillez entrer distinctement chaque mot sur une ligne part)'; end def msg_freeze_checkbox; 'Geler la page courante.'; end def msg_preview_button; 'Pr辿visualiser'; end def msg_save; 'Sauver'; end def msg_update_timestamp; '(TRANSLATE PLEASE) Update timestamp'; end def msg_latest; 'R辿f辿rencie version r辿cente'; end def msg_rules; %Q|Consultez ReglesDeFormatageDuTexte si n辿cessaire.|; end # (view) def msg_last_modified; 'Derni竪re modification'; end def msg_keyword; 'Mots clef'; end def msg_reference; 'R辿f辿rences'; end end end hiki-1.0.0/messages/it.rb000066400000000000000000000101261212533356300152070ustar00rootroot00000000000000# $Id: it.rb,v 1.15 2005-07-14 01:50:25 fdiary Exp $ # it.rb # # Copyright (C) 2003 Luigi Maselli # You can redistribute it and/or modify it under the terms of # the Ruby's licence. # # Original file is ja.rb: # Copyright (C) 2002-2003 TAKEUCHI Hitoshi # You can redistribute it and/or modify it under the terms of # the Ruby's licence. # module Hiki module Messages_it def msg_recent; 'Recente' end def msg_create; 'Crea' end def msg_diff; 'Differenze' end def msg_edit; 'Modifica' end def msg_search; 'Cerca' end def msg_admin; 'Amministratore' end def msg_login; 'Login' end def msg_logout; 'Logout' end def msg_search_result; 'Risultati trovati' end def msg_search_hits; '\'%1$s\': %3$d pagina(e) sono trovati in %2$d pagine.' end #da verificare def msg_search_not_found; '\'%s\'non trovato.' end def msg_search_comment; 'Cerca in questo sito. Ignora MAIUSCOLO/minuscolo. Hiki ricerca le pagine che contengono tutte le parole inserite' end def msg_frontpage; 'Alto' end def msg_hitory; 'Cronologia' end def msg_index; 'Indici' end def msg_recent_changes; 'Ultime modifiche' end def msg_newpage; 'Nuova' end def msg_no_recent; '

Non ci sono dati.

' end def msg_thanks; 'Grazie.' end def msg_save_conflict; 'Conflitto nell\'aggiornamento. Le modifiche non sono state salvate. Copia le tue modifiche, ricarica le pagine e prova a modificarle di nuovo.' end def msg_time_format; "%d-%m-%Y #DAY# %H:%M:%S" end def msg_date_format; "%d-%m-%Y " end def msg_day; %w(Dom Lun Mar Mer Gio Ven Sab) end def msg_preview; 'Conferma il risultato sotto e salvalo cliccando sul pulsante Salva se non ci sono errori ->Modulo' end def msg_mail_on; 'Invia updated-mail' end #da verificare def msg_mail_off; 'Non inviare updated-mail' end #da verificare def msg_use; 'Usa' end def msg_unuse; 'Non usare' end def msg_login_info; '(TRANSLATE PLEASE) If you want to login as an administrator, type \'admin\' in the Name field.' end def msg_login_failure; '(TRANSLATE PLEASE) Wrong name or password.' end def msg_name; 'Nomare' end def msg_password; 'Password' end def msg_ok; 'OK' end def msg_invalid_password; 'Password non corretta. Le tue modifiche non sono ancora state salvate.' end def msg_save_config; 'Modifiche salvate' end def msg_freeze; 'Questa pagina ? bloccata. Ti serve la password dell\'amministratore per salvare.' end def msg_freeze_mark; '[Bloccata]' end def msg_already_exist; 'La pagina gi? esistente.' end def msg_page_not_exist; 'La pagina non esiste. Createla! :-)' end def msg_invalid_filename(s); "Includi i caratteri invalidi, o ? oltre la lunghezza massima(#{s}byte). Cambia il nome della pagina." end def msg_delete; 'Cancellato' end def msg_delete_page; 'Pagina cancellata.' end def msg_follow_link; 'Segui il collegamento: ' end def msg_match_title; '[corrispondente in titolo]' end def msg_match_keyword; '[corrispondente nella chiave di ricerca]' end def msg_duplicate_page_title; 'Titolo della pagina gi? esistente.' end def msg_missing_anchor_title; 'Create new %s and edit.' end # (config) def msg_config; 'Configurazione Hiki'; end # (diff) def msg_diff_add; 'Le linee aggiunte sono mostrate come qui.'; end def msg_diff_del; 'Le linee rimosse sono mostrate come qui.'; end # (edit) def msg_title; 'Titolo pagina'; end def msg_keyword_form; 'Parole chiave (Scrivile una ogni riga)'; end def msg_freeze_checkbox; 'Blocca la pagina corrente.'; end def msg_preview_button; 'Anteprima'; end def msg_save; 'Salva'; end def msg_update_timestamp; '(TRANSLATE PLEASE) Update timestamp'; end def msg_latest; 'Riferimento versione recente'; end def msg_rules; %Q|Vedi TextFormattingRules se serve.|; end # (view) def msg_last_modified; 'Ultima modifica'; end def msg_keyword; 'Parola chiave'; end def msg_reference; 'Referenze'; end end end hiki-1.0.0/messages/ja.rb000066400000000000000000000113051212533356300151650ustar00rootroot00000000000000# -*- coding: utf-8 -*- # $Id: ja.rb,v 1.15 2008-02-12 15:06:08 hiraku Exp $ # Copyright (C) 2002-2003 TAKEUCHI Hitoshi # You can redistribute it and/or modify it under the terms of # the Ruby's licence. module Hiki module Messages_ja def msg_recent; '贋医吋罩' end def msg_create; '域鋎' end def msg_diff; '綏' end def msg_edit; '膩' end def msg_search; '罎膣' end def msg_admin; '膊∞' end def msg_login; '違ゃ' end def msg_logout; '違≪' end def msg_search_result; '罎膣∝' end def msg_search_hits; '\'%s\'若吾%d若娯賢%d若梧ゃ障' end def msg_search_not_found; '\'%s\'若吾荀ゃ障с' end def msg_search_comment; '若吾茯罎膣≪障紊ф絖絨絖阪ャ障茹鴻若鴻у茯阪絎茯若吾罎膣≪障' end def msg_frontpage; '' end def msg_hitory; '贋医吋罩' end def msg_index; '若娯荀' end def msg_recent_changes; '贋医吋罩' end def msg_newpage; '域' end def msg_no_recent; '

贋井宴絖障

' end def msg_thanks; '贋違障' end def msg_save_conflict; '贋違茵腦障筝荐絎鴻鴻c帥篆絖違若吾у膩' end def msg_time_format; "%Y-%m-%d #DAY# %H:%M:%S" end def msg_date_format; "%Y-%m-%d " end def msg_day; %w( 羂 ) end def msg_preview; '篁ヤャ若腆肴馹違若吾筝篆絖帥潟т絖 膩若' end def msg_mail_on; '<若ч' end def msg_mail_off; '' end def msg_use; '篏睡' end def msg_unuse; '篏睡' end def msg_login_info; '膊∞違ゃ潟若九 admin ュ' end def msg_login_failure; '若九障鴻若c障' end def msg_name; '若九' end def msg_password; '鴻若' end def msg_ok; 'OK' end def msg_invalid_password; '鴻若c障障荐絎宴篆絖障' end def msg_save_config; '荐絎篆絖障' end def msg_freeze; '若吾腟障篆絖膊∞鴻若綽荀с' end def msg_freeze_mark; '腟' end def msg_already_exist; '絎若吾с絖障' end def msg_page_not_exist; '絎若吾絖障蚊篏:-)' end def msg_invalid_filename(s); "筝罩c絖障紊ч(#{s}ゃ)莇障若後篆罩c" end def msg_delete; '若吾ゃ障' end def msg_delete_page; '篁ヤ若吾ゃ障' end def msg_follow_link; '篁ヤ潟c: ' end def msg_match_title; '[帥ゃ筝]' end def msg_match_keyword; '[若若筝]' end def msg_duplicate_page_title; '絎帥ゃ≪絖障' end def msg_missing_anchor_title; '若 %s 域鋎膩障' end # (config) def msg_config; 'Hiki 医荐絎'; end # (diff) def msg_diff_add; '緇贋違ц申茵腓冴障'; end def msg_diff_del; '緇贋違уゃ茵腓冴障'; end # (edit) def msg_title; '帥ゃ'; end def msg_keyword_form; '若若(1茵1よ菴違)'; end def msg_freeze_checkbox; '若吾腟'; end def msg_preview_button; 'ャ'; end def msg_save; '篆絖'; end def msg_update_timestamp; '帥ゃ鴻帥潟贋違'; end def msg_latest; '亥'; end def msg_rules; %Q|吾鴻翫TextFormattingRulesс|; end # (view) def msg_last_modified; '贋井ユ'; end def msg_keyword; '若若'; end def msg_reference; ''; end def msg_input_is_spam; 'ュ若帥鴻ゅ障'; end end end hiki-1.0.0/misc/000077500000000000000000000000001212533356300133725ustar00rootroot00000000000000hiki-1.0.0/misc/hiki-mode/000077500000000000000000000000001212533356300152405ustar00rootroot00000000000000hiki-1.0.0/misc/hiki-mode/README000066400000000000000000000005661212533356300161270ustar00rootroot00000000000000! hiki-mode.el EmacsHiki若吾膩major modeс !! ゃ潟鴻若 鴻chiki-mode.el臀緇~/.hiki (setq hiki-site-list '(("Hoge-Hiki" "http://example.com/hiki/") ("Fuga-Hiki" "http://example.jp/hiki/hiki.cgi"))) (require 'hiki-mode) 吾OK hiki-1.0.0/misc/hiki-mode/hiki-mode.el000066400000000000000000001160201212533356300174300ustar00rootroot00000000000000;;; hiki-mode.el -- Major mode for Hiki editing -*- coding: euc-jp -*- ;; Copyright (C) 2003 Hideaki Hori ;; Author: Hideaki Hori ;; $Id: hiki-mode.el,v 1.10 2005-08-24 06:43:04 fdiary Exp $ ;; ;; This program is free software; you can redistribute it and/or ;; modify it under the terms of the GNU General Public License as ;; published by the Free Software Foundation; either version 2, or (at ;; your option) any later version. ;; This program is distributed in the hope that it will be useful, but ;; WITHOUT ANY WARRANTY; without even the implied warranty of ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU ;; General Public License for more details. ;; You should have received a copy of the GNU General Public License ;; along with this program; see the file COPYING. If not, write to the ;; Free Software Foundation, Inc., 59 Temple Place - Suite 330, ;; Boston, MA 02111-1307, USA. ;;; Commentary: ;; usage: ;; ;; Put the following in ~/.emacs or ~/.hiki ;; ;; (setq hiki-site-list '(("my 1st Hiki" "http://example.com/hiki/hiki.cgi") ;; ("my 2nd Hiki" "http://example.com/hiki2/"))) ;; (setq hiki-browser-function 'browse-url) ;; (autoload 'hiki-edit "hiki-mode" nil t) ;; (autoload 'hiki-edit-url "hiki-mode" nil t) ;; ;;; Variable: (require 'pces) (defvar hiki-http-proxy-server nil "Proxy server for HTTP.") (defvar hiki-http-proxy-port nil "Proxy port for HTTP.") (defvar hiki-http-timeout 10 "Timeout for HTTP.") (defvar hiki-http-cookie nil) (defvar hiki-freeze nil) (if (or (featurep 'xemacs) (not (boundp 'emacs-major-version)) (< emacs-major-version 21)) (progn (require 'poe) (require 'poem))) (require 'derived) (defconst hiki-mode-version (let ((revision "$Revision: 1.10 $")) (string-match "\\([0-9.]+\\)" revision) (match-string 1 revision))) (defvar hiki-site-list nil "List of Hiki list. Each element looks like (NAME URL STYLE). STYLE is optional.") (defvar hiki-list nil "`hiki-list' is OBSOLETE; use hiki-site-list.") (defvar hiki-site-info nil) (defvar hiki-index-page-info-list nil) (defvar hiki-index-sort-key nil) (defvar hiki-coding-system 'euc-japan-dos) (defvar hiki-pagename nil) (defvar hiki-pagetitle nil) (defvar hiki-md5hex nil) (defvar hiki-session-id nil) (defvar hiki-update-timestamp nil) (defvar hiki-edit-newpage nil) (defvar hiki-password-alist nil) (defvar hiki-browser-function nil "Function to call browser. If non-nil, `hiki-edit-save-page' calls this function. The function is expected to accept only one argument(URL).") (defvar hiki-init-file "~/.hiki" "Init file for hiki-mode.") (defvar hiki-non-wikiname-regexp-string "[^A-Za-z0-9]") (defvar hiki-wikiname-regexp-string "\\([A-Z][a-z0-9]+\\([A-Z][a-z0-9]+\\)+\\)") (defvar hiki-wikiname-regexp-list (list (cons (concat hiki-non-wikiname-regexp-string hiki-wikiname-regexp-string hiki-non-wikiname-regexp-string) 1) (cons (concat "^" hiki-wikiname-regexp-string hiki-non-wikiname-regexp-string) 1) (cons (concat hiki-non-wikiname-regexp-string hiki-wikiname-regexp-string "$") 1) (cons (concat "^" hiki-wikiname-regexp-string "$") 1))) (defvar hiki-bracket-name-regexp '("\\[\\[\\([^]:|]+\\)\\]\\]" . 1) ) (defvar hiki-rd+-bracket-name-regexp '("((<\\([^>:|]+\\)>))" . 1)) (defvar hiki-style-anchor-regexp-alist (list (cons 'default (cons hiki-bracket-name-regexp hiki-wikiname-regexp-list)) (cons 'rd+ (list hiki-rd+-bracket-name-regexp))) "Alist of regexp for anchor.") (defvar hiki-anchor-regexp-alist (cdr (assoc 'default hiki-style-anchor-regexp-alist))) (defvar hiki-anchor-face (copy-face 'underline 'hiki-anchor-face) "Face for Hiki anchor." ) (defvar hiki-site-name-history nil "History of Hiki site name." ) (defvar hiki-pagename-history nil "History of Hiki page name." ) (defvar hiki-diff-buffer-name "*Hiki diff*") (defvar hiki-page-buffer-alist nil) (defvar hiki-init nil) ;;; Code: (defun hiki-mode-version () (interactive) (message (format "hiki-mode (Revision: %s)" hiki-mode-version))) (defun hiki-initialize () (unless hiki-init (hiki-load-init-file) (setq hiki-init t))) ;;; 膩≪若 (hiki-edit-*) (define-derived-mode hiki-edit-mode text-mode "Hiki Edit" "Major mode for Hiki editing. \\{hiki-edit-mode-map}" (make-local-variable 'require-final-newline) (make-local-variable 'hiki-site-info) (make-local-variable 'hiki-newpage) (make-local-variable 'hiki-pagename) (make-local-variable 'hiki-md5hex) (make-local-variable 'hiki-session-id) (make-local-variable 'hiki-update-timestamp) (setq require-final-newline t indent-tabs-mode nil) (hiki-edit-setup-keys) (set-buffer-file-coding-system hiki-coding-system) (setq hiki-anchor-regexp-alist (cdr (assoc (hiki-site-style hiki-site-info) hiki-style-anchor-regexp-alist))) (when (and (featurep 'font-lock) (fboundp 'font-lock-add-keywords)) (let ((case-fold-search nil)) ;;(font-lock-set-defaults) (font-lock-add-keywords 'hiki-edit-mode (mapcar (lambda (cell) (list (car cell) (cdr cell) 'hiki-anchor-face t)) hiki-anchor-regexp-alist))) (put 'hiki-edit-mode 'font-lock-defaults '(text-font-lock-keywords nil t)) (turn-on-font-lock)) (run-hooks 'hiki-edit-mode-hook)) (defun hiki-edit-setup-keys () "Set up keymap for hiki-edit-mode. If you want to set up your own key bindings, use `hiki-edit-mode-hook'." (define-key hiki-edit-mode-map "\C-c\C-i" 'hiki-edit-next-anchor) (define-key hiki-edit-mode-map "\C-c\C-r" 'hiki-edit-reload) (define-key hiki-edit-mode-map "\C-c\C-e" 'hiki-edit) (define-key hiki-edit-mode-map "\C-c\C-c" 'hiki-edit-save-page) (define-key hiki-edit-mode-map "\C-c\C-q" 'hiki-edit-quit) ) (defun hiki-load-init-file () "Load init file." (when hiki-init-file (let ((init-file (expand-file-name hiki-init-file))) (when (file-readable-p init-file) (load init-file t t)) (hiki-obsolete-check)))) (defun hiki-obsolete-check () (when hiki-list (message "hiki-list is OBSOLETE. Use hiki-site-list.") (sit-for 5) (setq hiki-site-list hiki-list))) (defun hiki-read-site-name (&optional string) "泣ゃ<茯帥泣ゃ宴鴻菴 STRING non-nil 泣ゃ" (let* ((selected (car hiki-site-list)) (default (or (hiki-site-name) (car selected)))) (assoc (or (completing-read (format "Select SITE (%s): " default) hiki-site-list nil t nil 'hiki-site-name-history default) default) hiki-site-list))) (defun hiki-password-read (sitename pagename) (cdr (assoc (cons sitename pagename) hiki-password-alist))) (defun hiki-password-store (sitename pagename password) (let (key unit) (setq key (cons sitename pagename) unit (assoc key hiki-password-alist)) (if unit (if password (setcdr unit password) (setq hiki-password-alist (delete unit hiki-password-alist))) (if password (setq hiki-password-alist (cons (cons (cons sitename pagename) password) hiki-password-alist)))))) (defun hiki-read-pagename (arg site-name) (completing-read (format "Page name for %s: " site-name) (cdr (assoc site-name hiki-pagename-history)) nil nil arg nil arg)) ;;; navi2ch-read-char 障 (defun hiki-read-char (prompt) "PROMPT (non-nil 翫) 茵腓冴 `read-char' 若喝冴" (let ((cursor-in-echo-area t) c) (if prompt (message "%s" prompt)) (setq c (read-char)) (if prompt (message "%s%c" prompt c)) c)) ;;; navi2ch-read-char-with-retry 障 (defun hiki-read-char-with-retry (prompt retry-prompt list) (let ((retry t) c) (while retry (setq c (hiki-read-char prompt)) (cond ((memq c list) (setq retry nil)) ((eq c 12) (recenter)) (t (ding) (setq prompt (or retry-prompt prompt))))) c)) (defun hiki-http-request (mode cmd pagename site-url &optional post-data) (let* ((url (if (eq mode 'get) (concat (format "%s?c=%s" site-url cmd) (if pagename (format ";p=%s" (hiki-http-url-hexify-string pagename hiki-coding-system)))) site-url)) (buf (hiki-http-fetch url mode nil nil (hiki-http-url-hexify-alist post-data hiki-coding-system)))) (if (bufferp buf) (save-excursion (set-buffer buf) (decode-coding-region (point-min) (point-max) hiki-coding-system) (goto-char (point-min)) buf) (error (format "hiki get: %s - %s" (car buf) (cdr buf)))))) (defun hiki-current-anchor-string () "Return anchor string at current point." (let (str result pos (point (point))) (save-excursion (beginning-of-line) (setq pos (point)) (while (and (setq result (hiki-search-anchor pos)) (<= (cdr result) point)) (setq pos (cdr result))) (when (and result (<= (car result) point)) (setq str (buffer-substring-no-properties (car result) (cdr result))))) str)) (defun hiki-edit-next-anchor (&optional prev) "罨<≪潟若悟Щ PREV non-nil 違≪潟若悟Щ" (interactive "P") (goto-char (or (car (hiki-search-anchor (point) prev)) (point)))) (defun hiki-search-anchor (point &optional prev) "POINT 菴≪潟若「 荀ゃc (beginning . end) 荀ゃc nil 菴" (let ((case-fold-search nil) (alist hiki-anchor-regexp-alist) result) (save-excursion (while alist (goto-char point) (if (if prev (re-search-backward (car (car alist)) nil t nil) (re-search-forward (car (car alist)) nil t nil)) (when (or (null result) (> (car result) (match-beginning (cdr (car alist))))) (setq result (cons (match-beginning (cdr (car alist))) (match-end (cdr (car alist))))))) (setq alist (cdr alist)))) result)) (defun hiki-edit-rename-buffer (sitename pagename pagetitle frozenp) (let ((name (format "[%s%s] %s%s" sitename (if (string= pagename pagetitle) "" (concat ":" pagename)) pagetitle (if frozenp " (frozen)" "")))) (or (string= name (buffer-name)) (rename-buffer name t)))) (defun hiki-edit-url (str &optional url-encoded) "URL 絎膩" (interactive "sURL: ") (let (url pagename site-info) (or (string-match "^\\(http://[^?]+\\)\\?\\(.+\\)$" str) (error "Illegal URL. (%s)" str)) (setq url (match-string 1 str)) (setq pagename (match-string 2 str)) (when (string-match "=" pagename) (if (string-match "\\(^\\|[?&;]\\)p=\\(.+\\)" pagename) (setq pagename (match-string 2 pagename)) (error "Illegal URL. (%s)" str))) (setq site-info (list url url)) (hiki-edit-page (hiki-http-url-unhexify-string pagename hiki-coding-system) site-info))) (defun hiki-edit-quit () (interactive) (let ((site-info hiki-site-info) (pagename hiki-pagename) win cancelled) (setq buffer-read-only t) (when (buffer-modified-p) (if (y-or-n-p "Buffer is modified. Really quit?") (progn (kill-buffer (current-buffer)) (setq hiki-page-buffer-alist (remassoc (list (hiki-site-name site-info) pagename) hiki-page-buffer-alist)) (delete-other-windows)) (setq cancelled t))) (when (not cancelled) (cond ((setq win (get-buffer-window (hiki-index-buffer-name site-info))) (select-window win)) (t (delete-other-windows))) (hiki-index site-info t pagename)))) (defun hiki-edit-reload () "憜膩筝若吾若" (interactive) (let ((selected-pagename hiki-pagename)) (hiki-edit))) (defun hiki-edit (&optional select-site) "若後絎膩 SELECT-SITE non-nil SITE絎" (interactive "P") (hiki-initialize) (let ((point (point)) (start (window-start)) site-info pagename (same-site t) same-page) ;; site-name input (if required) (cond ((and (hiki-site-name) (not select-site)) (setq site-info hiki-site-info)) (t (setq site-info (hiki-read-site-name)) (when (not (string= (hiki-site-name site-info) (hiki-site-name))) (setq same-site nil)))) ;; pagename input (setq pagename (if (boundp 'selected-pagename) selected-pagename (hiki-read-pagename (or (hiki-current-anchor-string) hiki-pagename "FrontPage") (hiki-site-name site-info)))) (if (string= pagename hiki-pagename) (setq same-page t)) ;; edit (hiki-edit-page pagename site-info) ;; restore point (if required) (when (and same-site same-page) (set-window-start (selected-window) start) (goto-char point)))) ;;; 筝荀с≪若(hiki-index-*) (define-derived-mode hiki-index-mode text-mode "Hiki Index" "Major mode for Hiki index. \\{hiki-index-mode-map}" (make-local-variable 'hiki-site-info) (make-local-variable 'hiki-index-page-info-list) (make-local-variable 'hiki-index-sort-key) (hiki-index-setup-keys) (run-hooks 'hiki-index-mode-hook)) (defun hiki-index-setup-keys () "Set up keymap for hiki-index-mode. If you want to set up your own key bindings, use `hiki-index-mode-hook'." (define-key hiki-index-mode-map "\r" 'hiki-index-edit-page-current-line) (define-key hiki-index-mode-map "e" 'hiki-index-edit-page) (define-key hiki-index-mode-map "." 'hiki-index-display-page) (define-key hiki-index-mode-map " " 'hiki-index-display-page-next) (define-key hiki-index-mode-map "S" 'hiki-index-sort) (define-key hiki-index-mode-map "R" 'hiki-index-refetch-index) (define-key hiki-index-mode-map "q" 'hiki-index-suspend) (define-key hiki-index-mode-map "Q" 'hiki-index-quit) (define-key hiki-index-mode-map "I" 'hiki-index-login) (define-key hiki-index-mode-map "O" 'hiki-index-logout) ) (defun hiki-index (&optional site-info refetch pagename) "筝荀с≪若ャ SITE-INFO 絎違<茯粋昭 REFETCH nil сс<絖HTTP GET " (interactive "P") (hiki-initialize) (let (buf) ;; site-name input (if required) (when (null site-info) (setq site-info (hiki-read-site-name))) (setq buf (hiki-display-index site-info refetch pagename)) (switch-to-buffer buf) (unless pagename (delete-other-windows)))) (defun hiki-display-index (site-info &optional refetch pagename) "筝荀с茵腓冴<菴 REFETCH nil ф≪<絖HTTP GET PAGENAME 絲上茵違若純腱糸 " (let ((old-buf (current-buffer)) (buf (hiki-index-get-buffer-create site-info))) (switch-to-buffer buf) (setq buffer-read-only nil) (erase-buffer) (when (or refetch (null hiki-index-page-info-list)) (message "Loading...") (setq hiki-index-page-info-list (hiki-fetch-index site-info)) (message "Loading... done.")) (mapcar (lambda (page-info) (insert (hiki-index-page-info-string page-info site-info))) hiki-index-page-info-list) (set-buffer-modified-p nil) (hiki-index-sort-by) (setq buffer-read-only t) (goto-char (point-min)) (when pagename (dolist (elm hiki-index-page-info-list) (when (string= (nth 1 elm) pagename) (re-search-forward (format "^%4d" (nth 0 elm))) (beginning-of-line) (recenter)))) (switch-to-buffer old-buf) buf)) (defun hiki-index-get-buffer-create (site-info) "筝荀ц;腓榊<菴" (let ((buf-name (hiki-index-buffer-name site-info))) (or (get-buffer buf-name) (progn (save-excursion (get-buffer-create buf-name) (set-buffer buf-name) (hiki-index-mode) (setq hiki-site-info site-info) (get-buffer buf-name)))))) (defun hiki-index-page-info-string (page-info site-info) (let ((num (nth 0 page-info)) (name (nth 1 page-info)) (title (nth 2 page-info)) (extra (nth 3 page-info))) (format "%4d %s %s %s\n" num (if (hiki-page-buffer-name name site-info) "V" " ") (hiki-prefix (concat title (if (string= title name) "" (format " <%s>" name))) 35) extra))) (defun hiki-index-display-page (&optional refetch) "憜茵若吾茵腓冴 REFETCH nil сс<絖HTTP GET " (interactive) (let ((point (point)) (page-info (hiki-index-page-info-current-line)) pagename) (when page-info (setq pagename (nth 1 page-info)) (delete-other-windows) (split-window nil 10) (recenter t) (other-window 1) (hiki-display-page pagename hiki-site-info refetch) (setq buffer-read-only t) (other-window 1)) (hiki-index hiki-site-info nil pagename) (goto-char point))) (defun hiki-index-display-page-next (&optional refetch) "憜茵若吾茵腓冴с茵腓冴鴻若 REFETCH nil сс<絖HTTP GET " (interactive) (let ((page-info (hiki-index-page-info-current-line)) (old-win (selected-window)) pagename buf win) (when page-info (setq pagename (nth 1 page-info)) (setq buf (cdr (assoc (list (hiki-site-name hiki-site-info) pagename) hiki-page-buffer-alist))) (if (or (null buf) (null (setq win (get-buffer-window buf)))) (hiki-index-display-page refetch) (let ((other-window-scroll-buffer buf) (start (window-start win))) (scroll-other-window) ;;; 鴻若堺ャ罨∴腱祉 ;;; (when (= (window-start win) start) ;;; (forward-line) ;;; (hiki-index-display-page refetch)) ))))) (defun hiki-index-edit-page-current-line () "憜茵若吾膩" (interactive) (hiki-index-edit-page (nth 1 (hiki-index-page-info-current-line)))) (defun hiki-index-edit-page (&optional pagename) "若吾膩" (interactive) (let ((index-buf (current-buffer)) edit-buf start) (unless pagename (setq pagename (hiki-read-pagename (nth 1 (hiki-index-page-info-current-line)) (hiki-site-name)))) (when (and pagename (setq edit-buf (hiki-edit-page pagename hiki-site-info))) (switch-to-buffer index-buf) (delete-other-windows) (split-window nil 10) (setq start (window-start)) (recenter) (hiki-display-index hiki-site-info nil pagename) (set-window-start (selected-window) start) (other-window 1) (switch-to-buffer edit-buf)))) (defun hiki-index-page-info-current-line () "憜茵若御(list)菴" (let (num) (save-excursion (beginning-of-line) (re-search-forward "\\([0-9]+\\)" nil t nil) (setq num (match-string 1))) (cond (num (nth (1- (string-to-number num)) hiki-index-page-info-list)) (t nil)))) (defun hiki-index-page-info (pagename) "PAGENAME page-info 菴ャ nil" (let (result) (dolist (page-info hiki-index-page-info-list) (when (string= (nth 1 page-info) pagename) (setq result page-info))) result)) (defun hiki-index-refetch-index () "筝荀с茯粋昭帥茵" (interactive) (hiki-index hiki-site-info t (nth 1 (hiki-index-page-info-current-line)))) (defun hiki-index-sort (&optional rev) "筝荀с純若茵" (interactive "P") (message "Sorting...") (hiki-index-sort-by (hiki-read-char-with-retry "Sort by n)umber or d)ate? " nil '(?n ?d)) rev) (message "Sorting... done.")) (defun hiki-index-suspend () "hiki-index 筝筝" (interactive) (delete-other-windows) (dolist (elm hiki-page-buffer-alist) (bury-buffer (cdr elm))) (replace-buffer-in-windows (current-buffer))) (defun hiki-index-quit () "hiki-index 腟篋" (interactive) (let ((tmp hiki-page-buffer-alist)) (delete-other-windows) (dolist (elm hiki-page-buffer-alist) (when (string= (nth 0 (car elm)) (hiki-site-name)) (kill-buffer (cdr elm)) (setq tmp (remassoc (car elm) tmp)))) (setq hiki-page-buffer-alist tmp) (kill-buffer (current-buffer)))) (defun hiki-index-login () (interactive) (let (username password post-data buf) (sit-for 0.1) (setq username (read-from-minibuffer (format "Username for %s: " (car hiki-site-info)))) (setq password (read-passwd (format "Password for %s: " (car hiki-site-info)))) (add-to-list 'post-data (cons "c" "login")) (add-to-list 'post-data (cons "name" username)) (add-to-list 'post-data (cons "password" password)) (setq buf (hiki-http-request 'post nil nil (hiki-site-url) post-data)) (set-buffer buf) (goto-char (point-min)) (if (re-search-forward "HTTP/1.[01] \\([0-9][0-9][0-9]\\) \\(.*\\)" nil t) (let ((code (match-string 1)) (desc (match-string 2))) (cond ((equal code "302") (message "Logged in.")) (t (message "Username and/or Password is wrong!!."))))))) (defun hiki-index-logout () (interactive) (let (post-data buf) (add-to-list 'post-data (cons "c" "logout")) (setq buf (hiki-http-request 'post nil nil (hiki-site-url) post-data)) (message "Logged out."))) ;;; func (defun hiki-display-page (pagename site-info &optional refetch) "若吾茵腓冴 REFETCH nil сс<絖HTTP GET " (let ((not-cancelled t) result body keyword pagetitle password history point buf new-page) (setq buf (cdr (assoc (list (hiki-site-name site-info) pagename) hiki-page-buffer-alist))) (if (and buf (buffer-name buf) (not refetch)) (progn (switch-to-buffer buf) (goto-char (point-min))) (and buf (kill-buffer buf)) (message "Loading...") (setq result (hiki-fetch-source pagename (hiki-site-url site-info))) (setq body (cdr (assoc 'body result))) (setq pagetitle (cdr (assoc 'pagetitle result))) (setq password (cdr (assq 'password result))) (setq keyword (cdr (assoc 'keyword result))) (when (and body (or (> (length body) 0) (progn (setq not-cancelled (y-or-n-p (format "Page %s is not exist. Create new page?" pagename))) (if not-cancelled (setq new-page t) (setq result nil)) not-cancelled))) (setq buf (generate-new-buffer "*hiki tmp*")) (switch-to-buffer buf) (hiki-edit-rename-buffer (hiki-site-name site-info) pagename pagetitle password) (save-excursion (when keyword (insert (hiki-propertize "Keywords:" 'read-only t 'front-sticky t 'rear-nonsticky t 'hiki-special t)) (insert (hiki-propertize "\n" 'hiki-special t)) (insert (hiki-propertize (format "%s\n" keyword) 'hiki-special t)) (insert (hiki-propertize "----\n" 'read-only t 'front-sticky t 'rear-nonsticky t 'hiki-special t))) (setq point (point)) (insert body) (goto-char (point-min)) (hiki-replace-entity-refs) (hiki-edit-mode) (setq hiki-edit-new-page new-page) (set-buffer-modified-p nil) (add-to-list 'hiki-page-buffer-alist (cons (list (hiki-site-name site-info) pagename) (current-buffer))) (message "Loading... done.")) (goto-char point)) result))) (defun hiki-edit-page (pagename site-info) "PAGENAME 膩≪若ャ<菴" (let ((result (hiki-display-page pagename site-info t))) (when result (setq hiki-md5hex (cdr (assq 'md5hex result))) (setq hiki-session-id (cdr (assq 'session-id result))) (setq hiki-update-timestamp (cdr (assq 'update-timestamp result))) (setq hiki-pagename pagename) (setq hiki-pagetitle (or (cdr (assq 'pagetitle result)) pagename)) (setq hiki-site-info site-info) (or (setq history (assoc (hiki-site-name) hiki-pagename-history)) (setq hiki-pagename-history (cons (setq history (cons (hiki-site-name) nil)) hiki-pagename-history))) (or (member hiki-pagename (cdr history)) (setcdr history (cons (cons hiki-pagename nil) (cdr history)))) (set-buffer-modified-p nil) (current-buffer)))) (defun hiki-fetch-index (site-info) "若娯荀с緇" (let (indexes history (i 1) (buf (hiki-http-request 'get "index" nil (hiki-site-url site-info)))) (when (bufferp buf) (save-excursion (set-buffer buf) (re-search-forward "
    \n\\s-*" nil t nil) (while (and (equal (char-after) ?<) (re-search-forward "\\([^<]*\\): \\([^<]*\\)" nil t nil)) (let ((page-url (match-string 1)) (page-title (match-string 2)) (page-description (match-string 3))) (setq indexes (cons (list i (hiki-http-url-unhexify-string (if (string-match "\\?\\(.*\\)" page-url) (match-string 1 page-url) "FrontPage") hiki-coding-system) (hiki-replace-entity-refs page-title) (hiki-replace-entity-refs page-description)) indexes))) (setq i (1+ i)))) (or (setq history (assoc (hiki-site-name site-info) hiki-pagename-history)) (setq hiki-pagename-history (cons (setq history (cons (hiki-site-name site-info) nil)) hiki-pagename-history))) (setcdr history (mapcar (lambda (elm) (cons (nth 1 elm) nil)) indexes)) (reverse indexes)))) (defun hiki-fetch-source (pagename site-url) "Hiki 純若鴻緇 '((md5hex . \"...\") (session-id . \"...\") (body . \"...\") (pagetitle . (...)) (keyword . (...)) (update-timestamp . t/nil) (password . t/nil)) 菴" (let (buf start end pt result) (setq buf (hiki-http-request 'get "edit" pagename site-url)) (when (bufferp buf) (save-excursion (set-buffer buf) ;; md5hex (re-search-forward "]+name=\"md5hex\" value=\"\\([^>\"]*\\)\">" nil t nil) (setq result (cons (cons 'md5hex (match-string 1)) result)) ;; session id (re-search-forward "]+name=\"session_id\" value=\"\\([^>\"]*\\)\">" nil t nil) (setq result (cons (cons 'session-id (match-string 1)) result)) (setq pt (point)) ;; textarea (re-search-forward "" nil t nil) (setq end (match-beginning 0)) (setq result (cons (cons 'body (buffer-substring start end)) result)) ;; page_title (goto-char pt) (re-search-forward "]+name=\"page_title\" [^>]+value=\"\\([^>\"]*\\)\">" nil t nil) (setq result (cons (cons 'pagetitle (hiki-replace-entity-refs (match-string 1))) result)) ;; update timestamp? (if (re-search-forward "" nil t nil) (setq result (cons (cons 'update-timestamp t) result)) (setq result (cons (cons 'update-timestamp nil) result))) ;; keyword (when (re-search-forward "" nil t nil) (setq end (match-beginning 0)) (setq result (cons (cons 'keyword (hiki-replace-entity-refs (buffer-substring start end))) result))) ;; frozen? (if (re-search-forward "" nil t nil) (setq hiki-freeze t) (setq hiki-freeze nil)))) result)) (defun hiki-edit-save-page (&optional toggle) (interactive "P") (let (buf contents post-data pagetitle password freeze keywords result) (message "Sending... ") (sit-for 0.1) (setq pagetitle (read-from-minibuffer (format "Page title for [%s] %s: " (car hiki-site-info) hiki-pagename) (or hiki-pagetitle hiki-pagename) nil nil nil (or hiki-pagetitle hiki-pagename))) (goto-char (point-min)) (when (get-text-property (point) 'hiki-special) (re-search-forward "^Keywords:$" nil t nil) (let (start end) (setq start (+ (match-end 0) 1)) (re-search-forward "^----$" nil t nil) (setq end (match-beginning 0)) (setq keywords (buffer-substring-no-properties start end))) (goto-char (next-single-property-change (point) 'hiki-special))) (setq contents (buffer-substring-no-properties (point) (point-max))) (add-to-list 'post-data (cons "c" "save")) (add-to-list 'post-data (cons "p" hiki-pagename)) (add-to-list 'post-data (cons "page_title" pagetitle)) (add-to-list 'post-data (cons "keyword" (or keywords ""))) (add-to-list 'post-data (cons "md5hex" hiki-md5hex)) (add-to-list 'post-data (cons "session_id" hiki-session-id)) (if (not (null hiki-update-timestamp)) (add-to-list 'post-data (cons "update_timestamp" "on"))) (if (not (null hiki-freeze)) (add-to-list 'post-data (cons "freeze" "on"))) (add-to-list 'post-data (cons "contents" contents)) (add-to-list 'post-data (cons "save" "save")) (setq buf (hiki-http-request 'post nil hiki-pagename (hiki-site-url) post-data)) (when (bufferp buf) (save-excursion (set-buffer buf) (setq result (cond ((progn (goto-char (point-min)) (re-search-forward "
    " nil t nil)) 'conflict)
    	       ((progn (goto-char (point-min)) 
    		       (re-search-forward "

    HTML end hiki-1.0.0/misc/plugin/attach.rb000066400000000000000000000165151212533356300164710ustar00rootroot00000000000000# -*- coding: utf-8 -*- # $Id: attach.rb,v 1.7 2007-06-24 12:00:11 fdiary Exp $ # Copyright (C) 2003 TAKEUCHI Hitoshi # # thanks to Kazuhiko, Masao Mutoh, SHIMADA Mitsunobu, Yoshimi, begin require "cgi/util" rescue LoadError require 'cgi' # fallback for Ruby1.8 end @options['attach.form'] ||= 'edit' def attach_form(s = '') command = @command == 'create' ? 'edit' : @command attach_cgi = @options['attach.cgi_name'] || 'attach.cgi' <
    #{s}
    #{attach_usage}
    EOS end def attach_map attach_files = attach_all_files return '' if attach_files.size == 0 s = "
      \n" attach_files.sort do |a, b| unescape(a[0]) <=> unescape(b[0]) end.each do |attach_info| s << "
    • #{hiki_anchor(attach_info[0], page_name(unescape(attach_info[0])))}
    • \n" s << "
        \n" attach_info[1].each do |f| s << "
      • #{attach_anchor(f, unescape(attach_info[0]))}
      • \n" end s << "
      \n" end s << "
    \n" end def attach_anchor_string(string, file_name, page = @page) s = %Q!! s << %Q!#{if string then h(string) else h(file_name) end}! end def attach_anchor(file_name, page = @page) s = %Q!! s << %Q!#{h(file_name)}! end def get_image_size(file_name, page = @page) begin require 'image_size' f = "#{@cache_path}/attach/#{escape(page)}/#{escape(file_name)}" File.open(f.untaint,'rb') do |fh| return ImageSize.new(fh).get_size end rescue return nil end end def attach_image_anchor(file_name, page = @page) image_size = get_image_size(file_name, page) s = %Q!#{h(file_name)}! else s << %Q! src="#{@conf.cgi_name}#{cmdstr('plugin', "plugin=attach_download;p=#{escape(page)};file_name=#{escape(file_name)}")}">! end end def attach_flash_anchor(file_name, page = @page) image_size = get_image_size(file_name, page) s = %Q!! end def attach_download require 'image_size' params = @request.params page = (params['p'] || '') file_name = (params['file_name'] || '') attach_file = "#{@cache_path}/attach/#{escape(page)}/#{escape(file_name)}" extname = /\.([^.]+)$/.match(file_name.downcase).to_a[1] if File.exist?( attach_file.untaint ) mime_type = nil File.open(attach_file.untaint, 'rb') do |fh| mime_type = ImageSize.new(fh).mime_type end header = {} header['Content-Type'] = mime_type header['Content-Length'] = File.size(attach_file.untaint) header['Last-Modified'] = CGI.rfc1123_date(File.mtime(attach_file.untaint)) if %r|^image/| =~ mime_type header['Content-Disposition'] = %Q|inline; filename="#{file_name.to_sjis}"; modification-date="#{header['Last-Modified']}";| else header['Content-Disposition'] = %Q|attachment; filename="#{file_name.to_sjis}"; modification-date="#{header['Last-Modified']}";| end return ::Hiki::Response.new(File.open(attach_file.untaint, 'rb').read, 200, header) else data = get_common_data( @db, @plugin, @conf ) return generate_error_page( data ) end end def attach_src(file_name, page = @page) tabstop = ' ' * (@options['attach.tabstop'] ? @options['attach.tabstop'].to_i : 2) if file_name =~ /\.(txt|rd|rb|c|pl|py|sh|java|html|htm|css|xml|xsl|sql|yaml)\z/i file = "#{@conf.cache_path}/attach/#{escape(page.untaint)}/#{escape(file_name.untaint)}" s = %Q!
    !
        content = File.readlines(file)
        if @options['attach.show_linenum']
          line = 0
          content.collect! {|i| sprintf("%3d| %s", line+=1, i)}
        end
        s << h(content.join).gsub(/^\t+/) {|t| tabstop * t.size}.to_euc
        s << %Q!
    ! end end def attach_view(file_name, page = @page) if file_name =~ /\.(txt|rd|rb|c|pl|py|sh|java|html|htm|css|xml|xsl)\z/i attach_src(file_name, page) elsif file_name =~ /\.(jpeg|jpg|png|gif|bmp)\z/i attach_image_anchor(file_name, page) end end def attach_page_files result = [] attach_path = "#{@cache_path}/attach/#{escape(@page)}".untaint if FileTest.directory?(attach_path) Dir.entries(attach_path).collect do |file_name| result << file_name if FileTest.file?("#{attach_path}/#{file_name}".untaint) end end result end def attach_all_files attach_files = Hash.new([]) return [] unless File.exist?("#{@cache_path}/attach/") Dir.foreach("#{@cache_path}/attach/") do |dir| next if /^\./ =~ dir attach_files[File.basename(dir)] = Dir.glob("#{@cache_path}/attach/#{dir.untaint}/*").collect do |f| unescape(File.basename(f)) end end attach_files.to_a end def attach_show_page_files s = '' if (files = attach_page_files).size > 0 s << %Q!

    #{attach_files_label}: \n! files.each do |file_name| f = unescape(file_name) case @conf.charset when 'EUC-JP' f = unescape(file_name).to_euc when 'Shift_JIS' f = unescape(file_name).to_sjis end s << %Q! [#{attach_anchor(f)}] ! end s << "

    \n" end s end def attach_show_page_files_checkbox attach_cgi = @options['attach.cgi_name'] || 'attach.cgi' s = '' if (files = attach_page_files).size > 0 s << %Q!

    #{attach_files_label}: ! files.each do |file_name| f = unescape(file_name) case @conf.charset when 'EUC-JP' f = unescape(file_name).to_euc when 'Shift_JIS' f = unescape(file_name).to_sjis end s << %Q! [#{attach_anchor(f)}] \n! end s << %Q!\n

    \n
    \n! end s end add_body_leave_proc { begin s = case @options['attach.form'] when 'view', 'both' attach_form(attach_show_page_files) else '' end rescue Exception end } add_form_proc { begin s = case @options['attach.form'] when 'edit', 'both' attach_form(attach_show_page_files_checkbox) else '' end rescue Exception end } export_plugin_methods(:attach_form, :attach_map, :attach_anchor_string, :attach_anchor, :attach_image_anchor, :attach_flash_anchor, :attach_download, :attach_src, :attach_view) hiki-1.0.0/misc/plugin/attach/000077500000000000000000000000001212533356300161345ustar00rootroot00000000000000hiki-1.0.0/misc/plugin/attach/attach.cgi000077500000000000000000000056061212533356300200760ustar00rootroot00000000000000#!/usr/bin/env ruby # $Id: attach.cgi,v 1.20 2008-01-24 15:42:11 znz Exp $ # Copyright (C) 2003 TAKEUCHI Hitoshi BEGIN { $stdout.binmode } $SAFE = 1 if FileTest.symlink?( __FILE__ ) then org_path = File.dirname( File.expand_path( File.readlink( __FILE__ ) ) ) else org_path = File.dirname( File.expand_path( __FILE__ ) ) end $:.unshift( org_path.untaint, "#{org_path.untaint}/hiki" ) $:.delete(".") if File.writable?(".") require 'cgi' require 'hiki/config' require 'hiki/util' include Hiki::Util def attach_file @conf = Hiki::Config.new set_conf(@conf) cgi = CGI.new params = cgi.params page = params['p'] ? params['p'].read : 'FrontPage' command = params['command'] ? params['command'].read : 'view' command = 'view' unless ['view', 'edit'].index(command) r = '' max_size = @conf.options['attach_size'] || 1048576 if cgi.params['attach'] begin raise 'Invalid request.' unless params['p'] && params['attach_file'] filename = File.basename(params['attach_file'].original_filename.gsub(/\\/, '/')) cache_path = "#{@conf.cache_path}/attach" Dir.mkdir(cache_path) unless test(?e, cache_path.untaint) attach_path = "#{cache_path}/#{escape(page)}" Dir.mkdir(attach_path) unless test(?e, attach_path.untaint) path = "#{attach_path}/#{escape(filename.to_euc)}" if params['attach_file'].size > max_size raise "File size is larger than limit (#{max_size} bytes)." end unless filename.empty? content = params['attach_file'].read if (!@conf.options['attach.allow_script']) && (/ ex print cgi.header( 'type' => 'text/plain' ) puts ex.message end elsif cgi.params['detach'] then attach_path = "#{@conf.cache_path}/attach/#{escape(page)}" begin Dir.foreach(attach_path) do |file| next unless params["file_#{file}"] path = "#{attach_path}/#{file}" if FileTest.file?(path.untaint) and params["file_#{file}"].read File.unlink(path) r << "FILE = #{File.basename(path)}\n" end end Dir.rmdir(attach_path) if Dir.entries(attach_path).size == 2 send_updating_mail(page, 'detach', r) if @conf.mail_on_update redirect(cgi, "#{@conf.index_url}?c=#{command}&p=#{escape(page)}") rescue Exception => ex print cgi.header( 'type' => 'text/plain' ) puts ex.message end end end attach_file hiki-1.0.0/misc/plugin/auth_typekey.rb000066400000000000000000000035661212533356300177420ustar00rootroot00000000000000# $Id: auth_typekey.rb,v 1.6 2005-06-07 09:10:55 fdiary Exp $ # Copyright (C) 2005 TAKEUCHI Hitoshi # # require 'hiki/auth/typekey' require 'hiki/session' @conf['typekey.token'] ||= '' def auth? return true if @conf['typekey.token'].empty? session_id = @request.cookies['typekey_session_id'] session_id && Session.new(@conf, session_id).check end def auth_typekey tk = TypeKey.new(@conf['typekey.token'], '1.1') ts = @request.params['ts'] email = @request.params['email'] name = @request.params['name'] nick = @request.params['nick'] sig = @request.params['sig'] page = @request.params['p'] || 'FrontPage' if ts and email and name and nick and sig and tk.verify(email, name, nick, ts, sig) session = Session.new(@conf) session.user = utf8_to_euc(nick) session.save self.cookies << typekey_cookie('typekey_session_id', session.session_id) end redirect(@cgi, "#{@conf.cgi_name}?#{page}", self.cookies) end def login_url tk = TypeKey.new(@conf['typekey.token']) return_url = "#{@conf.index_url}?c=plugin;plugin=auth_typekey;p=#{@page}" tk.getLoginUrl(return_url) end def typekey_cookie(name, value, max_age = Session::MAX_AGE) Hiki::Cookie.new( { 'name' => name, 'value' => value, 'path' => self.cookie_path, }) end add_body_enter_proc(Proc.new do if !auth? label_auth_typekey_login elsif @user < #{sprintf(label_auth_typekey_hello, h(@user))} EOS end end) def saveconf_auth_typekey if @mode == 'saveconf' then @conf['typekey.token'] = @request.params['typekey.token'] end end add_conf_proc('auth_typekey', label_auth_typekey_config) do saveconf_auth_typekey str = <<-HTML

    #{label_auth_typekey_token}

    #{label_auth_typekey_token_msg}

    HTML str end hiki-1.0.0/misc/plugin/bbs.rb000066400000000000000000000040261212533356300157650ustar00rootroot00000000000000# $Id: bbs.rb,v 1.14 2006-10-05 06:46:43 fdiary Exp $ # Copyright (C) 2002-2003 TAKEUCHI Hitoshi add_body_enter_proc(Proc.new do @bbs_num = 0 "" end) def bbs(level = 1) return '' if @conf.use_session && !@session_id @bbs_num += 1 name = @user || '' level = (Integer(level) rescue 1) <
    #{bbs_name_label}: #{bbs_subject_label}:

    EOS end def bbs_post return '' if @conf.use_session && @session_id != @request.params['session_id'] params = @request.params bbs_num = (params['bbs_num'] || 0).to_i bbs_level = (params['bbs_level'] || 1).to_i name = params['name'].size == 0 ? bbs_anonymous_label : params['name'] subject = (params['subject'].size == 0 ? bbs_notitle_label : params['subject']) msg = params['msg'] return '' if msg.strip.size == 0 lines = @db.load( @page ) md5hex = @db.md5hex( @page ) flag = false count = 1 content = '' lines.each do |l| if /^\{\{bbs\b(:?[^\}]*)?\}\}/ =~ l && flag == false if count == bbs_num content << "#{l}\n" content << @conf.parser.heading( "#{subject} - #{name} (#{format_date(Time.now)})\n", bbs_level ) content << "#{msg}\n" content << "{{comment}}\n" flag = true else count += 1 content << l end else content << l end end save( @page, content, md5hex ) if flag end hiki-1.0.0/misc/plugin/category.rb000066400000000000000000000016611212533356300170360ustar00rootroot00000000000000# $Id: category.rb,v 1.6 2005-09-30 11:45:49 fdiary Exp $ # Copyright (C) 2002-2003 TAKEUCHI Hitoshi def category_list(*category) category_re = /^\(([^\)]+?)\)/ category.collect! {|a| unescape_html(a) } l = {} @db.page_info.each do |a| if category_re =~ a.keys[0] && (category.size == 0 || category.index($1)) l[$1] = [] unless l[$1] l[$1] << a end end # sort by category list = l.to_a.sort {|a,b| a[0] <=> b[0]} s = '' list.each do |j| category = j[0] p = j[1] s << "

    #{view_title(category)}

    \n" s << "
      \n" # sort by page name p.collect! { |i| i.to_a.flatten! }.sort! do |p1, p2| p2[1][:last_modified] <=> p1[1][:last_modified] end p.each do |a| name = a[0] tm = a[1][:last_modified] s << "
    • #{format_date( tm )}: #{hiki_anchor(escape(name), page_name(name))}
    • \n" end s << "
    \n" end s end hiki-1.0.0/misc/plugin/cd.rb000066400000000000000000000027601212533356300156100ustar00rootroot00000000000000# -*- coding: utf-8 -*- # $Id: cd.rb,v 1.3 2004-03-01 09:50:45 hitoshi Exp $ # Copyright (C) 2003 not def cd(code) amazon_id = @options['amazon.aid'].to_s amazon_id = '&tag=' + amazon_id unless amazon_id.empty? keyword = code.to_s keyword.sub!(/([^\d])(\d+.*)$/, "\\1-\\2") unless keyword.index('-') keyword_prefix, keyword_num = keyword.split('-') keyword2 = keyword.delete('-').sub(/([^\d])0+(\d+.*)$/, "\\1\\2") keyword3 = keyword2.sub(/[A-Za-z]$/, '') t = ' ' t << make_anchor( 'http://www.amazon.co.jp/exec/obidos/search-handle-url/index=blended%26field-keywords=' + keyword + amazon_id + '/', 'amazon' ) + ' / ' t << make_anchor( 'http://www.hmv.co.jp/search/title.asp?category=CATALOGUENO&keyword=' + keyword3, 'hmv' ) + ' / ' t << make_anchor( 'http://www.towerrecords.co.jp/sitemap/CSfSearchResults.jsp?keyword=AllCatalog&SEARCH_GENRE=ALL&entry=' + keyword, 'TOWER' ) + ' / ' t << make_anchor( 'http://www.netdirect.co.jp/search/ISSSchDetail.asp?ISBN=' + keyword2, '絮' ) + ' / ' t << make_anchor( 'http://www.neowing.co.jp/detailview.html?KEY=' + keyword, 'NeoWing' ) + ' / ' t << make_anchor( 'http://www.ebisurecords.jp/shop/goods/search.asp?shop=&goods=' + keyword, 'EBISU' ) + ' / ' t << make_anchor( 'http://search.www.tsutaya.co.jp/search_q/all/index.pl?RBT_SELECT=1&TXT_SEARCH=&TXT_SEARCH1=' + keyword_prefix + '&TXT_SEARCH2=' + keyword_num + '&BTN_SEARCH_2=%8C%9F%8D%F5%82%B7%82%E9', 'TSUTAYA' ) + ' ' end hiki-1.0.0/misc/plugin/comment.rb000066400000000000000000000040201212533356300166530ustar00rootroot00000000000000# $Id: comment.rb,v 1.14 2006-10-05 06:46:43 fdiary Exp $ # Copyright (C) 2002-2003 TAKEUCHI Hitoshi # modified by yoshimi. add_body_enter_proc(Proc.new do @comment_num = 0 "" end) def comment(cols = 60, style = 0) return '' if @conf.use_session && !@session_id cols = 60 unless cols.respond_to?(:integer?) style = 0 unless style.respond_to?(:integer?) style = 0 if style != 1 @comment_num += 1 name = @user || '' <
    #{comment_name_label}: #{comment_comment_label}:
    EOS end def comment_post return '' if @conf.use_session && @session_id != @request.params['session_id'] params = @request.params comment_no = (params['comment_no'] || 0).to_i name = params['name'].size == 0 ? comment_anonymous_label : params['name'] msg = params['msg'] style = params['style'].to_i return '' if msg.strip.size == 0 lines = @db.load( @page ) md5hex = @db.md5hex( @page ) flag = false count = 1 content = '' lines.each do |l| if /^\{\{r?comment.*\}\}/ =~ l && flag == false if count == comment_no content << l if style == 1 content << "*#{format_date(Time.now)} #{name} : #{msg}\n" content << l if style == 0 flag = true else count += 1 content << l end else content << l end end save( @page, content, md5hex ) if flag end def rcomment(cols = 60) comment(cols, 1) end hiki-1.0.0/misc/plugin/de/000077500000000000000000000000001212533356300152605ustar00rootroot00000000000000hiki-1.0.0/misc/plugin/de/append-css.rb000066400000000000000000000002771212533356300176500ustar00rootroot00000000000000def append_css_label 'CSS Anhängen' end def append_css_desc <<-HTML

    CSS Elemente

    Wenn Sie CSS Element anhängen wollen, geben Sie diese unten an.

    HTML end hiki-1.0.0/misc/plugin/de/attach.rb000066400000000000000000000011671212533356300170560ustar00rootroot00000000000000# $Id: attach.rb,v 1.1 2005-08-02 13:37:41 yanagita Exp $ # Copyright (C) 2003 TAKEUCHI Hitoshi def attach_files_label 'Angehängte Dateien' end def attach_upload_label 'Datei hochladen' end def detach_upload_label 'Dateien löschen' end def plugin_usage_label attach_usage end def attach_usage '
    • Link zu einer angehängten Datei: {{attach_anchor(dateiname [, seitenname])}}.
    • Ausgabe einer angehängten Datei: {{attach_view(dateiname [, seitenname])}}.
    • Liste aller angehängten Dateien: {{attach_map}}.
    ' end hiki-1.0.0/misc/plugin/de/bbs.rb000066400000000000000000000004721212533356300163560ustar00rootroot00000000000000# $Id: bbs.rb,v 1.1 2005-08-02 13:37:41 yanagita Exp $ # Copyright (C) 2002-2003 TAKEUCHI Hitoshi def bbs_name_label 'Name' end def bbs_subject_label 'Titel' end def bbs_post_label 'Nachricht' end def bbs_anonymous_label 'Anonymous' end def bbs_notitle_label 'kein Titel' end hiki-1.0.0/misc/plugin/de/comment.rb000066400000000000000000000004501212533356300172460ustar00rootroot00000000000000# $Id: comment.rb,v 1.1 2005-08-02 13:37:41 yanagita Exp $ # Copyright (C) 2002-2003 TAKEUCHI Hitoshi def comment_name_label 'Name' end def comment_comment_label 'Kommentar' end def comment_post_label 'Nachricht' end def comment_anonymous_label 'Anonymous' end hiki-1.0.0/misc/plugin/de/edit_user.rb000066400000000000000000000014461212533356300175750ustar00rootroot00000000000000# $Id: edit_user.rb,v 1.1 2005-08-02 13:37:41 yanagita Exp $ # Copyright (C) 2005 Kazuhiko def label_edit_user_config; 'Benutzerverwaltung'; end def label_edit_user_title; 'Benutzer löschen / Passwörter ändern'; end def label_edit_user_add_title; 'Benutzer hinzufügen'; end def label_edit_user_description 'Jede Zeile bedeutet genau einen Benutzer, jede Zeile in der Form von "name password".' end def label_edit_user_auth_title; 'Seitenbearbeitung'; end def label_edit_user_auth_description 'Dürfen nur registrierte Benutzer Seiten editieren?' end def label_edit_user_auth_candidate [ 'Ja', 'Nein' ] end def label_edit_user_delete; 'Löschen'; end def label_edit_user_name; 'Name'; end def label_edit_user_new_password; 'Neues Passwort'; end hiki-1.0.0/misc/plugin/de/frozenmark.rb000066400000000000000000000000751212533356300177650ustar00rootroot00000000000000def frozenmark_message 'Diese Seite ist eingefrohren.' end hiki-1.0.0/misc/plugin/de/history.rb000066400000000000000000000016541212533356300173140ustar00rootroot00000000000000def history_label 'Verlauf' end module Hiki class History < Command private def history_label 'Verlauf' end def history_th_label ['Rev', 'Datum', 'Änderungen', 'Operation', 'Log'] end def history_not_supported_label 'Verlauf ist in der derzeitigen Konfiguration nicht möglich.' end def history_revert_label 'Zu dieser Version zurückkehren' end def history_diffto_current_label 'Unterschied zur aktuallen Version' end def history_view_this_version_src_label 'Inhalt dieser Version einsehen.' end def history_backto_summary_label 'Zurück zur Verlaufs-Seite' end def history_add_line_label 'Hinzgefügte Teile werden wie hier angezeigt.' end def history_delete_line_label 'Entfernte Teile werden wie hier angezeigt.' end end end hiki-1.0.0/misc/plugin/de/math.rb000066400000000000000000000013231212533356300165350ustar00rootroot00000000000000def label_math_latex_ptsize; 'Schriftgröße (pt)'; end def label_math_latex_documentclass; 'Dokument Klasse'; end def label_math_latex_preamble; 'Preamble'; end def label_math_latex_log; 'Protokoll'; end def label_math_latex_log_description; 'Wenn angewählt, wird das Fehlerprotokoll (standard error output) nach der ausführung nicht gelöscht.'; end def label_math_latex_cache_clear; 'Zwischenspeicher Löschen'; end def label_math_latex_cache_clear_description; 'Wenn angewählt, werden die zwischengespeicherten Bilder gelöscht.'; end def label_math_latex_latex; 'latex Befehl'; end def label_math_latex_dvips; 'dvips Befehl'; end def label_math_latex_convert; 'convert Befehl'; end hiki-1.0.0/misc/plugin/de/note.rb000066400000000000000000000004771212533356300165620ustar00rootroot00000000000000def note_prefix; 'Note-'; end def label_note_config; 'Notiz'; end def label_note_link; 'Notiz'; end def label_note_orig; 'Original'; end def label_note_template; 'Dokumentenvorlage einer neuen Notiz.'; end def label_note_template_default str = <<-END Dies ist eine Notiz zu {{note_orig_page}}. ---- {{bbs}} END end hiki-1.0.0/misc/plugin/de/referer.rb000066400000000000000000000003431212533356300172370ustar00rootroot00000000000000# $Id: referer.rb,v 1.1 2005-08-02 13:37:41 yanagita Exp $ # Copyright (C) 2003 TAKEUCHI Hitoshi def referer_short_label 'Referer' end def referer_long_label 'Referer (zuvor besuchte Webseite)' end hiki-1.0.0/misc/plugin/de/rss.rb000066400000000000000000000010731212533356300164150ustar00rootroot00000000000000# $Id: rss.rb,v 1.2 2005-09-06 06:08:29 fdiary Exp $ # Copyright (C) 2003-2004 TAKEUCHI Hitoshi # Copyright (C) 2005 Kazuhiko def label_rss_recent 'Letzte Änderungen' end def label_rss_config; 'RSS Publikation'; end def label_rss_mode_title; 'Formatauswahl.'; end def label_rss_mode_candidate [ 'unified diff', 'word diff (Auszug)', 'word diff (voller Text)', 'HTML (voller Text)', ] end def label_rss_menu_title; 'RSS Menü hinzufügen'; end def label_rss_menu_candidate [ 'Ja', 'Nein' ] end hiki-1.0.0/misc/plugin/de/search.rb000066400000000000000000000000451212533356300170510ustar00rootroot00000000000000def search_post_label 'Suchen' end hiki-1.0.0/misc/plugin/de/src.rb000066400000000000000000000002221212533356300163700ustar00rootroot00000000000000# $Id: src.rb,v 1.1 2005-08-02 13:37:41 yanagita Exp $ # Copyright (C) 2003 TAKEUCHI Hitoshi def src_label 'Source' end hiki-1.0.0/misc/plugin/de/template.rb000066400000000000000000000013121212533356300174150ustar00rootroot00000000000000# $Id: template.rb,v 1.1 2005-08-02 13:37:41 yanagita Exp $ # Copyright (C) 2003 TAKEUCHI Hitoshi def template_label 'Dokumentenvorlage' end def template_select_label 'Import' end def label_template_default 'Standardvorlage' end def label_template_default_desc 'Wählen Sie eine Seite als Standard Dokumentenvorlage.' end def label_template_keyword 'Stichwort für Dokumentenvorlagen.' end def label_template_keyword_desc 'Nur Seiten mit diesem Stichwort werden als Vorlageseiten angezeigt.' end def label_template_autoinsert 'Automatische Vorlage' end def label_template_autoinsert_desc 'Automatisch bei dem Erstellen einer Seite eine Vorlage benutzen.' end hiki-1.0.0/misc/plugin/diffmail.rb000066400000000000000000000031711212533356300167720ustar00rootroot00000000000000# $Id: diffmail.rb,v 1.11 2005-07-17 14:29:06 fdiary Exp $ # Copyright (C) 2004-2005 Kazuhiko #----- send a mail on updating def updating_mail begin latest_text = @db.load(@page) || '' if @request.params['page_title'] title = @request.params['page_title'].empty? ? @page : @request.params['page_title'].strip else title = nil end if @request.params['keyword'] keyword = (@request.params['keyword'] || '').split("\n").collect {|k| k.chomp.strip}.delete_if{|k| k.empty?}.join(' / ') else keyword = nil end head = '' type = (!@db.text or @db.text.empty?) ? 'create' : 'update' if type == 'create' then head << "TITLE = #{title}\n" if title head << "KEYWORD = #{keyword}\n" if keyword r = "#{latest_text}\n" elsif type == 'update' title_old = unescape_html(page_name(@page)) keyword_old = @db.get_attribute(@page, :keyword).join(' / ') if title && title != title_old head << "TITLE = #{title_old} -> #{title}\n" end if keyword && keyword != keyword_old head << "KEYWORD = #{keyword_old} -> #{keyword}\n" end head << "-------------------------\n" unless head.empty? src = @db.text dst = latest_text diff_style = @options['diffmail.style'] || 0 case diff_style.to_i when 0 unified = @options['diffmail.lines'] || 3 r = unified_diff( src, dst, unified ) when 1 r = word_diff_text( src, dst, true ) end end send_updating_mail(@page, type, head + r) unless (head + r).empty? rescue end end hiki-1.0.0/misc/plugin/edit_user.rb000066400000000000000000000042751212533356300172100ustar00rootroot00000000000000# $Id: edit_user.rb,v 1.5 2005-06-11 16:31:04 fdiary Exp $ # Copyright (C) 2005 Kazuhiko def saveconf_edit_user if @mode == 'saveconf' then @conf['user.auth'] = @request.params['user.auth'].to_i user_list = {} (@conf['user.list'] ||= []).sort.each do |name, pass| unless @request.params["#{escape(name)}_remove"] password = @request.params["#{escape(name)}_pass"] unless password.empty? user_list[name] = crypt_password(password) else user_list[name] = pass end end end @conf['user.list'] = user_list @request.params['user.list'].each do |line| if /^([^\s]+)\s+([^\s]+)/ =~ line name = $1 pass = $2 unless @conf['user.list'].has_key?(name) && /^[\w\d\-]+$/ =~ name @conf['user.list'][name] = crypt_password(pass) end end end end @conf['user.auth'] ||= 1 end add_conf_proc('user', label_edit_user_config) do saveconf_edit_user str = <<-HTML

    #{label_edit_user_title}

    #{(@conf['user.list'] || {}).sort.collect { |i, j| "" }.join("\n")}
    #{label_edit_user_delete}#{label_edit_user_name}#{label_edit_user_new_password}
    #{i}

    #{label_edit_user_add_title}

    #{label_edit_user_description}

    #{label_edit_user_auth_title}

    #{label_edit_user_auth_description}

    \n" str end def auth? return false if @conf['user.auth'] == 0 && !@user return true end def crypt_password(passwd) salt = [rand(64),rand(64)].pack("C*").tr("\x00-\x3f","A-Za-z0-9./") passwd.crypt(salt) end export_plugin_methods(:auth?) hiki-1.0.0/misc/plugin/en/000077500000000000000000000000001212533356300152725ustar00rootroot00000000000000hiki-1.0.0/misc/plugin/en/amazon.rb000066400000000000000000000047431212533356300171140ustar00rootroot00000000000000# # English resource of amazon plugin # # Copyright (C) 2002 HAL99 # You can redistribute it and/or modify it under GPL2. # # # isbn_image_left: show the item image of specified ISBN by class="left". # Parameter: # asin: ASIN or ISBN # comment: comment (optional) # # isbn_image_right: # Parameter: # asin: ASIN or ISBN # comment: comment (optional) # # isbn_image: show the item image of specified ISBN by class="right". # asin: ASIN or ISBN # comment: comment (optional) # # isbn_detail: show the item detail with image # asin: ASIN or ISBN # # isbn: light version. it dose not access to amazon. # asin: ASIN or ISBN # comment: comment # # options in tdiary.conf: # @options['amazon.aid']: Your Amazon Assosiate ID. This option can be # changed in preferences page. # @options['amazon.hideconf']: When you want to prohibit changing amazon.aid # via preferences page, set false. # @options['amazon.imgsize']: specify image size (0:laege, 1:regular, 2:small) # @options['amazon.hidename']: hide book name when class="amazon", set true. # @options['amazon.default_image_base']: URL that include default images. # amazon.rb uses images on tDiary.org when this # option not specified. If you want to use your # original images, modify PNG file in amazon directory. # @options['amazon.nodefault']: If you dosen't want to show default image # when the book image not found, set true. @amazon_default_country = 'us' @amazon_item_name = /^Amazon\.com: (.*)$/ @amazon_item_image = %r|()|i @amazon_label_conf = 'Amazon' @amazon_label_aid = 'Amazon Assosiate ID' @amazon_label_aid_desc = "If you don't specified it, this plugin call amazon with ID of tDiary developer." @amazon_label_imgsize = 'Image size of the book' @amazon_label_large = 'Large' @amazon_label_regular = 'Regular' @amazon_label_small = 'Small' @amazon_label_title = 'When using isbn_image plugin' @amazon_label_hide = 'Hide book title' @amazon_label_show = 'Show book title' @amazon_label_notfound = 'If book image dose not found' @amazon_label_usetitle = 'Show book title' @amazon_label_usedefault = 'Use default image' @amazon_label_clearcache = 'Clear Cache' @amazon_label_clearcache_desc = 'Delete local cache file about book images' hiki-1.0.0/misc/plugin/en/append-css.rb000066400000000000000000000003241212533356300176530ustar00rootroot00000000000000def append_css_label 'Append CSS' end def append_css_desc <<-HTML

    CSS elements

    If you want to append some elements of style sheet, specify below.

    HTML end hiki-1.0.0/misc/plugin/en/attach.rb000066400000000000000000000010531212533356300170620ustar00rootroot00000000000000# $Id: attach.rb,v 1.4 2005-06-17 05:03:43 fdiary Exp $ # Copyright (C) 2003 TAKEUCHI Hitoshi def attach_files_label 'Attached Files' end def attach_upload_label 'File Upload' end def detach_upload_label 'Remove files' end def attach_usage '
    • Anchor to the attached file is {{attach_anchor(file name [, page name])}}.
    • Indication of the attached file is {{attach_view(file name [, page name])}}.
    • List of the attached pages and files is {{attach_map}}.
    ' end hiki-1.0.0/misc/plugin/en/bbs.rb000066400000000000000000000004631212533356300163700ustar00rootroot00000000000000# $Id: bbs.rb,v 1.3 2005-03-03 15:53:55 fdiary Exp $ # Copyright (C) 2002-2003 TAKEUCHI Hitoshi def bbs_name_label 'Name' end def bbs_subject_label 'Subject' end def bbs_post_label 'Post' end def bbs_anonymous_label 'Anonymous' end def bbs_notitle_label 'No Title' end hiki-1.0.0/misc/plugin/en/comment.rb000066400000000000000000000004401212533356300172570ustar00rootroot00000000000000# $Id: comment.rb,v 1.2 2004-02-15 02:48:35 hitoshi Exp $ # Copyright (C) 2002-2003 TAKEUCHI Hitoshi def comment_name_label 'Name' end def comment_comment_label 'Comment' end def comment_post_label 'Post' end def comment_anonymous_label 'Anonymous' end hiki-1.0.0/misc/plugin/en/edit_user.rb000066400000000000000000000013211212533356300175770ustar00rootroot00000000000000# $Id: edit_user.rb,v 1.3 2005-06-14 13:49:07 fdiary Exp $ # Copyright (C) 2005 Kazuhiko def label_edit_user_config; 'Edit users'; end def label_edit_user_title; 'Delete users / Change passwords'; end def label_edit_user_add_title; 'Add users'; end def label_edit_user_description 'Each line has one user, which is in the form of "name password".' end def label_edit_user_auth_title; 'Restrict editing'; end def label_edit_user_auth_description 'Do you permit only registrated users to edit?' end def label_edit_user_auth_candidate [ 'Yes', 'No' ] end def label_edit_user_delete; 'Delete'; end def label_edit_user_name; 'Name'; end def label_edit_user_new_password; 'New password'; end hiki-1.0.0/misc/plugin/en/frozenmark.rb000066400000000000000000000000641212533356300177750ustar00rootroot00000000000000def frozenmark_message 'This page is frozen.' end hiki-1.0.0/misc/plugin/en/history.rb000066400000000000000000000015201212533356300173160ustar00rootroot00000000000000def history_label 'History' end module Hiki class History < Command private def history_label 'History' end def history_th_label ['Rev', 'Time', 'Changes', 'Operation', 'Log'] end def history_not_supported_label 'History is not available in current configuration.' end def history_revert_label 'Revert to this version' end def history_diffto_current_label 'Diff to current' end def history_view_this_version_src_label 'See the source of this version' end def history_backto_summary_label 'Back to History page' end def history_add_line_label 'Added words are showed as here.' end def history_delete_line_label 'Removed words are showed as here.' end end end hiki-1.0.0/misc/plugin/en/math.rb000066400000000000000000000012111212533356300165430ustar00rootroot00000000000000def label_math_latex_ptsize; 'Font Size (pt)'; end def label_math_latex_documentclass; 'Document Class'; end def label_math_latex_preamble; 'Preamble'; end def label_math_latex_log; 'Log'; end def label_math_latex_log_description; 'When checked, the log to standard error output during execution won\'t be deleted afterwards'; end def label_math_latex_cache_clear; 'Clear Cache'; end def label_math_latex_cache_clear_description; 'When checked, the images stored in the cache will be removed'; end def label_math_latex_latex; 'latex Command'; end def label_math_latex_dvips; 'dvips Command'; end def label_math_latex_convert; 'convert Command'; end hiki-1.0.0/misc/plugin/en/note.rb000066400000000000000000000004711212533356300165660ustar00rootroot00000000000000def note_prefix; 'Note-'; end def label_note_config; 'Note'; end def label_note_link; 'Note'; end def label_note_orig; 'Original'; end def label_note_template; 'The template of a new note page'; end def label_note_template_default str = <<-END This is a note page for {{note_orig_page}}. ---- {{bbs}} END end hiki-1.0.0/misc/plugin/en/referer.rb000066400000000000000000000003071212533356300172510ustar00rootroot00000000000000# $Id: referer.rb,v 1.3 2005-03-03 15:53:55 fdiary Exp $ # Copyright (C) 2003 TAKEUCHI Hitoshi def referer_short_label 'Referer' end def referer_long_label 'Referer' end hiki-1.0.0/misc/plugin/en/rss.rb000066400000000000000000000010411212533356300164220ustar00rootroot00000000000000# $Id: rss.rb,v 1.5 2005-09-06 06:08:29 fdiary Exp $ # Copyright (C) 2003-2004 TAKEUCHI Hitoshi # Copyright (C) 2005 Kazuhiko def label_rss_recent 'Recent Changes' end def label_rss_config; 'RSS publication'; end def label_rss_mode_title; 'Select the format.'; end def label_rss_mode_candidate [ 'unified diff', 'word diff (digest)', 'word diff (full text)', 'HTML (full text)', ] end def label_rss_menu_title; 'add RSS menu'; end def label_rss_menu_candidate [ 'Yes', 'No' ] end hiki-1.0.0/misc/plugin/en/search.rb000066400000000000000000000000451212533356300170630ustar00rootroot00000000000000def search_post_label 'Search' end hiki-1.0.0/misc/plugin/en/src.rb000066400000000000000000000002211212533356300164010ustar00rootroot00000000000000# $Id: src.rb,v 1.2 2004-02-15 02:48:35 hitoshi Exp $ # Copyright (C) 2003 TAKEUCHI Hitoshi def src_label 'Source' end hiki-1.0.0/misc/plugin/en/template.rb000066400000000000000000000011621212533356300174320ustar00rootroot00000000000000# $Id: template.rb,v 1.3 2005-06-27 05:21:42 fdiary Exp $ # Copyright (C) 2003 TAKEUCHI Hitoshi def template_label 'Template' end def template_select_label 'Import' end def label_template_default 'Default template' end def label_template_default_desc 'Select the default template page.' end def label_template_keyword 'A keyword of templates' end def label_template_keyword_desc 'Only pages that has the specified keyword will be candidates.' end def label_template_autoinsert 'Auto insert' end def label_template_autoinsert_desc 'Insert the template in creating new pages.' end hiki-1.0.0/misc/plugin/entityref.rb000066400000000000000000000003521212533356300172260ustar00rootroot00000000000000# $Id: entityref.rb,v 1.3 2004-03-01 09:50:45 hitoshi Exp $ # Copyright (C) 2003 yoshimi def e( str ) if str.respond_to?(:integer?) || str =~ /^(\d+)/ %Q[&\##{str};] else %Q[&#{str};] end end hiki-1.0.0/misc/plugin/footnote.rb000066400000000000000000000052611212533356300170560ustar00rootroot00000000000000# -*- coding: utf-8 -*- # footnote.rb $Revision: 1.10 $ # # fn: 羈plugin # <: # text: 羈 # mark: 羈若('*') # # Copyright (c) 2001,2002 Junichiro KITA # Distributed under the GPL # =begin ChangeLog 2005-09-05 Kouhei Yanagita * support a block element argument (patch by U.Nakamura). 2002-05-06 MUTOH Masao * change file encoding from ISO-2022-JP to EUC-JP. 2002-03-12 TADA Tadashi * runable in secure mode. =end # initialize instance variable as taint @footnote_name = "" @footnote_name.taint @footnote_url = "" @footnote_url.taint @footnote_mark_name = "" @footnote_mark_name.taint @footnote_mark_url = "" @footnote_mark_url.taint @footnotes = [] @footnotes.taint @footnote_index = [0] @footnote_index.taint def fn(text, mark = '*') if @footnote_name @footnote_index[0] += 1 @footnotes << [@footnote_index[0], text, mark] %Q|#{mark}#{@footnote_index[0]}| else "" end end def render( text ) tmp = @conf.use_plugin @conf.use_plugin = false parser = @conf.parser.new( @conf ) tokens = parser.parse(unescape_html(text) ) formatter = @conf.formatter.new( tokens, @db, self, @conf ) @conf.use_plugin = tmp formatter.to_s.gsub(/\A

    /,'').gsub(/<\/p>\Z/,'').gsub(/

    /, '

    ') end if @options['command'] == 'view' add_body_enter_proc(Proc.new do |date| date = date.strftime("%Y%m%d") @footnote_name.replace "f%02d" @footnote_url.replace "#{@index}#{anchor date}##{@footnote_name}" @footnote_mark_name.replace "fm%02d" @footnote_mark_url.replace "#{@index}#{anchor date}##{@footnote_mark_name}" @footnotes.clear @footnote_index[0] = 0 "" end) add_body_leave_proc(Proc.new do |date| if @footnote_name and @footnotes.size > 0 %Q|

    \n| + @footnotes.collect do |fn| %Q|

    #{fn[2]}#{fn[0]} #{render(fn[1])}

    | end.join("\n") + %Q|\n
    \n| else "" end end) end export_plugin_methods(:fn) hiki-1.0.0/misc/plugin/fr/000077500000000000000000000000001212533356300152775ustar00rootroot00000000000000hiki-1.0.0/misc/plugin/fr/attach.rb000066400000000000000000000004231212533356300170670ustar00rootroot00000000000000# $Id: attach.rb,v 1.3 2005-03-03 15:53:56 fdiary Exp $ # Copyright (C) 2003 Laurent Sansonetti def attach_files_label 'Fichiers joints' end def attach_upload_label 'Attacher le fichier' end def detach_upload_label 'Retirer les fichiers' end hiki-1.0.0/misc/plugin/fr/bbs.rb000066400000000000000000000004631212533356300163750ustar00rootroot00000000000000# $Id: bbs.rb,v 1.3 2005-03-03 15:53:56 fdiary Exp $ # Copyright (C) 2003 Laurent Sansonetti def bbs_name_label 'Nom' end def bbs_subject_label 'Sujet' end def bbs_post_label 'Envoyer' end def bbs_anonymous_label 'Anonyme' end def bbs_notitle_label 'Pas de titre' end hiki-1.0.0/misc/plugin/fr/comment.rb000066400000000000000000000004421212533356300172660ustar00rootroot00000000000000# $Id: comment.rb,v 1.2 2004-02-15 02:48:35 hitoshi Exp $ # Copyright (C) 2003 Laurent Sansonetti def comment_name_label 'Nom' end def comment_comment_label 'Commentaire' end def comment_post_label 'Envoyer' end def comment_anonymous_label 'Anonyme' end hiki-1.0.0/misc/plugin/fr/frozenmark.rb000066400000000000000000000000651212533356300200030ustar00rootroot00000000000000def frozenmark_message 'On a gel cette page.' end hiki-1.0.0/misc/plugin/fr/referer.rb000066400000000000000000000003421212533356300172550ustar00rootroot00000000000000# $Id: referer.rb,v 1.3 2005-03-03 15:53:56 fdiary Exp $ # Copyright (C) 2003 Laurent Sansonetti def referer_short_label 'Rfrences externes' end def referer_long_label 'Rfrences externes' end hiki-1.0.0/misc/plugin/fr/rss.rb000066400000000000000000000006451212533356300164400ustar00rootroot00000000000000# $Id: rss.rb,v 1.4 2005-09-06 06:08:29 fdiary Exp $ # Copyright (C) 2003 Laurent Sansonetti def label_rss_recent 'Modifications rcentes' end # PLEASE TRANSLATE def label_rss_config; 'RSS publication'; end def label_rss_mode_title; 'Select the format.'; end def label_rss_mode_candidate [ 'unified diff', 'word diff (digest)', 'word diff (full text)', 'HTML (full text)', ] end hiki-1.0.0/misc/plugin/fr/src.rb000066400000000000000000000002241212533356300164110ustar00rootroot00000000000000# $Id: src.rb,v 1.2 2004-02-15 02:48:35 hitoshi Exp $ # Copyright (C) 2003 Laurent Sansonetti def src_label 'Source' end hiki-1.0.0/misc/plugin/frozenmark.rb000066400000000000000000000005151212533356300173740ustar00rootroot00000000000000# $Id: frozenmark.rb,v 1.5 2005-06-27 05:54:26 fdiary Exp $ # Copyright (C) 2003 OZAWA Sakuro add_page_attribute_proc { if @db.is_frozen?(@page) then <<-EOS
    #{frozenmark_message}
    EOS else '' end } hiki-1.0.0/misc/plugin/google-sitemaps.rb000066400000000000000000000025051212533356300203160ustar00rootroot00000000000000# $Id: google-sitemaps.rb,v 1.1 2005-06-09 13:17:40 yanagita Exp $ # Copyright (C) 2003-2004 TAKEUCHI Hitoshi # Copyright (C) 2005 Kazuhiko # Copyright (C) 2005 Kouhei Yanagita def google_sitemaps_body sitemaps = %Q!\n! sitemaps << %Q!\n! site_last_modified = nil @db.page_info.each do |page| name = page.keys[0] lastmod = page.values[0][:last_modified] if site_last_modified.nil? or site_last_modified < lastmod site_last_modified = lastmod end sitemaps << <<_E #{@conf.index_url}?#{escape(name)} #{lastmod.utc.strftime('%Y-%m-%dT%H:%M:%S+00:00')} _E end sitemaps << '' [sitemaps, site_last_modified] end def google_sitemaps body, last_modified = google_sitemaps_body header = {} header['Last-Modified'] = CGI.rfc1123_date(last_modified) header['type'] = 'text/xml' header['charset'] = 'UTF-8' header['Content-Language'] = @conf.lang header['Pragma'] = 'no-cache' header['Cache-Control'] = 'no-cache' ::Hiki::Response.new(body, 200, header) end add_body_enter_proc(Proc.new do add_plugin_command('google_sitemaps', nil) end) hiki-1.0.0/misc/plugin/highlight.rb000066400000000000000000000070021212533356300171630ustar00rootroot00000000000000# -*- coding: utf-8 -*- # highlight.rb $Revision: 1.3 $ # # 吾c潟<潟ゃゃ腱違茗JavaScript腟綵∽ # ゃ潟鴻若у篏障 # # 激с: # @options["highlight.color"]: ゃゃ絖(ユ:) # @options["highlight.background"]: ゃゃ(ユ:莎) # # See: http://tdiary-users.sourceforge.jp/cgi-bin/wiki.cgi?%A5%EA%A5%F3%A5%AF%B8%B5%A4%F2%A4%BF%A4%C9%A4%C3%A4%C6%A4%E2%A1%A2%A4%C9%A4%B3%A4%CE%CF%C3%C2%EA%A4%AB%A4%EF%A4%AB%A4%E9%A4%CA%A4%A4%A4%F3%A4%C7%A4%B9%A4%B1%A4%C9 # #2004-02-14 TAKEUCHI Hitoshi # * modified for Hiki add_footer_proc do @options['highlight.color'] ||= '#fff' @options['highlight.background'] ||= '#f00' <<-SCRIPT SCRIPT end # vim: ts=3 hiki-1.0.0/misc/plugin/history.rb000066400000000000000000000246161212533356300167270ustar00rootroot00000000000000# -*- coding: utf-8 -*- =begin == plugin/history.rb - CVS 膩絮ユ眼茵腓冴違ゃ Copyright (C) 2003 Hajime BABA $Id: history.rb,v 1.29 2007-09-24 21:23:09 fdiary Exp $ You can redistribute and/or modify this file under the terms of the LGPL. Copyright (C) 2003 Yasuo Itabashi === 篏帥 * Hiki cvs 違ゃ ( svn 違ゃ) >散с * 筝сHiki 違ゃ潟c潟若違 筝<ャ若膩絮ユ眼憗篏帥障 === 荅括完 * 篁ヤ筝ゃ違ゃ潟潟潟菴遵障 * history 若吾膩絮ユ眼筝荀с茵腓 * history_src 吾с潟純若鴻茵腓 * history_diff 篁紙吾с渇綏茵腓 絎 @conf.cgi_name?c=history;p=FrontPage @conf.cgi_name?c=plugin;plugin=history_diff;p=FrontPage;r=2 篏睡障 * 絮ユ眼潟膈憗障 * Subversion 絲上綵с(篏帥c) * 違ゃ割篏羈cс眼 === history 2003/12/17 Yasuo Itabashi(Yas) Subversion絲上, 紊雁綣決水上, Ruby 1.7篁ラ絲上 === notice Hikifarm篏睡翫hiki.conf @conf.repos_type = (defined? repos_type) ? "#{repos_type}" : nil 菴遵-- Yas CSSspan.add_line, span.del_line荐絎紊雁絖絮с紊眼с障 -- Yas === SEE ALSO * 筝荀с阪綵√ WiLiKi 膩絮ユ眼障 http://www.shiro.dreamhost.com/scheme/wiliki/wiliki.cgi =end def history h = Hiki::History.new(@request, @db, @conf) h.history end def history_src h = Hiki::History.new(@request, @db, @conf) h.history_src end def history_diff h = Hiki::History.new(@request, @db, @conf) h.history_diff end add_body_enter_proc(Proc.new do add_plugin_command('history', history_label, {'p' => true}) end) module Hiki class History < Command private def history_repos_type @conf.repos_type # 'cvs' or 'svn' or 'svnsingle' end def history_repos_root @conf.repos_root # hiki.conf end # Subroutine to invoke external command using `` sequence. def history_exec_command(cmd_string) Dir.chdir("#{@db.pages_path}") do `#{cmd_string.untaint}` end end # Subroutine to output proper HTML for Hiki. def history_output(s) # Imported codes from hiki/command.rb::cmd_view() parser = @conf.parser.new( @conf ) tokens = parser.parse( s ) formatter = @conf.formatter.new( tokens, @db, @plugin, @conf ) @page = Page.new( @request, @conf ) data = get_common_data( @db, @plugin, @conf ) @plugin.hiki_menu(data, @cmd) pg_title = @plugin.page_name(@p) data[:title] = title( "#{pg_title} - #{history_label}") data[:view_title] = "#{pg_title} - #{history_label}" data[:body] = formatter.apply_tdiary_theme(s) @cmd = 'view' # important!!! generate_page(data) # private method inherited from Command class end def recent_revs(revs, rev) ind = revs.index(revs.assoc(rev)) || 0 prev_rev = revs[ind + 1] prev2_rev = revs[ind + 2] if ind - 1 >= 0 next_rev = revs[ind - 1] else next_rev = nil end [prev2_rev, prev_rev, revs[ind], next_rev] end def diff_link(rev1, rev2, rev_title1, rev_title2, link) title = [] title << (rev_title1 || (rev1 and rev1[0]) || nil) title << (rev_title2 || (rev2 and rev2[0]) || nil) title = title.compact title.reverse! unless rev2.nil? title = h(title.join("<=>")) do_link = (link and rev1) rv = "[" if do_link rev_param = "r=#{rev1[0]}" rev_param << ";r2=#{rev2[0]}" if rev2 rv << %Q[] end rv << title if do_link rv << "" end rv << "]\n" rv end public # Output summary of change history def history # parse the result and make revisions array revs = @conf.repos.revisions(@p) # construct output sources prevdiff = 1 sources = '' sources << @plugin.hiki_anchor(escape(@p), @plugin.page_name(@p)) sources << "\n
    \n" sources << "\n\n" if @conf.options['history.hidelog'] case history_repos_type when 'cvs' sources << " \n" else sources << " \n" end else case history_repos_type when 'cvs' sources << " \n" else sources << " \n" end end revs.each do |rev,time,changes,log| # time << " GMT" op = "[View this version] " if revs.size != 1 op << "[Diff to " op << "current" unless prevdiff == 1 op << " | " unless (prevdiff == 1 || prevdiff >= revs.size) op << "previous" unless prevdiff >= revs.size op << "]" end if @conf.options['history.hidelog'] case history_repos_type when 'cvs' sources << " \n" else sources << " \n" end else log.gsub!(/=============================================================================/, '') log.chomp! log = "*** no log message ***" if log.empty? case history_repos_type when 'cvs' sources << " \n" else sources << " \n" end end prevdiff += 1 end sources << "
    #{h(history_th_label[0])}#{h(history_th_label[1])}#{h(history_th_label[2])}#{h(history_th_label[3])}
    #{h(history_th_label[0])}#{h(history_th_label[1])}#{h(history_th_label[3])}
    #{h(history_th_label[0])}#{h(history_th_label[1])}#{h(history_th_label[2])}#{h(history_th_label[3])}
    #{h(history_th_label[4])}
    #{h(history_th_label[0])}#{h(history_th_label[1])}#{h(history_th_label[3])}
    #{h(history_th_label[4])}
    #{rev}#{h(time)}#{h(changes)}#{op}
    #{rev}#{h(time)}#{op}
    #{rev}#{h(time)}#{h(changes)}#{op}
    #{h(log)}
    #{rev}#{h(time)}#{op}
    #{h(log)}
    \n" history_output(sources) end # Output source at an arbitrary revision def history_src # make command string r = @request.params['r'] || '1' txt = @conf.repos.get_revision(@p, r) txt = "*** no source ***" if txt.empty? # construct output sources sources = '' sources << "
    \n" sources << @plugin.hiki_anchor(escape(@p), @plugin.page_name(@p)) sources << "\n
    \n" sources << "#{h(history_revert_label)}
    \n" sources << "#{h(history_diffto_current_label)}
    \n" sources << "#{h(history_backto_summary_label)}
    \n" sources << "
    \n" sources << "
    \n" sources << h(txt).gsub(/\n/, "
    \n").gsub(/ /, ' ') sources << "
    \n" history_output(sources) end # Output diff between two arbitrary revisions def history_diff # make command string r = @request.params['r'] || '1' r2 = @request.params['r2'] if r2.nil? || r2.to_i == 0 new = @db.load(@p) old = @conf.repos.get_revision(@p, r) else new = @conf.repos.get_revision(@p, r) old = @conf.repos.get_revision(@p, r2) end # parse the result and make revisions array revs = @conf.repos.revisions(@p) prev2_rev, prev_rev, curr_rev, next_rev = recent_revs(revs, r.to_i) last_rev = revs[0] diff = word_diff( old, new ) # construct output sources sources = '' sources << "
    \n" sources << @plugin.hiki_anchor(escape(@p), @plugin.page_name(@p)) sources << "
    \n" sources << "#{h(history_view_this_version_src_label)}
    \n" if curr_rev sources << "#{h(history_backto_summary_label)}
    \n" sources << "\n" if prev_rev do_link = (last_rev and prev_rev and last_rev[0] != prev_rev[0]) sources << diff_link(prev_rev, nil, nil, "HEAD", do_link) end if prev_rev and prev2_rev sources << diff_link(prev_rev, prev2_rev, nil, nil, true) end sources << diff_link(curr_rev, r2.nil? ? nil : prev_rev, nil, nil, false) if next_rev sources << diff_link(next_rev, curr_rev, nil, nil, true) end do_link = (r2 and last_rev and last_rev[0] != curr_rev[0]) sources << diff_link(curr_rev, nil, nil, "HEAD", do_link) sources << "
    \n
    \n" sources << "
      " sources << "
    • #{history_add_line_label}
    • " sources << "
    • #{history_delete_line_label}
    • " sources << "
    " sources << "
    #{diff.gsub(/\n/, "
    \n")}
    \n" history_output(sources) end end end hiki-1.0.0/misc/plugin/incremental_search.rb000066400000000000000000000100451212533356300210430ustar00rootroot00000000000000# -*- coding: utf-8 -*- # ajaxsearch.rb $Revision: 1.3 $ # Copyright (C) 2005 Michitaka Ohno # # This program is free software; you can redistribute it and/or # modify it under the terms of the GNU General Public License # as published by the Free Software Foundation; either version 2 # of the License, or (at your option) any later version. # # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License # along with this program; if not, write to the Free Software # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. def search as = Hiki::AjaxSearch.new(@request, @db, @conf) @request.params['key'] ? as.search : as.form end module Hiki class AjaxSearch < Command def form data = get_common_data( @db, @plugin, @conf ) @plugin.hiki_menu( data, @cmd ) body =<<-HTML
    #{@conf.msg_search_comment}
    #{@conf.msg_search}:
    HTML data[:title] = data[:view_title] = title( @conf.msg_search ) data[:body] = body @cmd = 'plugin' generate_page(data) end def search word = utf8_to_euc(@request.params['key']) r = "" unless word.empty? then total, l = @db.search( word ) if @conf.hilight_keys l.collect! {|p| @plugin.make_anchor("#{@conf.cgi_name}?cmd=view&p=#{escape(p[0])}&key=#{escape(word.split.join('+'))}", @plugin.page_name(p[0])) + " - #{p[1]}"} else l.collect! {|p| @plugin.hiki_anchor(escape(p[0]), @plugin.page_name(p[0])) + " - #{p[1]}"} end if l.size > 0 then r = "
      \n" + l.map{|i| "
    • #{i}
    • \n"}.join + "
    \n" end end header = {} header['type'] = 'text/html' header['charset'] = 'EUC-JP' header['Content-Language'] = @conf.lang header['Pragma'] = 'no-cache' header['Cache-Control'] = 'no-cache' ::Hiki::Response.new(r, 200, header) end end end eval(< # add Amazon Associate ID by Kazuhiko def isbn(isbn, bookname = "") isbn1 = isbn.to_s.gsub(/ISBN/i, "") isbn2 = isbn1.gsub(/-/, "") if bookname == "" buf = "" else buf = "#{h(bookname)}" end aid = @options['amazon.aid'] ? "/#{@options['amazon.aid']}" : "" s = "" s << buf s << " " s << make_anchor( "http://www.amazon.co.jp/exec/obidos/ASIN/#{isbn2}#{aid}/ref=nosim/", 'amazon' ) + ' / ' s << make_anchor( "http://www.bk1.co.jp/search/search.asp?srch=2&kywd=&ti=&au=&pb=&isbn=#{isbn1}&idx=1", 'bk1' ) + ' / ' s << make_anchor( "http://www.netdirect.co.jp/search/ISSSchDetail.asp?ISBN=#{isbn2}", '絮' ) + ' / ' s << make_anchor( "http://www.jbook.co.jp/product.asp?isbn=#{isbn2}", 'Jbook' ) + ' / ' s << make_anchor( "http://bookweb.kinokuniya.co.jp/guest/cgi-bin/wshosea.cgi?W-ISBN=#{isbn2}", '膣篌絮' ) + ' / ' s << make_anchor( "http://www.esbooks.co.jp/bks.svl?CID=BKS504&access_method=isbn_cd&input_data=#{isbn1}", 'eS!' ) + ' / ' s << make_anchor( "http://bsearch.rakuten.co.jp/Btitles?KEY=#{isbn1}", '罐遵ぉ' ) s << " " end hiki-1.0.0/misc/plugin/it/000077500000000000000000000000001212533356300153045ustar00rootroot00000000000000hiki-1.0.0/misc/plugin/it/attach.rb000066400000000000000000000003721212533356300170770ustar00rootroot00000000000000# $Id: attach.rb,v 1.3 2005-03-03 15:53:56 fdiary Exp $ # Copyright (C) 2003 Luigi Maselli def attach_files_label 'File allegati' end def attach_upload_label 'File caricati' end def detach_upload_label 'Rimuovi file' end hiki-1.0.0/misc/plugin/it/bbs.rb000066400000000000000000000004541212533356300164020ustar00rootroot00000000000000# $Id: bbs.rb,v 1.3 2005-03-03 15:53:56 fdiary Exp $ # Copyright (C) 2003 Luigi Maselli def bbs_name_label 'Nome' end def bbs_subject_label 'Argomento' end def bbs_post_label 'Post' end def bbs_anonymous_label 'Anonimo' end def bbs_notitle_label 'Senza titolo' end hiki-1.0.0/misc/plugin/it/comment.rb000066400000000000000000000004241212533356300172730ustar00rootroot00000000000000# $Id: comment.rb,v 1.2 2004-02-15 02:48:35 hitoshi Exp $ # Copyright (C) 2003 Luigi Maselli def comment_name_label 'Nome' end def comment_comment_label 'Commento' end def comment_post_label 'Post' end def comment_anonymous_label 'Anonimo' end hiki-1.0.0/misc/plugin/it/referer.rb000066400000000000000000000003051212533356300172610ustar00rootroot00000000000000# $Id: referer.rb,v 1.3 2005-03-03 15:53:56 fdiary Exp $ # Copyright (C) 2003 Luigi Maselli def referer_short_label 'Referente' end def referer_long_label 'Referente' end hiki-1.0.0/misc/plugin/it/rss.rb000066400000000000000000000005761212533356300164500ustar00rootroot00000000000000# $Id: rss.rb,v 1.3 2005-03-03 15:53:56 fdiary Exp $ # Copyright (C) 2003 Luigi Maselli def label_rss_recent 'Ultime modifiche' end # PLEASE TRANSLATE def label_rss_config; 'RSS publication'; end def label_rss_mode_title; 'Select the format.'; end def label_rss_mode_candidate [ 'unified diff', 'word diff (digest)', 'word diff (full text)', ] end hiki-1.0.0/misc/plugin/it/src.rb000066400000000000000000000002151212533356300164160ustar00rootroot00000000000000# $Id: src.rb,v 1.2 2004-02-15 02:48:35 hitoshi Exp $ # Copyright (C) 2003 Luigi Maselli def src_label 'Sorgente' end hiki-1.0.0/misc/plugin/its.rb000066400000000000000000000162411212533356300160200ustar00rootroot00000000000000export_plugin_methods(:its_add_ticket_form, :its_edit_ticket_form, :its_active_tickets, :its_closed_tickets, :its_all_tickets, :its_add_ticket_post, :its_edit_ticket_post) def its_priority_candidates %w(High Normal Low) end def its_status_candidates %w(New Assigned Reopened Closed) end def its_add_ticket_form return '' if @conf.use_session && !@session_id name = @user || '' result = <
    Summary:
    Priority:
    Reporter:
    Description:
    EOS result end def its_edit_ticket_form return '' if @conf.use_session && !@session_id ticket = its_parse_ticket( @page ) return '' unless ticket name = @user || '' result = <
    Name:
    Comment:
    Change Properties
    Priority: EOS its_status_candidates.each do |i| result << %Q| #{h(i)}| end result << <
    Version:
    Milestone:
    Assigned to:
    EOS result end def its_active_tickets( num = nil ) @its_tickets ||= its_get_tickets its_view_tickets(@its_tickets.select {|i| /^Closed$/i !~ i[:status]}.sort_by{|a| [its_priority_candidates.index(a[:priority]), -a[:num]]}, num) end def its_closed_tickets( num = nil ) @its_tickets ||= its_get_tickets its_view_tickets(@its_tickets.select {|i| /^Closed$/i =~ i[:status]}.sort_by{|a| -a[:num]}, num) end def its_all_tickets( num = nil ) @its_tickets ||= its_get_tickets its_view_tickets(@its_tickets.sort_by{|a| -a[:num]}, num) end def its_view_tickets( tickets, num = nil ) ret = <<-EOS EOS (num ? tickets[0...num.to_i] : tickets).each do |i| ret << %Q| \n| end ret << "
    No.SummaryVersionMilestonePriorityReporterCreated
    #{hiki_anchor("Ticket-#{i[:num]}", i[:num])}#{hiki_anchor("Ticket-#{i[:num]}", h(i[:summary]))}#{h(i[:version])}#{h(i[:milestone])}#{h(i[:priority])}#{h(i[:reporter])}#{h(i[:created])}
    \n" ret end def its_parse_ticket( page ) begin text = @db.load(page) num = /^Ticket-(\d+)/.match(page)[1].to_i summary = /^!(.+)/ =~ text ? $1.strip : '' priority = /^:Priority:(.*)/ =~ text ? $1.strip : '' reporter = /^:Reporter:(.*)/ =~ text ? $1.strip : '' status = /^:Status:(.*)/ =~ text ? $1.strip : '' assigned = /^:Assigned to:(.*)/ =~ text ? $1.strip : '' created = /^:Created:(.*)/ =~ text ? $1.strip : '' version = /:Version:(.*)/ =~ text ? $1.strip : '' milestone = /:Milestone:(.*)/ =~ text ? $1.strip : '' { :num => num, :summary => summary, :priority => priority, :reporter => reporter, :status => status, :assigned => assigned, :created => created, :version => version, :milestone => milestone, } rescue nil end end def its_get_tickets pages = @db.page_info.collect{|i| i.keys[0]}.select {|i| /^Ticket-\d+$/ =~ i} tickets = pages.collect {|page| its_parse_ticket( page ) } tickets.compact end def its_add_ticket_post return '' if @conf.use_session && @session_id != @request.params['session_id'] priority = @request.params['priority'] version = @request.params['version'] reporter = @request.params['reporter'] summary = @request.params['summary'] description = @request.params['description'] return true if priority.empty? || summary.empty? || description.empty? status = 'New' assigned = '?' milestone = '?' @its_tickets ||= its_get_tickets last_ticket = @its_tickets.sort{|a,b| a[:num] <=> b[:num]}.last num = last_ticket ? last_ticket[:num].succ : 1 page = "Ticket-#{num}" current_text = load( page ) md5hex = @db.md5hex( page ) text = < # You can redistribute it and/or modify it under GPL2. # # # isbn_image_left: 絎ISBN後襲class="left"ц;腓 # <: # asin: ASIN障ISBN(綽) # comment: 潟<潟(ュ) # # isbn_image_right: 絎ISBN後襲class="right"ц;腓 # <: # asin: ASIN障ISBN(綽) # comment: 潟<潟(ュ) # # isbn_image: 絎ISBN後襲class="amazon"ц;腓 # asin: ASIN障ISBN(綽) # comment: 潟<潟(ュ) # # isbn_detail: 絎ISBN悟後襲篁ц括完茵腓 # asin: ASIN障ISBN(綽) # # isbn: amazon≪祉鴻膂≧若吾с潟 # asin: ASIN障ISBN(綽) # comment: 潟<潟(綽) # # ASIN≪障括膊∞IDс # 悟ISBNASINュ悟茵腓冴障 # # 糸荀ゃc翫 # # 茵腓冴障 # 潟<潟荐菴違翫潟<潟絎鴻紊障 # # tdiary.conf荐絎: # @options['amazon.aid']: ≪純激ゃID絎с # 純激ゃ違с障 # 激с潟荐絎脂≪紊翫純с # @options['amazon.hideconf']: 荐絎脂≫с≪純激ゃIDュ筝 # 翫true荐絎障 # @options['amazon.imgsize']: 茵腓冴ゃ<若吾泣ゃ冴絎障 # (0:紊 1:筝 2:絨) # @options['amazon.hidename']: class="amazon"茵腓冴 # 翫true荐絎障 # @options['amazon.default_image_base']: ゃ<若吾主 # URL絎障≧絎tDiary.org # 篏帥障篏翫 # 違ゃ渇amazoncPNG # <ゃ筝 # @options['amazon.nodefault']: ゃ<若吾茵腓冴翫 # true荐絎障 # # # 羈鐚篏罔∫c冴www.amazon.co.jp≪純激ゃ違 # 腆肴筝筝 # @amazon_default_country = 'jp' @amazon_item_name = /^Amazon.co.jp鐚 (.*)<.*$/ @amazon_item_image = %r|()|i @amazon_label_conf ='Amazon' @amazon_label_aid = 'Amazon≪純激ゃID絎' @amazon_label_aid_desc = '絎翫tDiary篏ID絎障с羈' @amazon_label_imgsize = '茵腓冴ゃ<若吾泣ゃ' @amazon_label_large = '紊с' @amazon_label_regular = '' @amazon_label_small = '絨' @amazon_label_title = 'isbn_image違ゃ潟у' @amazon_label_hide = '茵腓冴' @amazon_label_show = '茵腓冴' @amazon_label_notfound = 'ゃ<若吾荀ゃ' @amazon_label_usetitle = '茵腓冴' @amazon_label_usedefault = 'ゃ<若吾篏帥' @amazon_label_clearcache = 'c激ャ' @amazon_label_clearcache_desc = 'ゃ<若檎∫f宴c激ャゃ(Amazon筝茵腓冴障翫荅筝)' hiki-1.0.0/misc/plugin/ja/append-css.rb000066400000000000000000000004771212533356300176540ustar00rootroot00000000000000# -*- coding: utf-8 -*- def append_css_label 'CSS菴遵' end def append_css_desc <<-HTML

    CSS

    憜絎若鴻帥ゃ激若菴遵荐絎翫 篁ヤCSSュ

    HTML end hiki-1.0.0/misc/plugin/ja/attach.rb000066400000000000000000000012141212533356300170510ustar00rootroot00000000000000# -*- coding: utf-8 -*- # $Id: attach.rb,v 1.2 2005-06-17 05:03:43 fdiary Exp $ # Copyright (C) 2003 TAKEUCHI Hitoshi def attach_files_label '羞私<ゃ' end def attach_upload_label '<ゃ羞私' end def detach_upload_label 'с<ゃ' end def attach_usage '
    • 羞私<ゃ吾≪潟{{attach_anchor(<ゃ [, 若後])}}
    • 羞私<ゃ茵腓冴{{attach_view(<ゃ [, 若後])}}
    • 羞私若吾<ゃ筝荀с{{attach_map}}
    ' end hiki-1.0.0/misc/plugin/ja/auth_typekey.rb000066400000000000000000000011731212533356300203240ustar00rootroot00000000000000# -*- coding: utf-8 -*- # $Id: auth_typekey.rb,v 1.1 2005-03-06 09:05:23 fdiary Exp $ # Copyright (C) 2005 TAKEUCHI Hitoshi def label_auth_typekey_login < 若吾膩違ゃ綽荀с EOS end def label_auth_typekey_hello '<%s' end def label_auth_typekey_config 'TypeKey茯荐' end def label_auth_typekey_token 'TypeKey若' end def label_auth_typekey_token_msg 'TypeKey若潟絎障若潟TypeKey泣ゃ≪潟宴х∈茯' end hiki-1.0.0/misc/plugin/ja/bbs.rb000066400000000000000000000005251212533356300163570ustar00rootroot00000000000000# -*- coding: utf-8 -*- # $Id: bbs.rb,v 1.1 2005-03-03 15:53:56 fdiary Exp $ # Copyright (C) 2002-2003 TAKEUCHI Hitoshi def bbs_name_label '' end def bbs_subject_label '篁九' end def bbs_post_label '腮' end def bbs_anonymous_label '<' end def bbs_notitle_label '♂' end hiki-1.0.0/misc/plugin/ja/comment.rb000066400000000000000000000005111212533356300172460ustar00rootroot00000000000000# -*- coding: utf-8 -*- # $Id: comment.rb,v 1.1 2005-03-03 15:53:56 fdiary Exp $ # Copyright (C) 2002-2003 TAKEUCHI Hitoshi def comment_name_label '' end def comment_comment_label '潟<潟' end def comment_post_label '腮' end def comment_anonymous_label '<' end hiki-1.0.0/misc/plugin/ja/edit_user.rb000066400000000000000000000015101212533356300175670ustar00rootroot00000000000000# -*- coding: utf-8 -*- # $Id: edit_user.rb,v 1.2 2005-06-09 08:12:39 fdiary Exp $ # Copyright (C) 2005 Kazuhiko def label_edit_user_config; '若句隈'; end def label_edit_user_title; '若吟 / 鴻若紊'; end def label_edit_user_add_title; '若吟菴遵'; end def label_edit_user_description '筝茵ゃ若九 鴻若後ф吾' end def label_edit_user_auth_title; '膩狗'; end def label_edit_user_auth_description '脂蚊若吟睡隈с狗障鐚' end def label_edit_user_auth_candidate [ '', '' ] end def label_edit_user_delete; ''; end def label_edit_user_name; '若九'; end def label_edit_user_new_password; '違鴻若'; end hiki-1.0.0/misc/plugin/ja/frozenmark.rb000066400000000000000000000003431212533356300177650ustar00rootroot00000000000000# -*- coding: utf-8 -*- # $Id: frozenmark.rb,v 1.1 2005-03-03 15:53:56 fdiary Exp $ # Copyright (C) 2003 OZAWA Sakuro def frozenmark_message; '若吾腟障'; end hiki-1.0.0/misc/plugin/ja/history.rb000066400000000000000000000017771212533356300173240ustar00rootroot00000000000000# -*- coding: utf-8 -*- def history_label '膩絮ユ' end module Hiki class History < Command private def history_label '膩絮ユ' end def history_th_label ['Rev', '', '紊', '篏', ''] end def history_not_supported_label '憜荐絎с膩絮ユ眼泣若障' end def history_revert_label '若吾с潟祉' end def history_diffto_current_label '憜若吾с潟綏荀' end def history_view_this_version_src_label '若吾с潟純若鴻荀' end def history_backto_summary_label '膩絮ユ眼若吾祉' end def history_add_line_label '菴遵茵腓冴障' end def history_delete_line_label 'ゃ茵腓冴障' end end end hiki-1.0.0/misc/plugin/ja/math.rb000066400000000000000000000014641212533356300165450ustar00rootroot00000000000000# -*- coding: utf-8 -*- def label_math_latex_ptsize; '潟泣ゃ (pt)'; end def label_math_latex_documentclass; 'ャ<潟'; end def label_math_latex_preamble; '≪潟'; end def label_math_latex_log; '違篆'; end def label_math_latex_log_description; '帥ゃ祉祉潟潟絎茵罔羣阪 罔羣弱阪違ゃ鐚'; end def label_math_latex_cache_clear; 'c激ャ'; end def label_math_latex_cache_clear_description; 'с OK 鐚憝鴻т糸c激ャゃ鐚'; end def label_math_latex_latex; 'latex 潟潟'; end def label_math_latex_dvips; 'dvips 潟潟'; end def label_math_latex_convert; 'convert 潟潟'; end hiki-1.0.0/misc/plugin/ja/note.rb000066400000000000000000000005711212533356300165570ustar00rootroot00000000000000# -*- coding: utf-8 -*- def note_prefix; 'Note-'; end def label_note_config; '若'; end def label_note_link; '若'; end def label_note_orig; '若'; end def label_note_template; '域若若吾潟若'; end def label_note_template_default str = <<-END {{note_orig_page}} 若若吾с ---- {{bbs}} END end hiki-1.0.0/misc/plugin/ja/referer.rb000066400000000000000000000003761212533356300172470ustar00rootroot00000000000000# -*- coding: utf-8 -*- # $Id: referer.rb,v 1.1 2005-03-03 15:53:56 fdiary Exp $ # Copyright (C) 2003 TAKEUCHI Hitoshi def referer_short_label '潟' end def referer_long_label '若吾吾潟' end hiki-1.0.0/misc/plugin/ja/rss.rb000066400000000000000000000011721212533356300164170ustar00rootroot00000000000000# -*- coding: utf-8 -*- # $Id: rss.rb,v 1.4 2005-09-06 06:08:29 fdiary Exp $ # Copyright (C) 2003-2004 TAKEUCHI Hitoshi # Copyright (C) 2005 Kazuhiko def label_rss_recent '贋井ユ' end def label_rss_config; 'RSS 篏'; end def label_rss_mode_title; 'RSS 若'; end def label_rss_mode_candidate [ 'unified diff 綵√', 'word diff 綵√ (ゃ吾с鴻)', 'word diff 綵√ ()', 'HTML 綵√ ()', ] end def label_rss_menu_title; 'RSS <ャ若茵腓'; end def label_rss_menu_candidate [ '', '' ] end hiki-1.0.0/misc/plugin/ja/search.rb000066400000000000000000000000751212533356300170560ustar00rootroot00000000000000# -*- coding: utf-8 -*- def search_post_label '罎膣' end hiki-1.0.0/misc/plugin/ja/src.rb000066400000000000000000000002531212533356300163760ustar00rootroot00000000000000# -*- coding: utf-8 -*- # $Id: src.rb,v 1.1 2005-03-03 15:53:56 fdiary Exp $ # Copyright (C) 2003 TAKEUCHI Hitoshi def src_label '純若' end hiki-1.0.0/misc/plugin/ja/template.rb000066400000000000000000000015111212533356300174200ustar00rootroot00000000000000# -*- coding: utf-8 -*- # $Id: template.rb,v 1.2 2005-06-27 05:21:42 fdiary Exp $ # Copyright (C) 2003 TAKEUCHI Hitoshi def template_label '潟若' end def template_select_label '茯莨' end def label_template_default '潟若' end def label_template_default_desc '潟若絎障' end def label_template_keyword '潟若若若' end def label_template_keyword_desc '絎若若ゃ若吾潟若茖障絎翫腥冴' end def label_template_autoinsert '潟若水' end def label_template_autoinsert_desc '域若娯水ャ' end hiki-1.0.0/misc/plugin/keyword.rb000066400000000000000000000020631212533356300167020ustar00rootroot00000000000000# $Id: keyword.rb,v 1.5 2005-09-30 11:45:49 fdiary Exp $ # Copyright (C) 2003 TAKEUCHI Hitoshi def keyword_list(*key) # sort by category list = keywords(*key).to_a.sort {|a,b| a[0].downcase <=> b[0].downcase} s = '' list.each do |j| category = j[0] p = j[1] s << "

    #{view_title(category)}

    \n" s << "
      \n" # sort by page name p.collect! { |i| i.to_a.flatten! }.sort! do |p1, p2| p2[1][:last_modified] <=> p1[1][:last_modified] end p.each do |a| name = a[0] tm = a[1][:last_modified] s << "
    • #{format_date( tm )}: #{hiki_anchor(escape(name), page_name(name))}
    • \n" end s << "
    \n" end s end def keywords(*keyword) keyword.collect! {|a| unescape_html(a) } key = {} @db.page_info.each do |info| next unless info.values[0][:keyword] info.values[0][:keyword].each do |k| if keyword.size == 0 || keyword.index(k) key[k] = [] unless key[k] key[k] << info end end end key end export_plugin_methods(:keyword_list) hiki-1.0.0/misc/plugin/math.rb000066400000000000000000000076411212533356300161560ustar00rootroot00000000000000def math_latex_download page = (@request.params['p'] || '') file_name = (@request.params['file_name'] || '') image_file = "#{@cache_path}/math_latex/#{escape(page)}/#{escape(file_name)}" mime_type = "image/png" header = {} header['Content-Type'] = mime_type header['Last-Modified'] = CGI.rfc1123_date(File.mtime(image_file.untaint)) header['Content-Disposition'] = %Q|filename="#{file_name.to_sjis}"| ::Hiki::Response.new(File.open(image_file.untaint, "rb").read, 200, header) end add_header_proc { <<-EOS EOS } def math_init @conf['math.latex.ptsize'] ||= '12' @conf['math.latex.documentclass'] ||= 'report' @conf['math.latex.preamble'] ||= '' @conf['math.latex.log'] ||= false @conf['math.latex.secure'] ||= true unless (@conf['math.latex.secure'] || true) then @conf['math.latex.latex'] ||= 'latex %.tex' @conf['math.latex.dvips'] ||= 'dvips %.dvi' @conf['math.latex.convert'] ||= 'convert -antialias -transparent white -trim %.ps %.png' end nil end if @mode != 'conf' and @mode != 'saveconf' then add_body_enter_proc do math_init end end def math_clear_cache cache_path = "#{@conf.cache_path}/math_latex".untaint Dir.glob("#{cache_path}/*") do |ent| require 'fileutils' ent.untaint FileUtils.rm_rf(ent) if File.directory?(ent) end end def saveconf_math if @mode == 'saveconf' then @conf['math.latex.ptsize'] = @request.params['math.latex.ptsize'] @conf['math.latex.documentclass'] = @request.params['math.latex.documentclass'] @conf['math.latex.preamble'] = @request.params['math.latex.preamble'] @conf['math.latex.log'] = (@request.params['math.latex.log'] == 'true') unless (@conf['math.latex.secure'] || true) then @conf['math.latex.latex'] = @request.params['math.latex.latex'] @conf['math.latex.dvips'] = @request.params['math.latex.dvips'] @conf['math.latex.convert'] = @request.params['math.latex.convert'] end math_init if @request.params['math.latex.cache_clear'] == 'true' then math_clear_cache end end end add_conf_proc('math', 'math style') do saveconf_math math_init str = <<-HTML

    #{label_math_latex_ptsize}

    pt

    #{label_math_latex_documentclass}

    #{label_math_latex_preamble}

    #{label_math_latex_log}

    #{label_math_latex_log_description}

    #{label_math_latex_cache_clear}

    #{label_math_latex_cache_clear_description}

    HTML # NOTE that following items are disabled now because it is not # suitable for setting these through CGI. If you want to configure # these values on your head, do set the math.latex.secure to false. unless @conf['math.latex.secure'] then str += <<-HTML

    #{label_math_latex_latex}

    #{label_math_latex_dvips}

    #{label_math_latex_convert}

    HTML end str end hiki-1.0.0/misc/plugin/note.rb000066400000000000000000000023251212533356300161640ustar00rootroot00000000000000# $Id: note.rb,v 1.2 2005-03-05 15:24:28 hitoshi Exp $ # Copyright (C) 2005 Kazuhiko # based on joesaisan's idea def note_orig_page if /\A#{Regexp.escape(note_prefix)}/ =~ @page hiki_anchor(escape($'), page_name($')) end end add_menu_proc do if /\A#{Regexp.escape(note_prefix)}/ =~ @page then hiki_anchor(escape( $' ), h(label_note_orig) ) else page = note_prefix + @page text = @db.load( page ) if text.nil? || text.empty? @conf['note.template'] ||= label_note_template_default %Q|#{h(label_note_link)}| else hiki_anchor(escape(page), h(label_note_link)) end end end if @page and auth? def saveconf_note if @mode == 'saveconf' then @conf['note.template'] = @request.params['note.template'] end end add_conf_proc('note', label_note_config) do saveconf_note @conf['note.template'] ||= label_note_template_default str = <<-HTML

    #{label_note_template}

    HTML str end hiki-1.0.0/misc/plugin/orphan.rb000066400000000000000000000007231212533356300165060ustar00rootroot00000000000000# $Id: orphan.rb,v 1.5 2005-09-30 11:45:49 fdiary Exp $ # Copyright (C) 2003 TAKEUCHI Hitoshi def orphan_pages pages = @db.pages.select{|p| @db.get_references(p).empty?} pages.collect!{|p| [p, page_name(p)]} pages.sort_by{|i| unescape_html(i[1]) } end def orphan s = '
      ' orphan_pages.each do |p, page_name| s << %Q!
    • #{hiki_anchor(escape(p), page_name)}
    • \n! end s << "
    \n" end export_plugin_methods(:orphan) hiki-1.0.0/misc/plugin/pagerank.rb000066400000000000000000000243451212533356300170150ustar00rootroot00000000000000# # PageRank Hiki plugin ver 0.1.9 # # author: ichiyama ryoichi # site: http://kumiki.c.u-tokyo.ac.jp/~ichiyama/cgi-bin/hiki/PageRankPlugin.html # date: 2004/02/20 # # [@options configuration] # @options["pagerank.algorithm"]: "google-original" or "eigenvalue" # PageRank algorithm choice: default "google-original" # google-original: PR(A) = (1-d) + d(PR(t1)/C(t1) + ... + PR(tn)/C(tn)) # eigenvalue: PR(A) = 1 + PR(t1)/C(t1) + ... + PR(tn)/C(tn) # # @options["pagerank.dvalue"]: Float value # d value in google-original: default 0.85 # # @options["pagerank.tablealign"]: "center" or "left" or "right" # PageRank table alignment in PageRank page: default "left" # # @options["pagerank.rankformat"]: sprintf format string # PageRank table: default "%2.6f" # # @options["pagerank.pagetitle"]: string # PageRank page title: default "PageRank: #{@conf.site_name}" # # @options["pagerank.showfrom"]: true or false # show "linked from" column if true: default true # # @options["pagerank.maxpages"]: Integer # Max pages in tables. if nil, show all pages: default nil # # @options["pagerank.showtime"]: true or false # show computing time if true: default false # class PageRank end def PageRank.version '0.1.9' end def PageRank.menu_label 'PageRank' end def PageRank.default_options( conf ) { "pagerank.algorithm" => "google-original", "pagerank.dvalue" => 0.85, "pagerank.tablealign" => "left", "pagerank.rankformat" => "%2.6f", "pagerank.pagetitle" => "PageRank: #{conf.site_name}", "pagerank.showfrom" => true, "pagerank.maxpages" => nil, "pagerank.showtime" => false, } end # Mathematical Algorithms module PageRankAlgorithms # solve simultaneous equations # by gaussian elimination def solve(matrix, value) m = mcopy(matrix) v = value.dup size = v.size vorder = (0...size).to_a convertdim(m, vorder) frontsolve(m, v) backsolve(m, v) sortorder(v, vorder) v end # copy matrix def mcopy(matrix) m = [] matrix.each do |row| m << row.dup end m end # exchange columns as the any diagonal values are none-zero def convertdim(m, vorder) size = vorder.size size.times do |i| if m[i][i] == 0.0 size.times do |j| next if i == j if m[i][j] != 0.0 and m[j][i] != 0.0 swapv(vorder, i, j) swapmc(m, i, j) end end end end end # create upper half triangle def frontsolve(m, v) size = v.size size.times do |i| (i + 1).upto(size - 1) do |j| next if m[j][i] == 0.0 pole = m[j][i] / m[i][i] size.times do |k| m[j][k] -= m[i][k] * pole end v[j] -= v[i] * pole end end end # generate result def backsolve(m, v) size = v.size (size-1).downto(0) do |i| next if m[i][i] == 0.0 v[i] /= m[i][i] size.times do |j| break if i == j v[j] -= m[j][i] * v[i] end end v end # sort as original order def sortorder(value, order) size = order.size (size - 1).downto(0) do |i| i.times do |j| if order[i] < order[j] swapv(order, i, j) swapv(value, i, j) end end end value end # swap values in vector v def swapv(v, i, j) t = v[i] v[i] = v[j] v[j] = t v end # swap matrix column def swapmc(m, i, j) m.each do |row| swapv(row, i, j) end m end # summary of each values in vector v def vsum(v) value = 0.0 v.each do |c| value += c end value end # vector div by b def vdiv(v, b) r = [] v.each do|c| r << c/b end r end # solve PageRank in link matrix # see http://www.kusastro.kyoto-u.ac.jp/~baba/wais/pagerank.html def pagerank(linkmatrix) lm = mcopy(linkmatrix) setdiag(lm, 0) weightingrow(lm) transpose(lm) size = lm.size setdiag(lm, -1.0) v = [-1.0] * size frontsolve(lm, v) backsolve(lm, v) r = vdiv(v, vsum(v)) r end # set diagonal line values as v def setdiag(m, v) m.size.times do |i| m[i][i] = v end m end # matrix of weighted values in each rows def weightingrow(linkmatrix) size = linkmatrix.size size.times do |i| row = linkmatrix[i] weight = vsum(row) next if weight == 0 size.times do |j| c = row[j] row[j] = if c == 0 then 0.0 else c.to_f / weight end end end end # transpose matrix def transpose(m) size = m.size size.times do |i| (i + 1).upto(size - 1) do |j| t = m[i][j] m[i][j] = m[j][i] m[j][i] = t end end m end # solve the original PageRank in link matrix # see http://www.sem-research.jp/sem/seo/20031022000321.html def pagerank0(linkmatrix, d=0.85) lm = mcopy(linkmatrix) setdiag(lm, 0) weightingrow(lm) transpose(lm) diagvalue = -1.0 / d setdiag(lm, diagvalue) size = lm.size v = [-(1.0 - d) / d] * size frontsolve(lm, v) backsolve(lm, v) v end # print matrix def pm(matrix) puts "
    "
        matrix.each do |row|
          p row
        end
        puts "
    " end end # PageRank core functions class PageRank include PageRankAlgorithms # get page link matrix def get_link_matrix(page_names, db) size = page_names.size lm = [] size.times do |i| lm << [0] * size end size.times do |i| page_name = page_names[i] ref_names = db.get_references(page_name) size.times do |j| lm[j][i] = 1 if ref_names.include?(page_names[j]) end end lm end # calc pageranks def get_pagerank(page_names, db, options) linkmatrix = get_link_matrix(page_names, db) if options["pagerank.algorithm"] == "eigenvalue" pagerank = pagerank(linkmatrix) else d = options["pagerank.dvalue"] pagerank = pagerank0(linkmatrix, d) end pagerank end # sort page names and pageranks by descending order def sort(page_names, pagerank) size = page_names.size (size - 1).downto(0) do |i| i.times do |j| if pagerank[i] > pagerank[j] swap(page_names, i, j) swap(pagerank, i, j) end end end end # swap array values def swap(a, i, j) t = a[i] a[i] = a[j] a[j] = t a end # pagerank test def test_pagerank_eigen() lm = [[0, 1, 1, 1, 1, 0, 1], [1, 0, 0, 0, 0, 0, 0], [1, 1, 0, 0, 0, 0, 0], [0, 1, 1, 0, 1, 0, 0], [1, 0, 1, 1, 0, 1, 0], [1, 0, 0, 0, 1, 0, 0], [0, 0, 0, 0, 1, 0, 0]] pr = pagerank(lm) pr end end # show pagerank page: called by hiki menu def pagerank_page header = {} header['Last-Modified'] = CGI.rfc1123_date(Time.now) header['type'] = 'text/html' header['charset'] = @conf.charset header['Content-Language'] = @conf.lang header['Pragma'] = 'no-cache' header['Cache-Control'] = 'no-cache' options = PageRank.default_options( @conf ) options.update(@options) stylesheet = @conf.theme_url + "/" + @conf.theme + "/" + @conf.theme + ".css" align = options["pagerank.tablealign"] title = options["pagerank.pagetitle"] sources = %{ #{h(title)}

    #{h(title)}

    #{pagerank()}

    } ::Hiki::Response.new(sources, 200, header) end # print pagerank table def pagerank(pagerank_options = @options) options = PageRank.default_options( @conf ) options.update(pagerank_options) pr = PageRank.new page_names = @db.pages start = Time.now pagerank = pr.get_pagerank(page_names, @db, options) calcsec = Time.now - start pr.sort(page_names, pagerank) get_rank_table(page_names, pagerank, calcsec, options) end # generate HTML table def get_rank_table(page_names, pagerank, calcsec, options) size = page_names.size no = [] showfrom = options["pagerank.showfrom"] rankformat = options["pagerank.rankformat"] maxpages = options["pagerank.maxpages"] showtime = options["pagerank.showtime"] source = %{} source += if showfrom %{} else %{} end size.times do |i| break if i == maxpages no[i] = i + 1 no[i] = no[i - 1] if i > 0 and pagerank[i] == pagerank[i - 1] page = page_names[i] page = hiki_anchor(escape(page), page_name(page)) rank = sprintf(rankformat, pagerank[i]) if showfrom linked_names = @db.get_references(page_names[i]).collect do |linked_name| hiki_anchor(escape(linked_name), page_name(linked_name)) end linked = linked_names.join(", ") source += %{} else source += %{} end end source += %{
    No.PageRankLinked from
    No.PageRank
    #{no[i].to_s}#{page}#{rank}#{linked}
    #{no[i].to_s}#{page}#{rank}
    } source += %{
    Top #{no.size} of #{size} pages
    } if no.size < size source += %{
    computing time: #{calcsec.to_s} sec.
    } if showtime source end # append hiki menu add_body_enter_proc(Proc.new do add_plugin_command('pagerank_page', PageRank.menu_label, {}) end) # history # 0.1.9: add options "pagerank.showtime", refine code # 0.1.8: add options "pagerank.showfrom" and "pagerank.maxpages" # 0.1.7: use page_name() builtin function as table view # 0.1.6: optimization 0 value in frontsolve # 0.1.5: add "Linked from" list # 0.1.4: self links are ignored # 0.1.3: fix array creation miss # 0.1.2: use options # 0.1.1: fix link matrix generate method # 0.1: newly create plugin export_plugin_methods(:pagerank_page) hiki-1.0.0/misc/plugin/quote_page.rb000066400000000000000000000010131212533356300173410ustar00rootroot00000000000000# $Id: quote_page.rb,v 1.5 2005-12-28 22:42:55 fdiary Exp $ # Copyright (C) 2003 OZAWA Sakuro add_body_enter_proc { @quote_page_quoted = [] '' } def quote_page(name, top_wanted=1) unless @quote_page_quoted.include?(name) @quote_page_quoted << name tokens = @conf.parser.new(@conf).parse(@db.exist?(name) ? @db.load(name) : %Q|[[#{name}]]|, top_wanted.to_i + 1) @conf.formatter.new(tokens, @db, self, @conf).to_s else '' end end export_plugin_methods(:quote_page) hiki-1.0.0/misc/plugin/rank.rb000066400000000000000000000011311212533356300161440ustar00rootroot00000000000000# $Id: rank.rb,v 1.6 2006-08-04 15:34:14 fdiary Exp $ # Copyright (C) 2002-2003 TAKEUCHI Hitoshi def rank( n = 20 ) n = n > 0 ? n : 0 l = @db.page_info.sort do |a, b| b[b.keys[0]][:count] <=> a[a.keys[0]][:count] end s = "
      \n" c = 1 l.each do |a| break if c > n name = a.keys[0] p = a[name] t = "#{page_name(name)} (#{p[:count]})" an = hiki_anchor(escape(name), t) s << "
    • #{an}\n" c = c + 1 end s << "
    \n" s end if @command == 'view' add_body_leave_proc do @db.increment_hitcount( @page ) '' end end hiki-1.0.0/misc/plugin/rbl.rb000066400000000000000000000007011212533356300157720ustar00rootroot00000000000000require "resolv" def postable? dnsbl_list = (@conf['rbl.dnsbl_list'] || '').split if dnsbl_list.empty? dnsbl_list = ["niku.2ch.net"] end address = ENV['REMOTE_ADDR'] ip = address.scan(/\d+/).reverse.join(".") dnsbl_list.each do |dnsbl| begin Resolv.getaddress( "#{ip}.#{dnsbl}" ) STDERR.puts "RBL : #{address}" return false rescue Resolv::ResolvError rescue Exception end end return true end hiki-1.0.0/misc/plugin/readlirs.rb000066400000000000000000000051661212533356300170320ustar00rootroot00000000000000# $Id: readlirs.rb,v 1.6 2005-06-27 07:38:08 fdiary Exp $ # Copyright (C) 2003 yoshimi def readlirs( url, n = 20, style=1, cache_time = 1800, tf="%Y/%m/%d %H:%m" ) n = 20 unless n.respond_to?(:integer?) n = n > 0 ? n : 200 style = 1 unless n.respond_to?(:integer?) if lirs = readlirs_get(url, cache_time) items = readlirs_sort(lirs) s = "
      \n" c = 1 items.each do |line| break if c > n data = line.split(/,/) case style when 1 an = "#{Time.at(data[1].to_i).strftime(tf)} #{h(data[6])} #{h(data[7])}" if style when 2 an = "#{Time.at(data[1].to_i).strftime(tf)}
      #{h(data[6])}" when 3 an = "#{h(data[6])}" else an = "#{Time.at(data[1].to_i).strftime(tf)} #{h(data[6])} #{h(data[7])}" if style end s << "
    1. #{an}
    2. \n" c = c + 1 end s << "
    \n" s else '' end end def readlirs_get(url, cache_time) if /^(https?:\/\/)(.+?)(\/.*)/ =~ url Dir.mkdir("#{@cache_path}/readlirs") unless File.exist?("#{@cache_path}/readlirs") cache_file = "#{@cache_path}/readlirs/#{escape(url)}".untaint begin readlirs_recent_cache(url, cache_file, cache_time) raise unless File.readable?(cache_file) open(cache_file).read rescue Exception nil end else open(url).read end end def readlirs_recent_cache(url, cache_file, cache_time) begin raise if Time.now > File.mtime(cache_file) + cache_time rescue begin require 'net/http' port = 80 host = '' path = '' proxy_host = nil proxy_port = nil if /^([^:]+):(\d+)$/ =~ @options['readlirs.proxy'] then proxy_host = $1 proxy_port = $2.to_i end if url =~ /(https?:\/\/)(.+?)(\/.*)/ host = $2.untaint path = $3 end Net::HTTP.Proxy( proxy_host, proxy_port ).start( host, port ) do |http| response , = http.get(path) readlirs_write_cache(cache_file, response.body) end rescue $stderr.puts $!, $@.join("\n") nil end end end def readlirs_write_cache(cache_file, lirs) File.open(cache_file, 'w') do |f| f.flock(File::LOCK_EX) f.puts lirs f.flock(File::LOCK_UN) end end def readlirs_sort(lirs) lirs.sort do |a, b| b.split(/,/)[1].to_i <=> a.split(/,/)[1].to_i end end export_plugin_methods(:readlirs) hiki-1.0.0/misc/plugin/recent2.rb000066400000000000000000000014261212533356300165620ustar00rootroot00000000000000# $Id: recent2.rb,v 1.3 2004-12-14 16:12:33 fdiary Exp $ # Copyright (C) 2003 not def recent2( n = 20 ) n = n > 0 ? n : 0 now = Time.now l = @db.page_info.sort do |a, b| b[b.keys[0]][:last_modified] <=> a[a.keys[0]][:last_modified] end s = "
      \n" l[0..n-1].each do |a| name = a.keys[0] p = a[name] tm = p[:last_modified ] tp = now - tm if tp < 3600 then ps = "#{(tp / 60).to_i}m" elsif tp < 86400 then ps = "#{(tp / 3600).to_i}h" else ps = "#{(tp / 86400).to_i}d" end cur_date = tm.strftime( @conf.msg_date_format ) t = page_name(name) an = hiki_anchor(escape(name), t) s << "
    • #{an} (#{ps})\n" end s << "
    \n" s end hiki-1.0.0/misc/plugin/referer.rb000066400000000000000000000056701212533356300166570ustar00rootroot00000000000000# coding: utf-8 # $Id: referer.rb,v 1.13 2006-07-21 07:36:37 znz Exp $ # Copyright (C) 2003 TAKEUCHI Hitoshi require 'hiki/db/ptstore' def add_referer(db) begin raise unless @db.exist?(@page) omit_url = false if @options['referer.omit_url'] && @request.referer omit_url = Regexp.new("(#{@options['referer.omit_url'].join('|')})") =~ @request.referer end raise if 'HEAD' == @request.request_method || ! @request.referer || /^https?/ !~ @request.referer || omit_url db.transaction do db[@request.referer] = (db.root?(@request.referer) ? db[@request.referer] : 0) + 1 end rescue Exception end end def referers(db) db.transaction(true) do db.roots.collect do |p| [p, db[p]] end.sort do |a,b| b[1] <=> a[1] end end end def show_short_referer(db) s = %Q!
    #{referer_short_label} |! referers(db).each_with_index do |ref, i| break if i == @options['referer_limit'] disp = h(replace_url(unescape(ref[0]))) s << make_anchor("#{h(ref[0])}", " #{ref[1]}").gsub(/]+)>/i) { %Q!! } s << ' |' end s << '
    ' end def show_referer(db) s = %Q!
    #{referer_long_label}
      ! referers(db).each_with_index do |ref, i| break if i == @options['referer_limit'] disp = h(replace_url(unescape(ref[0]))) s << %!
    • #{ref[1]} ! + make_anchor("#{h(ref[0])}", "#{disp}") + "
    • " end s << '
    ' end def referer_path "#{@cache_path}/referer" end def referer_map path = referer_path s = '' return s unless File.exist?(path) s << "
      \n" Dir.entries(path).sort {|a, b| unescape(a) <=> unescape(b) }.each do |f| next if /(?:^\.)|(?:~$)/ =~ f next unless @db.exist?(unescape(f.untaint)) db = PTStore.new("#{path}/#{f}") p = File.basename(f) s << "
    • #{hiki_anchor(p, page_name(unescape(p)))}
    • \n" s << "
        \n" referers(db).each_with_index do |ref, i| break if i == @options['referer_limit'] disp = h(replace_url(unescape(ref[0]))) s << %!
      • #{ref[1]} ! + make_anchor("#{h(ref[0])}", "#{disp}")+"
      • " end db.close_cache s << "
      \n" end s << "
    \n" end def replace_url(url) replace_list = @options['referer.replace_url'] return url unless replace_list replaced_url = url replace_list.each do |list| rep_url, rep_str = list.split(' ') replaced_url = url.sub(Regexp.new(rep_url), rep_str) break if url != replaced_url end replaced_url end add_body_leave_proc(Proc.new do begin Dir.mkdir(referer_path) unless File.exist?(referer_path) file_name = "#{referer_path}/#{escape(@page).to_euc}" db = PTStore.new(file_name) add_referer(db) case @options['referer.display_type'] when 'none' when 'long' show_referer(db) else show_short_referer(db) end rescue Exception end end) export_plugin_methods(:referer_map) hiki-1.0.0/misc/plugin/rss-show.rb000066400000000000000000000034241212533356300170050ustar00rootroot00000000000000# $Id: rss-show.rb,v 1.11 2005-09-26 13:35:05 fdiary Exp $ # Copyright (C) 2003 TAKEUCHI Hitoshi require 'rss/1.0' require 'rss/2.0' def rss_show(url, cache_time = 1800, number = 5) if rss = rss_get(url.untaint, cache_time) items = RSS::Parser.parse(rss, false).items rss_format_items(items[0...number]) else '' end end def rss_get(url, cache_time) Dir.mkdir("#{@cache_path}/rss-show") unless File.exist?("#{@cache_path}/rss-show") cache_file = "#{@cache_path}/rss-show/#{escape(url)}".untaint begin rss_recent_cache(url, cache_file, cache_time) raise unless File.readable?(cache_file) open(cache_file).read rescue Exception nil end end def rss_recent_cache(url, cache_file, cache_time) begin raise if Time.now > File.mtime(cache_file) + cache_time rescue begin require 'net/http' port = 80 host = '' path = '' proxy_host = nil proxy_port = nil if /^([^:]+):(\d+)$/ =~ @options['rss.proxy'] then proxy_host = $1 proxy_port = $2.to_i end if url =~ /(https?:\/\/)(.+?)(\/.*)/ host = $2 path = $3 end Net::HTTP.Proxy( proxy_host, proxy_port ).start( host, port ) do |http| response , = http.get(path) rss_write_cache(cache_file, response.body) end rescue nil end end end def rss_format_items(items) html = "
      \n" items.each do |i| page = utf8_to_euc( i.title ) url = utf8_to_euc( i.link ) html << "
    • #{make_anchor(h(url), h(unescape_html(page)))}
    • \n" end html << "
    \n" end def rss_write_cache(cache_file, rss) File.open(cache_file, 'w') do |f| f.flock(File::LOCK_EX) f.puts rss f.flock(File::LOCK_UN) end end export_plugin_methods(:rss_show) hiki-1.0.0/misc/plugin/rss.rb000066400000000000000000000110641212533356300160260ustar00rootroot00000000000000# $Id: rss.rb,v 1.23 2008-07-06 02:40:43 hsbt Exp $ # Copyright (C) 2003-2004 TAKEUCHI Hitoshi # Copyright (C) 2005 Kazuhiko def rss_body(page_num = 10) pages = @db.page_info.sort do |a, b| k1 = a.keys[0] k2 = b.keys[0] b[k2][:last_modified] <=> a[k1][:last_modified] end n = 0 item_list = '' last_modified = pages[0].values[0][:last_modified] items = < #{h(@conf.site_name)} : #{label_rss_recent} #{@conf.index_url}?c=recent #{h(@conf.site_name)} #{label_rss_recent} ja Copyright (C) #{h(@conf.author_name)} #{last_modified.utc.strftime('%Y-%m-%dT%H:%M:%S+00:00')} EOS pages.each do |p| break if (n += 1) > page_num name = p.keys[0] src = @db.load_backup(name) || '' dst = @db.load(name) || '' case @conf['rss.mode'] when 1 content = word_diff(src, dst, true).strip.gsub(/\n/, "
    \n") when 2 content = word_diff(src, dst).strip.gsub(/\n/, "
    \n") when 3 tokens = @db.load_cache( name ) unless tokens parser = @conf.parser.new( @conf ) tokens = parser.parse( @db.load( name ) ) @db.save_cache( name, tokens ) end tmp = @conf.use_plugin @conf.use_plugin = false formatter = @conf.formatter.new( tokens, @db, Plugin.new( @conf.options, @conf), @conf ) content = formatter.to_s @conf.use_plugin = tmp else content = unified_diff(src, dst).strip.gsub(/\n/, "
    \n").gsub(/ /, ' ') end if content and content.empty? content = shorten(dst).strip.gsub(/\n/, "
    \n") end items << ' ' uri = "#{@conf.index_url}?#{escape(name)}" items << %Q!\n! item_list << < #{h(page_name(name))} #{uri} #{p[name][:last_modified].utc.strftime('%Y-%m-%dT%H:%M:%S+00:00')} EOS item_list << " #{content}]]>" if content item_list << ' ' end items << <
    EOS items << item_list << '
    ' return( [items, last_modified] ) end def rss body, last_modified = rss_body header = {} require 'time' begin if_modified_since = Time.parse(ENV['HTTP_IF_MODIFIED_SINCE']) rescue if_modified_since = nil end if if_modified_since and last_modified <= if_modified_since header['status'] = 'NOT_MODIFIED' return ::Hiki::Response.new('', 304, header) else header['Last-Modified'] = CGI.rfc1123_date(last_modified) header['type'] = 'text/xml' header['charset'] = @conf.charset header['Content-Language'] = @conf.lang header['Pragma'] = 'no-cache' header['Cache-Control'] = 'no-cache' return ::Hiki::Response.new(body, 200, header) end end add_body_enter_proc(Proc.new do @conf['rss.mode'] ||= 0 if @conf['rss.menu'] == 1 add_plugin_command('rss', nil) else add_plugin_command('rss', 'RSS') end end) add_header_proc(Proc.new do %Q! ! end) def saveconf_rss if @mode == 'saveconf' then @conf['rss.mode'] = @request.params['rss.mode'].to_i end end if @request.params['conf'] == 'rss' && @mode == 'saveconf' @conf['rss.menu'] = @request.params['rss.menu'].to_i end add_conf_proc('rss', label_rss_config) do saveconf_rss str = <<-HTML

    #{label_rss_mode_title}

    \n" str << <<-HTML

    #{label_rss_menu_title}

    \n" str end export_plugin_methods(:rss) hiki-1.0.0/misc/plugin/search.rb000066400000000000000000000011411212533356300164570ustar00rootroot00000000000000# search.rb - search plugin for Hiki # Usage: just only {{search_form}} in your page. # See http://www.usability.gr.jp/alertbox/20010513.html in detail. # Copyright (C) 2003 Hajime BABA def search_form < EOS end export_plugin_methods( :search_form ) unless respond_to?( :search ) alias :search :search_form export_plugin_methods( :search, :search_form ) end hiki-1.0.0/misc/plugin/show_plugins.rb000066400000000000000000000002741212533356300177410ustar00rootroot00000000000000# $Id: show_plugins.rb,v 1.2 2006-02-18 06:00:35 yanagita Exp $ # Copyright (C) 2005 Kouhei Yanagita # implemented in 01sp.rb export_plugin_methods(:show_plugins) hiki-1.0.0/misc/plugin/similarity.rb000066400000000000000000000007211212533356300174030ustar00rootroot00000000000000# $Id: similarity.rb,v 1.3 2004-03-04 06:15:19 hitoshi Exp $ def similarity(style, permalink) s = <<"EOS"
    EOS end hiki-1.0.0/misc/plugin/sitemap.rb000066400000000000000000000014721212533356300166630ustar00rootroot00000000000000# $Id: sitemap.rb,v 1.5 2005-09-30 11:45:49 fdiary Exp $ # Copyright (C) 2003 TAKEUCHI Hitoshi def sitemap(page = 'FrontPage') @map_path = [] @map_traversed = [] @map_str = '' return '' unless @db.exist?(page) @map_str = "
      \n" sitemap_traverse(page) @map_str << "
    \n" end def sitemap_traverse(page) info = @db.info(page) return if @map_path.index(page) or !info @map_path.push page @map_str << "
  • #{hiki_anchor(escape(page), "#{page_name(page)}")}
  • \n" unless @map_traversed.index(page) referer = info[:references].sort if referer.size > 0 @map_str << "
      \n" referer.each do |r| sitemap_traverse(r) end @map_str << "
    \n" end @map_traversed << page end @map_path.pop end export_plugin_methods(:sitemap) hiki-1.0.0/misc/plugin/src.rb000066400000000000000000000020541212533356300160050ustar00rootroot00000000000000# $Id: src.rb,v 1.9 2007-01-12 02:27:19 fdiary Exp $ # Copyright (C) 2003 TAKEUCHI Hitoshi def src sources = < #{h(page_name(@page))}
    EOS page = @db.load( @page ) sources << (page ? h(page).gsub(/\n/, "
    \n").gsub(/ /, ' ') : 'load error.') sources << < EOS header = {} header['Last-Modified'] = CGI.rfc1123_date(Time.now) header['type'] = 'text/html' header['charset'] = @conf.charset header['Content-Language'] = @conf.lang header['Pragma'] = 'no-cache' header['Cache-Control'] = 'no-cache' ::Hiki::Response.new(sources, 200, header) end add_body_enter_proc(Proc.new do add_plugin_command('src', src_label, {'p' => true}) end) hiki-1.0.0/misc/plugin/template.rb000066400000000000000000000052421212533356300170330ustar00rootroot00000000000000# $Id: template.rb,v 1.6 2005-09-30 11:45:49 fdiary Exp $ # Copyright (C) 2003 TAKEUCHI Hitoshi # def templates keyword = @options['template.keyword'] if keyword @db.select {|p| p[:keyword] and p[:keyword].index(keyword)} else @db.select {|p| true} end end def template_form pages = templates.sort {|a,b| a.downcase <=> b.downcase} unless pages.empty? s = < #{template_label}:
    EOS else '' end end def load_template tmpl_name = @request.params['template'] page = @request.params['p'] ? @request.params['p'] : 'FrontPage' @text = if tmpl_name @db.load(tmpl_name) else '' end end add_edit_proc { if @text.size == 0 tmpl = @options['template.default'] tmpl = templates[0] if !tmpl and templates.size == 1 @text = @db.load(tmpl) if tmpl and @options['template.autoinsert'] end template_form } export_plugin_methods(:load_template) def saveconf_template if @mode == 'saveconf' then @conf['template.default'] = @request.params['template.default'] && @request.params['template.default'].empty? ? nil : @request.params['template.default'] @conf['template.keyword'] = @request.params['template.keyword'].empty? ? nil : @request.params['template.keyword'] @conf['template.autoinsert'] = @request.params['template.autoinsert'] ? true : false end end add_conf_proc('template', template_label) do saveconf_template str = <<-HTML

    #{label_template_keyword}

    #{label_template_keyword_desc}

    HTML pages = templates.sort {|a,b| a.downcase <=> b.downcase} unless pages.empty? str << <<-HTML

    #{label_template_default}

    #{label_template_default_desc}

    #{label_template_autoinsert}

    #{label_template_autoinsert_desc}

    HTML str end hiki-1.0.0/misc/plugin/todo.rb000066400000000000000000000010271212533356300161620ustar00rootroot00000000000000# $Id: todo.rb,v 1.5 2004-02-15 02:48:35 hitoshi Exp $ # Copyright (C) 2002-2003 TAKEUCHI Hitoshi def todo(p, num = 8) todo_re = /^(\d\d?)\s+(.+)(\d\d\d\d-\d\d-\d\d)?$/ todo_list = [] n = @db.load(unescape_html(p)) || '' n.scan(todo_re) do |i| todo_list << {:priority => $1.to_i, :todo => $2} end todo_list.sort! {|a, b| b[:priority] <=> a[:priority]} s= "" c = 0 todo_list.each do |t| break if (c += 1) > num s << "#{'%02d' % t[:priority]} #{h(t[:todo])}
    \n" end s end hiki-1.0.0/misc/plugin/trackback.rb000066400000000000000000000030211212533356300171360ustar00rootroot00000000000000# $Id: trackback.rb,v 1.14 2006-10-05 06:46:43 fdiary Exp $ # Copyright (C) 2004 Kazuhiko def trackback script_name = ENV['SCRIPT_FILENAME'] base_url = script_name.nil? || script_name.empty? ? '' : File.basename(script_name) <<-EOF
    EOF end def trackback_post params = @request.params url = params['url'] unless 'POST' == @request.request_method && url return redirect(@request, "#{@conf.index_url}?#{h(@page)}") end blog_name = utf8_to_euc( params['blog_name'] || '' ) title = utf8_to_euc( params['title'] || '' ) excerpt = utf8_to_euc( params['excerpt'] || '' ) lines = @db.load( @page ) md5hex = @db.md5hex( @page ) flag = false content = '' lines.each do |l| if /^\{\{trackback\}\}/ =~ l && flag == false content << "#{l}\n" content << %Q!* trackback : #{@conf.parser.link( url, "#{title} (#{blog_name})" )} (#{format_date(Time.now)})\n! content << @conf.parser.blockquote( shorten( excerpt ) ) flag = true else content << l end end save( @page, content, md5hex ) response = <<-END 0 END head = { 'type' => 'text/xml', 'Vary' => 'User-Agent' } head['Content-Length'] = response.size.to_s head['Pragma'] = 'no-cache' head['Cache-Control'] = 'no-cache' ::Hiki::Response.new(response, 200, head) end hiki-1.0.0/misc/text/000077500000000000000000000000001212533356300143565ustar00rootroot00000000000000hiki-1.0.0/misc/text/default.de/000077500000000000000000000000001212533356300163715ustar00rootroot00000000000000hiki-1.0.0/misc/text/default.de/FrontPage000066400000000000000000000013611212533356300202020ustar00rootroot00000000000000! Welcome to Hiki Dies ist die FrontPage von [[Hiki|http://hikiwiki.org/en/]]. Wenn Sie diese Seite sehen k旦nnen, haben Sie die Installation erfolgreich abgeschlosssen. ! Wichtig: Bevor Sie anfangen Wählen Sie das [Admin] Men端 und setzten Sie ein Passwort f端r den Administrator. Nur der Administrator kann Seiten einfrieren (was bedeutet, das nur ein Administrator diese Seite weiter bearbeiten kann) und wieder 'auftauen'. ! Hiki Format Die Formatierung von Hiki ist 辰hnlich dem des Originals. Wenn Sie bereits Kenntnisse 端ber die Editierung von Wikis verf端gen, k旦nnen Sie diese ganz einfach hier anwenden. Jedoch wurden einige Regeln hinzugef端gt. Beachten sie die [[Formatierungsregeln|TextFormattingRules]] f端r weitere Informationen.hiki-1.0.0/misc/text/default.de/InterWikiName000066400000000000000000000011571212533356300210260ustar00rootroot00000000000000*[[AsWiki|http://www.assist.media.nagoya-u.ac.jp/ASDP/aswiki.cgi/]] euc *[[GoogleJ|http://www.google.com/search?num=50&lr=lang_ja&q=]] sjis *[[Hiki|http://hikiwiki.org/en/$1.html]] euc *[[Image|http://images.google.co.jp/images?hl=ja;btnG=Google?hl=ja;btnG=Google+%8C%9F%8D%F5;q=]] sjis *[[ruby-list|http://blade.nagaokaut.ac.jp/cgi-bin/scat.rb/ruby/ruby-list/]] *[[RAA|http://raa.ruby-lang.org/project/$1/]] *[[RWiki|http://pub.cozmixng.org/~the-rwiki/?cmd=view;name=]] euc *[[Tiki|http://todo.is.os-omicron.org/tiki.cgi?c=v;p=]] euc *[[WikiWikiWeb|http://www.c2.com/cgi/wiki?]] *[[Ruby|http://www.ruby-lang.org/]] alias hiki-1.0.0/misc/text/default.de/SideMenu000066400000000000000000000000401212533356300200170ustar00rootroot00000000000000! Letzte nderungen {{recent}} hiki-1.0.0/misc/text/default.de/TextFormattingRules000066400000000000000000000165431212533356300223170ustar00rootroot00000000000000{{toc}} !Note * bersetzt aus dem Englischen von Kashia Buch, 2005-08-01 * bersetzt aus dem Japanischen von Steve Brumbaugh, 22 November 2004 ! Abs辰tze * Fortlaufende Zeilen werden in einen einzigen Absatz zusammengefasst. * Leere Zeilen (solche mit nur einem Return oder Leerzeichen bzw. Tabs) markieren das eine eines Absatzes. * Beispiel Zum Beispiel, wenn ich so schreibe, diese Zeilen werden als ein einziger Absatz angesehen. * Beispiel Ausgabe Zum Beispiel, wenn ich so schreibe, diese Zeilen werden als ein einziger Absatz angesehen. ! Links !! WikiNamen * WikiNamen bestehen aus zwei oder mehr Worten zusammen; jedes beginnend mit einem Grobuchstaben gefolgt von mindestens einem Kleinbuchstaben oder einer Nummer. * Worte, die diesen Konditionen gerecht werden, werden zu WikiNamen, und ein Link wird automatisch angeh辰ngt. * Beispiel WikiName - WikiName HogeRule1 - WikiName NOTWIKINAME - Alle Buchstaben sind Grobuchstaben, dies ist kein WikiName WikiNAME - Alle Buchstaben in NAME sind Grobuchstaben, dies ist ebenfalls kein WikiName fooWikiName - Dieses beginnt mit foo, welches nur aus Kleinbuchstaben besteht, also ist dies ebenfalls kein WikiName *Beispiel Ausgabe ** WikiName - WikiName ** HogeRule1 - WikiName ** NOTWIKINAME - Alle Buchstaben sind Grobuchstaben, dies ist kein WikiName ** WikiNAME - Alle Buchstaben in NAME sind Grobuchstaben, dies ist ebenfalls kein WikiName ** fooWikiName - Dieses beginnt mit foo, welches nur aus Kleinbuchstaben besteht, also ist dies ebenfalls kein WikiName !! Zu anderen Wiki Seiten linken Wenn ein Seitenname mit zwei eckigen Klammern umschlossen ist, wird er zu einem Link zu dieser Seite. * Beispiel Zum Beispiel, wenn du [[TextFormattingRules]] schreibst, wird dies zu einem Link zu dieser Seite. * Beispiel Ausgabe Zum Beispiel, wenn du [[TextFormattingRules]] schreibst, wird dies zu einem Link zu dieser Seite. !! Zu einer normalen URL linken Normaler Text, seperiert von einer URL mit einer Pipe (|) innerhalb von eckigen Klammern, wird zu einem Link zu der angegebenen URL. * Beispiel Links wie [[Yahoo!|http://www.yahoo.com/]] sind auch m旦glich. * Beispiel Ausgabe Links wie [[Yahoo!|http://www.yahoo.com/]] sind auch m旦glich. In dem Falle das die URL mit .jpg, .jpeg, .png oder .gif aufh旦rt, wird das Bild auf der Seite angezeigt, der Text vor dem Link wird dann zum ALT text f端r das Bild. * Beispiel [[Four-leaf clover|http://jp.rubyist.net/theme/clover/clover_h1.png]] * Beispiel Ausgabe [[Four-leaf clover|http://jp.rubyist.net/theme/clover/clover_h1.png]] Ein Text in einem Absatz, der so aussieht wie eine URL, wird mit einem Link hinterlegt. * Beispiel Hiki's homepage ist http://hikiwiki.org/en/ (Englisch). * Beispiel Ausgabe Hiki's Homepage ist http://hikiwiki.org/en/ (Englisch). !! InterWiki InterWiki ist m旦glich, indem man [[Tiki:Tiki]] schreibt. Um einen Server hinzuzuf端gen, editiert man InterWikiName. * Beispiel * [[ruby-talk:1]] * [[Google:ruby wiki]] * Beispiel Ausgabe ** [[ruby-talk:1]] ** [[Google:ruby wiki]] ! Vorvormatierter Text * Zeilen die mit Leerzeichen oder Tabs anfangen werder als vorformatierter Text behandelt. * Beispiel Ausgabe require 'cgi' cgi = CGI::new cgi.header puts < Hello!

    Hello!

    EOS ! Text decoration * Text eingeschlossen von jeweils zwei einfachen Anf端hrungszeichen ('') wird kursiv. * Text eingeschlossen von jeweils drei einfachen Anf端hrungszeichen (''') wird fett. * Text eingeschlossen von jeweils zwei Gleich-Zeichen (==) wird durchgestrichen. * Beispiel Wenn man so schreibt, wird es ''kursiv''. Und wenn man es so schreibt, wird der Text '''fett'''. ==Das ist dumm, aber== Und durchgestrichener Text ist auch m旦glich! * Beispiel Ausgabe Wenn man so schreibt, wird es ''kursiv''. Und wenn man es so schreibt, wird der Text '''fett'''. ==Das ist dumm, aber== Und durchgestrichener Text ist auch m旦glich! ! berschriften * Zeilen mit Anf端hrungszeichen am Anfang werden berschriften. * Man kann bis zu f端nf Ausrufezeichen setzen; sie werden zu

    bis

    Tags convertiert. * Beispiel ! Heading1 !! Heading2 !!! Heading3 !!!! Heading4 !!!!! Heading5 * Beispiel Ausgabe ! Heading1 !! Heading2 !!! Heading3 !!!! Heading4 !!!!! Heading5 ! Horizontale Linien Vier Bindestriche am Anfang (----) werden zu einer Horizontalen Linie. * Beispiel A B C D E ---- F G H I J * Beispiel Ausgabe A B C D E ---- F G H I J ! Listen * Zeilen beginnend mit Sternchen (*) werden zu Listenpunkten. * Es ist m旦glich bis zu drei Sternchen nebeneinander zu setzen, so ist es m旦glich verschachtelte Listen zu erstellen. * Zeilen mit Gattern (#) am Anfang werden zu Aufz辰hlungen. * Beispiel * Item 1 ** Item 1.1 ** Item 1.2 *** Item 1.2.1 *** Item 1.2.2 *** Item 1.2.3 ** Item 1.3 ** Item 1.4 * Item 2 # Item 1 # Item 2 ## Item 2.1 ## Item 2.2 ## Item 2.3 # Item 3 ## Item 3.1 ### Item 3.1.1 ### Item 3.1.2 * Beispiel Ausgabe * Item 1 ** Item 1.1 ** Item 1.2 *** Item 1.2.1 *** Item 1.2.2 *** Item 1.2.3 ** Item 1.3 ** Item 1.4 * Item 2 # Item 1 # Item 2 ## Item 2.1 ## Item 2.2 ## Item 2.3 # Item 3 ## Item 3.1 ### Item 3.1.1 ### Item 3.1.2 ! Zitate Zeilen beginnend mit Doppelten Anf端hrungszeichen werden zu Zitaten. * Beispiel ""Das ist ein Zitat. ""Das ist noch ein Zitat. ""Dies ist ein fortgesetztes Zitat. Wenn die Anf端hrungszeichen fortlaufend sind ""Werden sie als ein einziges Zitat angesehen, ""wie dieses. * Beispiel Ausgabe ""Das ist ein Zitat. ""Das ist noch ein Zitat. ""Dies ist ein fortgesetztes Zitat. Wenn die Anf端hrungszeichen fortlaufend sind ""Werden sie als ein einziges Zitat angesehen, ""wie dieses. ! Definitionen Zeilen beginnend mit einem Doppelpunk und einer Phrase mit anschliessend einem weiteren Doppelpunkt werden zu Definitionen. * Beispiel :ringo:apple :gorira:gorilla :rakuda:camel * Beispiel Ausgabe :ringo:apple :gorira:gorilla :rakuda:camel ! Tabellen Tabellen Beginnen mit zwei vertikalen Strichen. Ein f端hrendes Ausrufezeichen in einer Zelle gibt an, das es sich um eine berschriften-Zelle handelt. Um mehrere Zeilen oder Reihen zusammenzuf端gen, schreibe '>' (Spalten) oder '^' (Reihen) am anfang der Zelle. * Beispiel ||!Reihen端berschrift \ Spalten端berschrift||!Spalte A||!Spalte B||!Spalte C||!>Spalte D-E (horizontale verbindung) ||!Reihe 1||A1||B1||^C1-C2 (vertikale verbindung)||D1||E1 ||!Reihe 2||A2||B2||^>D2-E2-D3-E3 (vertikale and horizontal verbindung) ||!Reihe 3||>>A3-C3 (horizontale verbindung) * Beispiel Ausgabe ||!Reihen端berschrift \ Spalten端berschrift||!Spalte A||!Spalte B||!Spalte C||!>Spalte D-E (horizontale verbindung) ||!Reihe 1||A1||B1||^C1-C2 (vertikale verbindung)||D1||E1 ||!Reihe 2||A2||B2||^>D2-E2-D3-E3 (vertikale and horizontal verbindung) ||!Reihe 3||>>A3-C3 (horizontale verbindung) ! Kommentare Zeilen startend mit '//' werden zu Kommentarzeilen. Kommentarzeilen erscheinen nicht auf der Seite. * Beispiel // Das ist eine Kommentarzeile * Beispiel Ausgabe (nicht anzeigbar) // Das ist eine Kommentarzeile ! Plugins * Plugins ruft man auf, indem man zwei geschleifte klammern um einen Ausdruck setzt. * Mehrzeilige Parameter sind erlaubt. * Wenn eine Zeile nichts ausser einem Plugin enth辰lt, wird es zu einem Block-Plugin, dass nicht in einem

    ....

    engeschlossen ist. * Beispiel {{recent(3)}} * Beispiel von mehreren Zeilen {{pre(' ... ')}} hiki-1.0.0/misc/text/default.en/000077500000000000000000000000001212533356300164035ustar00rootroot00000000000000hiki-1.0.0/misc/text/default.en/FrontPage000066400000000000000000000010611212533356300202110ustar00rootroot00000000000000! Welcome to Hiki This is FrontPage of [[Hiki|http://hikiwiki.org/en/]]. If you can see this page, the installation completed successfully, perhaps ;-) ! Before starting (IMPORTANT) Choose [Admin] menu and set password for the administrator. Only an administrator can freeze pages (this means `only an administrator can update') and cancel frozen state. ! Format of Hiki Format of Hiki is similar to the original one. So you can easily write if you know original wiki's format. However, some format is extended originally. See TextFormattingRules for details.hiki-1.0.0/misc/text/default.en/InterWikiName000066400000000000000000000011571212533356300210400ustar00rootroot00000000000000*[[AsWiki|http://www.assist.media.nagoya-u.ac.jp/ASDP/aswiki.cgi/]] euc *[[GoogleJ|http://www.google.com/search?num=50&lr=lang_ja&q=]] sjis *[[Hiki|http://hikiwiki.org/en/$1.html]] euc *[[Image|http://images.google.co.jp/images?hl=ja;btnG=Google?hl=ja;btnG=Google+%8C%9F%8D%F5;q=]] sjis *[[ruby-list|http://blade.nagaokaut.ac.jp/cgi-bin/scat.rb/ruby/ruby-list/]] *[[RAA|http://raa.ruby-lang.org/project/$1/]] *[[RWiki|http://pub.cozmixng.org/~the-rwiki/?cmd=view;name=]] euc *[[Tiki|http://todo.is.os-omicron.org/tiki.cgi?c=v;p=]] euc *[[WikiWikiWeb|http://www.c2.com/cgi/wiki?]] *[[Ruby|http://www.ruby-lang.org/]] alias hiki-1.0.0/misc/text/default.en/SideMenu000066400000000000000000000000351212533356300200350ustar00rootroot00000000000000! Recent 20 pages {{recent}} hiki-1.0.0/misc/text/default.en/TextFormattingRules000066400000000000000000000154641212533356300223320ustar00rootroot00000000000000{{toc}} !Note I still need to do some more editing, but this should be adequate for now. -- Steve Brumbaugh, 22 November 2004 !Paragraphs *Consecutive lines are concatenated into a single paragraph. *Blank lines (ones with only a carriage return or with only spaces and tabs) mark the end of a paragraph. *Example statement For example, if I write like this, these lines will be formatted as one paragraph. *Example output For example, if I write like this, these lines will be formatted as one paragraph. !Links !!WikiNames *WikiNames are comprised of two or more words put together; each word begins with an uppercase letter, and is followed by at least one lowercase letter or number. *Words in which this condition is met become a WikiName, and a link is automatically attached. *Example statement WikiName - WikiName HogeRule1 - WikiName NOTWIKINAME - All of the letters are uppercase, so this is not a WikiName WikiNAME - All of the letters in NAME are uppercase, so this is not a WikiName *fooWikiName - This begins with "foo", which is in all lowercase, so this is not a WikiName *Example output **WikiName - WikiName **HogeRule1 - WikiName **NOTWIKINAME - All of the letters are uppercase, so this is not a WikiName **WikiNAME - All of the letters in NAME are uppercase, so this is not a WikiName **fooWikiName - This begins with "foo", which is in all lowercase, so this is not a WikiName !!Linking to other Wiki pages If a page name is surrounded with two pairs of brackets, it becomes a link to that page. *Example statement For example, if you write [[TextFormattingRules]], it becomes a link to that page. *Example output For example, if you write [[TextFormattingRules]], it becomes a link to that page. !!Linking to an arbitrary URL If a phrase and URL, separated by a vertical line, are surrounded with two pairs of brackets, it becomes a link to an arbitrary URL. *Example statement Links like [[Yahoo!|http://www.yahoo.com/]] are also possible. *Example output Links like [[Yahoo!|http://www.yahoo.com/]] are also possible. In this case, if the URL ends with jpg., .jpeg, .png, or .gif, the image is displayed on the page. (The specified phrase becomes the ALT text for that image.) *Example statement [[Four-leaf clover|http://jp.rubyist.net/theme/clover/clover_h1.png]] *Example output [[Four-leaf clover|http://jp.rubyist.net/theme/clover/clover_h1.png]] Text in a paragraph that looks like a URL will automatically become a link. *Example statement Hiki's home page is http://hikiwiki.org/en/ (English). *Example output Hiki's home page is http://hikiwiki.org/en/ (English). !!InterWiki InterWiki is supported using [[Tiki:Tiki]]. To add a server, edit InterWikiName. *Example statement *[[ruby-talk:1]] *[[Google:ruby wiki]] *Example output **[[ruby-talk:1]] **[[Google:ruby wiki]] !Preformatted text *Lines beginning with spaces or tabs will be treated as preformatted text. *Example output require 'cgi' cgi = CGI::new cgi.header puts < Hello!

    Hello!

    EOS !Text decoration *Text surrounded by sets of two single quotes ('') is emphasized. *Text surrounded by sets of three single quotes (''') is strongly emphasized. *Text surrounded by sets of double equal signs (===) is struck out. *Example statement If you write like this, it becomes ''emphasized''. And if you write like this, it becomes '''strongly emphasized'''. ==This is dull, but== And struck-out text is supported, too! *Example output If you write like this, it becomes ''emphasized''. And if you write like this, it becomes '''strongly emphasized'''. ==This is dull, but== And struck-out text is supported, too! !Headings * Lines with exclamation marks at the beginning become headings. * One can use up to five exclamation marks; they will be converted to

    to

    tags. *Example statement !Heading1 !!Heading2 !!!Heading3 !!!!Heading4 !!!!!Heading5 *Example output !Heading1 !!Heading2 !!!Heading3 !!!!Heading4 !!!!!Heading5 !Horizontal lines Four hyphens at the beginning of the line (----) become a horizontal rule. *Example statement A B C D E ---- F G H I J *Example output A B C D E ---- F G H I J !Lists * Lines beginning with asterisks become list items. * It is possible to use up to three asterisks; it is also possible to create nested lists. * Lines beginning with a # become numbered lists. *Example statement *Item 1 **Item 1.1 **Item 1.2 ***Item 1.2.1 ***Item 1.2.2 ***Item 1.2.3 **Item 1.3 **Item 1.4 *Item 2 #Item 1 #Item 2 ##Item 2.1 ##Item 2.2 ##Item 2.3 #Item 3 ##Item 3.1 ###Item 3.1.1 ###Item 3.1.2 *Example output *Item 1 **Item 1.1 **Item 1.2 ***Item 1.2.1 ***Item 1.2.2 ***Item 1.2.3 **Item 1.3 **Item 1.4 *Item 2 #Item 1 #Item 2 ##Item 2.1 ##Item 2.2 ##Item 2.3 #Item 3 ##Item 3.1 ###Item 3.1.1 ###Item 3.1.2 !Quotations Lines beginning with two double quotes become quotations. *Example statement ""This is a quotation. ""This is another quote. ""This is a continued quote. When there are consecutive quotations, ""they are displayed as one quote, ""like this. *Example output ""This is a quotation. ""This is another quote. ""This is a continued quote. When there are consecutive quotations, ""they are displayed as one quote, ""like this. !Definitions Lines beginning with a colon and have a phrase and explanation separated by another colon will become a definition. *Example statement :ringo:apple :gorira:gorilla :rakuda:camel *Example output :ringo:apple :gorira:gorilla :rakuda:camel ! Tables Tables begin with two vertical bars. Leading `!' in a cell means that it is a heading cell. To concatenate columns or rows, put `>'(columns) or `^'(rows) at head of the cell. * Example statement ||!row heading \ column heading||!column A||!column B||!column C||!>column D-E (horizontal concatenation) ||!row 1||A1||B1||^C1-C2 (vertical concatenation)||D1||E1 ||!row 2||A2||B2||^>D2-E2-D3-E3 (vertical and horizontal concatenation) ||!row 3||>>A3-C3 (horizontal concatenation) * Example output ||!row heading \ column heading||!column A||!column B||!column C||!>column D-E (horizontal concatenation) ||!row 1||A1||B1||^C1-C2 (vertical concatenation)||D1||E1 ||!row 2||A2||B2||^>D2-E2-D3-E3 (vertical and horizontal concatenation) ||!row 3||>>A3-C3 (horizontal concatenation) ! Comments Lines starting with `//' becomes a comment line. Comment lines is not outputted. * Example statement // This is a comment line. * Example output (not displayed) // This is a comment line. !Plugins One can use a plugin by surrounding text with two pairs of brackets. Multiple lines parameter is supported. When a line contains plugin only, it is becomes a block plugin, which is not surrounded by

    ...

    . *Example statement {{recent(3)}} * Example statement of multiple lines {{pre(' ... ')}} hiki-1.0.0/misc/text/rd+/000077500000000000000000000000001212533356300150365ustar00rootroot00000000000000hiki-1.0.0/misc/text/rd+/FrontPage000066400000000000000000000016041212533356300166470ustar00rootroot00000000000000= 帥с障鐚鐚ゃo Wiki潟吾(())FrontPageс 若吾荀ゃ潟鴻若障c障紊(^^; = 篏帥紮鐚荀鐚 若娯[膊∞]≪潟膊∞鴻若荐絎 若吾腟鐚膊∞篁ュ贋違罩≪鐚茹iゃ膊∞粋с障 = Hiki/RD+後ゃ Hiki/RD+後RD≦宍с荅括完(())с (())若吾膩脂≪у幻茵腓冴罸莠荀с 純違若吾絎鴻腟с hiki-1.0.0/misc/text/rd+/InterWikiName000066400000000000000000000011571212533356300174730ustar00rootroot00000000000000*[[AsWiki|http://www.assist.media.nagoya-u.ac.jp/ASDP/aswiki.cgi/]] euc *[[GoogleJ|http://www.google.com/search?num=50&lr=lang_ja&q=]] sjis *[[Hiki|http://hikiwiki.org/ja/$1.html]] euc *[[Image|http://images.google.co.jp/images?hl=ja;btnG=Google?hl=ja;btnG=Google+%8C%9F%8D%F5;q=]] sjis *[[ruby-list|http://blade.nagaokaut.ac.jp/cgi-bin/scat.rb/ruby/ruby-list/]] *[[RAA|http://raa.ruby-lang.org/project/$1/]] *[[RWiki|http://pub.cozmixng.org/~the-rwiki/?cmd=view;name=]] euc *[[Tiki|http://todo.is.os-omicron.org/tiki.cgi?c=v;p=]] euc *[[WikiWikiWeb|http://www.c2.com/cgi/wiki?]] *[[Ruby|http://www.ruby-lang.org/]] alias hiki-1.0.0/misc/text/rd+/SideMenu000066400000000000000000000000341212533356300164670ustar00rootroot00000000000000= 違20篁 {{recent}} hiki-1.0.0/misc/text/rd+/TextFormattingRules000066400000000000000000000067571212533356300207720ustar00rootroot00000000000000= rd+ style荐菴井号 ャ<潟RDц菴違障荅潟(())с (())с(篁蕁(^^;)) == rd+≦宍 === ModuleNames rd+ styleс膂≧Rubyゃ∫cャ<潟茯炊吾с 鴻<純潟障緇c(('(())'))荐c荐菴違綽荀障 号柑鐚鴻API<潟鴻荐с鐚篁ヤ若緇c * 潟 * Hoge::Foo - 劫 * Hoge::FOO - 絎医 * Hoge::Foo#bar - ゃ潟鴻帥潟鴻<純 * Hoge::Foo.bar - 鴻<純 * Hoge.bar - ≪吾ャ若∽ * 潟 * 鴻<純 - "--- Hoge::Foo.new" * ゃ潟鴻帥潟鴻<純 - "--- bar" #<純 罘純篏帥ModuleNames若吾≪吾ャ若荐菴違障 === ≪潟取 ≪潟若RD篏ゆ号HikiInterWiki≦宍InterWiki+罘純篏帥с障 ==== 綣違膣≪潟若号 絽吾RD泣若綵√с (()) (()) * name - 潟腱(ュ純ャ翫url腱違茵腓冴) * url - URL 箴鐚 (()) (()) 篁ヤ腟障 腟鐚 http://www.hoge.com/ hoge URL糸(jpg, jpeg, pngх)IMG帥違絮障 ==== InterWiki篏帥号 InterWiki荀紊吾潟膂≦сс(())篏InterWiki罕罘純сInterWikiName若吾若若脂蚊key荅峨若帥≪潟若障 (()) * name - 潟腱(ュ)ャ翫key茵腓冴障 * key - (InterWikiName若若)InterWikiNameURL絮障 * option - URL菴遵絖(ュ)ユ茯篏帥翫URL潟潟若荐絎障(default莨吾<ゃeuc/sjis/jis絎) 箴鐚 (()) (()) (()) 箴違緇菴違InterWikiName障上篁ヤ腟障 腟鐚 Hiki bibo Linux <帥号荐('/')篏帥翫"(若)ф障 ((<"Ruby/GLib">)) ==== InterWikiName若吾吾 InterWikiName若吾 (('[[keyword|url]]')) charset 若ф吾障 *[[Hiki|http://hikiwiki.org/ja/?]] euc *[[bibo|http://ponx.s5.xrea.com/bibo/?date=]] euc hiki-1.0.0/misc/webrick/000077500000000000000000000000001212533356300150205ustar00rootroot00000000000000hiki-1.0.0/misc/webrick/README000066400000000000000000000003221212533356300156750ustar00rootroot00000000000000! Hikilet WEBrick Hiki 鴻с !! 篏帥 Hiki c hikilet.rb 潟若絎茵 !! 篏 茱水臼綺 hiki-1.0.0/misc/webrick/README.en000066400000000000000000000002531212533356300163010ustar00rootroot00000000000000! Hikilet Hikilet is a script to run Hiki with WEBrick. !! Usage Copy 'hikilet.rb' to the top of hiki directory where 'hiki.cgi' exists. !! Author Kazuhiro NISHIYAMA hiki-1.0.0/misc/webrick/hikilet.rb000077500000000000000000000110251212533356300170000ustar00rootroot00000000000000#!/usr/bin/ruby -Ke # $Id: hikilet.rb,v 1.12 2008-01-06 05:49:30 znz Exp $ # Copyright (C) 2005-2007 Kazuhiro NISHIYAMA require 'hiki/config' require 'thread' require 'webrick/httpservlet/abstract' class Hikilet < WEBrick::HTTPServlet::AbstractServlet DEFOUT = Object.new def DEFOUT.write(s) (Thread.current[:defout]||::STDOUT) << s.to_s end $stdout = DEFOUT class DummyCGI def initialize(req=nil, res=nil) @req, @res = req, res @params = nil @cookies = nil end def request_method @req.request_method end def header(headers) headers.each do |k, v| case k when 'cookie' @res['Set-Cookie'] = v when 'type' @res['Content-Type'] = v else @res[k] = v end end '' # print nothing end def params return @params if @params @params = Hash.new([]) if @req @req.query.each do |k,v| @params[k] = [v] end end @params end def [](key) params[key][0] end def cookies return @cookies if @cookies @cookies = Hash.new([]) @req.cookies.each do |cookie| @cookies[cookie.name] = [cookie.value] end @cookies end end Mutex_of_HTTP_ACCEPT_LANGUAGE = Mutex.new def do_GET(req, res) proc do begin $SAFE = 1 Thread.current[:defout] = '' # ugly hack # can not use Thread.exclusive because Thread.start in load_cgi_conf conf = nil Mutex_of_HTTP_ACCEPT_LANGUAGE.synchronize do saved_HTTP_ACCEPT_LANGUAGE = ENV['HTTP_ACCEPT_LANGUAGE'] ENV['HTTP_ACCEPT_LANGUAGE'] = req['Accept-Language'] conf = Hiki::Config::new ENV['HTTP_ACCEPT_LANGUAGE'] = saved_HTTP_ACCEPT_LANGUAGE end cgi = DummyCGI::new(req, res) db = conf.database db.open_db do cmd = Hiki::Command::new( cgi, db, conf ) cmd.dispatch end res.body, Thread.current[:defout] = Thread.current[:defout], nil if res['location'] res.status = 302 end rescue Exception => err res.status = 500 res['content-type'] = 'text/html' res.body = [ 'Hiki Error', '

    Hiki Error

    ', '
    ',
              CGI.escapeHTML( "#{err} (#{err.class})\n" ),
              CGI.escapeHTML( err.backtrace.join( "\n" ) ),
              '
    ', "
    #{' ' * 500}
    ", '', ].join('') end end.call end def do_HEAD(req, res) do_GET(req, res) end def do_POST(req, res) do_GET(req, res) end end if __FILE__ == $0 require 'webrick' require 'logger' # load conf conf = Hiki::Config::new base_url = URI.parse(conf.base_url) unless base_url.is_a?(URI::HTTP) raise "@base_url must be full http URL (e.g. http://localhost:10080/ ): current base_url=#{conf.base_url.inspect}" end theme_url = base_url + conf.theme_url theme_path = conf.theme_path xmlrpc_enabled = conf.xmlrpc_enabled # release conf (need to load conf each request because content-negotiation) conf = nil # CGI environments emulation ENV['SERVER_NAME'] ||= base_url.host ENV['SERVER_PORT'] ||= base_url.port.to_s logger = WEBrick::Log::new(STDERR, WEBrick::Log::INFO) server = WEBrick::HTTPServer.new({ :Port => base_url.port, :Logger => logger, }) # prepare $LOAD_PATH if FileTest::symlink?( __FILE__ ) org_path = File::dirname( File::expand_path( File::readlink( __FILE__ ) ) ) else org_path = File::dirname( File::expand_path( __FILE__ ) ) end $:.unshift( org_path.untaint, "#{org_path.untaint}/hiki" ) $:.delete(".") if File.writable?(".") # mount hiki if false # use hiki.cgi instead of Hikilet (for debug) server.mount(base_url.path, WEBrick::HTTPServlet::CGIHandler, 'hiki.cgi') else server.mount(base_url.path, Hikilet) end # mount theme if base_url.host == theme_url.host && base_url.port == theme_url.port server.mount(theme_url.path, WEBrick::HTTPServlet::FileHandler, theme_path) end # mount attach.cgi if File.exist?('attach.cgi') server.mount(base_url.path + 'attach.cgi', WEBrick::HTTPServlet::CGIHandler, 'attach.cgi') end if xmlrpc_enabled require 'hiki/xmlrpc' xmlrpc_servlet = XMLRPC::WEBrickServlet.new ::Hiki::XMLRPCHandler.init_handler(xmlrpc_servlet, ::Hikilet::DummyCGI) server.mount('/HikiRPC', xmlrpc_servlet) end trap("INT") {server.shutdown} server.start end hiki-1.0.0/plugin/000077500000000000000000000000001212533356300137355ustar00rootroot00000000000000hiki-1.0.0/plugin/00default.rb000066400000000000000000000213371212533356300160540ustar00rootroot00000000000000# $Id: 00default.rb,v 1.58 2008-06-25 11:15:32 hsbt Exp $ # Copyright (C) 2002-2003 TAKEUCHI Hitoshi #============================== # tDiary plugins for Hiki #============================== def anchor( s ) s.sub!(/^\d+$/, '') p = h(escape(@page)) p.gsub!(/%/, '%%') %Q[#{@conf.cgi_name}?#{p}#{s}] end def my( a, str ) %Q[#{h(str)}] end #============================== # Hiki default plugins #============================== #===== hiki_url def hiki_url(page) "#{@conf.cgi_name}?#{escape(page)}" end #===== hiki_anchor def hiki_anchor( page, display_text ) if page == 'FrontPage' then make_anchor(@conf.cgi_name, display_text) else make_anchor("#{@conf.cgi_name}?#{page}", display_text) end end #===== make_anchor def make_anchor(url, display_text, a_class = nil) if a_class %Q!#{display_text}! else %Q!#{display_text}! end end #===== page_name def page_name( page ) pg_title = @db.get_attribute(page, :title) h((pg_title && pg_title.size > 0) ? pg_title : page) end #===== toc def toc @toc_f = :top '' end def toc_here( page = nil ) if page tokens = @db.load_cache( page ) unless tokens parser = @conf.parser.new( @conf ) tokens = parser.parse( @db.load( page ) ) @db.save_cache( page, tokens ) end formatter = @conf.formatter.new( tokens, @db, Plugin.new( @conf.options, @conf), @conf ) formatter.to_s formatter.toc.gsub( / 0 ? n : 0 l = @db.page_info.sort do |a, b| b[b.keys[0]][:last_modified] <=> a[a.keys[0]][:last_modified] end s = '' c = 0 ddd = nil l.each do |a| break if (c += 1) > n name = a.keys[0] p = a[name] tm = p[:last_modified ] cur_date = tm.strftime( @conf.msg_date_format ) if ddd != cur_date s << "
\n" if ddd s << "
#{cur_date}
\n
    \n" ddd = cur_date end t = page_name(name) an = hiki_anchor(escape(name), t) s << "
  • #{an}
  • \n" end s << "
\n" s end #===== br def br( n = 1 ) '
' * n.to_i end #===== update_proc add_update_proc { updating_mail if @conf.mail_on_update if @user @conf.repos.commit(@page, escape(@user)) else @conf.repos.commit(@page) end } #----- send a mail on updating def updating_mail begin latest_text = @db.load(@page) || '' type = (!@db.text or @db.text.size == 0) ? 'create' : 'update' text = '' text = "#{@db.text}\n#{'-' * 25}\n" if type == 'update' text << "#{latest_text}\n" send_updating_mail(@page, type, text) rescue end end #===== delete_proc add_delete_proc { @conf.repos.delete(@page) } #===== hiki_header add_header_proc { hiki_header } def hiki_header return "#{title}\n" if @conf.mobile_agent? s = < #{title} EOS s << < EOS s end #===== hiki_footer add_footer_proc { hiki_footer } def hiki_footer s = %Q|Generated by
Hiki #{::Hiki::VERSION} (#{::Hiki::RELEASE_DATE}).
\nPowered by Ruby #{RUBY_VERSION}| s << %Q|-p#{RUBY_PATCHLEVEL}| if RUBY_PATCHLEVEL > 0 rescue nil s << %Q| (#{RUBY_RELEASE_DATE})| if /ruby/i =~ ENV['GATEWAY_INTERFACE'] s << ' with mod_ruby' elsif defined?(FCGI) s << ' with ruby-fcgi' end s << %Q|.
\nFounded by #{h(@conf.author_name)}.
\n| end #===== edit_proc add_edit_proc { hiki_anchor(escape(@page), "[#{page_name(@page)}]") } #===== menu def create_menu(data, command) menu = [] if @conf.bot? menu << %Q!#{@conf.msg_index}! else menu << %Q!#{@conf.msg_create}! if creatable? menu << %Q!#{@conf.msg_edit}! if @page && editable? menu << %Q!#{@conf.msg_diff}! if @page && editable? menu << %Q!#{hiki_anchor( 'FrontPage', page_name('FrontPage') )}! menu << %Q!#{@conf.msg_index}! menu << %Q!#{@conf.msg_search}! menu << %Q!#{@conf.msg_recent_changes}! @plugin_menu.each do |c| next if c[:option].has_key?('p') && !(@page && editable?) cmd = %Q!#{c[:display_text]}! menu << cmd end menu_proc.each {|i| menu << i} menu << %Q!#{@conf.msg_login}! unless @user || @conf.password.empty? menu << %Q!#{@conf.msg_admin}! if admin? menu << %Q!#{@conf.msg_logout}! if @user && !@conf.password.empty? end menu end def hiki_menu(data, command) menu = create_menu(data, command) if @conf.mobile_agent? data[:tools] = menu.join('|') else data[:tools] = menu.collect! {|i| %Q!#{i}! }.join(" \n") end end # conf: default def saveconf_default if @mode == 'saveconf' then @conf.site_name = @request.params['site_name'] @conf.author_name = @request.params['author_name'] mails = [] @request.params['mail'].each_line do |addr| mails << addr.gsub(/\r?\n/, '').strip end mails.delete_if{|e| e.empty?} @conf.mail = mails @conf.mail_on_update = @request.params['mail_on_update'] == "true" end end # conf: password def saveconf_password if @mode == 'saveconf' then old_password = @request.params['old_password'] password1 = @request.params['password1'] password2 = @request.params['password2'] if password1 and password1.size > 0 if (@conf.password.size > 0 && old_password.crypt( @conf.password ) != @conf.password) || (password1 != password2) return :password_change_failure end salt = [rand(64),rand(64)].pack("C*").tr("\x00-\x3f","A-Za-z0-9./") @conf.password = password1.crypt( salt ) return :password_change_success end end return nil end # conf: display def saveconf_theme # dummy end if @request.params['conf'] == 'theme' && @mode == 'saveconf' @conf.theme = @request.params['theme'] || '' @conf.use_sidebar = @request.params['sidebar'] == "true" @conf.main_class = @request.params['main_class'] @conf.main_class = 'main' if @conf.main_class == '' @conf.sidebar_class = @request.params['sidebar_class'] @conf.sidebar_class = 'sidebar' if @conf.sidebar_class == '' @conf.auto_link = @request.params['auto_link'] == "true" @conf.use_wikiname = @request.params['use_wikiname'] == "true" @conf.theme_url = @request.params['theme_url'] @conf.theme_path = @request.params['theme_path'] end if @request.params['conf'] == 'theme' @conf_theme_list = [] Dir.glob( "#{@conf.theme_path}/*".untaint ).sort.each do |dir| theme = File.basename( dir ) next unless FileTest.file?( "#{dir}/#{theme}.css".untaint ) name = theme.split( /_/ ).collect{|s| s.capitalize}.join( ' ' ) @conf_theme_list << [theme,name] end end # conf: XML-RPC def saveconf_xmlrpc if @mode == 'saveconf' @conf.xmlrpc_enabled = @request.params['xmlrpc_enabled'] == 'true' end end def auth? true end def editable?( page = @page ) if page auth? && ((!@db.is_frozen?( page ) && !@conf.options['freeze']) || admin?) else creatable? end end def creatable? auth? && (!@conf.options['freeze'] || admin?) end def postable? true end export_plugin_methods(:toc, :toc_here, :recent, :br) hiki-1.0.0/plugin/01sp.rb000066400000000000000000000115711212533356300150520ustar00rootroot00000000000000# 01sp.rb - select-plugins plugin $Revision: 1.6 $ =begin ChangeLog See ../ChangeLog for changes after this. * Thu Aug 28, 2003 zunda - 1.3 - simpler configuration display * Tue Aug 26, 2003 zunda - 1.2 - option defaults are flipped - Typo for @options are fixed * Tue Aug 26, 2003 zunda - 1.1 - English translation * Fri Aug 22, 2003 zunda - 1.1.2.6 - bug fix: check conf mode before updating the options * Fri Aug 22, 2003 zunda - 1.1.2.5 - following options are added: thanks to kaz - @options['select_plugins.hidesource'] - @options['select_plugins.hidemandatory'] - @options['select_plugins.newdefault'] - new plugins are marked in the list until the user configures the selections * Wed Aug 20, 2003 zunda - 1.1.2.1 - first release =end ChangeLog SP_PREFIX = 'sp' *@sp_path = *( @conf["#{SP_PREFIX}.path"] || "#{PATH}/misc/plugin" ) @sp_path = @sp_path.collect do |path| /\/$/ =~ path ? path.chop : path end # get plugin option def sp_option( key ) @conf["#{SP_PREFIX}.#{key}"] end # hash of paths from array of dirs def sp_hash_from_dirs( dirs ) r = {} dirs.each do |dir| Dir.glob( "#{dir}/*.rb" ).each do |path| filename = File.basename( path ) r[filename] ||= path end end r end # url of the document def sp_doc_url( file ) case @conf.lang when 'ja' "http://hikiwiki.org/ja/#{escape(file)}.html" else "http://hikiwiki.org/en/#{escape(file)}.html" end end def collect_plugins( sp_opt ) # categorize the available plugins used = [] notused = [] unknown = [] # File.basenmame needed to read option from 01sp.rb <= 1.10 selected_array = sp_option( 'selected' ) ? sp_option( 'selected' ).split( /\n/ ).collect{ |p| File.basename( p ) } : [] notselected_array = sp_option( 'notselected' ) ? sp_option( 'notselected').split( /\n/ ).collect{ |p| File.basename( p ) } : [] sp_opt.keys.each do |path| if selected_array.include?( path ) then used << path elsif notselected_array.include?( path ) then notused << path else unknown << path end end [used, notused, unknown] end #
  • list of plugins def sp_li_plugins( paths, with_checkbox, is_checked ) paths.collect { |path| File.basename( path ) }.sort.inject('') do |result, file| checkbox = with_checkbox ? %Q!! : '' result << %Q!
  • #{checkbox}#{h(file)}! end end # lists of plugins def sp_list_plugins( sp_opt, with_checkbox ) r = '' if sp_opt.empty? return @sp_label_noplugin else used, notused, unknown = collect_plugins( sp_opt ) # list up r << @sp_label_please_select unless unknown.empty? then r << @sp_label_new r << "
      \n" r << sp_li_plugins( unknown, with_checkbox, sp_option( 'usenew' ) ) r << "
    \n" end # selected plugins unless used.empty? then r << @sp_label_used r << "
      \n" r << sp_li_plugins( used, with_checkbox, true ) r << "
    \n" end # not selected plugins unless notused.empty? then r << @sp_label_notused r << "
      \n" r << sp_li_plugins( notused, with_checkbox, false ) r << "
    \n" end end r end # things needed to configure this plugin if SP_PREFIX == @request.params['conf'] # list of plugins @sp_opt = sp_hash_from_dirs( @sp_path ) # update options # we have to do this when we are eval'ed to update the config menu if /saveconf/ =~ @mode @conf["#{SP_PREFIX}.selected"] = '' @conf["#{SP_PREFIX}.notselected"] = '' @sp_opt.each_key do |file| if 't' == @request.params["#{SP_PREFIX}.#{file}"] @conf["#{SP_PREFIX}.selected"] << "#{file}\n" else @conf["#{SP_PREFIX}.notselected"] << "#{file}\n" end end end end # configuration menu # options are updated when we are eval'ed add_conf_proc( SP_PREFIX, @sp_label ) do r = '' r << @sp_label_description r << sp_list_plugins( @sp_opt, true ) end # Finally, we can eval the selected plugins as tdiary.rb does if sp_option( 'selected' ) sp_option( 'selected' ).untaint.split( /\n/ ).collect{ |p| File.basename( p ) }.sort.each do |filename| @sp_path.each do |dir| path = "#{dir}/#{filename}" if File.readable?( path ) begin load_plugin( path ) @plugin_files << path rescue Exception raise PluginError.new( "Plugin error in '#{path}'.\n#{$!}" ) end break end end end end # The `show_plugins' plugin is enabled in show_plugins.rb def show_plugins used = @conf["#{SP_PREFIX}.selected"].split( /\n/ ).collect{ |p| File.basename( p ) }.sort used.empty? ? '' : "
      \n" + sp_li_plugins( used, false, true ) + "
    \n" end export_plugin_methods() hiki-1.0.0/plugin/02help.rb000066400000000000000000000256761212533356300153740ustar00rootroot00000000000000def help_enabled? (@conf.style == "default" || @conf.style == "math") && !@conf.mobile_agent? end def hiki_help @options['help.tlbr_class'] ||= "helptlbr" @options['help.bttn_class'] ||= "helpbttn" help = < END_HELP help end def help_add_pbttn( help_txt, help_tps, help_pre, help_suf ) return unless help_enabled? add_edit_proc do help = < END_HELP help end end if help_enabled? add_edit_proc do hiki_help end end # export no methods export_plugin_methods hiki-1.0.0/plugin/50bayes_filter.rb000066400000000000000000000235021212533356300171010ustar00rootroot00000000000000# Copyright (C) 2008, KURODA Hiraku # You can redistribute it and/or modify it under GPL2. require "hiki/util" class BayesFilterConfig Hiki = ::Hiki Filter = Hiki::Filter BayesFilter = Hiki::Filter::BayesFilter include Hiki::Util include BayesFilter::Key module Mode SUBMITTED_PAGES = "submitted_pages" SUBMITTED_PAGE_DIFF = "submitted_page_diff" PROCESS_PAGE_DATA = "process_page_data" HAM_TOKENS = "ham_tokens" SPAM_TOKENS = "spam_tokens" PAGE_TOKEN = "page_token" end SubmittedPages = Struct.new(:ham, :spam, :doubt) def initialize(request, conf, mode, db) BayesFilter.init(conf) @request = request @conf = conf @confmode = mode @db = db end def save_mode? @request.request_method=="POST" and @confmode=="saveconf" end def html case @mode = @request.params['bfmode'] when Mode::SUBMITTED_PAGES r = submitted_pages_html when Mode::SUBMITTED_PAGE_DIFF r = submitted_page_diff_html when Mode::PROCESS_PAGE_DATA process_page_data r = top_html when Mode::HAM_TOKENS r = tokens_html(BayesFilter.db.ham.keys, Res.ham_tokens) when Mode::SPAM_TOKENS r = tokens_html(BayesFilter.db.spam.keys, Res.spam_tokens) when Mode::PAGE_TOKEN r = page_token_html else r = top_html end r = "#{@message}
    "+r if @message r end def conf_url(mode=nil) r = "#{@conf.cgi_name}#{cmdstr("admin", "conf=bayes_filter")}" r << ";bfmode=#{mode}" if mode r end def top_html selected = "selected='selected'" plain = "PLAIN" paul_graham = "Paul Graham" @conf[TYPE] ||= plain @conf[THRESHOLD] ||= 0.9 @conf[THRESHOLD_HAM] ||= 0.1 if save_mode? and @request.params["from_top"] @conf[USE] = @request.params[USE] @conf[REPORT] = @request.params[REPORT] @conf[SHARE_DB] = @request.params[SHARE_DB] @conf[LIMIT_OF_SUBMITTED_PAGES] = @request.params[LIMIT_OF_SUBMITTED_PAGES] || 50 threshold_spam = (@request.params[THRESHOLD]||0.95).to_f threshold_ham = (@request.params[THRESHOLD_HAM]||0.05).to_f if 0 <= threshold_ham and threshold_ham <= threshold_spam and threshold_spam <= 1.0 @conf[THRESHOLD_HAM] = threshold_ham @conf[THRESHOLD] = threshold_spam end rebuild = false rebuild = true if @request.params["rebuild_db"]=="execute" if @request.params[TYPE] && @request.params[TYPE]!=@conf[TYPE] @conf[TYPE] = @request.params[TYPE] rebuild = true end rebuild_db if rebuild end r = <
  • #{Res.ham_tokens}
  • #{Res.spam_tokens}
  • #{Res.submitted_pages}
  • #{Res.threshold} : 0 <= Ham <= <= Doubt <= <= 1
  • EOT if @conf[SHARED_DB_PATH] r << < EOT end r << < EOT end def limit_of_submitted_pages (@conf[LIMIT_OF_SUBMITTED_PAGES] || 50).to_i end def submitted_pages_html sp = submitted_pages r = "" {"Ham"=>sp.ham, "Doubt"=>sp.doubt, "Spam"=>sp.spam}.each do |k, hash| next if hash.empty? r << "

    #{k}

    \n
      \n" hash.keys.sort.each do |id| r << <#{h(hash[id].new_page.page)}
      #{Res.title}
      #{h(hash[id].new_page.title)}
      Unified Diff
      #{h(hash[id].get_unified_diff)}
      #{ unless hash[id].diff_keyword.join("\n").strip.empty? "
      #{Res.diff_keyword}
      #{h(hash[id].diff_keyword.join("\n").strip).gsub(/\n/, "
      ")}
      " end }
      #{Res.remote_addr}
      #{h(hash[id].new_page.remote_addr)}
      #{ rate = BayesFilter.db.estimate(hash[id].token) rate ? "
      #{Res.spam_rate}
      #{format("%.4f", rate)}
      " : "" }
      #{Res.submitted_page_diff}
      #{Res.token}
      EOT end r << "
    \n" end r << "" r end def submitted_pages r = SubmittedPages.new({}, {}, {}) path = BayesFilter::PageData.cache_path Dir["#{path}/[HSD]*"][0, limit_of_submitted_pages].each do |f| next unless d = BayesFilter::PageData.load(f.untaint) n = File.basename(f) case f when /^#{Regexp.escape(path)}\/S\d+$/o r.spam[n] = d when /^#{Regexp.escape(path)}\/H\d+$/o r.ham[n] = d when /^#{Regexp.escape(path)}\/D\d+$/o r.doubt[n] = d else next end end r end def submitted_page_diff_html return "" unless data = BayesFilter::PageData.load_from_cache(@request.params["id"].untaint) <#{Res.submitted_page_diff}
  • #{Res.difference}
    #{word_diff(data.old_page.text, data.new_page.text)}
    #{Res.old_text}
    #{h(data.old_page.text||"")}
    #{Res.new_text}
    #{h(data.new_page.text||"")}
    EOT end def page_token_html return "" unless data = BayesFilter::PageData.load_from_cache(@request.params["id"].untaint) <#{Res.page_token}
    #{tokens_html(data.token)} EOT end def add_ham(token) db = BayesFilter.db db.ham << token 10.times do break if db.estimate(token) and db.estimate(token)<=BayesFilter.threshold_ham db.ham << token end @db_update = true end def add_spam(token) db = BayesFilter.db db.spam << token 10.times do break if db.estimate(token) and db.estimate(token)>=BayesFilter.threshold db.spam << token end @db_update = true end def save_db BayesFilter.db.save if @db_update @db_update = false end def process_page_data return unless save_mode? @request.params.keys.select{|k| k=~/\A[HSD]\d+\z/}.each do |id| data = BayesFilter::PageData.load_from_cache(id.dup.untaint, true) next unless data case @request.params["register_#{id}"] when "ham" add_ham(data.token) data.corpus_save(true) when "spam" add_spam(data.token) data.corpus_save(false) end end save_db @message = Res.success_process_page_data end def tokens_html(token, title=nil) db = BayesFilter.db scores = token.uniq.map{|t| [t, db.score(t)] }.sort{ |a, b| sa = a[1]||1.1 sb = b[1]||1.1 sa==sb ? a[0]<=>b[0] : sb<=>sa } normal = [] addr = [] url = [] scores.each do |i| case i[0] when /^A (.*)$/ addr << [$1, i[1]] when /^U (.*)$/ url << [$1, i[1]] else normal << i end end sub = lambda do |subtitle, list| break "" if list.empty? sr = <#{subtitle} EOT list.each do |i| sr << < EOT end sr << "
    #{Res.token}#{Res.score}
    #{i[0]} #{i[1] ? format("%.4f", i[1]) : "DOUBT"}
    " end r = title ? "

    #{title}

    " : "" {Res.remote_addr=>addr, "URL"=>url, Res.other=>normal}.each do |subtitle, list| r << sub.call(subtitle, list) end r end def rebuild_db db = BayesFilter.new_db db.ham.clear db.spam.clear @db.pages.each do |page| text = @db.load(page) title = @db.get_attribute(page, :title) || "" title = page if title.empty? keyword = @db.get_attribute(page, :keyword) || [] add_ham(BayesFilter::PageData.new(Filter::PageData.new(page, text, title, keyword)).token) end ["S", "H"].each do |prefix| Dir["#{BayesFilter::PageData.corpus_path}/#{prefix}*"].each do |f| next unless f=~/\/[SH]\d+\z/ token = BayesFilter::PageData.load(f.untaint).token case prefix when "S" add_spam(token) when "H" add_ham(token) else "must not happen" end end end db.save end end if self.is_a?(::Hiki::Plugin) add_conf_proc( "bayes_filter", BayesFilterConfig::Res.label) do begin BayesFilterConfig.new(@request, @conf, @mode, @db).html rescue < #{$!.class.name} #{$!.message} #{$!.backtrace.join("\n")} EOT end end end hiki-1.0.0/plugin/50word_filter.rb000066400000000000000000000014301212533356300167450ustar00rootroot00000000000000# Copyright (C) 2008, KURODA Hiraku # You can redistribute it and/or modify it under GPL2. add_conf_proc("word_filter", WordFilterMessage.word_filter) do pre = "word_filter" key_use = "#{pre}.use" key_words = "#{pre}.words" if @cgi.request_method=="POST" and @mode=="saveconf" @conf[key_use] = @request.params[key_use] @conf[key_words] = @request.params[key_words] end old = @conf[key_words] @conf[key_words] ||= "" m = WordFilterMessage <#{m.word_filter}

    #{m.regexp_by_line}

    EOT end hiki-1.0.0/plugin/de/000077500000000000000000000000001212533356300143255ustar00rootroot00000000000000hiki-1.0.0/plugin/de/00default.rb000066400000000000000000000113161212533356300164400ustar00rootroot00000000000000# # labels # # # preferences (resources) # add_conf_proc( 'default', 'Standard-Einstellungen' ) do saveconf_default <<-HTML

    Wiki Name

    Der Name des Wikis. Er erscheint in de Seitentiteln.

    Author

    Ihr Name

    Email Addresse

    Email

    Sende Emails bei änderungen?

    Einstellung, ob Sie über änderungen an Seiten per Email informiert werden möchten. Die Email wird zu der Adresse die Sie in den Standard-Einstellungen eingegeben haben gesendet. (Stellen Sie sicher, dass ein SMTP server in der hikiconf.rb angegeben ist.)

    HTML end add_conf_proc( 'password', 'Passwort' ) do '

    Passwort

    ' + case saveconf_password when :password_change_success '

    Das Administrator Passwort wurde erfolgreich geändert.

    ' when :password_change_failure '

    Sie haben entweder ein falsches altes Passwort eingegeben oder Sie haben sich bei der Passwort-wiederholung verschrieben.

    ' when nil '

    Administrator Passwort ändern.

    ' end + <<-HTML

    Jetziges Passwort:

    Neues Passwort:

    Neues Passwort (wiederholung):

    HTML end add_conf_proc( 'theme', 'Aussehen' ) do saveconf_theme r = <<-HTML

    Aussehen

    Themes um das Aussehen der Seiten zu verändern.

    Theme URL

    Eine URL eines Themes. Wenn Sie hier eine URL angeben, wird dieses CSS Theme verwendet und das oben angegebene ignoriert.

    Theme Ordner

    Ordner der vorhandenen Themes.

    Seitenleiste

    Manche Themes können die Seitenleiste nicht ordnungsgemäß darstellen. Wenn sie eines dieser Themes benutzten, den Wert auf 'Aus' setzen.

    CSS Klassename der die Haupt-Fläche

    CSS Klassenname der die Haupt-Fläche (Stardard: 'main').

    CSS Klassenname der Seitenleiste

    CSS Klassenname der Seitenleiste (Standard: 'sidebar').

    Auto link

    Um die Auto link Funktion zu aktivieren, den Wert auf 'An' setzen.

    WikiNamen

    Wenn sie WikiNamen deaktivieren wollen, den Wert auf 'Aus' setzen.

    HTML end add_conf_proc( 'xmlrpc', 'XML-RPC' ) do saveconf_xmlrpc <<-HTML

    XML-RPC

    Um die XML-RPC interfaces zu deaktivieren, den Wert auf 'Aus' setzen.

    HTML end hiki-1.0.0/plugin/de/01sp.rb000066400000000000000000000032571212533356300154440ustar00rootroot00000000000000# English resources of 01sp.rb $Revision: 1.1 $ =begin = Select-plugin plugin == Abstract Selects which plugin to be actually used. == Usage Put this file into the plugin/ directory. Next, move the plugins you want to be optional into another directory. In the example below, these plugins are assumed to be in plugin/selectable directory. Finally, edit the tdiary.conf file in the same directory as tdiary.rb and add the following line: @options['sp.path'] = 'misc/plugin' to indicate the directory you have put the optional plugins. It can be an absolute path. You can use this plugin in a secure diary. == Options :@options['sp.path'] Directory name where the optional plugins are, relative from the directory where tdiary.rb is or absolute. :@options['sp.usenew'] Define true if you want to the users to try a newly installed plugin. Newly installed plugins are detected next time when the user configures this plugin. == Copyright notice Copyright (C) 2003 zunda Permission is granted for use, copying, modification, distribution, and distribution of modified versions of this work under the terms of GPL version 2 or later. =end @sp_label = 'Plugin Auswahl' @sp_label_description = '

    Wählt das gewünschte Plugin.

    ' @sp_label_please_select = '

    Bitte die gewünschten Plugins hier auswählen. Jeder Plugin-Dateiname ist mit einer eigenen Hilfeseite verbunden. Bitte erstelle oder verbessere die Hilfeseite!

    ' @sp_label_new = '

    Neu! Probiers aus.

    ' @sp_label_used = '

    In benutzung

    ' @sp_label_notused = '

    Derzeit nicht benutzt

    ' @sp_label_noplugin = '

    Es gibt keine optionalen Plugins.

    ' hiki-1.0.0/plugin/de/02help.rb000066400000000000000000000022761212533356300157530ustar00rootroot00000000000000# -*- coding: utf-8 -*- def help_heading_label 'berschrift' end def help_list_label 'Liste' end def help_numbered_label 'Aufz辰hlung' end def help_link_label 'Link' end def help_url_label 'URL' end def help_emphasized_label 'Kursiv' end def help_strongly_label 'Fett' end def help_struckout_label 'Durchgestrichen' end def help_definition_label 'Definition' end def help_table_label 'Tabelle' end def help_cell_label 'Zelle' end def help_headingcell_label 'berschrift' end def help_rows_label 'Reihen' end def help_columns_label 'Spalten' end def help_horizontal_label 'Horizontal' end def help_multiplelines_label 'mehrere Zeilen' end def help_preformatted_label 'Vor-Formatiert' end def help_cancel_label 'Beenden' end def help_quotation_label 'Zitat' end def help_comment_label 'Kommentar' end def help_math_label 'Mathe' end def help_display_label 'display' end def help_inline_label 'inline' end def help_plugin_label 'Plugin' end def help_br_label 'Zeilenumbruch' end def help_toc_label 'Inhaltsverzeichnis' end def help_tochere_label 'hier' end def help_recent_label 'Letzte nderungen' end hiki-1.0.0/plugin/en/000077500000000000000000000000001212533356300143375ustar00rootroot00000000000000hiki-1.0.0/plugin/en/00default.rb000066400000000000000000000110601212533356300164460ustar00rootroot00000000000000# # labels # # # preferences (resources) # add_conf_proc( 'default', 'Basic preferences' ) do saveconf_default <<-HTML

    Site name

    Enter the name of your site. This will appear in page titles.

    Author

    Enter your name.

    E-mail address

    Enter your e-mail address. (One address in one line)

    Send update e-mails?

    Set whether or not you want to have e-mail sent when a page is updated. E-mail will be sent to the address set in the Basic Preferences. (Make sure to specify an SMTP server beforehand in hikiconf.rb.)

    HTML end add_conf_proc( 'password', 'Password' ) do '

    Password

    ' + case saveconf_password when :password_change_success '

    The admin password has been changed successfully.

    ' when :password_change_failure '

    The old password is wrong or new passwords are not same.

    ' when nil '

    You can change the admin password.

    ' end + <<-HTML

    Current password:

    New password:

    New password (confirm):

    HTML end add_conf_proc( 'theme', 'Appearance' ) do saveconf_theme r = <<-HTML

    Theme

    Select a theme to use in displaying pages.

    Theme URL

    Specify a URL where a theme is located. If you specify a CSS URL, the theme selected above will be ignored, and the CSS will be used.

    Theme directory

    Enter the directory where themes are located.

    Sidebar

    Some themes cannot properly display the sidebar. If you are using one of these themes, set this value to off.

    CSS class name for the main area

    Enter the CSS class name for the main area (default: 'main').

    CSS class name for the sidebar

    Enter the CSS class name for the sidebar (default: 'sidebar').

    Auto link

    If you want to use the auto link function, set this value to on.

    WikiName

    If you want to disable WikiName, set this value to off.

    HTML end add_conf_proc( 'xmlrpc', 'XML-RPC' ) do saveconf_xmlrpc <<-HTML

    XML-RPC

    If you want to disable XML-RPC interfaces, set this value to off.

    HTML end hiki-1.0.0/plugin/en/01sp.rb000066400000000000000000000032001212533356300154420ustar00rootroot00000000000000# English resources of 01sp.rb $Revision: 1.2 $ =begin = Select-plugin plugin == Abstract Selects which plugin to be actually used. == Usage Put this file into the plugin/ directory. Next, move the plugins you want to be optional into another directory. In the example below, these plugins are assumed to be in plugin/selectable directory. Finally, edit the tdiary.conf file in the same directory as tdiary.rb and add the following line: @options['sp.path'] = 'misc/plugin' to indicate the directory you have put the optional plugins. It can be an absolute path. You can use this plugin in a secure diary. == Options :@options['sp.path'] Directory name where the optional plugins are, relative from the directory where tdiary.rb is or absolute. :@options['sp.usenew'] Define true if you want to the users to try a newly installed plugin. Newly installed plugins are detected next time when the user configures this plugin. == Copyright notice Copyright (C) 2003 zunda Permission is granted for use, copying, modification, distribution, and distribution of modified versions of this work under the terms of GPL version 2 or later. =end @sp_label = 'Plugin selection' @sp_label_description = '

    Selects which plugins you want to use.

    ' @sp_label_please_select = '

    Please check the plugins you want to use. Each plugin filename is linked to its document. Please create or improve the document!

    ' @sp_label_new = '

    New! Give it a try.

    ' @sp_label_used = '

    Being used

    ' @sp_label_notused = '

    Currently not used

    ' @sp_label_noplugin = '

    There is no optional plugins.

    ' hiki-1.0.0/plugin/en/02help.rb000066400000000000000000000023361212533356300157620ustar00rootroot00000000000000def help_lineshelp_label 'LinesHelp' end def help_wordshelp_label 'WordsHelp' end def help_tablehelp_label 'TableHelp' end def help_pluginhelp_label 'PluginHelp' end def help_mathhelp_label 'MathHelp' end def help_heading_label 'Heading' end def help_list_label 'List' end def help_numbered_label 'numbered' end def help_preformatted_label 'Preformatted' end def help_quotation_label 'Quotation' end def help_comment_label 'Comment' end def help_cancel_label 'cancel' end def help_link_label 'Link' end def help_url_label 'URL' end def help_emphasized_label 'Emphasized' end def help_strongly_label 'strongly' end def help_struckout_label 'Struck out' end def help_definition_label 'Definition' end def help_horizontal_label 'Horizontal' end def help_cell_label 'cell' end def help_headingcell_label 'heading' end def help_rows_label 'rows' end def help_columns_label 'columns' end def help_plugin_label 'Plugin' end def help_br_label 'Line break' end def help_toc_label 'Contents' end def help_tochere_label 'here' end def help_recent_label 'Recent' end def help_display_label 'display' end def help_inline_label 'inline' end hiki-1.0.0/plugin/en/50bayes_filter.rb000066400000000000000000000027371212533356300175120ustar00rootroot00000000000000# Copyright (C) 2008, KURODA Hiraku # You can redistribute it and/or modify it under GPL2. class BayesFilterConfig module Res def self.label; "Bayes filter"; end def self.submitted_pages; "Submitted pages"; end def self.submitted_page_diff; "Diff of submitted page"; end def self.spam_rate; "spam rate"; end def self.title; "Title"; end def self.diff_text; "Appended text"; end def self.diff_keyword; "Appended keywords"; end def self.remote_addr; "remote address"; end def self.register_as_ham; "register as ham"; end def self.register_as_spam; "register as spam"; end def self.success_process_page_data; "Success processing page data"; end def self.ham_tokens; "Tokens of ham"; end def self.spam_tokens; "Tokens of spam"; end def self.token; "token"; end def self.score; "score"; end def self.old_text; "text(old)"; end def self.new_text; "text(new)"; end def self.rebuild_db; "Rebuild DataBase of BayesFilter"; end def self.remote_addr; "Remote host address"; end def self.other; "other"; end def self.use_filter; "Use Bayes filter"; end def self.threshold; "Threshold"; end def self.page_token; "Tokens of page"; end def self.report_filtering; "Report filtering result by mail"; end def self.share_db; "Use shared database"; end def self.limit_of_submitted_pages; "Limit of submitted pages to show at one time"; end def self.difference; "Difference"; end end end hiki-1.0.0/plugin/en/50word_filter.rb000066400000000000000000000004711212533356300173530ustar00rootroot00000000000000# Copyright (C) 2008, KURODA Hiraku # You can redistribute it and/or modify it under GPL2. module WordFilterMessage def self.word_filter; "Word filter"; end def self.use; "Filtering by bellow Regexp"; end def self.regexp_by_line; "Write one regular expression each line."; end end hiki-1.0.0/plugin/fr/000077500000000000000000000000001212533356300143445ustar00rootroot00000000000000hiki-1.0.0/plugin/fr/00default.rb000066400000000000000000000111351212533356300164560ustar00rootroot00000000000000# -*- coding: utf-8 -*- # # preferences (resources) # add_conf_proc( 'default', 'Pr辿f辿rences de base' ) do saveconf_default <<-HTML

    Pseudonyme

    Entrez votre nom d'utilisateur. Il appara樽tra comme 辿l辿ment de titre.

    Auteur

    Entrez votre nom complet.

    Adresse 辿lectronique

    Entrez votre adresse e-mail.

    Notification par e-mail.

    Si cette option est activ辿e, un e-mail de notification sera envoy辿 votre adresse 辿lectronique via le serveur SMTP (d辿finit dans hikiconf.rb) lorsqu'une page est modifi辿e. Aucun e-mail ne sera envoy辿 si cette option est d辿sactiv辿e.

    HTML end add_conf_proc( 'password', 'Mot de passe' ) do '

    Mot de passe

    ' + case saveconf_password when :password_change_success '

    The admin password has been changed successfully.

    ' when :password_change_failure '

    Sorry, wrong password.

    ' when nil '

    You can change the admin password.

    ' end + <<-HTML

    Mot de passe courant:

    Nouveau mot de passe:

    Nouveau mot de passe (confirmez):

    HTML end add_conf_proc( 'theme', 'Apparence' ) do saveconf_theme r = <<-HTML

    Th竪me

    Selectionnez un th竪me.

    Th竪me - URL

    Entrez l'URL d'un th竪me.

    Th竪me - R辿pertoire

    Entrez le r辿pertoire du th竪me.

    Barre contextuelle

    ON et la barre contextuelle sera affich辿e. Si vous voulez utiliser un th竪me qui ne g竪re pas de barre contextuelle, vous devez s辿lectionner OFF.

    Nom de la classe dans la section principale (CSS)

    Entrez le nom CSS de la classe dans la section principale.

    Nom de la classe dans la barre contextuelle (CSS)

    Entrez le nom CSS de la classe dans la barre contextuelle.

    Liens automatiques

    Choisissez ON si vous d辿sirez activer les liens automatiques.

    WikiName

    (TRANSLATE PLEASE) If you want to disable WikiName, set this value to off.

    HTML end add_conf_proc( 'xmlrpc', 'XML-RPC' ) do saveconf_xmlrpc <<-HTML

    XML-RPC

    (TRANSLATE PLEASE) If you want to disable XML-RPC interfaces, set this value to off.

    HTML end hiki-1.0.0/plugin/fr/01sp.rb000066400000000000000000000032001212533356300154470ustar00rootroot00000000000000# English resources of 01sp.rb $Revision: 1.2 $ =begin = Select-plugin plugin == Abstract Selects which plugin to be actually used. == Usage Put this file into the plugin/ directory. Next, move the plugins you want to be optional into another directory. In the example below, these plugins are assumed to be in plugin/selectable directory. Finally, edit the tdiary.conf file in the same directory as tdiary.rb and add the following line: @options['sp.path'] = 'misc/plugin' to indicate the directory you have put the optional plugins. It can be an absolute path. You can use this plugin in a secure diary. == Options :@options['sp.path'] Directory name where the optional plugins are, relative from the directory where tdiary.rb is or absolute. :@options['sp.usenew'] Define true if you want to the users to try a newly installed plugin. Newly installed plugins are detected next time when the user configures this plugin. == Copyright notice Copyright (C) 2003 zunda Permission is granted for use, copying, modification, distribution, and distribution of modified versions of this work under the terms of GPL version 2 or later. =end @sp_label = 'Plugin selection' @sp_label_description = '

    Selects which plugins you want to use.

    ' @sp_label_please_select = '

    Please check the plugins you want to use. Each plugin filename is linked to its document. Please create or improve the document!

    ' @sp_label_new = '

    New! Give it a try.

    ' @sp_label_used = '

    Being used

    ' @sp_label_notused = '

    Currently not used

    ' @sp_label_noplugin = '

    There is no optional plugins.

    ' hiki-1.0.0/plugin/it/000077500000000000000000000000001212533356300143515ustar00rootroot00000000000000hiki-1.0.0/plugin/it/00default.rb000066400000000000000000000110111212533356300164540ustar00rootroot00000000000000# -*- coding: utf-8 -*- # # preferences (resources) # add_conf_proc( 'default', 'Preferenze base' ) do saveconf_default <<-HTML

    Nome del sito

    Imposta il nome del sito. Questo appare come titolo dell'elemento.

    Autore

    Set your name.

    Indirizzo email

    Imposta il tuo indirizzo email.

    Manda email per le modifiche.

    Se 竪 ABILITATO, l'email di notifica 竪 inviata all'"Indirizzo email" delle preferenze di base via SMTP server(che 竪 impostato in hikiconf.rb) quando una pagina 竪 aggiornata. Se 竪 DISABILITATO, l'email viene inviata.

    HTML end add_conf_proc( 'password', 'Password' ) do '

    Password

    ' + case saveconf_password when :password_change_success '

    The admin password has been changed successfully.

    ' when :password_change_failure '

    Sorry, wrong password.

    ' when nil '

    You can change the admin password.

    ' end + <<-HTML

    Password corrente:

    Password nuova:

    Password nuova(conferma):

    HTML end add_conf_proc( 'theme', 'Aspetto' ) do saveconf_theme r = <<-HTML

    Tema

    Scegli un tema.

    URL Tema

    Imposta URL tema.

    Cartella tema

    Imposta cartella tema.

    Barra laterale

    ABILITATO se la barra laterale 竪 mostrata. Se vuoi usare un tema che non supporta la barra laterale, devi selezionare DISABILITATO qui.

    Nome della classe nell'area principale(CSS)

    Imposta il nome della classe CSS nell'area principale.

    Nome del CSS nella barra laterale (CSS)

    Imposta il nome della classe CSS nella barra laterale.

    Collegamento automatico

    Imposta ABILITATO se vuoi usare il collegamento automatico.

    WikiName

    (TRANSLATE PLEASE) If you want to disable WikiName, set this value to off.

    HTML end add_conf_proc( 'xmlrpc', 'XML-RPC' ) do saveconf_xmlrpc <<-HTML

    XML-RPC

    (TRANSLATE PLEASE) If you want to disable XML-RPC interfaces, set this value to off.

    HTML end hiki-1.0.0/plugin/it/01sp.rb000066400000000000000000000032001212533356300154540ustar00rootroot00000000000000# English resources of 01sp.rb $Revision: 1.2 $ =begin = Select-plugin plugin == Abstract Selects which plugin to be actually used. == Usage Put this file into the plugin/ directory. Next, move the plugins you want to be optional into another directory. In the example below, these plugins are assumed to be in plugin/selectable directory. Finally, edit the tdiary.conf file in the same directory as tdiary.rb and add the following line: @options['sp.path'] = 'misc/plugin' to indicate the directory you have put the optional plugins. It can be an absolute path. You can use this plugin in a secure diary. == Options :@options['sp.path'] Directory name where the optional plugins are, relative from the directory where tdiary.rb is or absolute. :@options['sp.usenew'] Define true if you want to the users to try a newly installed plugin. Newly installed plugins are detected next time when the user configures this plugin. == Copyright notice Copyright (C) 2003 zunda Permission is granted for use, copying, modification, distribution, and distribution of modified versions of this work under the terms of GPL version 2 or later. =end @sp_label = 'Plugin selection' @sp_label_description = '

    Selects which plugins you want to use.

    ' @sp_label_please_select = '

    Please check the plugins you want to use. Each plugin filename is linked to its document. Please create or improve the document!

    ' @sp_label_new = '

    New! Give it a try.

    ' @sp_label_used = '

    Being used

    ' @sp_label_notused = '

    Currently not used

    ' @sp_label_noplugin = '

    There is no optional plugins.

    ' hiki-1.0.0/plugin/ja/000077500000000000000000000000001212533356300143275ustar00rootroot00000000000000hiki-1.0.0/plugin/ja/00default.rb000066400000000000000000000130461212533356300164440ustar00rootroot00000000000000# -*- coding: utf-8 -*- # # preferences (resources) # add_conf_proc( 'default', '堺' ) do saveconf_default <<-HTML

    泣ゃ

    泣ゃ絎障

    絎障

    <若≪

    <若≪鴻絎障1茵1≪鴻ゆ絎障

    贋違<若ч

    若吾贋違c翫<若чャ絎障<若堺荐絎ф絎≪鴻篆<障hikiconf.rbSMTP泣若荐絎

    HTML end add_conf_proc( 'password', '鴻若' ) do '

    鴻若

    ' + case saveconf_password when :password_change_success '

    膊∞鴻若紊眼障

    ' when :password_change_failure '

    膊∞鴻若c鴻若筝眼障

    ' when nil '

    膊∞鴻若紊眼障

    ' end + <<-HTML

    憜鴻若:

    違鴻若:

    違鴻若鐚腆肴ュ鐚:

    HTML end add_conf_proc( 'theme', '茵腓肴┃絎' ) do saveconf_theme r = <<-HTML

    若絎

    茵腓冴篏睡若御с障

    若URL絎

    若URL絎с障贋・CSS絎翫筝若絎ч御若∴絎CSS篏帥障

    若c絎

    若c絎с障鐚茲域┃臀篏睡鐚

    泣ゃ若

    若c泣ゃ若茵腓冴箙宴障翫泣ゃ若茵腓冴с障

    <ゃ潟≪劫(CSS)絎

    с劫'main'篏睡障篁ュ劫篏睡翫絎障

    泣ゃ若劫(CSS)絎

    с泣ゃ若劫'sidebar'篏睡障篁ュ劫篏睡翫絎障

    若潟

    √若吾潟荐絎若潟罘純篏睡絎障

    WikiName 潟罘純

    WikiName 潟罘純篏睡絎障

    HTML end add_conf_proc( 'xmlrpc', 'XML-RPC' ) do saveconf_xmlrpc <<-HTML

    XML-RPC

    XML-RPC ゃ潟帥сゃ鴻鴻絎障

    HTML end hiki-1.0.0/plugin/ja/01sp.rb000066400000000000000000000056421212533356300154460ustar00rootroot00000000000000# -*- coding: utf-8 -*- # Japanese resources of 01sp.rb $Revision: 1.1 $ =begin = 違ゃ渇御違ゃ((-$Id: 01sp.rb,v 1.1 2005-01-29 03:34:40 fdiary Exp $-)) Please see below for an English description. == 网荀 違ゃ潟篏帥吾潟障 違ゃ潟00defaults.rb罨<茯障違ゃ活荳御 純違ゃ潟茯障障緇鴻違ゃ潟茯 粋昭障障с<純絎臂翫鴻 鴻障 == 篏帥 違ゃ潟plugin/c臀 障00defaults.rb違ゃ潟腟九障綽荀違ゃ割札紊 http泣若若荀ャc腱祉篁ヤ箴с pluginc筝selectablec篏c障 緇tdiary.rb贋tdiary.conf @options['sp.path'] = 'misc/plugin' 御с違ゃ潟ctdiary.rbc 後障鴻腟九障鴻ф絎 secure==trueヨс篏帥障 == 激с :@options['sp.path'] 'plugin/selectable'御с違ゃ潟c tdiary.rbc後障鴻腟九障鴻ф絎 :@options['sp.usenew'] 違ゃ潟鴻若違ゃ潟т戎翫 true荐絎違ゃ潟鴻若違ゃ潟罎冴 罨<違ゃ潟御с == TODO 御違ゃ潟羔サ憜絎茖с 違ゃ活粋昭炊∴罨<御羔 == 篏罔ゃ (Copyright notice) Copyright (C) 2003 zunda Permission is granted for use, copying, modification, distribution, and distribution of modified versions of this work under the terms of GPL version 2 or later. =end @sp_label = '違ゃ渇御' @sp_label_description = '

    違ゃ潟篏帥御障

    ' @sp_label_please_select = '

    鴻違ゃ潟с違ゃ潟<ゃャ<潟荀障画申紫隈

    ' @sp_label_new = '

    医ヨ件荅

    ' @sp_label_used = '

    篏睡筝

    ' @sp_label_notused = '

    篌筝

    ' @sp_label_noplugin = '

    御純違ゃ潟障

    ' hiki-1.0.0/plugin/ja/02help.rb000066400000000000000000000024701212533356300157510ustar00rootroot00000000000000# -*- coding: utf-8 -*- def help_lineshelp_label '茵' end def help_wordshelp_label '絖' end def help_tablehelp_label '茵' end def help_pluginhelp_label '違ゃ恰' end def help_mathhelp_label '医' end def help_heading_label '荀冴' end def help_list_label '膊≧' end def help_numbered_label '垬' end def help_preformatted_label '翫就羝' end def help_quotation_label '綣' end def help_comment_label '潟<潟' end def help_cancel_label '茹i' end def help_link_label '潟' end def help_url_label 'URL' end def help_emphasized_label '綣決' end def help_strongly_label '' end def help_struckout_label '羔膩' end def help_definition_label '茯茹h' end def help_horizontal_label '羂翫抗膩' end def help_cell_label '祉' end def help_headingcell_label '荀冴' end def help_rows_label '膰g' end def help_columns_label '罔g' end def help_plugin_label '違ゃ' end def help_br_label '壕' end def help_toc_label '罨' end def help_tochere_label '' end def help_recent_label '菴' end def help_display_label 'c鴻' end def help_inline_label 'ゃ潟ゃ' end hiki-1.0.0/plugin/ja/50bayes_filter.rb000066400000000000000000000034061212533356300174740ustar00rootroot00000000000000# -*- coding: utf-8 -*- # Copyright (C) 2008, KURODA Hiraku # You can redistribute it and/or modify it under GPL2. class BayesFilterConfig module Res def self.label; "ゃ冴c"; end def self.submitted_pages; "腮帥若吾若推荀"; end def self.submitted_page_diff; "腮帥若吾綏"; end def self.spam_rate; "鴻"; end def self.title; "帥ゃ"; end def self.diff_text; "菴遵"; end def self.diff_keyword; "菴遵若若"; end def self.remote_addr; "≪若≪"; end def self.register_as_ham; "脂"; end def self.register_as_spam; "鴻脂"; end def self.success_process_page_data; "腮帥若吾若帥障"; end def self.ham_tokens; "若割荀"; end def self.spam_tokens; "鴻若割荀"; end def self.token; "若"; end def self.score; "鴻"; end def self.old_text; "贋医"; end def self.new_text; "贋医"; end def self.rebuild_db; "ゃ冴c睡若帥若鴻罕膀"; end def self.remote_addr; "≪若鴻≪"; end def self.other; "篁"; end def self.use_filter; "ゃ冴c帥篏帥"; end def self.threshold; "上"; end def self.page_token; "若娯賢若割荀"; end def self.report_filtering; "c帥潟亥<若ч"; end def self.share_db; "援若帥若鴻篏帥"; end def self.limit_of_submitted_pages; "筝綺茵腓冴腮帥若吾若帥"; end def self.difference; "綏"; end end end hiki-1.0.0/plugin/ja/50word_filter.rb000066400000000000000000000006101212533356300173360ustar00rootroot00000000000000# -*- coding: utf-8 -*- # Copyright (C) 2008, KURODA Hiraku # You can redistribute it and/or modify it under GPL2. module WordFilterMessage def self.word_filter; "茯c"; end def self.use; "脂蚊罩h頫憗сc帥潟違"; end def self.regexp_by_line; "1茵1ゃゃ罩h頫憗荐菴違"; end end hiki-1.0.0/spec/000077500000000000000000000000001212533356300133715ustar00rootroot00000000000000hiki-1.0.0/spec/spec_50bayes_filter.rb000066400000000000000000000213421212533356300175470ustar00rootroot00000000000000# Copyright (C) 2008, KURODA Hiraku # You can redistribute it and/or modify it under GPL2. module Hiki class Plugin end end require "tmpdir" require "hiki/filter" require "plugin/ja/50bayes_filter" require "plugin/50bayes_filter" class << Object.new BayesFilter = Hiki::Filter::BayesFilter module Common def self.included(ex) ex.before do @tmpdir = "#{Dir.tmpdir}/hiki_filter_spec_#{$$}" FileUtils.mkdir(@tmpdir) @base_url = "http://www.example.org/hiki.cgi" @opt = {} @conf = stub("conf", :data_path=>@tmpdir, :cache_path=>"#{@tmpdir}/cache", :bayes_threshold=>nil, :filter_type=>nil, :cgi_name=>@base_url, :index_url=>@base_url, :null_object=>false) @conf.should_receive("[]".intern).any_number_of_times{|k| @opt[k]} @conf.should_receive("[]=".intern).any_number_of_times{|k, v| @opt[k]=v} BayesFilter.init(@conf) end ex.after do FileUtils.remove_entry_secure(@tmpdir) end ex.before do @params = Hash.new{|h, k| h[k]=[]} @cgi = stub("cgi", :params=>@params, :request_method=>"POST", :null_object=>false) @pages = [] @db = stub("db", :pages=>@pages, :null_object=>false) @c = BayesFilterConfig.new(@cgi, @conf, "saveconf", @db) end end end describe BayesFilterConfig::Res do it "support Japanese and English" do ["ja", "en"].each do |la| src = IO.read("plugin/#{la}/50bayes_filter.rb") rb = "module #{la.upcase}\n#{src}\nend" eval(rb, binding) end [EN].each do |m| JA::BayesFilterConfig::Res.methods.sort.should == m::BayesFilterConfig::Res.methods.sort end end end describe BayesFilterConfig, "default" do include Common it "html" do lambda{@c.html}.should_not raise_error end it "conf_url" do @c.conf_url.should == "#{@base_url}?c=admin;conf=bayes_filter" @c.conf_url("hoge").should == "#{@base_url}?c=admin;conf=bayes_filter;bfmode=hoge" end it "save_mode?" do @c.save_mode?.should be_true @cgi.stub!(:request_method).and_return("GET") @c.save_mode?.should be_false @cgi.stub!(:request_method).and_return("POST") @c.save_mode?.should be_true @c.instance_variable_set("@confmode", "conf") @c.save_mode?.should be_false end end describe BayesFilterConfig, "submitted page list" do include Common before do @params["bfmode"] << BayesFilterConfig::Mode::SUBMITTED_PAGES BayesFilter.db.ham << ["ham"] BayesFilter.db.spam << ["spam"] bp = Hiki::Filter::BayesFilter::PageData pd = Hiki::Filter::PageData @ham = bp.new(pd.new("ham", "ham", "ham", "ham", "127.0.0.1")) @ham.cache_save @spam = bp.new(pd.new("spam", "spam", "spam", "spam", "127.0.0.1")) @spam.cache_save @doubt = bp.new(pd.new("ham spam", "ham spam", "ham spam", "ham spam", "127.0.0.1")) @doubt.cache_save end it "setting test" do @ham.ham?.should be_true @spam.ham?.should be_false @doubt.ham?.should be_nil end it "html" do lambda{@c.html}.call #should_not raise_error end it "submitted_pages" do l = @c.submitted_pages l.ham.values.map{|i| i.cache_file_name}.should == [@ham.cache_file_name] l.ham.each_pair{|k, d| k.should == d.cache_file_name[/H\d+$/]} l.spam.values.map{|i| i.cache_file_name}.should == [@spam.cache_file_name] l.spam.each_pair{|k, d| k.should == d.cache_file_name[/S\d+$/]} l.doubt.values.map{|i| i.cache_file_name}.should == [@doubt.cache_file_name] l.doubt.each_pair{|k, d| k.should == d.cache_file_name[/D\d+$/]} end end describe BayesFilterConfig, "process page data" do include Common before do @params["bfmode"] << BayesFilterConfig::Mode::PROCESS_PAGE_DATA BayesFilter.db.ham << ["ham"] BayesFilter.db.spam << ["spam"] pd = Hiki::Filter::PageData bp = Hiki::Filter::BayesFilter::PageData @ham = bp.new(pd.new("ham", "ham", "ham", "ham", "127.0.0.1")) @ham.cache_save @ham.ham?.should be_true @spam = bp.new(pd.new("spam", "spam", "spam", "spam", "127.0.0.1")) @spam.cache_save @spam.ham?.should be_false @doubt = bp.new(pd.new("ham spam", "ham spam", "ham spam", "ham spam", "127.0.0.1")) @doubt.cache_save @doubt.ham?.should be_nil end it "html" do @c.should_receive(:process_page_data){@c.proxied_by_rspec__process_page_data} lambda{@c.html}.should_not raise_error end it "process data" do ham_id = "H#{@ham.file_name}" @params[ham_id] << "1" @params["register_#{ham_id}"] << "spam" @c.save_mode?.should be_true @c.process_page_data File.should_not be_exist(@ham.cache_file_name) File.should be_exist(@ham.corpus_file_name_spam) @ham.ham?.should be_false end end describe BayesFilterConfig, "with Bayes::PaulGraham" do include Common before do @token = Bayes::TokenList.new @token << "w" @filter_db = Bayes::PaulGraham.new @filter_db.spam << @token @filter_db.ham << @token BayesFilter.stub!(:db).and_return(@filter_db) end it "should occur infinity-loop at #add_ham" do lambda{@c.add_ham(@token)}.should_not raise_error end it "should occur infinity-loop at #add_spam" do lambda{@c.add_spam(@token)}.should_not raise_error end end describe BayesFilterConfig, "with Bayes::PaulGraham" do include Common before do @token = Bayes::TokenList.new @token << "w" @filter_db = Bayes::PaulGraham.new @filter_db.spam << @token @filter_db.ham << @token BayesFilter.stub!(:db).and_return(@filter_db) end it "should occur infinity-loop at #add_ham" do lambda{@c.add_ham(@token)}.should_not raise_error end it "should occur infinity-loop at #add_spam" do lambda{@c.add_spam(@token)}.should_not raise_error end end describe BayesFilterConfig, "ham/spam token list" do include Common it "html(ham)" do @params["bfmode"] << BayesFilterConfig::Mode::HAM_TOKENS @c.should_receive(:tokens_html){|token, title| @c.proxied_by_rspec__tokens_html(token, title)} lambda{@c.html}.should_not raise_error end it "html(spam)" do @params["bfmode"] << BayesFilterConfig::Mode::SPAM_TOKENS @c.should_receive(:tokens_html){|token, title| @c.proxied_by_rspec__tokens_html(token, title)} lambda{@c.html}.should_not raise_error end end describe BayesFilterConfig, "page diff" do include Common before do @params["bfmode"] << BayesFilterConfig::Mode::SUBMITTED_PAGE_DIFF @pd = Hiki::Filter::BayesFilter::PageData.new( Hiki::Filter::PageData.new("ham spam", "ham spam", "ham spam", "ham spam", "127.0.0.1")) @params["id"] << ("D"+@pd.file_name).taint @pd.cache_save end it "html" do @c.should_receive(:submitted_page_diff_html) lambda{@c.html}.should_not raise_error end it "submitted_page_diff_html" do $SAFE=1 @c.should_receive(:word_diff) lambda{@c.submitted_page_diff_html}.should_not raise_error end end describe BayesFilterConfig, "tokens" do include Common before do @params["bfmode"] << BayesFilterConfig::Mode::PAGE_TOKEN @pd = Hiki::Filter::BayesFilter::PageData.new( Hiki::Filter::PageData.new("ham spam", "ham spam", "ham spam", "ham spam", "127.0.0.1")) @params["id"] << ("D"+@pd.file_name).taint @pd.cache_save end it "html" do @c.should_receive(:page_token_html) lambda{@c.html}.should_not raise_error end it "submitted_page_diff_html" do $SAFE=1 lambda{@c.page_token_html}.should_not raise_error end end describe BayesFilterConfig, "rebuild DB" do include Common it "rebuild_db" do pd = Hiki::Filter::PageData Hiki::Filter::BayesFilter::PageData.new(pd.new("HamPage", "text")).corpus_save(true) Hiki::Filter::BayesFilter::PageData.new(pd.new("SpamPage", "text")).corpus_save(false) @pages << "TestPage" @db.should_receive(:load).and_return do |page| "Text" if page=="TestPage" end @db.should_receive(:get_attribute).any_number_of_times do |pg, attr| pg.should == "TestPage" case attr when :title "Title" when :keyword ["key", "word"] else puts attr end end Hiki::Filter::BayesFilter.should_receive(:new_db){Hiki::Filter::BayesFilter.proxied_by_rspec__new_db} lambda{$SAFE=1;@c.rebuild_db}.call #should_not raise_error end end end hiki-1.0.0/spec/spec_bayes_filter.rb000066400000000000000000000252561212533356300174120ustar00rootroot00000000000000# Copyright (C) 2008, KURODA Hiraku # You can redistribute it and/or modify it under GPL2. require "tmpdir" require "fileutils" require "hiki/command" $: << "hiki" module SetupBayesFilter def self.included(ex) ex.before do @tmpdir = "#{Dir.tmpdir}/hiki_filter_spec_#{$$}" FileUtils.mkdir(@tmpdir) @index_url = "http://www.example.org/hiki/" @opt = { } @conf = stub("Hiki::Config", :data_path=>@tmpdir, :cache_path=>"#{@tmpdir}/cache", :bayes_threshold=>nil, :site_name=>"SiteName", :index_url=>@index_url, :null_object=>false) @conf.should_receive("[]".intern).any_number_of_times{|k| @opt[k]} @bf = Hiki::Filter::BayesFilter.init(@conf) end ex.after do FileUtils.remove_entry_secure(@tmpdir) end end end class << Object.new class Dummy include Hiki::Filter::BayesFilter def conf @@hiki_conf end end describe Hiki::Filter::BayesFilter do include SetupBayesFilter it "@@hiki_conf.index_url should return correct URL" do Dummy.new.conf.index_url.should == @index_url end end end describe Hiki::Filter::BayesFilter, "with default settings" do include SetupBayesFilter it "is module" do @bf.should be_kind_of(Module) end it "threshold" do @bf.threshold.should == 0.9 end it "threshold_ham" do @bf.threshold_ham.should == 0.1 end it "db" do @bf.db.should be_kind_of(Bayes::PlainBayes) @bf.db.db_name.should == "#{@tmpdir}/bayes.db" File.should_not be_exist(@bf.db.db_name) lambda{@bf.db.save}.should_not raise_error File.should be_exist(@bf.db.db_name) end it "new db" do @bf.db.ham << "ham" @bf.db.ham.should be_include("ham") @bf.new_db @bf.db.ham.should_not be_include("ham") end it "cache_path" do path = "#{@tmpdir}/cache/bayes" File.should_not be_exist(path) @bf.cache_path.should == path File.should be_exist(path) end it ".filter should not call Hiki::Filter.plugin.sendmail" do new_page = Hiki::Filter::PageData.new( "Page", "text", "title") old_page = Hiki::Filter::PageData.new("Page") plugin = stub("plugin") Hiki::Filter.should_not_receive(:plugin) lambda{@bf.filter(new_page, old_page, true)}.should_not raise_error lambda{@bf.filter(new_page, old_page, false)}.should_not raise_error end end describe Hiki::Filter::BayesFilter, "with settings" do include SetupBayesFilter before do @opt["bayes_filter.type"] = "Paul Graham" @opt["bayes_filter.report"] = "1" @opt["bayes_filter.threshold"] = "0.9" @conf.should_receive("[]".intern).any_number_of_times{|k| @opt[k]} @bf = Hiki::Filter::BayesFilter.init(@conf) end it "is module" do @bf.should be_kind_of(Module) end it "threshold" do @bf.threshold.should == 0.90 end it "db" do @bf.db.should be_kind_of(Bayes::PaulGraham) end it "page_is_ham?" do db = mock("database") Hiki::Filter::BayesFilter.stub!(:db).and_return(db) pd = Hiki::Filter::PageData bfpd = Hiki::Filter::BayesFilter::PageData db.stub!(:estimate).and_return(0.0) bfpd.new(pd.new("Page", "text")).ham?.should be_true db.stub!(:estimate).and_return(1.0) bfpd.new(pd.new("Page", "spam")).ham?.should be_false db.stub!(:estimate).and_return(0.5) bfpd.new(pd.new("Page", "ham spam")).ham?.should == nil db.stub!(:estimate).and_return(nil) bfpd.new(pd.new("Page", "ham spam")).ham?.should == nil end it ".filter should call Hiki::Filter.plugin.sendmail" do new_page = Hiki::Filter::PageData.new( "Page", "text", "title") old_page = Hiki::Filter::PageData.new("Page") plugin = stub("plugin") plugin.should_receive(:sendmail) Hiki::Filter.should_receive(:plugin).and_return(plugin) lambda{@bf.filter(new_page, old_page, false)}.should_not raise_error end it ".filter should not call Hiki::Filter.plugin.sendmail when posted by registered user" do new_page = Hiki::Filter::PageData.new( "Page", "text", "title") old_page = Hiki::Filter::PageData.new("Page") Hiki::Filter.should_not_receive(:plugin) lambda{@bf.filter(new_page, old_page, true)}.should_not raise_error end end describe Hiki::Filter::BayesFilter::PageData do include SetupBayesFilter it "url" do pd = Hiki::Filter::BayesFilter::PageData.new(Hiki::Filter::PageData.new("Wiki Name", "text")) pd.url.should == "#{@index_url}?Wiki+Name" end it "ham?" do pd = Hiki::Filter::PageData bfpd = Hiki::Filter::BayesFilter::PageData bfpd.new(pd.new("Page", "text")).ham?.should be_nil @bf.db.ham << ["ham"] bfpd.new(pd.new("Page", "ham")).ham?.should be_true @bf.db.spam << ["spam"] bfpd.new(pd.new("Page", "spam")).ham?.should be_false bfpd.new(pd.new("Page", "ham spam")).ham?.should be_nil end it "token" do pd = Hiki::Filter::PageData bfpd = Hiki::Filter::BayesFilter::PageData o = pd.new("Page", "text", "Title", "keyword", "127.0.0.1") tl = Hiki::Filter::BayesFilter::TokenList.new tl << "Page" << "text" << "Title" << "keyword" tl.add_host("127.0.0.1", "A") bfpd.new(o).token.sort.should == tl.sort tl.clear.add_host("127.0.0.1", "A") bfpd.new(o.dup, o).token.sort.should == tl.sort tl.clear << "newtext" << "New" << "newword" tl.add_host("127.0.0.2", "A") bfpd.new(pd.new("Page", "text\nnewtext", "New", "newword\nkeyword", "127.0.0.2"), o).token.sort.should == tl.sort end it "diff_text" do pd = Hiki::Filter::PageData Hiki::Filter::BayesFilter::PageData.new(pd.new("", "old1\nnew1\nold2\nnew2"), pd.new("", "old1\nold2")).diff_text.should == "new1\nnew2" end it "diff_keyword" do pd = Hiki::Filter::PageData Hiki::Filter::BayesFilter::PageData.new(pd.new(nil, nil, nil, "old1\nnew1\nold2\nnew2"), pd.new(nil, nil, nil, "old1\nold2")).diff_keyword.sort.should == ["new1", "new2"].sort end it "get_unified_diff" do pd = Hiki::Filter::PageData Hiki::Filter::BayesFilter::PageData.new(pd.new("", "old1\nnew1\nold2\nnew2\n"), pd.new("", "old1\nold2\n")).get_unified_diff.should == "@@ -1,2 +1,4 @@\n old1\n+new1\n old2\n+new2\n" end end describe Hiki::Filter::BayesFilter::PageData, "save and load" do include SetupBayesFilter before do @time = Time.local(2001,2,3,4,5,6,7) @time2 = Time.local(2001,2,3,4,5,6,8) @time_str = @time.strftime("%Y%m%d%H%M%S") << format("%06d", @time.usec) @time2_str = @time2.strftime("%Y%m%d%H%M%S") << format("%06d", @time2.usec) pd = Hiki::Filter::PageData bp = Hiki::Filter::BayesFilter::PageData @pd = bp.new(pd.new("WikiName", "text", "Title of page", "key\nword", "127.0.0.1"), pd.new, @time) end it "time_str" do @time_str.should == "20010203040506000007" end it "file_name" do @pd.file_name.should == @time_str end it "PageData#cache_path" do path = "#{@tmpdir}/cache/bayes" File.should_not be_exist(path) @pd.cache_path.should == path File.should be_exist(path) end it "PageData.cache_path" do path = "#{@tmpdir}/cache/bayes" File.should_not be_exist(path) Hiki::Filter::BayesFilter::PageData.cache_path.should == path File.should be_exist(path) end it "PageData#corpus_path" do path = "#{@tmpdir}/cache/bayes/corpus" File.should_not be_exist(path) @pd.corpus_path.should == path File.should be_exist(path) end it "PageData.corpus_path" do path = "#{@tmpdir}/cache/bayes/corpus" File.should_not be_exist(path) Hiki::Filter::BayesFilter::PageData.corpus_path.should == path File.should be_exist(path) end it "cache_file_name if DOUBT" do @pd.cache_file_name.should == "#{@tmpdir}/cache/bayes/D#{@time_str}" end it "cache_file_name if HAM" do @bf.db.ham << ["text"] @pd.cache_file_name.should == "#{@tmpdir}/cache/bayes/H#{@time_str}" end it "cache_file_name if SPAM" do @bf.db.spam << ["WikiName", "New", "Title"] @pd.cache_file_name.should == "#{@tmpdir}/cache/bayes/S#{@time_str}" end it "save and load" do File.should_not be_exist(@pd.cache_file_name) @pd.cache_save File.should be_exist(@pd.cache_file_name) pd2 = Hiki::Filter::BayesFilter::PageData.load(@pd.cache_file_name) pd2.should be_kind_of(Hiki::Filter::BayesFilter::PageData) [:page, :text, :title, :keyword, :remote_addr].each do |m| pd2.old_page.send(m).should == @pd.old_page.send(m) pd2.new_page.send(m).should == @pd.new_page.send(m) end pd2.time.should == @pd.time end it "load and delete" do @pd.cache_save File.should be_exist(@pd.cache_file_name) Hiki::Filter::BayesFilter::PageData.load(@pd.cache_file_name) File.should be_exist(@pd.cache_file_name) Hiki::Filter::BayesFilter::PageData.load(@pd.cache_file_name, true) File.should_not be_exist(@pd.cache_file_name) path = "#{@tmpdir}/dummy" open(path, "w") do |f| Marshal.dump([], f) end File.should be_exist(path) Hiki::Filter::BayesFilter::PageData.load(path) File.should be_exist(path) Hiki::Filter::BayesFilter::PageData.load(path, true) File.should be_exist(path) end it "load invalid data and return nil" do file = "#{@tmpdir}/dummy" open(file, "w") do |f| Marshal.dump([], f) end Hiki::Filter::BayesFilter::PageData.load(file).should be_nil end it "load cache" do @pd.cache_save pd = Hiki::Filter::BayesFilter::PageData.load_from_cache(@pd.cache_file_name[/.\d+$/]) pd.cache_file_name.should == @pd.cache_file_name Hiki::Filter::BayesFilter::PageData.load_from_cache(@pd.cache_file_name[/.\d+$/], true) File.should_not be_exist(@pd.cache_file_name) end it "save different data at same time" do fn = @pd.cache_file_name @pd.cache_save @pd.cache_file_name.should == fn @pd.time.should == @time @pd.cache_save @pd.time.should_not == @time @pd.time.should == @time2 @pd.file_name.should == @time2_str @pd.cache_file_name.should == "#{@tmpdir}/cache/bayes/D#{@time2_str}" end it "saving at same time over 10 times raise error" do time = @time.dup 10.times do lambda{@pd.cache_save}.should_not raise_error end @time.should == time pd2 = Hiki::Filter::BayesFilter::PageData.new(Hiki::Filter::PageData.new("Page", "text", "Title"), Hiki::Filter::PageData.new, @time) lambda{pd2.cache_save}.should raise_error(Errno::EEXIST) pd2.time.should == time end it "corpus_save" do ham = "#{@tmpdir}/cache/bayes/corpus/H#{@time_str}" spam = "#{@tmpdir}/cache/bayes/corpus/S#{@time_str}" File.should_not be_exist(ham) File.should_not be_exist(spam) @pd.corpus_save(true) File.should be_exist(ham) @pd.corpus_save(false) File.should be_exist(spam) end end hiki-1.0.0/spec/spec_filter.rb000066400000000000000000000022421212533356300162150ustar00rootroot00000000000000# Copyright (C) 2008, KURODA Hiraku # You can redistribute it and/or modify it under GPL2. require "tmpdir" require "fileutils" require "hiki/command" describe Hiki::Filter, "when error raised in filtering" do before do Hiki::Filter.should_not be_respond_to(:clear_filters) module Hiki::Filter def self.clear_filters r = @filters.dup @filters.clear r end end @original_filters = Hiki::Filter::clear_filters Hiki::Filter.add_filter do raise "ERROR" end @conf = stub("conf", :null_object=>true) @cgi = stub("cgi", :null_object=>true) @plugin = stub("plugin", :null_object=>true) @db = stub("db", :null_object=>true) Hiki::Filter.init(@conf, @cgi, @plugin, @db) end after do Hiki::Filter::clear_filters @original_filters.each do |filter| Hiki::Filter.add_filter(&filter) end class << Hiki::Filter undef clear_filters end end it "should through page data without filter raised error" do r = nil lambda{r = Hiki::Filter.new_page_is_spam?("TestPage", "text", "title")}.should_not raise_error r.should be_false end end hiki-1.0.0/style/000077500000000000000000000000001212533356300135775ustar00rootroot00000000000000hiki-1.0.0/style/default/000077500000000000000000000000001212533356300152235ustar00rootroot00000000000000hiki-1.0.0/style/default/html_formatter.rb000066400000000000000000000160551212533356300206060ustar00rootroot00000000000000# $Id: html_formatter.rb,v 1.62 2008-01-06 05:49:30 znz Exp $ # Copyright (C) 2002-2003 TAKEUCHI Hitoshi require 'hiki/util' require 'hiki/pluginutil' require 'hiki/interwiki' require 'hiki/aliaswiki' require 'hiki/hiki_formatter' require 'uri' module Hiki class HTMLFormatter_default < HikiFormatter include Hiki::Util def initialize( s, db, plugin, conf, prefix = 'l') @html = s @db = db @plugin = plugin @conf = conf @prefix = prefix @references = [] @interwiki = InterWiki.new( @db.load( @conf.interwiki_name ) ) @aliaswiki = AliasWiki.new( @db.load( @conf.aliaswiki_name ) ) get_auto_links if @conf.auto_link end def to_s s = @html s = replace_inline_image( s ) s = replace_link( s ) s = replace_auto_link( s ) if @conf.auto_link s = replace_heading( s ) s = replace_plugin( s ) if @conf.use_plugin @html_converted = s s end def references @references.uniq end HEADING_RE = %r!.*.*?(.*?)! TAG_RE = %r!(<.+?>)! def toc s = "
      \n" num = -1 level = 1 to_s unless @html_converted @html_converted.each_line do |line| if HEADING_RE =~ line new_level = $1.to_i - 1 num += 1 title = $2.gsub( TAG_RE, '' ).strip if new_level > level s << ( "
        \n" * ( new_level - level ) ) level = new_level elsif new_level < level s << ( "
      \n" * ( level - new_level ) ) level = new_level end s << %Q!
    • #{title}
    • \n! end end s << ("
    \n" * level) s end private def replace_inline_image( text ) text.gsub( /(.+?)<\/a>/i ) do |str| %Q|#{$3}| end end def replace_auto_link( text ) return text if @auto_links.empty? replace_inline( text ) do |str| str.gsub!( @auto_links_re ) do |match| @plugin.hiki_anchor( escape(unescape_html(@auto_links[match])), match ) end end end PLUGIN_OPEN_RE = /<(span|div) class="plugin">/ PLUGIN_CLOSE_RE = %r!! LINK_OPEN_RE = /! PRE_OPEN_RE = /
    /
        PRE_CLOSE_RE = %r!
    ! def replace_inline( text ) status = [] ret = text.split( TAG_RE ).collect do |str| case str when PLUGIN_OPEN_RE status << :plugin when LINK_OPEN_RE status << :a when PRE_OPEN_RE status << :pre when PLUGIN_CLOSE_RE, LINK_CLOSE_RE, PRE_CLOSE_RE status.pop when TAG_RE # do nothing else if status.empty? yield( str ) end end str end ret.join end URI_RE = /\A#{URI.regexp( %w( http https ftp file mailto ) )}\z/ def replace_link( text ) text.gsub( %r|
    (.+?)| ) do |str| k, u = $2, $1 if URI_RE =~ u # uri @plugin.make_anchor(u, k, 'external') else u = unescape_html(u) u = @aliaswiki.aliaswiki_names.key( u ) || u # alias wiki if /(.*)(#l\d+)\z/ =~ u u, anchor = $1, $2 else anchor = '' end if @db.exist?( u ) # page name k = @plugin.page_name( k ) if k == u @references << u @plugin.hiki_anchor( escape(u) + anchor, k ) elsif orig = @db.select{|i| i[:title] == u}.first # page title k = @plugin.page_name( k ) if k == u u = orig @references << u @plugin.hiki_anchor( escape(u) + anchor, k ) elsif outer_alias = @interwiki.outer_alias( u ) # outer alias @plugin.make_anchor(outer_alias[0] + anchor, k, 'external') elsif /:/ =~ u # inter wiki ? s, p = u.split( /:/, 2 ) if s.empty? # normal link @plugin.make_anchor( h(p) + anchor, k, 'external') elsif inter_link = @interwiki.interwiki( s, unescape_html(p), "#{s}:#{p}" ) @plugin.make_anchor(inter_link[0], k, 'external') else missing_page_anchor( k, u ) end else missing_page_anchor( k, u ) end end end end def missing_page_anchor( k, u ) if @plugin.creatable? missing_anchor_title = @conf.msg_missing_anchor_title % [h(u)] "#{k}?" else k end end BLOCKQUOTE_OPEN_RE = /
    / BLOCKQUOTE_CLOSE_RE = %r!
    ! HEADING_OPEN_RE = // HEADING_CLOSE_RE = %r!! def replace_heading( text ) status = [] num = -1 ret = text.split( TAG_RE ).collect do |str| case str when BLOCKQUOTE_OPEN_RE status << :blockquote when BLOCKQUOTE_CLOSE_RE status.pop when HEADING_OPEN_RE unless status.include?( :blockquote ) num += 1 level = $1.to_i status << level case level when 2 str << %Q! ! when 3 str << %Q! ! else str << %Q! ! end end when HEADING_CLOSE_RE unless status.include?( :blockquote ) level = status.pop str = "#{str}" if level == 2 end end str end ret.join end def replace_plugin( text ) text.gsub( %r!<(span|div) class="plugin">\{\{(.+?)\}\}!m ) do |str| tag, plugin_str = $1, $2 begin case tag when 'span' result = @plugin.inline_context{ apply_plugin( plugin_str, @plugin, @conf ) } when 'div' result = @plugin.block_context{ apply_plugin( plugin_str, @plugin, @conf ) } end result.class == String ? result : '' rescue Exception => e $& + e.message end end end def get_auto_links pages = {} @db.pages.each do |p| page_h = escape_html( p ) pages[page_h] = page_h title_h = @plugin.page_name( p ).gsub( /"/, '"' ) pages[title_h] = page_h unless title_h == page_h end @aliaswiki.aliaswiki_names.each do |key, value| orig_h = escape_html( key ) alias_h = escape_html( value ) pages[alias_h] = orig_h end @auto_links_re = Regexp.union( * pages.keys.sort_by{|i| -i.size} ) @auto_links = pages end def escape_html( text ) text.gsub( /&/, '&' ). gsub( //, '>' ) end end end hiki-1.0.0/style/default/parser.rb000066400000000000000000000013161212533356300170450ustar00rootroot00000000000000# $Id: parser.rb,v 1.22 2005-12-28 22:42:55 fdiary Exp $ # Copyright (C) 2002-2003 TAKEUCHI Hitoshi require 'hikidoc' module Hiki class Parser_default class << self def heading( str, level = 1 ) '!' * level + str end def link( link_str, str = nil ) str ? "[[#{str}|#{link_str}]]" : "[[#{link_str}]]" end def blockquote( str ) str.split(/\n/).collect{|s| %Q|""#{s}\n|}.join end end def initialize( conf ) @use_wiki_name = conf.use_wikiname end def parse( s, top_level = 2 ) HikiDoc.to_html( s, :level => top_level, :use_wiki_name => @use_wiki_name ) end end end hiki-1.0.0/style/math/000077500000000000000000000000001212533356300145305ustar00rootroot00000000000000hiki-1.0.0/style/math/README000066400000000000000000000041001212533356300154030ustar00rootroot00000000000000! Math 鴻帥ゃ医頫腓冴違ゃ default 鴻帥ゃ≦宍医茵腓冴с鴻帥ゃс !! 綽荀 * LaTeX DVI 紊 (鐚platex) * DVI PS 紊 (鐚dvips) * PS PNG 紊 (鐚convert ghostscript) !! ゃ潟鴻若号 # hikiconf.rb @style @style = 'math' 紊眼 # misc/plugin/math.rb plugin/ 潟若 !! 吾 羈 Hiki default 鴻帥ゃゃ潟ゃ恰医 [$...$] 若≪c鴻ゆ医 $$... $$... 若≪菴遵障 !! 激с Math 鴻帥ゃс篁ヤ激с潟障hikiconf.rb荐菴違 * @options['math.latex.ptsize'] ** LaTeX 堺ゃ潟泣ゃ冴с ( '12pt') * @options['math.latex.documentclass'] ** LaTeX documentclass с ( 'report') * @options['math.latex.preamble'] ** laTeX preamble с ( '') * @options['math.latex.latex'] ** LaTeX DVI 紊潟潟 ( 'platex %.tex') * @options['math.latex.dvips'] ** DVI PS 紊潟潟 ( 'dvips %.dvi') * @options['math.latex.convert'] ** DVI PNG 紊潟潟 ( 'convert -antialias -trim -transparent white %.ps %.png') * @options['math.latex.log'] ** 違阪 ( false) * @options['math.latex.recompile'] ** 鴻潟紊 ( false) !! Tips 若篏帥c翫@options['math.latex.convert'] 'convert -antialias -trim -border 4x4 -bordercolor white %.ps %.png' 'convert -antialias -trim -negate -transparent black %.ps %.png' 荐絎医荀с hiki-1.0.0/style/math/html_formatter.rb000066400000000000000000000014611212533356300201060ustar00rootroot00000000000000# $Id: html_formatter.rb,v 1.4 2005-09-29 04:53:01 fdiary Exp $ require 'hiki/util' require "style/default/html_formatter" require "style/math/latex.rb" module Hiki class HTMLFormatter_math < HTMLFormatter_default include Hiki::Util def to_s super @html_converted = replace_math( @html_converted ) end private def replace_math( text ) replace_inline( text ) do |str| str.gsub!( /\[\$(.+?)\$\]/ ) do |match| math.text_mode(unescape_html($1) ) end str.gsub!( /(^\$\$.*\n?)+/ ) do |match| '
    %s
    ' % math.display_mode( unescape_html(match).gsub( /^\$\$/, '' ) ) end end end def math @math ||= Math_latex.new(@conf, @plugin.instance_eval{@page}) end end end hiki-1.0.0/style/math/latex.rb000066400000000000000000000053411212533356300161750ustar00rootroot00000000000000require "digest/md5" require 'hiki/util' module Hiki class Math_latex include Hiki::Util def initialize(conf, page) @conf = conf @page = page @cache_path = "#{@conf.cache_path}/math_latex" @image_path = "#{@cache_path}/#{escape(@page)}" begin Dir.mkdir(@cache_path) unless test(?e, @cache_path.untaint) rescue Exception end @ptsize = @conf['math.latex.ptsize'] @documentclass = @conf['math.latex.documentclass'] @preamble = @conf['math.latex.preamble'] @latex = @conf['math.latex.latex'] ||= 'latex %.tex' @dvips = @conf['math.latex.dvips'] ||= 'dvips %.dvi' @convert = @conf['math.latex.convert'] ||= 'convert -antialias -transparent white -trim %.ps %.png' @log = @conf['math.latex.log'] end def md5(text) Digest::MD5.hexdigest(text) end def prepare_directory begin Dir.mkdir(@image_path) unless test(?e, @image_path.untaint) rescue Exception end end def typeset(text) self.prepare_directory() filename = md5(text.untaint) if !File.exist?("#{@image_path}/#{filename}.png") then File.open("#{@image_path}/#{filename}.tex", "w") do |f| f.puts('\documentclass[' + @ptsize + 'pt]{' + @documentclass + '}') f.puts(@preamble) f.puts('\pagestyle{empty}') f.puts('\begin{document}') f.puts(text) f.puts('\end{document}') end begin if @log log = ">>#{filename}.err 2>&1" else log = ">/dev/null 2>&1" end [ @latex, @dvips, @convert ].each do |cmd| run = cmd.gsub('%') { filename } File.open("#{@image_path}/#{filename}.err", "a"){|f| f.puts("cd #{@image_path} && #{run}") } if @log raise unless system("cd #{@image_path} && #{run} #{log}") end %w( tex aux log dvi ps err ).each do |ext| next if ext == "err" and @log gabage = "#{@image_path}/#{filename}.#{ext}" File.delete(gabage) if File.exist?(gabage) end rescue if @log "Error: see error log `#{filename}.err'" else "Error: set @options['tex.log'] = true and see the error log." end end end html = %Q!! end def text_mode(text) return '' unless text typeset("$#{text}$") end def display_mode(text) return '' unless text typeset("\\[#{text}\\]") end end end hiki-1.0.0/style/math/parser.rb000066400000000000000000000002241212533356300163470ustar00rootroot00000000000000# $Id: parser.rb,v 1.3 2005-09-29 04:53:01 fdiary Exp $ require "style/default/parser" module Hiki class Parser_math < Parser_default end end hiki-1.0.0/style/rd+/000077500000000000000000000000001212533356300142575ustar00rootroot00000000000000hiki-1.0.0/style/rd+/anchorlist.rb000066400000000000000000000052111212533356300167510ustar00rootroot00000000000000# anchorlist.rb for Hiki/RD+ # # Copyright (c) 2003 Masao Mutoh # You can redistribute it and/or modify it under GPL2. # # Original: a.rb is from tDiary # a.rb - # Copyright (c) 2002,2003 MUTOH Masao # You can redistribute it and/or modify it under GPL2. # require 'nkf' require 'hiki/util' module Hiki class AnchorList include Hiki::Util REG_PIPE = /\|/ REG_COLON = /\:/ REG_URL = /:\/\// REG_CHARSET = /euc|sjis|jis/ REG_CHARSET2 = /sjis|jis/ REG_CHARSET3 = /euc/ URL = '(?:http|https|ftp|mailto|file):\/\/[a-zA-Z0-9;/?:@&=+$,\-_.!~*\'()%#]+' REG_INTERWIKI_NAME = /\[\[([^|]+)\|(#{URL})\]\](?:\s+(sjis|euc))?/ def initialize(interwiki_data, plugin) @anchors = {} @plugin = plugin n = interwiki_data || '' n.scan(REG_INTERWIKI_NAME) do |i| @anchors[i[0]] = [i[1], "", i.size > 2 ? i[2] : ""] end end def separate(word) if REG_PIPE =~ word name, data = $`, $' else name, data = nil, word end option = nil if data =~ REG_URL key = data elsif data =~ REG_COLON key, option = $`, $' else key = data #Error pattern end [key, option, name] end def convert_charset(option, charset) return "" unless option return option unless charset if charset =~ REG_CHARSET2 ret = escape(NKF.nkf("-#{charset[0].chr}", option)) elsif charset =~ REG_CHARSET3 ret = escape(option) else ret = option end ret end def data(key) data = @anchors[key] if data data.collect{|v| v ? v.dup : nil} else [nil, nil, nil] end end def create_anchor(key, option_or_name = nil, name = nil, charset = nil) url, value, cset = data(key) if url.nil? key, option, name = separate(key) url, value, cset = data(key) option_or_name = option unless option_or_name end charset = cset unless charset option_or_name = "#{option_or_name}" if option_or_name value = "#{key}:#{option_or_name}" if value == "" if url.nil? url = key if name value = name url += convert_charset(option_or_name, charset) elsif option_or_name value = option_or_name else value = key end else url += convert_charset(option_or_name, charset) value = name if name end %Q[#{value}] end def has_key?(key) @anchors.has_key?(key) end end end hiki-1.0.0/style/rd+/html_formatter.rb000066400000000000000000000030551212533356300176360ustar00rootroot00000000000000# html_formatter.rb for Hiki/RD+ # # Copyright (C) 2003 Masao Mutoh # # You can redistribute it and/or modify it under the terms of # the Ruby's licence. # # The original html_formatter.rb: # Copyright (C) 2002-2003 TAKEUCHI Hitoshi # You can redistribute it and/or modify it under the terms of # the Ruby's licence. require 'hiki/util' require 'hiki/hiki_formatter' require 'style/rd+/rd2html.rb' module Hiki class HTMLFormatter_rd < HikiFormatter include Hiki::Util def initialize( s, db, plugin, conf, suffix = 'l') @tokens = s @db = db @plugin = plugin @conf = conf @visitor = Hiki::RD2HTMLVisitor.new(@plugin, @db, @conf) end def to_s @references = @visitor.references begin @visitor.visit(@tokens).gsub(/<\/?body>/, "") rescue Exception tree = RD::RDTree.new("=begin\n==Error! Please edit this page again.\n#{h($!.backtrace.join("\n"))}" + "\n=end\n") @visitor.visit(tree).gsub(/<\/?body>/, "") end end def references @references.uniq end def toc s = "
      \n" lv = 1 @visitor.toc.each do |hash| if hash['level'] > lv s << ( "
        \n" * ( hash['level'] - lv ) ) lv = hash['level'] elsif hash['level'] < lv s << ( "
      \n" * ( lv - hash['level'] ) ) lv = hash['level'] end s << %Q!
    • #{h(hash['title'])}\n! end s << ("
    \n" * lv) end end end hiki-1.0.0/style/rd+/parser.rb000066400000000000000000000023121212533356300160760ustar00rootroot00000000000000# parser.rb for Hiki/RD+ # # Copyright (C) 2003 Masao Mutoh # # You can redistribute it and/or modify it under the terms of # the Ruby's licence. require 'rd/rdfmt' require 'cgi' module Hiki class Parser_rd class << self def heading( str, level = 1 ) '=' * level + str end def link( link_str, str = nil ) require 'uri' link_str = "URL:#{link_str}" if link_str.index( URI.regexp ) == 0 str ? "((<#{str}|#{link_str}>))" : "((<#{link_str}>))" end def blockquote( str ) str # RD does not support blockquote. end end def initialize( conf ) end def parse(s) begin RD::RDTree.new("=begin\n#{s}\n=end\n\n") rescue error = $!.message.gsub(/^/, " ") i = 0 s = "\n#{s}\n" src = s.split(/\n/).collect{|v| i += 1; " %03d: #{v.gsub('%', '%%')}" % [i]}.join("\n") begin RD::RDTree.new("=begin\n==Error! Please edit this page again.\n#{error}\n===Original document\n\n#{src}" + "\n=end\n") rescue RD::RDTree.new("=begin\n==Error! Please edit this page again.\n#{error}\n=end\n") end end end end end hiki-1.0.0/style/rd+/rd2html.rb000066400000000000000000000215161212533356300161650ustar00rootroot00000000000000# rd2html.rb for Hiki/RD+ # # Copyright (C) 2003,2004 Masao Mutoh # # You can redistribute it and/or modify it under the terms of # the Ruby's licence. # # The original rd2html-lib.rb in rdtool-0.6.11: # Copyright (C) 2002 Tosh # # You can redistribute it and/or modify it under the terms of # the Ruby's licence. require "cgi" require "rd/rd2html-lib" require 'style/rd+/anchorlist' require 'hiki/pluginutil' require 'hiki/util' module Hiki class RD2HTMLVisitor < RD::RD2HTMLVisitor include Hiki::Util attr_reader :references, :toc EVAL_PLUGIN_RE = /\{\{(.*?)\}\}/m LAST_WORD_RE = /^[A-Z0-9_]*$/ CLASS_RE = /\#|::|\./ CHR_ENTITY_RE = "<|>|&|"" CONSTANT_RE = /([a-zA-Z0-9_\+!\?\=\|\[\]]|#{CHR_ENTITY_RE})+/ ESC_WORD = '_h_i-k-i_' ESC_WORD_RE = /#{ESC_WORD}/ def initialize(plugin, db, conf) super() @title = "Untitled" @plugin = plugin @db = db @conf = conf @references = [] @regex = nil @toc = [] if text = @db.load("ModuleNames") @modulenames = text.split(/\s/).join("|") @esc_modulenames = /(#{text.split(/\s/).join(ESC_WORD + "|") + ESC_WORD})/ @regex_modulenames = /#{@modulenames}/ @regex = /(#{@modulenames})[\#\.\:](#{CHR_ENTITY_RE}|[a-zA-Z0-9_\#\.\:\=\[])*(#{CHR_ENTITY_RE}|[a-zA-Z0-9_!\+\?\=&\|\]])/ end #InterWikiName @anchorlist = AnchorList.new(@db.load(@conf.interwiki_name), plugin) end def get_anchor(element) escape(element.label) end def div_class_method(s) if sep = s.scan(CLASS_RE) # Gtk::Hoge#fuga, Gtk::Hoge.fuga, Gtk::Hoge::Foo # If Gtk::Hoge. << period for document, unscan it. if constant = s.scan(CONSTANT_RE) constant = unescape_html(constant) child = div_class_method(s) if child [sep, constant] << child else [sep, constant] end else [sep] end else nil end end def special_parse(content) return content if content.nil? or content == "" #Eval Plugin content = content.gsub(EVAL_PLUGIN_RE) do |match| method = unescape_html($1) ret = '' begin ret = Hiki::Util.apply_plugin(method, @plugin, @conf) ret.gsub!(@regex_modulenames, "\\&#{ESC_WORD}") if @regex_modulenames rescue Exception err = "Plugin Error: #{$!}" #
    #{match}
    " if @conf.plugin_debug err += "

    Back trace

    "
                $!.backtrace.each do |v|
                  err += v + "\n"
                  break if v =~ /special_parse/
                end
                err += "
    " end ret = err end ret end #Special Parse if @regex content = content.gsub(@regex) do |match| s = StringScanner.new(match) module_name = s.scan(@regex_modulenames) separator = "" lastword = "" name = "" option = nil divary = div_class_method(s) if divary divary.flatten! lastword = divary.pop separator = divary.pop if divary.size == 0 if separator == "::" if lastword =~ LAST_WORD_RE # Constants target = escape(module_name) name = module_name + separator + lastword option = lastword else # Class module_name += separator + lastword target = escape(module_name) name = module_name end else # Module method target = escape(module_name) name = module_name + separator + lastword option = module_name + escape(separator + lastword) end elsif divary.size > 1 module_name += divary.join target = escape(module_name) name = module_name + separator + lastword if separator == "." option = "#{target}.#{escape(lastword)}" else option = escape(lastword) end end #Create result if @db.exist?(module_name) @references << module_name if option ret = @plugin.hiki_anchor(target + "#" + option, name) else ret = @plugin.hiki_anchor(target, name) end else ret = %Q[#{name}?] end ret else match end end content = content.gsub(@esc_modulenames) do |match| match.gsub(ESC_WORD_RE, "") end end content end def apply_to_DocumentElement(element, content) html_body(content) + "\n" end def a_name_href(anchor, label) if label.is_a? String label.gsub!(ESC_WORD_RE, "") else label[0].gsub!(ESC_WORD_RE, "") end %Q[#{label}] end def apply_to_Headline(element, title) title = special_parse(title.join) anchor = get_anchor(element) label = hyphen_escape(element.label) @toc.push({'level' => element.level, 'index' => anchor, 'title' => title}) depth = element.level depth += @conf.options['rd.header_depth'] - 1 if @conf.options['rd.header_depth'] %Q[#{a_name_href(anchor, title)}] + %Q[] end def apply_to_TextBlock(element, content) content = content.join("") content = special_parse(content) if (is_this_textblock_only_one_block_of_parent_listitem?(element) or is_this_textblock_only_one_block_other_than_sublists_in_parent_listitem?(element)) content.chomp else %Q[

    #{content.chomp}

    ] end end def apply_to_DescListItem(element, term, description) anchor = get_anchor(element.term) label = hyphen_escape(element.label) if description.empty? %Q[
    #{a_name_href(anchor, term)}
    ] else %Q[
    #{a_name_href(anchor, term)}
    \n] + %Q[
    \n#{description.join("\n").chomp}\n
    ] end end def apply_to_MethodListItem(element, term, description) term = parse_method(term) # maybe: term -> element.term anchor = get_anchor(element.term) label = hyphen_escape(element.label) if description.empty? %Q[
    #{a_name_href(anchor, "" + term + "")}
    ] else %Q[
    #{a_name_href(anchor, "" + term + "")}
    ] + %Q[
    \n#{description.join("\n")}
    ] end end def apply_to_Reference_with_URL(element, content) url = element.label.url if /\.(jpg|jpeg|png|gif)\z/ =~ url %Q[#{content.join(] else %Q[#{content.join("")}] end end def apply_to_Reference(element, content) content end def apply_to_RefToElement(element, content) content = content.join("") content.gsub!(@regex_modulenames, "\\&#{ESC_WORD}") if @regex_modulenames label = element.to_label key, *option = label.split(/\#/) if @db.infodb_exist? and @db.info_exist?(key) escaped = escape(key) if @regex_modulenames escaped.gsub!(@regex_modulenames, "\\&#{ESC_WORD}") escaped += '#' + escape(option.join.gsub(@regex_modulenames, "\\&#{ESC_WORD}")) if option and option.size > 0 end @references << key @plugin.hiki_anchor(escaped, content) else key, option, name = @anchorlist.separate(label) if @anchorlist.has_key?(key) name = content if content @anchorlist.create_anchor(key, option, name) else if @regex_modulenames and @regex_modulenames =~ label label.gsub!(@regex_modulenames, "\\&#{ESC_WORD}") end escaped = escape(label) content + %Q[?] end end end def apply_to_Verbatim(element) begin require 'rt/rt2html-lib' content = element.content if /\A#\s*RT\s*/ =~ content[0] content.shift rt_visitor = ::RT::RT2HTMLVisitor.new return rt_visitor.visit(::RT::RTParser.parse(content.join)) end rescue LoadError $stderr.puts "RTtool cannot be load" end super(element) end end end hiki-1.0.0/template/000077500000000000000000000000001212533356300142525ustar00rootroot00000000000000hiki-1.0.0/template/adminform.html000066400000000000000000000015101212533356300171110ustar00rootroot00000000000000
    <%= @contents[:tools] %>

    <%=@conf.msg_config%>

    <%=@plugin.conf_label( @contents[:key] )%>

    <%=@plugin.conf_proc( @contents[:key] )%>

    hiki-1.0.0/template/diff.html000066400000000000000000000010771212533356300160550ustar00rootroot00000000000000
    <%= @contents[:tools] %>

    <%= @contents[:title] %>

    • <%=@conf.msg_diff_add%>
    • <%=@conf.msg_diff_del%>

    <%= @contents[:differ] %>
    <% if @contents[:sidebar_class] %>
    <%= @contents[:sidebar] %>
    <% end %> hiki-1.0.0/template/edit.html000066400000000000000000000042451212533356300160720ustar00rootroot00000000000000
    <%= @contents[:tools] %>

    <%= @contents[:title] %>

    <% if @contents[:msg] %>
    <%= @contents[:msg] %>
    <% end %> <% if @contents[:body] %>
    <%= @contents[:body] %>
    <% end %> <% if @contents[:differ] %>
    <%= @contents[:differ] %>
    <% end %>

    <%=@conf.msg_title%>

    <% if @contents[:preview_button] %><% end %> <% if @contents[:button] %><% end %> ><%=@conf.msg_update_timestamp%>

    <%=@conf.msg_keyword_form%>

    <% if @plugin.admin? %>

    ><%=@conf.msg_freeze_checkbox%>

    <% end %>
    <%= @contents[:edit_proc] %>
    <% if @contents[:link] %>
    <%=@conf.msg_latest%>: [<%= @contents[:link] %>]
    <% end %>

    <% unless @contents[:form_proc].empty? %>
    <%= @contents[:form_proc] %>
    <% end %>

    <%=@conf.msg_rules%>

    hiki-1.0.0/template/error.html000066400000000000000000000007041212533356300162720ustar00rootroot00000000000000<
    <%= @contents[:tools] %>

    <%= @contents[:view_title] %>

    <%= @contents[:message] %>
    <% if @contents[:sidebar_class] %>
    <%= @contents[:sidebar] %>
    <% end %> hiki-1.0.0/template/form.html000066400000000000000000000016551212533356300161120ustar00rootroot00000000000000
    <%= @contents[:tools] %>

    <%= @contents[:title] %>

    <% if @contents[:list] %>
      <% @contents[:list].each do |i| %>
    • <%= i %>
    • <% end %>
    <% end %> <% if @contents[:msg1] %>
    <%= @contents[:msg1] %>
    <% end %>
    <%= @contents[:msg2] %>>
    <% if @contents[:sidebar_class] %>
    <%= @contents[:sidebar] %>
    <% end %> hiki-1.0.0/template/hiki.conf000066400000000000000000000013351212533356300160470ustar00rootroot00000000000000# # hiki configuration file via CGI $Revision: 1.5 $ # # # basic # site_name = <%= @site_name.dump %> author_name = <%= @author_name.dump %> mail = <%= TMarshal::dump(@mail || []) %> mail_on_update = <%= @mail_on_update.inspect %> # # password # password = <%= @password.dump %> # # theme # theme = <%= @theme.dump %> theme_url = <%= @theme_url.dump %> theme_path = <%= @theme_path.dump %> use_sidebar = <%= @use_sidebar.inspect %> main_class = <%= @main_class.dump %> sidebar_class = <%= @sidebar_class.dump %> auto_link = <%= @auto_link.inspect %> use_wikiname = <%= @use_wikiname.inspect %> # # options for plugins # options2 = <%= TMarshal::dump @options2 %> # # XML-RPC interfaces # xmlrpc_enabled = <%= @xmlrpc_enabled %> hiki-1.0.0/template/i.adminform.html000066400000000000000000000011361212533356300173440ustar00rootroot00000000000000
    <%= @contents[:tools] %>

    <%=@conf.msg_config%>

    |<% @plugin.each_conf_key do |key|%><%=@plugin.conf_label( key )%>|<% end %>

    <%=@plugin.conf_label( @contents[:key] )%>

    <%=@plugin.conf_proc( @contents[:key] )%>
    hiki-1.0.0/template/i.diff.html000066400000000000000000000001531212533356300162760ustar00rootroot00000000000000
    <%= @contents[:tools] %>

    <%= @contents[:title] %>

    <%= @contents[:differ] %>
    hiki-1.0.0/template/i.edit.html000066400000000000000000000026241212533356300163200ustar00rootroot00000000000000
    <%= @contents[:tools] %>

    <%= @contents[:title] %>

    <% if @contents[:msg] %>
    <%= @contents[:msg] %>
    <% end %> <% if @contents[:body] %>
    <%= @contents[:body] %>
    <% end %> <% if @contents[:differ] %>
    <%= @contents[:differ] %>
    <% end %>

    <%=@conf.msg_title%>

    <% if @contents[:preview_button] %><% end %> <% if @contents[:button] %><% end %> ><%=@conf.msg_update_timestamp%>

    <%=@conf.msg_keyword_form%>

    <% if @plugin.admin? %>

    ><%=@conf.msg_freeze_checkbox%>

    <% end %>
    hiki-1.0.0/template/i.error.html000066400000000000000000000002551212533356300165220ustar00rootroot00000000000000
    <%= @contents[:tools] %>

    <%= @contents[:view_title] %>

    hiki-1.0.0/template/i.form.html000066400000000000000000000010341212533356300163300ustar00rootroot00000000000000
    <%= @contents[:tools] %>

    <%= @contents[:title] %>

    <% if @contents[:list] %>
      <% @contents[:list].each do |i| %>
    • <%= i %>
    • <% end %>
    <% end %> <% if @contents[:msg1] %>
    <%= @contents[:msg1] %>
    <% end %>
    <%= @contents[:msg2] %>>
    hiki-1.0.0/template/i.layout.html000066400000000000000000000001231212533356300167000ustar00rootroot00000000000000 <%= @contents[:header] %> <%= yield %> hiki-1.0.0/template/i.list.html000066400000000000000000000003111212533356300163350ustar00rootroot00000000000000
    <%= @contents[:tools] %>

    <%= @contents[:title] %>

    <% if @contents[:updatelist] %>
      <% @contents[:updatelist].each do |i| %>
    • <%= i %>
    • <% end %>
    <% end %>
    hiki-1.0.0/template/i.login.html000066400000000000000000000010061212533356300164740ustar00rootroot00000000000000
    <%= @contents[:tools] %>

    <%= @contents[:title] %>

    <%= @conf.msg_login_info %>

    <% if @contents[:login_result] %>

    <%= @contents[:login_result] %>

    <% end %> <%= @conf.msg_name %>:
    <%= @conf.msg_password %>:
    hiki-1.0.0/template/i.plugin.html000066400000000000000000000002141212533356300166620ustar00rootroot00000000000000
    <%= @contents[:tools] %>

    <%= @contents[:view_title] %>

    <%= @contents[:body] %>
    <%= @contents[:body_leave] %>
    hiki-1.0.0/template/i.success.html000066400000000000000000000002241212533356300170350ustar00rootroot00000000000000
    <%= @contents[:tools] %>

    <%= @contents[:title] %>

    <%= @contents[:msg] %>

    <%= @contents[:link] %>

    hiki-1.0.0/template/i.view.html000066400000000000000000000005641212533356300163460ustar00rootroot00000000000000
    <%= @contents[:tools] %>

    <%= @contents[:view_title] %>

    <% if !@contents[:body_enter].empty? %>
    <%= @contents[:body_enter] %>
    <% end %>
    <%= @contents[:body] %>
    <% unless @contents[:body_leave].empty? %>
    <%= @contents[:body_leave] %>
    <% end %> <% if @contents[:sidebar_class] %>
    <%= @contents[:sidebar] %>
    <% end %> hiki-1.0.0/template/layout.html000066400000000000000000000005431212533356300164570ustar00rootroot00000000000000 <%= @contents[:header] %>
    <%= yield %>
    hiki-1.0.0/template/list.html000066400000000000000000000010271212533356300161130ustar00rootroot00000000000000
    <%= @contents[:tools] %>

    <%= @contents[:title] %>

    <% if @contents[:updatelist] %>
      <% @contents[:updatelist].each do |i| %>
    • <%= i %>
    • <% end %>
    <% end %>
    <% if @contents[:sidebar_class] %>
    <%= @contents[:sidebar] %>
    <% end %> hiki-1.0.0/template/login.html000066400000000000000000000017341212533356300162550ustar00rootroot00000000000000
    <%= @contents[:tools] %>

    <%= @contents[:title] %>

    <%= @conf.msg_login_info %>

    <% if @contents[:login_result] %>

    <%= @contents[:login_result] %>

    <% end %> <%= @conf.msg_name %>:
    <%= @conf.msg_password %>:
    <% if @contents[:sidebar_class] %>
    <%= @contents[:sidebar] %>
    <% end %> hiki-1.0.0/template/plugin.html000066400000000000000000000005501212533356300164360ustar00rootroot00000000000000
    <%= @contents[:tools] %>

    <%= @contents[:view_title] %>

    <%= @contents[:body] %>
    <%= @contents[:body_leave] %>
    <% if @contents[:sidebar_class] %>
    <%= @contents[:sidebar] %>
    <% end %> hiki-1.0.0/template/success.html000066400000000000000000000007451212533356300166160ustar00rootroot00000000000000
    <%= @contents[:tools] %>

    <%= @contents[:title] %>

    <%= @contents[:msg] %>

    <%= @contents[:link] %>

    <% if @contents[:sidebar_class] %>
    <%= @contents[:sidebar] %>
    <% end %> hiki-1.0.0/template/view.html000066400000000000000000000017621212533356300161200ustar00rootroot00000000000000
    <%= @contents[:tools] %>

    <%= @contents[:view_title] %>

    <% if !@contents[:body_enter].empty? %>
    <%= @contents[:body_enter] %>
    <% end %>
    <%= @contents[:body] %>
    <%=@conf.msg_last_modified%>:<%= @contents[:last_modified].strftime('%Y/%m/%d %H:%M:%S') %>
    <%=@conf.msg_keyword%>:<%= @contents[:keyword] %>
    <%=@conf.msg_reference%>:<%= @contents[:references] %>
    <% unless @contents[:page_attribute].empty? %>
    <%= @contents[:page_attribute] %>
    <% end %>
    <% unless @contents[:body_leave].empty? %>
    <%= @contents[:body_leave] %>
    <% end %>
    <% if @contents[:sidebar_class] %>
    <%= @contents[:sidebar] %>
    <% end %> hiki-1.0.0/test/000077500000000000000000000000001212533356300134165ustar00rootroot00000000000000hiki-1.0.0/test/acceptance/000077500000000000000000000000001212533356300155045ustar00rootroot00000000000000hiki-1.0.0/test/acceptance/test_basic_scenario.rb000066400000000000000000000112451212533356300220370ustar00rootroot00000000000000# -*- coding: utf-8 -*- require "rack" require "hiki/app" require "test/unit/capybara" require "fileutils" module BasicScenario def test_title visit("/") assert_title("FrontPage") end def test_get_create visit("/?c=create") assert_title("Test Wiki - Create") end def test_create_new_page visit("/?c=create") fill_in("key", :with => "NewPage") click_button("New") fill_in("contents", :with => "Test Test") click_button("Save") click_link("Click here!") assert_title("NewPage") within(".body .section p") do assert_equal("Test Test", text) end end def test_edit_front_page visit("/") click_link("Edit") within("div.textarea textarea") do assert_equal(< "FrontPage contents") click_button("Save") click_link("Click here!") assert_title("FrontPage") within(".body .section p") do assert_equal("FrontPage contents", text) end end module Repository end end class BasicScenario::Repository::TestPlainText < Test::Unit::TestCase include Capybara::DSL include TestHelper include BasicScenario include FileUtils def setup @wiki_data_path = fixtures_dir + "plain_data" cp_r(fixtures_dir + "plain_data.prepare", @wiki_data_path) config_path = (fixtures_dir + "hikiconf_plain.rb").expand_path Capybara.app = Hiki::App.new(config_path) end def teardown rm_rf(@wiki_data_path) end end class BasicScenario::Repository::TestGit < Test::Unit::TestCase include Capybara::DSL include TestHelper include BasicScenario include FileUtils def setup check_command("git") @wiki_data_path = fixtures_dir + "git_data" cp_r(fixtures_dir + "plain_data.prepare", @wiki_data_path) Dir.chdir(@wiki_data_path.expand_path) do system("git", "init", "--quiet", ".") system("git", "add", "text") system("git", "commit", "--quiet", "-m", "'Initial commit'") end config_path = (fixtures_dir + "hikiconf_git.rb").expand_path Capybara.app = Hiki::App.new(config_path) end def teardown rm_rf(@wiki_data_path) end end class BasicScenario::Repository::TestHg < Test::Unit::TestCase include Capybara::DSL include TestHelper include BasicScenario include FileUtils def setup check_command("hg") @wiki_data_path = fixtures_dir + "hg_data" cp_r(fixtures_dir + "plain_data.prepare", @wiki_data_path) Dir.chdir(@wiki_data_path.expand_path) do system("hg", "init", "--quiet", ".") create_hgrc system("hg", "add", "--quiet", "text") system("hg", "commit", "--quiet", "-m", "'Initial commit'") end config_path = (fixtures_dir + "hikiconf_hg.rb").expand_path Capybara.app = Hiki::App.new(config_path) end def teardown rm_rf(@wiki_data_path) end end class BasicScenario::Repository::TestSVN < Test::Unit::TestCase include Capybara::DSL include TestHelper include BasicScenario include FileUtils def setup check_command("svn") @wiki_data_path = fixtures_dir + "svn_data" @wiki_repo_path = fixtures_dir + "svn_repo" @wiki_base_data_path = fixtures_dir + "plain_data.prepare" cp_r(@wiki_base_data_path, @wiki_data_path) system("svnadmin", "create", @wiki_repo_path.expand_path.to_s) system("svn", "import", "--quiet", "-m", "'Import initial data'", "#{(@wiki_base_data_path + 'text').expand_path}", "file://#{@wiki_repo_path.expand_path}") Dir.chdir(@wiki_data_path.expand_path) do rm_rf(@wiki_data_path + "text") system("svn", "checkout", "--quiet", "file://#{@wiki_repo_path.expand_path}", "#{@wiki_data_path + 'text'}") end config_path = (fixtures_dir + "hikiconf_svn.rb").expand_path Capybara.app = Hiki::App.new(config_path) end def teardown rm_rf(@wiki_data_path) rm_rf(@wiki_repo_path) end end hiki-1.0.0/test/fixtures/000077500000000000000000000000001212533356300152675ustar00rootroot00000000000000hiki-1.0.0/test/fixtures/hikiconf_default.rb000066400000000000000000000021771212533356300211210ustar00rootroot00000000000000# -*- coding: utf-8 -*- require "pathname" fixtures_dir = Pathname(__FILE__.tr("()", "")).dirname @data_path = (fixtures_dir + "plain_data").expand_path.to_s @smtp_server = 'localhost' @use_plugin = true @use_session = true @site_name = 'Test Wiki' @author_name = '<' @mail_on_update = false @mail = ['hoge@example.net'] @theme = 'hiki' @theme_url = 'theme' @theme_path = 'theme' @use_sidebar = true @main_class = 'main' @sidebar_class = 'sidebar' @auto_link = false @use_wikiname = true @xmlrpc_enabled = true #========================================= # 紊翫初 #========================================= # @cgi_name = 'hiki.cgi' # @base_url = "http://example.com/hiki/" # @cache_path = "#{@data_path}/cache" # @template_path = 'template' # @style = 'default' # @mail_from = 'from@mail.address.hoge' # @hilight_keys = true # @charset = 'UTF-8' # @timeout = 30 # @plugin_debug = false @options = {} # 茵紊眼с hiki-1.0.0/test/fixtures/hikiconf_git.rb000066400000000000000000000022261212533356300202530ustar00rootroot00000000000000# -*- coding: utf-8 -*- require "pathname" fixtures_dir = Pathname(__FILE__.tr("()", "")).dirname @data_path = (fixtures_dir + "git_data").expand_path.to_s @smtp_server = 'localhost' @use_plugin = true @use_session = true @site_name = 'Test Wiki' @author_name = '<' @mail_on_update = false @mail = ['hoge@example.net'] @theme = 'hiki' @theme_url = 'theme' @theme_path = 'theme' @use_sidebar = true @main_class = 'main' @sidebar_class = 'sidebar' @auto_link = false @use_wikiname = true @xmlrpc_enabled = true @repos_type = "git" #========================================= # 紊翫初 #========================================= # @cgi_name = 'hiki.cgi' # @base_url = "http://example.com/hiki/" # @cache_path = "#{@data_path}/cache" # @template_path = 'template' # @style = 'default' # @mail_from = 'from@mail.address.hoge' # @hilight_keys = true # @charset = 'UTF-8' # @timeout = 30 # @plugin_debug = false @options = {} # 茵紊眼с hiki-1.0.0/test/fixtures/hikiconf_hg.rb000066400000000000000000000022241212533356300200640ustar00rootroot00000000000000# -*- coding: utf-8 -*- require "pathname" fixtures_dir = Pathname(__FILE__.tr("()", "")).dirname @data_path = (fixtures_dir + "hg_data").expand_path.to_s @smtp_server = 'localhost' @use_plugin = true @use_session = true @site_name = 'Test Wiki' @author_name = '<' @mail_on_update = false @mail = ['hoge@example.net'] @theme = 'hiki' @theme_url = 'theme' @theme_path = 'theme' @use_sidebar = true @main_class = 'main' @sidebar_class = 'sidebar' @auto_link = false @use_wikiname = true @xmlrpc_enabled = true @repos_type = "hg" #========================================= # 紊翫初 #========================================= # @cgi_name = 'hiki.cgi' # @base_url = "http://example.com/hiki/" # @cache_path = "#{@data_path}/cache" # @template_path = 'template' # @style = 'default' # @mail_from = 'from@mail.address.hoge' # @hilight_keys = true # @charset = 'UTF-8' # @timeout = 30 # @plugin_debug = false @options = {} # 茵紊眼с hiki-1.0.0/test/fixtures/hikiconf_plain.rb000066400000000000000000000021771212533356300206000ustar00rootroot00000000000000# -*- coding: utf-8 -*- require "pathname" fixtures_dir = Pathname(__FILE__.tr("()", "")).dirname @data_path = (fixtures_dir + "plain_data").expand_path.to_s @smtp_server = 'localhost' @use_plugin = true @use_session = true @site_name = 'Test Wiki' @author_name = '<' @mail_on_update = false @mail = ['hoge@example.net'] @theme = 'hiki' @theme_url = 'theme' @theme_path = 'theme' @use_sidebar = true @main_class = 'main' @sidebar_class = 'sidebar' @auto_link = false @use_wikiname = true @xmlrpc_enabled = true #========================================= # 紊翫初 #========================================= # @cgi_name = 'hiki.cgi' # @base_url = "http://example.com/hiki/" # @cache_path = "#{@data_path}/cache" # @template_path = 'template' # @style = 'default' # @mail_from = 'from@mail.address.hoge' # @hilight_keys = true # @charset = 'UTF-8' # @timeout = 30 # @plugin_debug = false @options = {} # 茵紊眼с hiki-1.0.0/test/fixtures/hikiconf_svn.rb000066400000000000000000000023261212533356300202770ustar00rootroot00000000000000# -*- coding: utf-8 -*- require "pathname" fixtures_dir = Pathname(__FILE__.tr("()", "")).dirname @data_path = (fixtures_dir + "svn_data").expand_path.to_s @smtp_server = 'localhost' @use_plugin = true @use_session = true @site_name = 'Test Wiki' @author_name = '<' @mail_on_update = false @mail = ['hoge@example.net'] @theme = 'hiki' @theme_url = 'theme' @theme_path = 'theme' @use_sidebar = true @main_class = 'main' @sidebar_class = 'sidebar' @auto_link = false @use_wikiname = true @xmlrpc_enabled = true @repos_type = "svn" @repos_root = (fixtures_dir + "svn_repo").expand_path.to_s #========================================= # 紊翫初 #========================================= # @cgi_name = 'hiki.cgi' # @base_url = "http://example.com/hiki/" # @cache_path = "#{@data_path}/cache" # @template_path = 'template' # @style = 'default' # @mail_from = 'from@mail.address.hoge' # @hilight_keys = true # @charset = 'UTF-8' # @timeout = 30 # @plugin_debug = false @options = {} # 茵紊眼с hiki-1.0.0/test/fixtures/plain_data.prepare/000077500000000000000000000000001212533356300210205ustar00rootroot00000000000000hiki-1.0.0/test/fixtures/plain_data.prepare/info.db000066400000000000000000000011041212533356300222560ustar00rootroot00000000000000{ "FrontPage" => { :count => 0, :freeze => false, :keyword => [ ], :last_modified => Time.at(1318683741), :references => [ ], :title => "", }, "InterWikiName" => { :count => 0, :freeze => false, :keyword => [ ], :last_modified => Time.at(1318683573), :references => [ ], :title => "", }, "SideMenu" => { :count => 0, :freeze => false, :keyword => [ ], :last_modified => Time.at(1318683741), :references => [ ], :title => "", }, "TextFormattingRules" => { :count => 0, :freeze => false, :keyword => [ ], :last_modified => Time.at(1318683741), :references => [ ], :title => "", }, }hiki-1.0.0/test/fixtures/plain_data.prepare/text/000077500000000000000000000000001212533356300220045ustar00rootroot00000000000000hiki-1.0.0/test/fixtures/plain_data.prepare/text/FrontPage000066400000000000000000000015141212533356300236150ustar00rootroot00000000000000! Wiki潟吾[[Hiki|http://hikiwiki.org/ja/]]FrontPageс 若吾荀ゃ潟鴻若障c障紊(^^; !篏帥紮鐚荀鐚 若娯[膊∞]≪潟膊∞鴻若荐絎 若吾腟鐚膊∞篁ュ贋違罩≪鐚茹iゃ膊∞粋с障 !Hiki後ゃ Hiki後吾Wiki篌若障с吾後ャc鴻 鴻若冴潟潟潟荐菴違сс筝≦宍 後障с荅括完ゃTextFormattingRulesс hiki-1.0.0/test/fixtures/plain_data.prepare/text/InterWikiName000066400000000000000000000011571212533356300244410ustar00rootroot00000000000000*[[AsWiki|http://www.assist.media.nagoya-u.ac.jp/ASDP/aswiki.cgi/]] euc *[[GoogleJ|http://www.google.com/search?num=50&lr=lang_ja&q=]] sjis *[[Hiki|http://hikiwiki.org/ja/$1.html]] euc *[[Image|http://images.google.co.jp/images?hl=ja;btnG=Google?hl=ja;btnG=Google+%8C%9F%8D%F5;q=]] sjis *[[ruby-list|http://blade.nagaokaut.ac.jp/cgi-bin/scat.rb/ruby/ruby-list/]] *[[RAA|http://raa.ruby-lang.org/project/$1/]] *[[RWiki|http://pub.cozmixng.org/~the-rwiki/?cmd=view;name=]] euc *[[Tiki|http://todo.is.os-omicron.org/tiki.cgi?c=v;p=]] euc *[[WikiWikiWeb|http://www.c2.com/cgi/wiki?]] *[[Ruby|http://www.ruby-lang.org/]] alias hiki-1.0.0/test/fixtures/plain_data.prepare/text/SideMenu000066400000000000000000000000331212533356300234340ustar00rootroot00000000000000!違20篁 {{recent}} hiki-1.0.0/test/fixtures/plain_data.prepare/text/TextFormattingRules000066400000000000000000000174361212533356300257340ustar00rootroot00000000000000{{toc}} !違 *g茲域g1ゃ違障 *腥肴(壕帥障鴻若鴻帥茵)違阪障 *荐菴遺 箴違 蘂荐菴違茵 1ゃ違翫就障 *阪箴 箴違 蘂荐菴違茵 1ゃ違翫就障 !潟 !!WikiName *紊ф絖怨у障絨絖怨障医1絖篁ヤ膓 *>散2篁ヤ膵違菴茯WikiName潟障 *荐菴遺 WikiName - WikiName HogeRule1 - WikiName NOTWIKINAME - 紊ф絖WikiNameс WikiNAME - NAME紊ф絖WikiNameс *fooWikiName - 絨絖怨fooWikiNameс *阪箴 **WikiName - WikiName **HogeRule1 - WikiName **NOTWIKINAME - 紊ф絖WikiNameс **WikiNAME - NAME紊ф絖WikiNameс **fooWikiName - 絨絖怨fooWikiNameс !!若吾吾潟 若後鐚ゃ潟у蚊若吾吾潟障 *荐菴遺 箴[[綣Ruby]]若吾吾潟障 *阪箴 箴[[綣Ruby]]若吾吾潟障 !!篁紙URL吾潟 茯|URL鐚ゃ潟у蚊篁紙URL吾潟障 *荐菴遺 [[Yahoo!|http://www.yahoo.co.jp/]]с障 *阪箴 [[Yahoo!|http://www.yahoo.co.jp/]]с障 URL絨障jpg,jpeg,png,gifIMG帥違絮障鐚絎茯ALT荐絎鐚 *荐菴遺 [[若|http://jp.rubyist.net/theme/clover/clover_h1.png]] *阪箴 [[若|http://jp.rubyist.net/theme/clover/clover_h1.png]] 違筝URLc純潟障 *荐菴遺 Hiki若吾http://hikiwiki.org/ja/с *阪箴 Hiki若吾http://hikiwiki.org/ja/с !!InterWiki [[Tiki:Tiki]]InterWiki泣若障泣若菴遵 InterWikiName若吾膩障 *荐菴遺 *[[Hiki:綣Ruby]] *[[ruby-list:1]] *[[GoogleJ:ruby wiki]] *阪箴 **[[Hiki:綣Ruby]] **[[ruby-list:1]] **[[GoogleJ:ruby wiki]] InterWikiouter alias若違膂≦紊潟罘純絲上障outer aliasInterWikiNamealias若若篁泣若菴遵障 *荐菴遺 * [[Ruby|http://www.ruby-lang.org/]] alias 筝сalias荐絎茯鐚ゃ潟у蚊潟障 *荐菴遺 *[[Ruby]] *阪箴 **[[Ruby]] !翫就羝帥鴻 *茵鴻若鴻障帥у障c茵翫就羝帥宴障 *阪箴 require 'cgi' cgi = CGI::new cgi.header puts < Hello!

    Hello!

    EOS *障<<< >>> с障茵鴻若鴻翫就羝帥宴障 *荐菴遺 <<< 綵 羝 >>> *阪箴 <<< 綵 羝 >>> !絖篆蕋 *'2с綣決帥障 *'3с綣決帥障 *=2с羔膩障 *荐菴遺 ''綣決''障 '''綣決'''障 ====羔膩泣若障 *阪箴 ''綣決''障 '''綣決'''障 ====羔膩泣若障 !荀冴 *!茵吾荀冴障 *!1ゃ5ゃ障ц菴違純с

    紊障 *荐菴遺 !荀冴1 !!荀冴2 !!!荀冴3 !!!!荀冴4 !!!!!荀冴5 *阪箴 !荀冴1 !!荀冴2 !!!荀冴3 !!!!荀冴4 !!!!!荀冴5 !羂翫抗膩 ゃ壕垩-茵4ゆ吾羂翫抗膩障 *荐菴遺 ---- *阪箴 ---- !膊≧吾 **茵吾膊≧吾障 **鐚ゃ鐚ゃ障ц菴違純уャ絖с障 *#茵吾垬膊≧吾障 *荐菴遺 *≪ゃ1 **≪ゃ1.1 **≪ゃ1.2 ***≪ゃ1.2.1 ***≪ゃ1.2.2 ***≪ゃ1.2.3 **≪ゃ1.3 **≪ゃ1.4 *≪ゃ2 #1 #2 ##2.1 ##2.2 ##2.3 #3 ##3.1 ###3.1.1 ###3.1.2 *阪箴 *≪ゃ1 **≪ゃ1.1 **≪ゃ1.2 ***≪ゃ1.2.1 ***≪ゃ1.2.2 ***≪ゃ1.2.3 **≪ゃ1.3 **≪ゃ1.4 *≪ゃ2 #1 #2 ##2.1 ##2.2 ##2.3 #3 ##3.1 ###3.1.1 ###3.1.2 !綣 "茵鐚ゆ吾綣障 *荐菴遺 ""綣с ""綣障 ""膓綣障綣g翫 ""筝ゃ綣 ""絮障 *阪箴 ""綣с ""綣障 ""膓綣障綣g翫 ""筝ゃ綣 ""絮障 !茯茹h 潟潟:茵吾膓茯:茹h茯茹h障 茯茹h茵篏с障 *荐菴遺 ::apple :眼:gorilla :: ::camel *阪箴 ::apple :眼:gorilla :: ::camel !茵 茵(若)||у障 祉!ゃ荀冴祉障 茵g^g>g違祉ゃ *荐菴遺 ||!茵荀冴鐚弱荀冴||!-A||!-B||!-C||!>-D-E鐚罔g鐚 ||!茵-1||A1||B1||^C1-C2鐚膰g鐚||D1||E1 ||!茵-2||A2||B2||^>D2-E2-D3-E3鐚膰罔g鐚 ||!茵-3||>>A3-C3鐚罔鐚g鐚 *阪箴 ||!茵荀冴鐚弱荀冴||!-A||!-B||!-C||!>-D-E鐚罔g鐚 ||!茵-1||A1||B1||^C1-C2鐚膰g鐚||D1||E1 ||!茵-2||A2||B2||^>D2-E2-D3-E3鐚膰罔g鐚 ||!茵-3||>>A3-C3鐚罔鐚g鐚 !潟<潟茵 //茵茵潟<潟茵阪障 *荐菴遺 // 潟<潟с *阪箴鐚茵腓冴障鐚 // 潟<潟с !違ゃ {鐚ゃ}鐚ゃу蚊違ゃ潟若喝冴с障 <若帥茲域吾純с 違ゃ潟帥茵吾翫違ゃ潟緇

    篁障 *荐菴遺 {{recent(3)}} *茲域荐菴遺 {{pre( <若随 <若随 <若随 )}} hiki-1.0.0/test/hikiconf_test.rb000066400000000000000000000020031212533356300165670ustar00rootroot00000000000000# -*- coding: utf-8 -*- @data_path = 'data' @smtp_server = 'localhost' @use_plugin = true @use_session = true @site_name = 'hoge hoge' @author_name = '<' @mail_on_update = false @mail = ['hoge@example.net'] @theme = 'hiki' @theme_url = 'theme' @theme_path = 'theme' @use_sidebar = true @main_class = 'main' @sidebar_class = 'sidebar' @auto_link = false @use_wikiname = true @xmlrpc_enabled = true #========================================= # 紊翫初 #========================================= #@cgi_name = 'hiki.cgi' #@base_url = "http://example.com/hiki/" #@cache_path = "#{@data_path}/cache" #@template_path = 'template' #@style = 'default' #@mail_from = 'from@mail.address.hoge' #@hilight_keys = true #@charset = 'UTF-8' #@timeout = 30 #@plugin_debug = false @options = {} # 茵紊眼с hiki-1.0.0/test/runner.rb000077500000000000000000000005701212533356300152610ustar00rootroot00000000000000#!/usr/bin/env ruby require 'bundler/setup' gem 'test-unit' require 'test/unit' require 'test/unit/notify' require 'test/unit/rr' rootdir = Pathname(__FILE__).dirname.parent.expand_path $LOAD_PATH.unshift(rootdir, "#{rootdir}/hiki") $LOAD_PATH.unshift(rootdir, "#{rootdir}/test") require "test_helper" require "rack" exit Test::Unit::AutoRunner.run(true, File.dirname($0)) hiki-1.0.0/test/test_aliaswiki.rb000066400000000000000000000012541212533356300167610ustar00rootroot00000000000000# $Id: test_aliaswiki.rb,v 1.1 2005-06-15 03:10:16 fdiary Exp $ require 'test/unit' require 'hiki/aliaswiki' class AliasWiki_Unit_Tests < Test::Unit::TestCase def setup @aliaswiki = Hiki::AliasWiki.new( "*[[orig_name:alias_name]]") end def test_aliaswiki_found assert_equal( 'alias_name', @aliaswiki.aliaswiki( 'orig_name' )) end def test_aliaswiki_not_found assert_equal( 'page_name', @aliaswiki.aliaswiki( 'page_name' )) end def test_original_name_found assert_equal( 'orig_name', @aliaswiki.original_name( 'alias_name' )) end def test_original_name_not_found assert_equal( 'page_name', @aliaswiki.original_name( 'page_name' )) end end hiki-1.0.0/test/test_config.rb000066400000000000000000000005101212533356300162430ustar00rootroot00000000000000# -*- coding: utf-8 -*- require 'test/unit' require 'hiki/config' class Config_Unit_Tests < Test::Unit::TestCase def setup base_dir = File.dirname(__FILE__) @config_path = "#{base_dir}/hikiconf_test.rb" end def test_initialize assert_nothing_raised do Hiki::Config.new(@config_path) end end end hiki-1.0.0/test/test_flatfile.rb000066400000000000000000000074321212533356300165760ustar00rootroot00000000000000# coding: utf-8 require 'test/unit' require 'hiki/config' require 'hiki/db/flatfile' require 'fileutils' require 'test_helper' require "digest/md5" class HikiDB_flatfile_Unit_Tests < Test::Unit::TestCase include TestHelper include FileUtils def setup @wiki_data_path = fixtures_dir + "plain_data" cp_r(fixtures_dir + "plain_data.prepare", @wiki_data_path) config_path = (fixtures_dir + "hikiconf_default.rb").expand_path @conf = Hiki::Config.new(config_path) @db = Hiki::HikiDB_flatfile.new(@conf) end def teardown rm_rf(@wiki_data_path) end def test_close_db assert(@db.close_db) end def test_load expected = < /dev/null") end def file_name(page) File.join(@data_dir, "text", page) end def write(page, content) File.open(file_name(page), "wb") do |f| f.print(content) end end def read(page) File.open(file_name(page), "rb") do |f| f.read end end def create_hgrc File.open(".hg/hgrc", "a+") do |file| file.puts < EOF end end end hiki-1.0.0/test/test_hikifarm.rb000066400000000000000000000054671212533356300166100ustar00rootroot00000000000000$KCODE = 'u' unless Object.const_defined?(:Encoding) require 'test/unit' load "#{File.dirname(__FILE__)}/../misc/hikifarm/index.cgi" require 'fileutils' class Wiki_Unit_Tests < Test::Unit::TestCase def setup @data_root = '__tmp-wikitest' name = 'foo' FileUtils.mkdir_p("#{@data_root}/#{name}/text") Dir.chdir("#{@data_root}/#{name}/text") do File.open('FrontPage', 'w'){|f| f.puts "frontpage"} sleep 1 File.open('SandBox', 'w'){|f| f.puts "sandbox"} @now = Time.now end File.open("#{@data_root}/#{name}/hiki.conf", 'w'){|f| f.puts '@site_name = "FooBar"'} @wiki = Wiki.new(name, @data_root) end def teardown FileUtils.rm_rf(@data_root) end def test_name assert_equal('foo', @wiki.name) end def test_title assert_equal('FooBar', @wiki.title) end def test_mtime assert_equal(@now.to_i, @wiki.mtime.to_i) end def test_last_modified_page assert_equal('SandBox', @wiki.last_modified_page) end def test_pages_num assert_equal(2, @wiki.pages_num) end end class Hikifarm_Unit_Tests < Test::Unit::TestCase def setup @farm_pub_path = '__tmp-farmtest-pub' @data_root = '__tmp-wikitest' setup_wiki('foo', 'FrontPage', 'SandBox', 'HogeHoge') setup_wiki('bar', 'FrontPage', 'SandBox') setup_wiki('hoge', 'FrontPage', 'SandBox', 'aaa', 'bbb') @farm = Hikifarm.new(@farm_pub_path, '/usr/bin/ruby', 'default', nil, @data_root) end def setup_wiki(name, *pages) FileUtils.mkdir_p("#{@data_root}/#{name}/text") Dir.chdir("#{@data_root}/#{name}/text") do pages.each do |page| File.open(page, 'w'){|f| f.puts page} end end File.open("#{@data_root}/#{name}/hiki.conf", 'w') do |f| f.puts %Q!@site_name = "#{name.upcase}"! end FileUtils.mkdir_p("#{@farm_pub_path}/#{name}") File.open("#{@farm_pub_path}/#{name}/hikiconf.rb", 'w'){|f| } end def teardown FileUtils.rm_rf(@data_root) FileUtils.rm_rf(@farm_pub_path) end def test_wikis_num assert_equal(3, @farm.wikis_num) end def test_pages_num assert_equal(9, @farm.pages_num) end def test_create_wiki name = 'newwiki' default_pages_path = 'data/text' @farm.create_wiki(name, '', 'index.cgi', nil, @data_root, default_pages_path) default_pages = Dir["#{default_pages_path}/*"].delete_if{|f| !File.file?(f.untaint)}.map{|e| File.basename(e)} copied_pages = Dir["#{@data_root}/#{name}/text/*"].delete_if{|f| !File.file?(f.untaint)}.map{|e| File.basename(e)} assert_equal(default_pages.sort, copied_pages.sort) Dir["#{default_pages_path}/*"].each do |orig| orig.untaint next if not File.file?(orig) copy = "#{@data_root}/#{name}/text/#{File.basename(orig)}" assert(File.exist?(copy)) assert_equal(File.read(orig), File.read(copy)) end end end hiki-1.0.0/test/test_interwiki.rb000066400000000000000000000036271212533356300170170ustar00rootroot00000000000000# -*- coding: utf-8 -*- # $Id: test_interwiki.rb,v 1.2 2005-06-28 05:39:09 fdiary Exp $ require 'test/unit' require 'hiki/interwiki' class InterWiki_Unit_Tests < Test::Unit::TestCase def setup @interwiki = Hiki::InterWiki.new( <<-EOF ) *[[Hiki|http://hikiwiki.org/ja/?]] euc *[[Siki|http://hikiwiki.org/ja/?]] sjis *[[Uiki|http://hikiwiki.org/ja/?]] utf8 *[[sf.jp|http://sourceforge.jp/]] alias EOF end def test_interwiki_found assert_equal(['http://hikiwiki.org/ja/?FrontPage', 'Hiki:FrontPage'], @interwiki.interwiki('Hiki', 'FrontPage')) end def test_interwiki_found_euc assert_equal(['http://hikiwiki.org/ja/?%A5%D5%A5%ED%A5%F3%A5%C8%A5%DA%A1%BC%A5%B8', 'Hiki:潟若'], @interwiki.interwiki('Hiki', '潟若')) end def test_interwiki_found_sjis if Object.const_defined?(:Encoding) assert_equal(['http://hikiwiki.org/ja/?%83%74%83%8D%83%93%83%67%83%79%81%5B%83%57', 'Siki:潟若'], @interwiki.interwiki('Siki', '潟若')) else assert_equal(['http://hikiwiki.org/ja/?%83t%83%8D%83%93%83g%83y%81%5B%83W', 'Siki:潟若'], @interwiki.interwiki('Siki', '潟若')) end end def test_interwiki_found_utf8 assert_equal(['http://hikiwiki.org/ja/?%E3%83%95%E3%83%AD%E3%83%B3%E3%83%88%E3%83%9A%E3%83%BC%E3%82%B8', 'Uiki:潟若'], @interwiki.interwiki('Uiki', '潟若')) end def test_interwiki_not_found assert_equal( nil, @interwiki.interwiki( 'foo', 'bar' )) end def test_outer_alias_found assert_equal( ['http://sourceforge.jp/', 'sf.jp'], @interwiki.outer_alias( 'sf.jp' )) end def test_outer_alias_not_found assert_equal( nil, @interwiki.outer_alias( 'sf.net' )) end end hiki-1.0.0/test/test_plugin_referer.rb000066400000000000000000000021211212533356300200060ustar00rootroot00000000000000# coding: utf-8 require 'test/unit' require 'fileutils' require 'tempfile' class Plugin_Referer_Unit_Tests < Test::Unit::TestCase def setup define_dummy_methods @body_leave_proc = nil @cache_path = test_cache_path @options = {} @page = 'test page' plugin_file = File.expand_path(File.join(File.dirname(__FILE__), *%w{.. misc plugin referer.rb})) instance_eval(File.open(plugin_file).read) end def teardown FileUtils.rm_r(@test_cache_path) if File.exists?(@test_cache_path) end def test_body_leave_proc assert_nothing_raised do @body_leave_proc.call end end def add_body_leave_proc(p) @body_leave_proc = p end def define_dummy_methods instance_eval(%{def export_plugin_methods(*args); end}) end def test_cache_path if ! defined?(@test_cache_path) tempfile = Tempfile.new(self.class.to_s) @test_cache_path = File.join(File.dirname(tempfile.path), self.class.to_s) FileUtils.mkdir(@test_cache_path) unless File.exists?(@test_cache_path) tempfile.close(true) end @test_cache_path end endhiki-1.0.0/test/test_plugin_rss.rb000066400000000000000000000024141212533356300171700ustar00rootroot00000000000000# To do: Handle Exception raised in Time.parse line 92 require 'test/unit' require 'time' begin require 'cgi/util' rescue LoadError require 'cgi' end require 'rack' require File.join(File.dirname(__FILE__), *%w[.. hiki request]) require File.join(File.dirname(__FILE__), *%w[.. hiki response]) class Plugin_RSS_Unit_Tests < Test::Unit::TestCase def setup @now = Time.parse(CGI.rfc1123_date(Time.now)) @request = Object.new class << @request def params {} end end @conf = Object.new class << @conf def charset end def lang end end plugin_file = File.expand_path(File.join(File.dirname(__FILE__), *%w{.. misc plugin rss.rb})) instance_eval(File.read(plugin_file)) class << self define_method(:rss_body) {|*page_num| ['', @now] } end ARGV << " " # dummy argment for CGI offline mode end def test_rss_returns_304_when_if_modified_since_is_same_to_last_modified ENV['HTTP_IF_MODIFIED_SINCE'] = CGI.rfc1123_date(@now) assert_equal(304, rss.status) end def add_body_enter_proc(prcedure) end def add_header_proc(procedure) end def add_conf_proc(plugin_name, procedure) end def export_plugin_methods(*args) end def label_rss_config end end hiki-1.0.0/test/test_pluginutil.rb000066400000000000000000000023221212533356300171750ustar00rootroot00000000000000# $Id: test_pluginutil.rb,v 1.2 2005-07-20 04:26:22 fdiary Exp $ require 'test/unit' require 'hiki/pluginutil' class TMarshal_Unit_Tests < Test::Unit::TestCase def test_methodwords_simple assert_equal( ['foo'], Hiki::Util.methodwords( 'foo' ) ) end def test_methodwords_digit assert_equal( ['foo', 123], Hiki::Util.methodwords( 'foo(123)' ) ) end def test_methodwords_string assert_equal( ['foo', "0123"], Hiki::Util.methodwords( 'foo("0123")' ) ) assert_equal( ['foo', "0123"], Hiki::Util.methodwords( %q|foo('0123')| ) ) assert_equal( ['foo', 'ba"r', %q|a'iueo|], Hiki::Util.methodwords( %Q[foo('ba"r', "a'iueo" )]) ) end def test_methodwords_lines assert_equal( ['foo', 'bar', "a\niueo|\nkaki"], Hiki::Util.methodwords( %Q[foo "bar", "a iueo| kaki"]) ) end def test_methodwords_array assert_equal( ['foo', [[0, 1], [2, 3]]], Hiki::Util.methodwords( %Q[foo [[0,1],[2,3]]]) ) assert_equal( ['foo', 'File', ['h]oge', 'f[uga'], 'bar', [1, 2.0, 0.4]], Hiki::Util.methodwords( %Q[foo File, ["h]oge", "f[uga"], "bar", [1, 2.0, 0.4]]) ) end def test_methodwords_nil assert_equal( ['foo', nil, nil, 'hoge'], Hiki::Util.methodwords( %Q[foo nil, nil, "hoge"]) ) end end hiki-1.0.0/test/test_ptstore.rb000066400000000000000000000024561212533356300165110ustar00rootroot00000000000000# coding: utf-8 require 'test/unit' require 'hiki/db/ptstore' require 'tempfile' class PTStore_Unit_Tests < Test::Unit::TestCase def setup tempfile = Tempfile.new(self.class.to_s) tempfile.close @db = PTStore.new(tempfile.path) @db.transaction do @db['Taro'] = {:age => 22, :lang => 'Ruby', :man => true, :day => Time.now} @db['Hanako'] = {:age => 23, :lang => 'Perl', :man => false, :day => Time.now} @db['Jirou'] = {:age => 15, :lang => 'Smalltalk', :man => true, :day => Time.now} @db['Rika'] = {:age => 4, :lang => 'Lisp', :man => false, :day => Time.now} end end def test_roots roots = nil @db.transaction do roots = @db.roots end %w{Taro Hanako Jirou Rika}.each do |n| assert(roots.include?(n)) end end def test_settter_and_getter 10.times do @db.transaction do @db['Hanako'][:age] += 1 end end @db.transaction(true) do assert_equal(33, @db['Hanako'][:age]) end end def test_transaction @db.transaction(true) do assert(@db.roots.include?('Taro')) assert_raise(PStore::Error) do @db['Ichiro'] = {} end end end def test_root_p @db.transaction(true) do assert(@db.root?('Taro')) assert(! @db.root?('Ichiro')) end end end hiki-1.0.0/test/test_repos_default.rb000066400000000000000000000023241212533356300176370ustar00rootroot00000000000000require 'test/unit' require 'hiki/util' require 'hiki/repos/default' class Repos_Default_Tests < Test::Unit::TestCase def setup @data_path = '__tmp-wikitest' @repos = Hiki::ReposDefault.new(nil, @data_path) @page_name = 'HogeHoge' require 'fileutils' FileUtils.mkdir_p("#{@data_path}/text") FileUtils.mkdir_p("#{@data_path}/backup") File.open("#{@data_path}/text/#{@page_name}", 'w') do |f| f.print 'new file' end File.open("#{@data_path}/backup/#{@page_name}", 'w') do |f| f.print 'old file' end @now = Time.now end def teardown FileUtils.rm("#{@data_path}/text/#{@page_name}") FileUtils.rm("#{@data_path}/backup/#{@page_name}") FileUtils.rmdir("#{@data_path}/text") FileUtils.rmdir("#{@data_path}/backup") FileUtils.rmdir(@data_path) end def test_get_revision assert_equal('old file', @repos.get_revision(@page_name, 1)) assert_equal('new file', @repos.get_revision(@page_name, 2)) end def test_revisions revs = [ [2, @now.localtime.strftime('%Y/%m/%d %H:%M:%S'), '', 'current'], [1, @now.localtime.strftime('%Y/%m/%d %H:%M:%S'), '', 'backup'] ] assert_equal(revs, @repos.revisions(@page_name)) end end hiki-1.0.0/test/test_repos_git.rb000066400000000000000000000122151212533356300167760ustar00rootroot00000000000000# -*- coding: utf-8 -*- require 'test/unit' require 'fileutils' require 'hiki/repos/git' require 'hiki/util' class Repos_Git_Tests < Test::Unit::TestCase include Hiki::Util include TestHelper def setup @tmp_dir = File.join(File.dirname(__FILE__), "tmp") @root = "#{@tmp_dir}/root" @wiki = 'wikiwiki' @data_dir = "#{@tmp_dir}/data" @text_dir = "#{@data_dir}/text" @repos = Hiki::ReposGit.new(@root, @data_dir) FileUtils.mkdir_p(@text_dir) check_command("git") Dir.chdir(@text_dir) do git("init", "-q") end end def teardown FileUtils.rm_rf(@tmp_dir) end def test_commit write("FooBar", 'foobar') @repos.commit('FooBar') assert_equal('foobar', read('FooBar')) object = nil Dir.chdir(@text_dir) do object = git("hash-object", "FooBar") end write("FooBar", 'foobar new') @repos.commit('FooBar') assert_equal('foobar new', read('FooBar')) Dir.chdir(@text_dir) do assert_equal("foobar", git("cat-file", "blob", object)) end end def test_commit_with_content @repos.commit_with_content("FooBar", "foobar") assert_equal("foobar", read("FooBar")) old_hash = nil Dir.chdir(@text_dir) do old_hash = git("hash-object", "FooBar") end @repos.commit_with_content("FooBar", "foobar new") assert_equal("foobar new", read("FooBar")) Dir.chdir(@text_dir) do assert_equal("foobar", git("cat-file", "blob", old_hash)) end end def test_get_revision rev1 = rev2 = rev3 = nil write("HogeHoge", 'hogehoge1') Dir.chdir(@text_dir) {git("add", "HogeHoge")} Dir.chdir(@text_dir) {git("commit", "-m", "First", "HogeHoge")} Dir.chdir(@text_dir) {rev1 = git("hash-object", "HogeHoge")} write("HogeHoge", 'hogehoge2') Dir.chdir(@text_dir) {git("commit", "-m", "Second", "HogeHoge")} Dir.chdir(@text_dir) {rev2 = git("hash-object", "HogeHoge")} write("HogeHoge", 'hogehoge3') Dir.chdir(@text_dir) {git("commit", "-m", "Third", "HogeHoge")} Dir.chdir(@text_dir) {rev3 = git("hash-object", "HogeHoge")} assert_equal('hogehoge1', @repos.get_revision('HogeHoge', rev1[0, 7])) assert_equal('hogehoge2', @repos.get_revision('HogeHoge', rev2[0, 7])) assert_equal('hogehoge3', @repos.get_revision('HogeHoge', rev3[0, 7])) end def test_revisions rev1 = rev2 = rev3 = nil write("HogeHoge", 'hogehoge1') Dir.chdir(@text_dir) {git("add", "HogeHoge")} Dir.chdir(@text_dir) {git("commit", "-m", "First", "HogeHoge")} Dir.chdir(@text_dir) {rev1 = git("hash-object", "HogeHoge")} modified1 = Time.now.localtime.strftime('%Y/%m/%d %H:%M:%S') write("HogeHoge", 'hogehoge2') Dir.chdir(@text_dir) {git("commit", "-m", "Second", "HogeHoge")} Dir.chdir(@text_dir) {rev2 = git("hash-object", "HogeHoge")} modified2 = Time.now.localtime.strftime('%Y/%m/%d %H:%M:%S') write("HogeHoge", 'hogehoge3') Dir.chdir(@text_dir) {git("commit", "-m", "Third", "HogeHoge")} Dir.chdir(@text_dir) {rev3 = git("hash-object", "HogeHoge")} modified3 = Time.now.localtime.strftime('%Y/%m/%d %H:%M:%S') expected = [ [rev3[0, 7], modified1, '', 'Third'], [rev2[0, 7], modified2, '', 'Second'], [rev1[0, 7], modified3, '', 'First'], ].transpose actual = @repos.revisions('HogeHoge').transpose assert_equal(expected[0], actual[0]) # disable to fragile test # assert_equal(expected[1], actual[1]) assert_equal(expected[2], actual[2]) assert_equal(expected[3], actual[3]) end def test_rename write("HogeHoge", "hogehoge1\n") @repos.commit("HogeHoge") @repos.rename("HogeHoge", "FooBar") assert_equal("hogehoge1\n", read("FooBar")) end def test_rename_multibyte write(escape("祉祉"), "hogehoge1\n") @repos.commit("祉祉") @repos.rename("祉祉", "泣若違") assert_equal("hogehoge1\n", read(escape("泣若違"))) end def test_rename_new_page_already_exist write("HogeHoge", "hogehoge1\n") @repos.commit("HogeHoge") write("FooBar", "foobar\n") @repos.commit("FooBar") assert_raise(ArgumentError) do @repos.rename("HogeHoge", "FooBar") end end def test_pages write(escape("祉祉"), "hogehoge1\n") @repos.commit("祉祉") write("FooBar", "foobar\n") @repos.commit("FooBar") expected = ["祉祉", "FooBar"] if Object.const_defined?(:Encoding) expected = expected.map{|v| v.force_encoding("binary") } end assert_equal(expected.sort, @repos.pages.sort) end def test_pages_with_block write(escape("祉祉"), "hogehoge1\n") @repos.commit("祉祉") write("FooBar", "foobar\n") @repos.commit("FooBar") actuals = [] @repos.pages.each do |page| actuals << page end expected = ["祉祉", "FooBar"] if Object.const_defined?(:Encoding) expected = expected.map{|v| v.force_encoding("binary") } end assert_equal(expected.sort, actuals.sort) end private def git(*args) args = args.collect{|arg| arg.dump}.join(' ') result = `git #{args}`.chomp raise result unless $?.success? result end end hiki-1.0.0/test/test_repos_hg.rb000066400000000000000000000111651212533356300166140ustar00rootroot00000000000000# -*- coding: utf-8 -*- # $Id: test_repos_hg.rb,v 1.1 2008-08-06 10:48:25 hiraku Exp $ # Copyright (C) 2008, KURODA Hiraku # This code is modified from "test/test_repos_git.rb" by Kouhei Sutou # You can distribute this under GPL. require 'test/unit' require 'fileutils' require 'hiki/repos/hg' require 'hiki/util' class Repos_Hg_Tests < Test::Unit::TestCase include Hiki::Util include TestHelper def setup @tmp_dir = File.join(File.dirname(__FILE__), "tmp") @root = "#{@tmp_dir}/root" @wiki = 'wikiwiki' @data_dir = "#{@tmp_dir}/data" @text_dir = "#{@data_dir}/text" @repos = Hiki::ReposHg.new(@root, @data_dir) FileUtils.mkdir_p(@text_dir) check_command("hg") Dir.chdir(@text_dir) do hg("init") create_hgrc end end def teardown FileUtils.rm_rf(@tmp_dir) end def test_commit write("FooBar", 'foobar') @repos.commit('FooBar') assert_equal('foobar', read('FooBar')) file = nil write("FooBar", 'foobar new') @repos.commit('FooBar') assert_equal('foobar new', read('FooBar')) Dir.chdir(@text_dir) do assert_equal("foobar new", hg("cat", "FooBar")) end end def test_commit_with_content @repos.commit_with_content("FooBar", "foobar") assert_equal("foobar", read("FooBar")) @repos.commit_with_content("FooBar", "foobar new") assert_equal("foobar new", read("FooBar")) end def test_get_revision rev1 = rev2 = rev3 = nil write("HogeHoge", 'hogehoge1') Dir.chdir(@text_dir) {hg("add", "HogeHoge")} Dir.chdir(@text_dir) {hg("commit", "-m", "First", "HogeHoge")} write("HogeHoge", 'hogehoge2') Dir.chdir(@text_dir) {hg("commit", "-m", "Second", "HogeHoge")} write("HogeHoge", 'hogehoge3') Dir.chdir(@text_dir) {hg("commit", "-m", "Third", "HogeHoge")} assert_equal('hogehoge1', @repos.get_revision('HogeHoge', 1)) assert_equal('hogehoge2', @repos.get_revision('HogeHoge', 2)) assert_equal('hogehoge3', @repos.get_revision('HogeHoge', 3)) end def test_revisions write("HogeHoge", 'hogehoge1') Dir.chdir(@text_dir) {hg("add", "HogeHoge")} Dir.chdir(@text_dir) {hg("commit", "-m", "First", "HogeHoge")} modified1 = Time.now.localtime.strftime('%Y/%m/%d %H:%M:%S') write("HogeHoge", 'hogehoge2') Dir.chdir(@text_dir) {hg("commit", "-m", "Second", "HogeHoge")} modified2 = Time.now.localtime.strftime('%Y/%m/%d %H:%M:%S') write("HogeHoge", 'hogehoge3') Dir.chdir(@text_dir) {hg("commit", "-m", "Third", "HogeHoge")} modified3 = Time.now.localtime.strftime('%Y/%m/%d %H:%M:%S') expected = [ [3, modified3, '', 'Third'], [2, modified2, '', 'Second'], [1, modified1, '', 'First'], ].transpose actual = @repos.revisions('HogeHoge').transpose assert_equal(expected[0], actual[0]) # disable to fragile test # assert_equal(expected[1], actual[1]) assert_equal(expected[2], actual[2]) assert_equal(expected[3], actual[3]) end def test_rename write("HogeHoge", "hogehoge1\n") @repos.commit("HogeHoge") @repos.rename("HogeHoge", "FooBar") assert_equal("hogehoge1\n", read("FooBar")) end def test_rename_multibyte write(escape("祉祉"), "hogehoge1\n") @repos.commit("祉祉") @repos.rename("祉祉", "泣若違") assert_equal("hogehoge1\n", read(escape("泣若違"))) end def test_rename_new_page_already_exist write("HogeHoge", "hogehoge1\n") @repos.commit("HogeHoge") write("FooBar", "foobar\n") @repos.commit("FooBar") assert_raise(ArgumentError) do @repos.rename("HogeHoge", "FooBar") end end def test_pages write(escape("祉祉"), "hogehoge1\n") @repos.commit("祉祉") write("FooBar", "foobar\n") @repos.commit("FooBar") expected = ["祉祉", "FooBar"] if Object.const_defined?(:Encoding) expected = expected.map{|v| v.force_encoding("binary") } end assert_equal(expected.sort, @repos.pages.sort) end def test_pages_with_block write(escape("祉祉"), "hogehoge1\n") @repos.commit("祉祉") write("FooBar", "foobar\n") @repos.commit("FooBar") actuals = [] @repos.pages.each do |page| actuals << page end expected = ["祉祉", "FooBar"] if Object.const_defined?(:Encoding) expected = expected.map{|v| v.force_encoding("binary") } end assert_equal(expected.sort, actuals.sort) end private def hg(*args) args = args.collect{|arg| arg.dump}.join(' ') result = `hg #{args}`.chomp raise result unless $?.success? result end end hiki-1.0.0/test/test_repos_plain.rb000066400000000000000000000117411212533356300173210ustar00rootroot00000000000000# -*- coding: utf-8 -*- require 'test/unit' require 'fileutils' require 'hiki/repos/plain' require 'hiki/util' class Repos_Plain_Tests < Test::Unit::TestCase include Hiki::Util def setup @tmpdir = '__tmp-wikitest' @root = "#{@tmpdir}/root" @wiki = 'wikiwiki' @data_path = "#{@tmpdir}/data" @repos = Hiki::ReposPlain.new(@root, @data_path) FileUtils.mkdir_p("#{@root}/#{@wiki}") FileUtils.mkdir_p("#{@data_path}/text") mkfile("#{@data_path}/text/.wiki", @wiki) end def teardown FileUtils.rm_rf(@tmpdir) end def test_commit FileUtils.mkdir_p("#{@root}/#{@wiki}/HogeHoge") FileUtils.mkdir_p("#{@root}/#{@wiki}/FooBar") mkfile("#{@root}/#{@wiki}/HogeHoge/1", 'hogehoge') mkfile("#{@root}/#{@wiki}/FooBar/1", 'foobar') mkfile("#{@data_path}/text/HogeHoge", 'hogehoge') mkfile("#{@data_path}/text/FooBar", 'foobar new') @repos.commit('FooBar') assert_equal('foobar', File.read("#{@root}/#{@wiki}/FooBar/1")) assert_equal('foobar new', File.read("#{@root}/#{@wiki}/FooBar/2")) end def test_commit_with_content FileUtils.mkdir_p("#{@root}/#{@wiki}/HogeHoge") FileUtils.mkdir_p("#{@root}/#{@wiki}/FooBar") mkfile("#{@root}/#{@wiki}/HogeHoge/1", 'hogehoge') mkfile("#{@root}/#{@wiki}/FooBar/1", 'foobar') @repos.commit_with_content("FooBar", "foobar new") assert_equal('foobar', File.read("#{@root}/#{@wiki}/FooBar/1")) assert_equal('foobar new', File.read("#{@root}/#{@wiki}/FooBar/2")) end def test_get_revision FileUtils.mkdir_p("#{@root}/#{@wiki}/HogeHoge") FileUtils.mkdir_p("#{@root}/#{@wiki}/FooBar") mkfile("#{@root}/#{@wiki}/HogeHoge/1", 'hogehoge1') mkfile("#{@root}/#{@wiki}/FooBar/1", 'foobar1') mkfile("#{@root}/#{@wiki}/HogeHoge/2", 'hogehoge2') mkfile("#{@root}/#{@wiki}/FooBar/2", 'foobar2') mkfile("#{@root}/#{@wiki}/HogeHoge/3", 'hogehoge3') mkfile("#{@root}/#{@wiki}/FooBar/3", 'foobar3') assert_equal('hogehoge1', @repos.get_revision('HogeHoge', 1)) assert_equal('hogehoge2', @repos.get_revision('HogeHoge', 2)) assert_equal('hogehoge3', @repos.get_revision('HogeHoge', 3)) end def test_revisions FileUtils.mkdir_p("#{@root}/#{@wiki}/HogeHoge") mkfile("#{@root}/#{@wiki}/HogeHoge/1", 'hogehoge1') mkfile("#{@root}/#{@wiki}/HogeHoge/2", 'hogehoge2') mkfile("#{@root}/#{@wiki}/HogeHoge/3", 'hogehoge3') s = Time.now.localtime.to_s expected = [ [3, s, '', ''], [2, s, '', ''], [1, s, '', ''], ] assert_equal(expected, @repos.revisions('HogeHoge')) end def test_rename FileUtils.mkdir_p("#{@root}/#{@wiki}/FooBar") mkfile("#{@root}/#{@wiki}/FooBar/1", 'foobar') mkfile("#{@data_path}/text/FooBar", 'foobar new') @repos.commit('FooBar') @repos.rename("FooBar", "FooBarBaz") assert_equal('foobar', File.read("#{@root}/#{@wiki}/FooBarBaz/1")) assert_equal('foobar new', File.read("#{@root}/#{@wiki}/FooBarBaz/2")) end def test_rename_multibyte FileUtils.mkdir_p("#{@root}/#{@wiki}/#{escape("泣若違")}") mkfile("#{@root}/#{@wiki}/#{escape("泣若違")}/1", 'foobar') mkfile("#{@data_path}/text/#{escape("泣若違")}", 'foobar new') @repos.commit('泣若違') @repos.rename("泣若違", "泣若違若違") assert_equal('foobar', File.read("#{@root}/#{@wiki}/#{escape("泣若違若違")}/1")) assert_equal('foobar new', File.read("#{@root}/#{@wiki}/#{escape("泣若違若違")}/2")) end def test_rename_new_page_already_exist FileUtils.mkdir_p("#{@root}/#{@wiki}/HogeHoge") FileUtils.mkdir_p("#{@root}/#{@wiki}/FooBar") mkfile("#{@root}/#{@wiki}/HogeHoge/1", 'hogehoge') mkfile("#{@root}/#{@wiki}/FooBar/1", 'foobar') mkfile("#{@data_path}/text/HogeHoge", 'hogehoge') mkfile("#{@data_path}/text/FooBar", 'foobar new') @repos.commit('FooBar') assert_raise(ArgumentError) do @repos.rename("FooBar", "HogeHoge") end assert_equal('hogehoge', File.read("#{@root}/#{@wiki}/HogeHoge/1")) end def test_pages FileUtils.mkdir_p("#{@root}/#{@wiki}/HogeHoge") FileUtils.mkdir_p("#{@root}/#{@wiki}/FooBar") mkfile("#{@root}/#{@wiki}/HogeHoge/1", 'hogehoge') mkfile("#{@root}/#{@wiki}/FooBar/1", 'foobar') mkfile("#{@data_path}/text/HogeHoge", 'hogehoge') mkfile("#{@data_path}/text/FooBar", 'foobar new') assert_equal(["HogeHoge", "FooBar"].sort, @repos.pages.sort) end def test_pages_with_block FileUtils.mkdir_p("#{@root}/#{@wiki}/HogeHoge") FileUtils.mkdir_p("#{@root}/#{@wiki}/FooBar") mkfile("#{@root}/#{@wiki}/HogeHoge/1", 'hogehoge') mkfile("#{@root}/#{@wiki}/FooBar/1", 'foobar') mkfile("#{@data_path}/text/HogeHoge", 'hogehoge') mkfile("#{@data_path}/text/FooBar", 'foobar new') actuals = [] @repos.pages.each do |page| actuals << page end assert_equal(["HogeHoge", "FooBar"].sort, actuals.sort) end private def mkfile(file, contents) File.open(file, 'w') do |f| f.print contents end end end hiki-1.0.0/test/test_repos_svn.rb000066400000000000000000000111261212533356300170210ustar00rootroot00000000000000# -*- coding: utf-8 -*- require 'test/unit' require 'fileutils' require 'hiki/repos/svn' require 'hiki/util' class Repos_SVN_Tests < Test::Unit::TestCase include Hiki::Util include TestHelper def setup @tmp_dir = File.join(File.dirname(__FILE__), "tmp") @root = "#{@tmp_dir}/root" @wiki = 'wikiwiki' @data_dir = "#{@tmp_dir}/data" @text_dir = "#{@data_dir}/text" @repository_dir = "#{@tmp_dir}/repository" @repos = Hiki::ReposSvn.new(@root, @data_dir) FileUtils.mkdir_p(@text_dir) check_command("svn") svnadmin("create", @repository_dir) svn("checkout", "file://#{@repository_dir}", @text_dir) end def teardown FileUtils.rm_rf(@tmp_dir) end def test_commit write("FooBar", 'foobar') @repos.commit('FooBar') assert_equal('foobar', read('FooBar')) file = nil write("FooBar", 'foobar new') @repos.commit('FooBar') assert_equal('foobar new', read('FooBar')) Dir.chdir(@text_dir) do assert_equal("foobar new", svn("cat", "FooBar")) end end def test_commit_with_content @repos.commit_with_content("FooBar", "foobar") assert_equal("foobar", read("FooBar")) @repos.commit_with_content("FooBar", "foobar new") assert_equal("foobar new", read("FooBar")) end def test_get_revision Dir.chdir(@text_dir) do write("HogeHoge", "hogehoge1") svn("add", "HogeHoge") svn("commit", "-m", "First", "HogeHoge") write("HogeHoge", "hogehoge2") svn("commit", "-m", "Second", "HogeHoge") write("HogeHoge", "hogehoge3") svn("commit", "-m", "Third", "HogeHoge") end assert_equal('hogehoge1', @repos.get_revision('HogeHoge', 1)) assert_equal('hogehoge2', @repos.get_revision('HogeHoge', 2)) assert_equal('hogehoge3', @repos.get_revision('HogeHoge', 3)) end def test_revisions modified1 = modified2 = modified3 = nil Dir.chdir(@text_dir) do write("HogeHoge", "hogehoge1") modified1 = Time.now.localtime.strftime('%Y/%m/%d %H:%M:%S') svn("add", "HogeHoge") svn("commit", "-m", "First", "HogeHoge") write("HogeHoge", "hogehoge2") modified2 = Time.now.localtime.strftime('%Y/%m/%d %H:%M:%S') svn("commit", "-m", "Second", "HogeHoge") write("HogeHoge", "hogehoge3") modified3 = Time.now.localtime.strftime('%Y/%m/%d %H:%M:%S') svn("commit", "-m", "Third", "HogeHoge") end expected = [ [3, modified3, '1 line', 'Third'], [2, modified2, '1 line', 'Second'], [1, modified1, '1 line', 'First'], ].transpose actual = @repos.revisions('HogeHoge').transpose assert_equal(expected[0], actual[0]) # disable to fragile test # assert_equal(expected[1], actual[1]) assert_equal(expected[2], actual[2]) assert_equal(expected[3], actual[3]) end def test_rename write("HogeHoge", "hogehoge1\n") @repos.commit("HogeHoge") @repos.rename("HogeHoge", "FooBar") assert_equal("hogehoge1\n", read("FooBar")) end def test_rename_multibyte write(escape("祉祉"), "hogehoge1\n") @repos.commit("祉祉") @repos.rename("祉祉", "泣若違") assert_equal("hogehoge1\n", read(escape("泣若違"))) end def test_rename_new_page_already_exist write("HogeHoge", "hogehoge1\n") @repos.commit("HogeHoge") write("FooBar", "foobar\n") @repos.commit("FooBar") assert_raise(ArgumentError) do @repos.rename("HogeHoge", "FooBar") end end def test_pages write(escape("祉祉"), "hogehoge1\n") @repos.commit("祉祉") write("FooBar", "foobar\n") @repos.commit("FooBar") expected = ["祉祉", "FooBar"] if Object.const_defined?(:Encoding) expected = expected.map{|v| v.force_encoding("binary") } end assert_equal(expected.sort, @repos.pages.sort) end def test_pages_with_block write(escape("祉祉"), "hogehoge1\n") @repos.commit("祉祉") write("FooBar", "foobar\n") @repos.commit("FooBar") actuals = [] @repos.pages.each do |page| actuals << page end expected = ["祉祉", "FooBar"] if Object.const_defined?(:Encoding) expected = expected.map{|v| v.force_encoding("binary") } end assert_equal(expected.sort, actuals.sort) end private def svn(*args) args = args.map{|arg| arg.dump }.join(' ') result = `svn #{args}`.chomp raise result unless $?.success? result end def svnadmin(*args) args = args.map{|arg| arg.dump }.join(' ') result = `svnadmin #{args}`.chomp raise result unless $?.success? result end end hiki-1.0.0/test/test_tmarshal.rb000066400000000000000000000035361212533356300166240ustar00rootroot00000000000000# $Id: test_tmarshal.rb,v 1.1 2005-01-04 08:43:57 fdiary Exp $ require 'test/unit' require 'hiki/db/tmarshal' require 'stringio' class TMarshal_Unit_Tests < Test::Unit::TestCase class A;end def setup @input = [true, false, nil, Object, :a, /x/, 1..2, 3...4, Time.gm(1970), 'ABC', {'a'=>1, 'b'=>2, 'c'=>3}] end def teardown @io.close if @io && !@io.closed? end def test_string assert_equal('"123"', TMarshal::dump('123')) end def test_array assert_equal("[\n]", TMarshal::dump([])) assert_equal("[\n1,\n2,\n3,\n]", TMarshal::dump([1,2,3])) end def test_numeric assert_equal('123', TMarshal::dump(123)) assert_equal('123123123123123', TMarshal::dump(123123123123123)) assert_equal('1.23', TMarshal::dump(1.23)) assert_equal('1.23e+45', TMarshal::dump(1.23e+45)) end def test_hash assert_equal("{\n}", TMarshal::dump({})) assert_equal("{\n\"a\" => 1,\n\"b\" => 2,\n}", TMarshal::dump({'a'=>1, 'b'=>2})) end def test_true assert_equal("true", TMarshal::dump(true)) end def test_false assert_equal("false", TMarshal::dump(false)) end def test_nil assert_equal("nil", TMarshal::dump(nil)) end def test_range assert_equal("1..3", TMarshal::dump(1..3)) assert_equal("1...3", TMarshal::dump(1...3)) end def test_time assert_equal("Time.at(0)", TMarshal::dump(Time.gm(1970))) end def test_else assert_raise(RuntimeError) {TMarshal::dump(A.new)} end def test_load_string @io = StringIO.new TMarshal::dump(@input, @io) @io.rewind str = @io.read assert_equal(@input, TMarshal::load(str)) @io.close end def test_load_stringio @io = StringIO.new TMarshal::dump(@input, @io) @io.rewind assert_equal(@input, TMarshal::load(@io)) end def test_load_else assert_raise(RuntimeError) {TMarshal::load([])} end end hiki-1.0.0/test/test_util.rb000066400000000000000000000121611212533356300157600ustar00rootroot00000000000000# -*- coding: utf-8 -*- # $Id: test_util.rb,v 1.4 2006-05-29 13:39:10 fdiary Exp $ $:.unshift(File.join(File.dirname(__FILE__), '../hiki')) require 'test/unit' require 'hiki/util' class TestUtil < Test::Unit::TestCase include Hiki::Util def setup @t1 = "123\n456\n" @t2 = "123\nabc\n456\n" @t3 = "123\n456\ndef\n" @t4 = "<腱鴻с\n腱Just Another Ruby Porterс" @t5 = "違腱障ゃс\nRuby篏c腱с腱Ruby Hackerс" @conf = Object.new end def test_word_diff_html assert_equal( "123\nabc\n456\n", word_diff( @t1, @t2 ) ) assert_equal( "鴻с障ゃс\nRuby篏c腱сJust Another Ruby PorterHackerс", word_diff( @t4, @t5) ) end def test_word_diff_text assert_equal( "123\n{+abc+}\n456\n", word_diff_text( @t1, @t2 ) ) assert_equal( "[-<-]{+違+}腱[-鴻с-]{+障ゃс+}\n{+Ruby篏c腱с+}腱[-Just Another -]Ruby [-Porter-]{+Hacker+}с", word_diff_text( @t4, @t5 ) ) end def test_unified_diff assert_equal( "@@ -1,2 +1,3 @@\n 123\n+abc\n 456\n", unified_diff( @t1, @t2 ) ) assert_equal( "@@ -1,3 +1,2 @@\n 123\n-abc\n 456\n", unified_diff( @t2, @t1 ) ) end def test_euc_to_utf8 omit("do not use this method with Ruby1.9") if Object.const_defined?(:Encoding) hoge_euc = "\xA4\xDB\xA4\xB2" hoge_utf8 = "祉" fullwidth_wave_euc = "\xA1\xC1" fullwidth_wave_utf8 = "" assert_equal(hoge_utf8, euc_to_utf8(hoge_euc)) assert_equal(fullwidth_wave_utf8, euc_to_utf8(fullwidth_wave_euc)) end def test_utf8_to_euc omit("do not use this method with Ruby1.9") if Object.const_defined?(:Encoding) hoge_euc = "\xA4\xDB\xA4\xB2" hoge_utf8 = "祉" fullwidth_wave_euc = "\xA1\xC1" fullwidth_wave_utf8 = "" assert_equal(hoge_euc, utf8_to_euc(hoge_utf8)) assert_equal(fullwidth_wave_euc, utf8_to_euc(fullwidth_wave_utf8)) end def test_plugin_error error = Object.new mock(error).class.returns("Hiki::PluginError") mock(error).message.returns("Plugin Error") mock(@conf).plugin_debug.returns(false) assert_equal("Hiki::PluginError (Plugin Error): do_something
    ", plugin_error("do_something", error)) end def test_plugin_error_with_debug error = Object.new mock(error).class.returns("Hiki::PluginError") mock(error).message.returns("Plugin Error") mock(error).backtrace.returns(["backtrace1", "backtrace2", "backtrace3"]) mock(@conf).plugin_debug.returns(true) assert_equal(<Hiki::PluginError (Plugin Error): do_something
    backtrace1
    backtrace2
    backtrace3
    STR end def test_cmdstr assert_equal("?c=hoge;fuga", cmdstr("hoge", "fuga")) end def test_title mock(@conf).site_name.returns("") assert_equal("<TestSite> - FrontPage", title("FrontPage")) end def test_view_title mock(@conf).cgi_name.returns("hiki.cgi") assert_equal(%Q!FrontPage!, view_title("FrontPage")) end def test_format_date mock(@conf).msg_time_format.returns("%Y-%m-%d #DAY# %H:%M:%S") mock(@conf).msg_day.returns(%w( 羂 )) assert_equal("2011-01-01 () 01:02:03", format_date(Time.mktime(2011, 1, 1, 1, 2, 3))) end def test_escape if Object.const_defined?(:Encoding) expected = [ "%E3%81%82%E3%81%84%E3%81%86%E3%81%88%E3%81%8A", "%E3%83%95%E3%83%AD%E3%83%B3%E3%83%88%E3%83%9A%E3%83%BC%E3%82%B8", "%A4%A2%A4%A4%A4%A6%A4%A8%A4%AA", "%A5%D5%A5%ED%A5%F3%A5%C8%A5%DA%A1%BC%A5%B8", "%82%A0%82%A2%82%A4%82%A6%82%A8", "%83%74%83%8D%83%93%83%67%83%79%81%5B%83%57", ] else expected = [ "%E3%81%82%E3%81%84%E3%81%86%E3%81%88%E3%81%8A", "%E3%83%95%E3%83%AD%E3%83%B3%E3%83%88%E3%83%9A%E3%83%BC%E3%82%B8", "%A4%A2%A4%A4%A4%A6%A4%A8%A4%AA", "%A5%D5%A5%ED%A5%F3%A5%C8%A5%DA%A1%BC%A5%B8", "%82%A0%82%A2%82%A4%82%A6%82%A8", "%83t%83%8D%83%93%83g%83y%81%5B%83W", ] end actual = [ "", "潟若", NKF.nkf("-m0 -We", ""), NKF.nkf("-m0 -We", "潟若"), NKF.nkf("-m0 -Ws", ""), NKF.nkf("-m0 -Ws", "潟若"), ] assert_equal(expected, actual.map{|v| escape(v) }) end end hiki-1.0.0/theme/000077500000000000000000000000001212533356300135415ustar00rootroot00000000000000hiki-1.0.0/theme/hiki/000077500000000000000000000000001212533356300144655ustar00rootroot00000000000000hiki-1.0.0/theme/hiki/README000066400000000000000000000006451212533356300153520ustar00rootroot00000000000000Title: Hiki Author: TAKEUCHI Hitoshi Access: hitoshi@namaraii.com License: GPL Comment: Hiki若 tDiaryclover若若鴻篏障 吾若篏NT茗障 Copyright 2002 (C) by TADA Tadashi Copyright 2002 (C) by NT Copyright 2004 (C) by TAKEUCHI Hitoshi hiki-1.0.0/theme/hiki/hiki.css000066400000000000000000000233521212533356300161300ustar00rootroot00000000000000/* Title: Hiki $Revision: 1.10 $ Author: TAKEUCHI Hitoshi Access: hitoshi@namaraii.com License: GPL Comment: Hiki若 tDiaryclover若若鴻篏障 吾若篏NT茗障 Copyright 2002 (C) by TADA Tadashi Copyright 2002 (C) by NT Copyright 2004 (C) by TAKEUCHI Hitoshi validated by W3C. */ /* ChangeLog 2004-01-23 TAKEUCHI Hitoshi * modified for Hiki 2002-09-14 NT * convert for 1.5 series. 2002-05-07 TADA Tadashi * remove overflow from pre. * line-height of body upto 150%. 2002-03-28 TADA Tadashi * image color down to 7bit. * no underline for links. 2002-03-28 TADA Tadashi * support new amazon plugin. 2002-03-27 TADA Tadashi * fix textarea biyo--n problem. */ body { background-color: #fff; color: #000; font-family: Arial,Verdana,Helvetica,'MS UI Gothic',sans-serif; margin: 0; padding: 0.5em; padding-right: 1em; } a{ text-decoration: none; } a:link { color: #22a; } a:visited { color: #561464; } a:hover { text-decoration: underline; } div.adminmenu { text-align: right; margin-top: 0px; padding: 0.2em 0.5em 0.5em 0.5em; padding-right: 0; font-size: 75%; line-height: 2.5em; } span.adminmenu { background-color: #f0f0ff; color: #ffffff; border-color: #aaa; border-style: solid; border-width: 0px 1px 1px 0px; padding: 2px; white-space: nowrap; } h1 { height: 64px; line-height: 64px; text-align: right; padding-bottom: 5px; } h2 { font-size: 160%; border-style: solid; border-color: #48c; border-width: 0px 0px 1px 0px; } div.day h2 { font-size: 160%; border-style: solid; border-color: #48c; border-width: 0px 0px 2px 0px; margin-left: 0.5em; padding-left: 0.5em; padding-bottom: 4px; } div.body { margin-left: 1.8em; line-height: 120%; } div.body h3 { font-size: 140%; border-style: dashed; border-color: #48c; border-width: 0px 0px 2px 0px; margin-top: 1.5em; margin-bottom: 0.5em; padding: 0 0 0.4em 0; } div.body h4 h5 h6 { margin-top: 1.5em; margin-bottom: 0.5em; padding: 4px; } div.body h4 { font-size: 140%; border-left: solid 3px #48c; padding: 0.2em 0.3em; } div.body h5 { font-size: 140%; } div.body h6 { font-size: 110%; } div.body p { margin-top: 0px; margin-bottom: 0.5em; color: #000; background-color: transparent; line-height: 150%; } div.body pre { color: #000; background-color: #f0f0ff; border-style: solid; border-width: 1px 1px 1px 6px; border-color: #cccccc; padding: 8px; margin-left: 2em; } blockquote { color: #000; background-color: #f0f0ff; border-style: solid; border-color: #cccccc; border-width: 2px 0px 2px 0px; padding: 4px; margin-left: 3em; margin-right: 3em; } div.body blockquote p { margin-left: 0em; } div.body li { margin-left: 0.5em; } div.body dl { margin-left: 0.5em; } div.body dt { border-style: solid; border-color: #eef; border-width: 0px 0px 1px 0px; margin-top: 0.7em; } div.body dd { margin-top: 0.3em; margin-bottom: 0.5em; margin-left: 2em; } div.comment { border-style: solid; border-color: #ccc; border-width: 1px; color: #000; background-color: #eef; margin-top: 1em; margin-bottom: 0.5em; margin-left: 1em; padding: 4px; font-size: 90%; } div.form div.comment { margin-right: 1em; color: #000; background-color: #fff; } div.comment p { margin-top: 0px; margin-bottom: 0.5em; } div.comment p.commenttitle { border-style: dashed; border-color: #ccc; border-width: 0px 0px 1px 0px; } div.form { border-style: solid; border-color: #c0c0c0; border-width: 1px; color: #000; background-color: #f0f0ff; } div.day div.form { margin-top: 0px; margin-bottom: 0.5em; margin-left: 2em; } div.form form { margin: 0; padding: 4px 4px 4px 4px; width: 100%; } div.form p { margin-top: 0px; margin-bottom: 0.5em; padding-left: 4px; } div.form textarea { margin-left: 2em; } div.referer { text-align: right; font-size: x-small; margin-top: 0px; } div.refererlist { border-style: solid; color: #000; border-color: #c0c0c0; border-width: 1px; background-color: #f0f0ff; margin-top: 0px; margin-left: 2em; margin-bottom: 0.5em; font-size: small; } div.refererlist ul { margin-left: 2em; } div.form div.refererlist { margin-right: 1em; color: #000; background-color: #fff; } div.refererlist p, div.refererlist ul { margin-top: 0px; margin-bottom: 0em; padding: 4px 4px 4px 4px; } hr { margin-top: 0.5em; border-style: solid; border-width: 2px 0px 0px 0px; border-color: #ccc; } hr.sep { display: none; } div.footer { text-align: right; font-size: 80%; color: #444; } form div.body { border-style: solid; border-color: #c0c0c0; border-width: 1px; color: #000; background-color: #f0f0ff; padding: 0px 4px 4px 4px; } table { border-color: #ccc; border-width: 1px; padding: 0px; border-collapse: collapse; } th, tr, td { border-style: solid; border-color: #ccc; border-width: 1px; padding-top: 4px; padding-left: 4px; } /* for plugins */ /* calendar */ div.calendar { font-size: x-small; } /* calendar2 */ table.calendar { font-size: x-small; line-height: 100%; border-width: 0px; } table.calendar td { margin: 0px; text-align: right; padding: 0px; margin: 0px; } table.calendar td.calendar-prev-month, table.calendar td.calendar-current-month, table.calendar td.calendar-next-month { text-align: center; } /* recent_list */ p.recentitem { font-size: small; margin-top: 0px; margin-bottom: 0px; } div.recentsubtitles { font-size: x-small; margin-top: 0px; margin-bottom: 1em; margin-left: 1em; } /* footnote */ div.body span.footnote { vertical-align: super; font-size: 80%; } div.footnote { border-style: solid; border-color: #c0c0c0; border-width: 1px 0px 0px 0px; margin-left: 3em; font-size: small; } /* amazon plugin */ img.left { border-width: 1px; border-color: #000080; float: left; } img.right { border-width: 1px; border-color: #000080; float: right; } /* similarity Plugin */ .bulkfeedsSimilarity { width: 500px; } .bulkfeedsSimilarityHeader { font-weight: bold; background: #ccc; padding: 0.2em; margin-bottom: 0.2em; } .bulkfeedsSimilarityHeader a { font-weight: bold; color: #000; } .bulkfeedsSimilarityHeader a:visited { color: #000; } .bulkfeedsSimilarityItems { margin: 0; padding-left: 1em; list-style: none; } .bulkfeedsSimilarityFooter { text-align: center; margin-top: 0.5em; } .bulkfeedsSimilarityFooter a { color: #000; } .bulkfeedsSimilarityFooter a:visited { color: #000; } .comments-head { padding: 0.4em; background: #ccc; } .comments-head a { font-weight: bold; color: #000; } .comments-head a:visited { font-weight: bold; color: #000; } .comments-body { padding: 0.5em; } .comments-body p { margin: 0.2em; } .hilight { color: black; background: #ff6666; } div.section { clear: both; } div.main { margin-left: 20%; } div.sidebar { position: absolute; top: 0px; left: 0px; width: 20%; font-size: 75%; padding: 2px 2px 100% 2px; border-style: solid; border-color: #c0c0c0; border-width: 1px; color: #000; background-color: #f0f0ff; } div.sidebar ul { margin: 20px; padding: 0px; } div.sidebar form { margin: 0em 0em 0.5em 0em; padding: 0px; } /* 潟ョ */ div.commentshort { font-size: 0.9em; margin-left: 0.5em; } span.commentator { font-weight: bold; } div.commentshort p { margin-top: 0.5em; margin-bottom: 0.2em; line-height: 1.2em; } /* 潟篏 */ div.commentbody { font-size: 0.9em; margin: 0.5em; line-height: 1.2em; } /* 潟篋冴 */ div.commentator { line-height: 1.5em; } /* 潟 */ div.commentbody p { margin: 0.5em; margin-left: 2em; } /* 若荐絎 */ div.form form { margin: 0em 0em 0em 2em; } div.form div.caption { font-size: 0.9em; margin: 0.5em; } div.form form.comment { font-size: 0.9em; } div.field { display: inline; margin-right: 2em; } form.comment input { margin-left: 1em; } div.textarea { display: block; vertical-align: top; } form.comment textarea { display: block; margin-left: 3em; width: 30em; height: 5em; } div.button { display: block; margin-left: 3em; } /* 贋違若 */ form.update { padding-top: 0.5em; padding-bottom: 0.5em; } form.update input, form.update textarea, form.commentstat input { } form.update span.field { display: inline; margin-left: 0em; margin-right: 0.5em; } form.update div.field.title { display: block; margin-top: 1em; } form.update div.field.title input { margin-left: 0.5em; } form.update div.textarea { display: block; margin-top: 1em; } form.update textarea { display: block; margin-left: 3em; margin-bottom: 1em; width: 80%; height: 15em; } form.update span.checkbox.hidediary { margin-left: 1em; } /* 潟倶紊眼若 */ div.comment form { margin-top: 0em; } @media print { div.main { margin-left: 0%;} div.adminmenu { display: none; } div.sidebar { display: none; } div.comment { display: none; } div.footer { display: none; } div.referer { display: none; } } @media screen { div.main { margin-left: 20%;} div.adminmenu { display: block; } div.sidebar { display: block; } div.comment { display: block; } div.footer { display: block; } div.footer div { display: block; } div.referer { display: block;} } div.hello { text-align: right; font-size: 80%; margin-top: 0px; } hiki-1.0.0/theme/hiki_base.css000066400000000000000000000006541212533356300161760ustar00rootroot00000000000000ins.added { font-weight: bold; } del.deleted { text-decoration: line-through; } form.update textarea.keyword { width: 15em; height: 3em; } /* 02help */ div.helptlbr { font-size: small; padding: 1px; } span.helpbttn { border-style: solid; border-width: 0px 0px 1px 0px; } @media print{ div.adminmenu{ display: none; } div.main{ margin-left: 0; } div.sidebar{ display: none; } } hiki-1.0.0/tool/000077500000000000000000000000001212533356300134145ustar00rootroot00000000000000hiki-1.0.0/tool/convert.rb000077500000000000000000000071531212533356300154320ustar00rootroot00000000000000#! /usr/bin/env ruby $LOAD_PATH.unshift '.' require "optparse" require "pathname" require "fileutils" require "digest/md5" require "nkf" require "hiki/util" require "hiki/config" FILE_NAME_MAX_SIZE = 255 def check(data_path, database_class, input_encoding, output_encoding, nkf) config = Struct.new(:data_path).new config.data_path = data_path.expand_path db = database_class.new(config) db.pages.each do |page| begin old_page = page escaped_old_page = Hiki::Util.escape(old_page) new_page = encode(old_page, input_encoding, output_encoding, nkf) escaped_new_page = Hiki::Util.escape(new_page) if escaped_new_page.bytesize > FILE_NAME_MAX_SIZE puts "NG: #{escaped_old_page} => #{escaped_new_page}" end rescue StandardError => ex puts "Error: #{escaped_old_page}" puts "#{ex.class}: #{ex.message}" puts ex.backtrace end end end def convert(data_path, database_class, input_encoding, output_encoding, nkf) config = Struct.new(:data_path).new config.data_path = data_path.expand_path db = database_class.new(config) db.pages.each do |page| begin old_page = page new_page = encode(old_page, input_encoding, output_encoding, nkf) print "#{Hiki::Util.escape(old_page)} => #{Hiki::Util.escape(new_page)}" old_text = db.load(old_page) new_text = encode(old_text, input_encoding, output_encoding, nkf) db.unlink(old_page) db.store(new_page, new_text, Digest::MD5.hexdigest(old_text)) puts " OK." rescue StandardError => ex puts " NG." puts "#{ex.class}: #{ex.message}" puts ex.backtrace end end cache_path = data_path + "cache" FileUtils.rm_rf(cache_path) end def encode(text, input_encoding, output_encoding, nkf) if nkf NKF.nkf("-m0 --ic=#{input_encoding} --oc=#{output_encoding}", text) else text.dup.encode!(output_encoding, input_encoding, :invalid => :replace, :undef => :replace) end end def main(argv) parser = OptionParser.new data_path = nil repository_type = "plain" database_type = "flatfile" input_encoding = nil output_encoding = nil nkf = false check_only = false parser.on("-D", "--data-directory=DIR", "Specify the data directory"){|dir| data_path = Pathname(dir).realpath } # TODO Do we need to handle repository type? # parser.on("-r", "--repository-type=[TYPE]", # "Specify the repository type [plain, svn, git, hg] (default: plain") {|type| # repository_type = type # } parser.on("-d", "--database-type=[TYPE]", "Specify the database type [flatfile] (default: flatfile") {|type| database_type = type } parser.on("-i", "--input-encoding=ENCODING", "Specify the input encoding"){|encoding| input_encoding = Encoding.find(encoding) } parser.on("-o", "--output-encoding=ENCODING", "Specify the output encoding"){|encoding| output_encoding = Encoding.find(encoding) } parser.on("--nkf", "Use NKF (default: no)"){ nkf = true } parser.on("-C", "--check-only", "Check file name and exit"){ check = true } begin parser.parse!(argv) rescue STDERR.puts $!.class.to_s STDERR.puts $!.message exit 1 end # require_relative "../hiki/repos/#{repository_type}" # repository_class = ::Hiki.const_get("Repos#{repository_type.capitalize}") require_relative "../hiki/db/#{database_type}" database_class = ::Hiki::const_get("HikiDB_#{database_type}") if check_only check(data_path, database_class, input_encoding, output_encoding, nkf) else convert(data_path, database_class, input_encoding, output_encoding, nkf) end end if __FILE__ == $0 main(ARGV) end