tdiary-contrib 3.2.2.20130518
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.gitignore +1 -0
- data/.travis.yml +7 -0
- data/Gemfile +13 -0
- data/Gemfile.lock +35 -0
- data/README.en.md +12 -0
- data/README.md +13 -0
- data/Rakefile +41 -0
- data/doc/en/filter/spambayes.txt +3 -0
- data/doc/en/plugin.txt +1 -0
- data/doc/en/style/hatena.txt +10 -0
- data/doc/en/style/markdown.txt +16 -0
- data/doc/en/util.txt +1 -0
- data/doc/ja/filter/antirefspam.history.txt +59 -0
- data/doc/ja/filter/antirefspam.txt +86 -0
- data/doc/ja/filter/comment_key.ja.html +182 -0
- data/doc/ja/filter/spambayes.txt +3 -0
- data/doc/ja/plugin/add_bookmark.txt +50 -0
- data/doc/ja/plugin/category_to_tag.txt +21 -0
- data/doc/ja/plugin/cocoment.txt +31 -0
- data/doc/ja/plugin/google_adsense.txt +25 -0
- data/doc/ja/plugin/google_analytics.txt +7 -0
- data/doc/ja/plugin/image_detail.txt +69 -0
- data/doc/ja/plugin/image_gps.txt +36 -0
- data/doc/ja/plugin/image_gps2.txt +41 -0
- data/doc/ja/plugin/livedoor_weather.txt +105 -0
- data/doc/ja/plugin/opensearch_ad.txt +16 -0
- data/doc/ja/plugin/section_footer.txt +84 -0
- data/doc/ja/plugin/select_theme.txt +1 -0
- data/doc/ja/plugin.txt +13 -0
- data/doc/ja/style/hatena.txt +10 -0
- data/doc/ja/style/markdown.txt +13 -0
- data/doc/ja/util.txt +12 -0
- data/filter/antirefspam.rb +263 -0
- data/filter/commentkey.rb +29 -0
- data/filter/commentsize.rb +18 -0
- data/filter/hidecomment.rb +13 -0
- data/filter/iplookup.rb +55 -0
- data/filter/plugin/antirefspam.rb +59 -0
- data/filter/plugin/commentkey.rb +58 -0
- data/filter/plugin/commentsize.rb +12 -0
- data/filter/plugin/en/iplookup.rb +9 -0
- data/filter/plugin/en/spambayes.rb +123 -0
- data/filter/plugin/iplookup.rb +39 -0
- data/filter/plugin/ja/antirefspam.rb +91 -0
- data/filter/plugin/ja/commentkey.rb +17 -0
- data/filter/plugin/ja/commentsize.rb +6 -0
- data/filter/plugin/ja/iplookup.rb +9 -0
- data/filter/plugin/ja/spambayes.rb +124 -0
- data/filter/plugin/spambayes.rb +501 -0
- data/filter/plugin/zh/iplookup.rb +9 -0
- data/filter/rblcheck.rb +36 -0
- data/filter/spambayes.rb +535 -0
- data/filter/spamlookup.rb +37 -0
- data/io/dbi_io/ChangeLog +19 -0
- data/io/dbi_io/README.ja +39 -0
- data/io/dbi_io/dbi_io.rb +181 -0
- data/io/dbi_io/plugin/refererDbiIO.rb +76 -0
- data/io/dbi_io/tdiary_table.sql +42 -0
- data/js/appstore.js +109 -0
- data/js/datepicker.js +69 -0
- data/js/editor.js +82 -0
- data/js/flickr.js +157 -0
- data/js/image_ex.js +79 -0
- data/js/jquery.socialbutton.js +842 -0
- data/js/nicovideo.js +17 -0
- data/js/picasa.js +322 -0
- data/js/plugin_checker.js +71 -0
- data/js/prettify/lang-apollo.js +2 -0
- data/js/prettify/lang-clj.js +18 -0
- data/js/prettify/lang-css.js +2 -0
- data/js/prettify/lang-go.js +1 -0
- data/js/prettify/lang-hs.js +2 -0
- data/js/prettify/lang-lisp.js +3 -0
- data/js/prettify/lang-lua.js +2 -0
- data/js/prettify/lang-ml.js +2 -0
- data/js/prettify/lang-n.js +4 -0
- data/js/prettify/lang-proto.js +1 -0
- data/js/prettify/lang-scala.js +2 -0
- data/js/prettify/lang-sql.js +2 -0
- data/js/prettify/lang-tex.js +1 -0
- data/js/prettify/lang-vb.js +2 -0
- data/js/prettify/lang-vhdl.js +3 -0
- data/js/prettify/lang-wiki.js +2 -0
- data/js/prettify/lang-xq.js +3 -0
- data/js/prettify/lang-yaml.js +2 -0
- data/js/prettify/prettify.css +1 -0
- data/js/prettify/prettify.js +28 -0
- data/js/referer.js +17 -0
- data/js/show_and_hide.js +39 -0
- data/js/socialbutton.js +126 -0
- data/js/twitter_anywhere.js +28 -0
- data/js/yahoo_kousei.js +21 -0
- data/lib/bayes/convert.rb +34 -0
- data/lib/bayes.rb +232 -0
- data/lib/exifparser/BUGS +1 -0
- data/lib/exifparser/ChangeLog +169 -0
- data/lib/exifparser/README +15 -0
- data/lib/exifparser/install.rb +1015 -0
- data/lib/exifparser/lib/exifparser/makernote/canon.rb +502 -0
- data/lib/exifparser/lib/exifparser/makernote/fujifilm.rb +415 -0
- data/lib/exifparser/lib/exifparser/makernote/minolta.rb +84 -0
- data/lib/exifparser/lib/exifparser/makernote/mk_nikonflensname.rb +39 -0
- data/lib/exifparser/lib/exifparser/makernote/nikon.rb +267 -0
- data/lib/exifparser/lib/exifparser/makernote/nikon2.rb +581 -0
- data/lib/exifparser/lib/exifparser/makernote/nikonflensname.rb +438 -0
- data/lib/exifparser/lib/exifparser/makernote/olympus.rb +225 -0
- data/lib/exifparser/lib/exifparser/makernote/prove.rb +84 -0
- data/lib/exifparser/lib/exifparser/makernote/sigma.rb +237 -0
- data/lib/exifparser/lib/exifparser/pre-setup.rb +1 -0
- data/lib/exifparser/lib/exifparser/scan.rb +278 -0
- data/lib/exifparser/lib/exifparser/tag.rb +2298 -0
- data/lib/exifparser/lib/exifparser/thumbnail.rb +76 -0
- data/lib/exifparser/lib/exifparser/utils.rb +88 -0
- data/lib/exifparser/lib/exifparser.rb +265 -0
- data/lib/exifparser/sample/exifview.rb +279 -0
- data/lib/tdiary-contrib.rb +19 -0
- data/lib/wgs2tky.rb +93 -0
- data/misc/section_footer2/buzzurl.yaml +6 -0
- data/misc/section_footer2/fc2.yaml +6 -0
- data/misc/section_footer2/ldc.yaml +6 -0
- data/misc/section_footer2/retweet.yaml +7 -0
- data/misc/section_footer2/twitter.yaml +7 -0
- data/misc/section_footer2/yahoo.yaml +6 -0
- data/misc/tdiarygraph/tdiarygraph120x90e.swf +0 -0
- data/misc/tdiarygraph/tdiarygraph125x125e.swf +0 -0
- data/misc/tdiarygraph/tdiarygraph240x180e.swf +0 -0
- data/misc/tdiarygraph/tdiarygraph468x60e.swf +0 -0
- data/misc/tdiarygraph/tdiarygraph728x90e.swf +0 -0
- data/misc/tdiarytimes/tdiarytimes125x125r.swf +0 -0
- data/misc/tdiarytimes/tdiarytimes125x125r7.swf +0 -0
- data/misc/tdiarytimes/tdiarytimes125x125s.swf +0 -0
- data/misc/tdiarytimes/tdiarytimes125x30.swf +0 -0
- data/misc/tdiarytimes/tdiarytimes234x30.swf +0 -0
- data/misc/tdiarytimes/tdiarytimes468x30.swf +0 -0
- data/plugin/add_bookmark.rb +89 -0
- data/plugin/apple_webclip.rb +26 -0
- data/plugin/appstore.rb +47 -0
- data/plugin/bigpresen.rb +86 -0
- data/plugin/bitly.rb +39 -0
- data/plugin/bootstrap-navi.rb +54 -0
- data/plugin/canonical.rb +9 -0
- data/plugin/category_similar.rb +73 -0
- data/plugin/category_to_tag.rb +60 -0
- data/plugin/category_to_tagcloud.rb +172 -0
- data/plugin/cocomment.rb +37 -0
- data/plugin/code-prettify.rb +23 -0
- data/plugin/coderwall.rb +34 -0
- data/plugin/datepicker.rb +28 -0
- data/plugin/day2section.rb +20 -0
- data/plugin/del_footer.rb +111 -0
- data/plugin/description_from_body.rb +23 -0
- data/plugin/development.rb +16 -0
- data/plugin/editor.rb +11 -0
- data/plugin/en/add_bookmark.rb +20 -0
- data/plugin/en/del_footer.rb +10 -0
- data/plugin/en/git-register.rb +3 -0
- data/plugin/en/livedoor_weather.rb +25 -0
- data/plugin/en/microsummary.rb +18 -0
- data/plugin/en/nicovideo.rb +38 -0
- data/plugin/en/openid.rb +8 -0
- data/plugin/en/section_footer.rb +6 -0
- data/plugin/en/section_footer2.rb +3 -0
- data/plugin/en/socialbutton.rb +5 -0
- data/plugin/everytrail.rb +39 -0
- data/plugin/facebook_comments.rb +59 -0
- data/plugin/flickr.rb +209 -0
- data/plugin/gist.rb +16 -0
- data/plugin/git-register.rb +240 -0
- data/plugin/github_badge.rb +27 -0
- data/plugin/github_link.rb +9 -0
- data/plugin/goo_gl.rb +42 -0
- data/plugin/google_adsense.rb +132 -0
- data/plugin/google_analytics.rb +39 -0
- data/plugin/google_map.rb +168 -0
- data/plugin/google_sitemaps.rb +60 -0
- data/plugin/google_webmaster.rb +22 -0
- data/plugin/hatena_bookmark_nocomment.rb +9 -0
- data/plugin/hatena_star.rb +66 -0
- data/plugin/hb_footer.rb +255 -0
- data/plugin/hb_footer4sec.rb +244 -0
- data/plugin/hb_footer4sec_js.rb +30 -0
- data/plugin/hide_comment_form.rb +4 -0
- data/plugin/hide_sidebar_iphone.rb +21 -0
- data/plugin/iddy.rb +81 -0
- data/plugin/image_detail.rb +143 -0
- data/plugin/image_ex.rb +462 -0
- data/plugin/image_gps.rb +128 -0
- data/plugin/inline_wiki.rb +6 -0
- data/plugin/instagr.rb +64 -0
- data/plugin/ja/add_bookmark.rb +20 -0
- data/plugin/ja/del_footer.rb +10 -0
- data/plugin/ja/flickr.rb +62 -0
- data/plugin/ja/git-register.rb +3 -0
- data/plugin/ja/google_sitemaps.rb +35 -0
- data/plugin/ja/livedoor_weather.rb +25 -0
- data/plugin/ja/microsummary.rb +18 -0
- data/plugin/ja/nicovideo.rb +41 -0
- data/plugin/ja/openid.rb +7 -0
- data/plugin/ja/section_footer.rb +6 -0
- data/plugin/ja/section_footer2.rb +4 -0
- data/plugin/ja/socialbutton.rb +6 -0
- data/plugin/jdate.rb +20 -0
- data/plugin/jholiday.rb +16 -0
- data/plugin/jmonth.rb +20 -0
- data/plugin/jquery_ui_theme.rb +55 -0
- data/plugin/jroku.rb +28 -0
- data/plugin/jyear.rb +37 -0
- data/plugin/latlonglab_route.rb +25 -0
- data/plugin/lazy_referer.rb +38 -0
- data/plugin/livedoor_weather.rb +180 -0
- data/plugin/make_link.rb +44 -0
- data/plugin/makerss_category.rb +43 -0
- data/plugin/makerss_comment.rb +35 -0
- data/plugin/microsummary.rb +62 -0
- data/plugin/mm_footer.rb +215 -0
- data/plugin/monthly_autopagerize.rb +67 -0
- data/plugin/my_hotentry.rb +132 -0
- data/plugin/navi_day.rb +118 -0
- data/plugin/navi_this_month.rb +15 -0
- data/plugin/nicovideo.rb +115 -0
- data/plugin/notify_miniblog.rb +134 -0
- data/plugin/ogp.rb +55 -0
- data/plugin/ohmsha_estore.rb +71 -0
- data/plugin/openid.rb +90 -0
- data/plugin/opensearch_ad.rb +33 -0
- data/plugin/picasa.rb +56 -0
- data/plugin/plugin_checker.rb +41 -0
- data/plugin/popit.rb +22 -0
- data/plugin/prettify.rb +19 -0
- data/plugin/prezi.rb +10 -0
- data/plugin/profile.rb +222 -0
- data/plugin/puboo.rb +93 -0
- data/plugin/pygments_css.rb +76 -0
- data/plugin/rating.rb +419 -0
- data/plugin/recent_estraier.rb +50 -0
- data/plugin/recent_tweet.rb +71 -0
- data/plugin/retweet.rb +86 -0
- data/plugin/rubykaigi.rb +99 -0
- data/plugin/search-bing.rb +87 -0
- data/plugin/search-default.rb +264 -0
- data/plugin/search-google-custom.rb +60 -0
- data/plugin/search-yahoo-websearch.rb +121 -0
- data/plugin/search-yahoo.rb +109 -0
- data/plugin/section_footer.rb +195 -0
- data/plugin/section_footer2.rb +278 -0
- data/plugin/section_permalink.rb +73 -0
- data/plugin/section_permalink_anchor.rb +39 -0
- data/plugin/select_style.rb +42 -0
- data/plugin/select_theme.rb +90 -0
- data/plugin/show_and_hide.rb +77 -0
- data/plugin/slideshare.rb +10 -0
- data/plugin/socialbutton.rb +60 -0
- data/plugin/tatsu_zine.rb +93 -0
- data/plugin/tdiarygraph_flashstyle.rb +296 -0
- data/plugin/tdiarytimes.rb +166 -0
- data/plugin/tdiarytimes2.rb +406 -0
- data/plugin/tdiarytimes_flashstyle.rb +263 -0
- data/plugin/tdiarytimes_textstyle.rb +290 -0
- data/plugin/title_anchor.rb +16 -0
- data/plugin/tweet_quote.rb +106 -0
- data/plugin/twitpic.rb +10 -0
- data/plugin/twitter.rb +46 -0
- data/plugin/twitter_anywhere.rb +209 -0
- data/plugin/twitter_badge.rb +42 -0
- data/plugin/twitter_js.rb +59 -0
- data/plugin/ustream.rb +19 -0
- data/plugin/vimeo.rb +14 -0
- data/plugin/volatile.rb +89 -0
- data/plugin/vote.rb +100 -0
- data/plugin/wikiloc.rb +27 -0
- data/plugin/windex.rb +512 -0
- data/plugin/yahoo_kousei.rb +79 -0
- data/plugin/yahoo_map.rb +97 -0
- data/plugin/youtube.rb +33 -0
- data/plugin/yshop.rb +189 -0
- data/plugin/zenback.rb +46 -0
- data/spec/apple_webclip_spec.rb +46 -0
- data/spec/fixtures/friendfeed.xml +2 -0
- data/spec/fixtures/github.json +1 -0
- data/spec/fixtures/twitter.xml +73 -0
- data/spec/gist_spec.rb +16 -0
- data/spec/github_link_spec.rb +39 -0
- data/spec/google_analytics_spec.rb +60 -0
- data/spec/jdate_spec.rb +23 -0
- data/spec/jmonth_spec.rb +28 -0
- data/spec/jyear_spec.rb +21 -0
- data/spec/my_hotentry_spec.rb +78 -0
- data/spec/openid_spec.rb +246 -0
- data/spec/opensearch_ad_spec.rb +50 -0
- data/spec/profile_spec.rb +88 -0
- data/spec/rcov.opts +2 -0
- data/spec/spec_helper.rb +223 -0
- data/spec/title_anchor_spec.rb +39 -0
- data/spec/twitter_js_spec.rb +116 -0
- data/spec/youtube_spec.rb +20 -0
- data/style/hatena_style.rb +1011 -0
- data/style/markdown_style.rb +239 -0
- data/style/wikiext_style.rb +21 -0
- data/tdiary-contrib.gemspec +25 -0
- data/util/clean-spam/README.ja +1 -0
- data/util/clean-spam/tdiary-comment-clean +46 -0
- data/util/clean-spam/tdiary-comment-clean2 +81 -0
- data/util/clean-spam/tdiary-referer-clean +46 -0
- data/util/convert_pstore.rb +82 -0
- data/util/estraier-search/ChangeLog +36 -0
- data/util/estraier-search/README.ja +114 -0
- data/util/estraier-search/en/estraier-register.rb +3 -0
- data/util/estraier-search/estraier-register.rb +298 -0
- data/util/estraier-search/estraier-search.rb +273 -0
- data/util/estraier-search/estraier.rhtml +73 -0
- data/util/estraier-search/estraier.rxml +23 -0
- data/util/estraier-search/i.estraier.rhtml +31 -0
- data/util/estraier-search/ja/estraier-register.rb +3 -0
- data/util/image-gallery/README.ja +27 -0
- data/util/image-gallery/image-gallery.rb +523 -0
- data/util/image-gallery/image-gallery.rb.euc-jp +523 -0
- data/util/image-gallery/js/SmoothGallery/Changelog +52 -0
- data/util/image-gallery/js/SmoothGallery/css/ReMooz.css +186 -0
- data/util/image-gallery/js/SmoothGallery/css/img/carrow1.gif +0 -0
- data/util/image-gallery/js/SmoothGallery/css/img/carrow2.gif +0 -0
- data/util/image-gallery/js/SmoothGallery/css/img/closebox.gif +0 -0
- data/util/image-gallery/js/SmoothGallery/css/img/closebox.png +0 -0
- data/util/image-gallery/js/SmoothGallery/css/img/fleche1.gif +0 -0
- data/util/image-gallery/js/SmoothGallery/css/img/fleche1.png +0 -0
- data/util/image-gallery/js/SmoothGallery/css/img/fleche2.gif +0 -0
- data/util/image-gallery/js/SmoothGallery/css/img/fleche2.png +0 -0
- data/util/image-gallery/js/SmoothGallery/css/img/loading-bar-black.gif +0 -0
- data/util/image-gallery/js/SmoothGallery/css/img/open.gif +0 -0
- data/util/image-gallery/js/SmoothGallery/css/img/open.png +0 -0
- data/util/image-gallery/js/SmoothGallery/css/img/remo_bg_e.png +0 -0
- data/util/image-gallery/js/SmoothGallery/css/img/remo_bg_n.png +0 -0
- data/util/image-gallery/js/SmoothGallery/css/img/remo_bg_ne.png +0 -0
- data/util/image-gallery/js/SmoothGallery/css/img/remo_bg_nw.png +0 -0
- data/util/image-gallery/js/SmoothGallery/css/img/remo_bg_s.png +0 -0
- data/util/image-gallery/js/SmoothGallery/css/img/remo_bg_se.png +0 -0
- data/util/image-gallery/js/SmoothGallery/css/img/remo_bg_sw.png +0 -0
- data/util/image-gallery/js/SmoothGallery/css/img/remo_bg_w.png +0 -0
- data/util/image-gallery/js/SmoothGallery/css/img/spinner.gif +0 -0
- data/util/image-gallery/js/SmoothGallery/css/jd.gallery.css +371 -0
- data/util/image-gallery/js/SmoothGallery/css/layout.css +91 -0
- data/util/image-gallery/js/SmoothGallery/license.txt +621 -0
- data/util/image-gallery/js/SmoothGallery/resizer.php +113 -0
- data/util/image-gallery/js/SmoothGallery/scripts/Changelog +52 -0
- data/util/image-gallery/js/SmoothGallery/scripts/History.Routing.js +126 -0
- data/util/image-gallery/js/SmoothGallery/scripts/History.js +109 -0
- data/util/image-gallery/js/SmoothGallery/scripts/ReMooz.js +364 -0
- data/util/image-gallery/js/SmoothGallery/scripts/jd.gallery.js +843 -0
- data/util/image-gallery/js/SmoothGallery/scripts/jd.gallery.set.js +183 -0
- data/util/image-gallery/js/SmoothGallery/scripts/jd.gallery.transitions.js +90 -0
- data/util/image-gallery/js/SmoothGallery/scripts/jdgalleryresize.js +828 -0
- data/util/image-gallery/js/SmoothGallery/scripts/license.txt +621 -0
- data/util/image-gallery/js/SmoothGallery/scripts/mootools-1.2-more.js +103 -0
- data/util/image-gallery/js/SmoothGallery/scripts/mootools-1.2.1-core-yc.js +349 -0
- data/util/image-gallery/js/SmoothGallery/scripts/resizer.php +113 -0
- data/util/image-gallery/misc/plugin/recent_image.rb +406 -0
- data/util/image-gallery/skel/gallery.rhtml +154 -0
- data/util/image-gallery/skel/gallery.rhtml.euc-jp +154 -0
- data/util/image-gallery/tdiary.conf.igsample +8 -0
- data/util/image-gallery/theme/image-gallery.css +85 -0
- data/util/image2flickr.rb +282 -0
- data/util/posttdiary/README.ja +12 -0
- data/util/posttdiary/posttdiary-ex.rb +1155 -0
- data/util/posttdiary/posttdiary.rb +245 -0
- data/util/rast-search/ChangeLog +55 -0
- data/util/rast-search/README.ja +99 -0
- data/util/rast-search/en/rast-register.rb +3 -0
- data/util/rast-search/i.rast.rhtml +33 -0
- data/util/rast-search/ja/rast-register.rb +3 -0
- data/util/rast-search/rast-register.rb +326 -0
- data/util/rast-search/rast-search.rb +249 -0
- data/util/rast-search/rast.rhtml +66 -0
- data/util/rast-search/rast.rxml +21 -0
- data/util/section_link/README +11 -0
- data/util/section_link/misc/plugin/section_link.rb +68 -0
- data/util/section_link/misc/plugin/section_link_anchor.rb +38 -0
- data/util/section_link/tdiary/tdiary_day_ext.rb +21 -0
- data/util/section_link/tdiary/tdiaryext_style.rb +36 -0
- data/util/section_link/tdiary/wikiext_style.rb +36 -0
- data/util/tdiary-for-ruby1.9/compatible.rb +97 -0
- data/util/tdiary-for-ruby1.9/tdiary-2.2.0.patch +98 -0
- data/util/tdiary-for-ruby1.9/tdiary-2.3.1.patch +212 -0
- data/util/tdiary-grep/README +4 -0
- data/util/tdiary-grep/grep.rb +445 -0
- data/util/tdiary-mode/http.el +130 -0
- data/util/tdiary-mode/tdiary-mode.el +613 -0
- data/util/tdiary-vim/ChangeLog +25 -0
- data/util/tdiary-vim/README +60 -0
- data/util/tdiary-vim/tdiary.vim +350 -0
- data/util/tdiarysearch/README.en +53 -0
- data/util/tdiarysearch/README.ja +99 -0
- data/util/tdiarysearch/search.rb +504 -0
- metadata +497 -0
@@ -0,0 +1,613 @@
|
|
1
|
+
;;; tdiary-mode.el -- Major mode for tDiary editing -*- coding: utf-8 -*-
|
2
|
+
|
3
|
+
;; Copyright (C) 2002 Junichiro Kita
|
4
|
+
|
5
|
+
;; Author: Junichiro Kita <kita@kitaj.no-ip.com>
|
6
|
+
|
7
|
+
;; $Id: tdiary-mode.el,v 1.4 2005/08/19 08:36:43 tadatadashi Exp $
|
8
|
+
;;
|
9
|
+
;; This program is free software; you can redistribute it and/or
|
10
|
+
;; modify it under the terms of the GNU General Public License as
|
11
|
+
;; published by the Free Software Foundation; either version 2, or (at
|
12
|
+
;; your option) any later version.
|
13
|
+
|
14
|
+
;; This program is distributed in the hope that it will be useful, but
|
15
|
+
;; WITHOUT ANY WARRANTY; without even the implied warranty of
|
16
|
+
;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
17
|
+
;; General Public License for more details.
|
18
|
+
|
19
|
+
;; You should have received a copy of the GNU General Public License
|
20
|
+
;; along with this program; see the file COPYING. If not, write to the
|
21
|
+
;; Free Software Foundation, Inc., 59 Temple Place - Suite 330,
|
22
|
+
;; Boston, MA 02111-1307, USA.
|
23
|
+
|
24
|
+
;;; Commentary:
|
25
|
+
|
26
|
+
;; usage:
|
27
|
+
;;
|
28
|
+
;; Put the following in your .emacs file:
|
29
|
+
;;
|
30
|
+
;; (setq tdiary-diary-list '(("my 1st diary" "http://example.com/tdiary/")
|
31
|
+
;; ("my 2nd diary" "http://example.com/tdiary2/")))
|
32
|
+
;; (setq tdiary-text-directory (expand-file-name "~/path-to-saved-diary"))
|
33
|
+
;; (setq tdiary-browser-function 'browse-url)
|
34
|
+
;; (autoload 'tdiary-mode "tdiary-mode" nil t)
|
35
|
+
;; (autoload 'tdiary-new "tdiary-mode" nil t)
|
36
|
+
;; (autoload 'tdiary-new-diary "tdiary-mode" nil t)
|
37
|
+
;; (autoload 'tdiary-replace "tdiary-mode" nil t)
|
38
|
+
;; (add-to-list 'auto-mode-alist
|
39
|
+
;; '("\\.td$" . tdiary-mode))
|
40
|
+
;;
|
41
|
+
;; You can use your own plugin completion, keybindings:
|
42
|
+
;;
|
43
|
+
;; (setq tdiary-plugin-definition
|
44
|
+
;; '(
|
45
|
+
;; ("STRONG" ("<%=STRONG %Q|" (p "str: ") "| %>"))
|
46
|
+
;; ("PRE" ("<%=PRE %Q|" (p "str: ") "| %>"))
|
47
|
+
;; ("CITE" ("<%=CITE %Q|" (p "str: ") "| %>"))
|
48
|
+
;; ))
|
49
|
+
;;
|
50
|
+
;; (add-hook 'tdiary-mode-hook
|
51
|
+
;; '(lambda ()
|
52
|
+
;; (local-set-key "\C-i" 'tdiary-complete-plugin)))
|
53
|
+
;;
|
54
|
+
;; If you want to save username and password cache to file:
|
55
|
+
;;
|
56
|
+
;; (setq tdiary-passwd-file (expand-file-name "~/.tdiary-pass"))
|
57
|
+
;;
|
58
|
+
;; then, M-x tdiary-passwd-cache-save. !!DANGEROUS!!
|
59
|
+
;;
|
60
|
+
;; see http://kitaj.no-ip.com/rw-cgi.rb?cmd=view;name=tdiary-mode
|
61
|
+
;;
|
62
|
+
|
63
|
+
;; ToDo:
|
64
|
+
;; - find plugin definition automatically(needs modification for plugin)
|
65
|
+
;; - bug fix
|
66
|
+
;;
|
67
|
+
|
68
|
+
;;; Variable:
|
69
|
+
|
70
|
+
(require 'http)
|
71
|
+
(require 'poe)
|
72
|
+
(require 'tempo)
|
73
|
+
|
74
|
+
(defvar tdiary-diary-list nil
|
75
|
+
"List of diary list.
|
76
|
+
Each element looks like (NAME URL) or (NAME URL INDEX-RB UPDATE-RB).")
|
77
|
+
|
78
|
+
(defvar tdiary-diary-name nil
|
79
|
+
"Identifier for diary to be updated.")
|
80
|
+
|
81
|
+
(defvar tdiary-diary-url nil
|
82
|
+
"tDiary-mode updates this URL. URL should end with '/'.")
|
83
|
+
|
84
|
+
(defvar tdiary-index-rb nil
|
85
|
+
"Name of the 'index.rb'.")
|
86
|
+
|
87
|
+
(defvar tdiary-update-rb "update.rb"
|
88
|
+
"Name of the 'update.rb'.")
|
89
|
+
|
90
|
+
(defvar tdiary-csrf-key nil
|
91
|
+
"CSRF protection key.")
|
92
|
+
|
93
|
+
(defvar tdiary-coding-system 'utf-8-dos)
|
94
|
+
|
95
|
+
(defvar tdiary-title nil
|
96
|
+
"Title of diary")
|
97
|
+
|
98
|
+
(defvar tdiary-style-mode 'html-mode
|
99
|
+
"Major mode to be used for tDiary editing.")
|
100
|
+
|
101
|
+
(defvar tdiary-date nil
|
102
|
+
"Date to be updated.")
|
103
|
+
|
104
|
+
(defvar tdiary-edit-mode nil)
|
105
|
+
|
106
|
+
(defvar tdiary-plugin-list nil
|
107
|
+
"A List of pairs of a plugin name and its completing command.
|
108
|
+
It is used in `tdiary-complete-plugin'.")
|
109
|
+
|
110
|
+
(defvar tdiary-tempo-tags nil
|
111
|
+
"Tempo tags for tDiary mode")
|
112
|
+
|
113
|
+
(defvar tdiary-completion-finder "\\(\\(<\\|&\\|<%=\\).*\\)\\="
|
114
|
+
"Regexp used to find tags to complete.")
|
115
|
+
|
116
|
+
(defvar tdiary-plugin-initial-definition
|
117
|
+
'(
|
118
|
+
("my" ("<%=my %Q|" (p "a: ") "|, %Q|" (p "str: ") "| %>"))
|
119
|
+
("fn" ("<%=fn %Q|" (p "footnote: ") "| %>"))
|
120
|
+
)
|
121
|
+
"Initial definition for tDiary tempo."
|
122
|
+
)
|
123
|
+
|
124
|
+
(defvar tdiary-edit-mode-list '(("append") ("replace")))
|
125
|
+
|
126
|
+
(defvar tdiary-plugin-definition nil
|
127
|
+
"A List of definitions for tDiary tempo.
|
128
|
+
Each element looks like (NAME ELEMENTS). NAME is a string that
|
129
|
+
contains the name of plugin, and ELEMENTS is a list of elements in the
|
130
|
+
template. See tempo.info for details.")
|
131
|
+
|
132
|
+
(defvar tdiary-complete-plugin-history nil
|
133
|
+
"Minibuffer history list for `tdiary-complete-plugin'.")
|
134
|
+
|
135
|
+
(defvar tdiary-passwd-file nil)
|
136
|
+
(defvar tdiary-passwd-file-mode 384) ;; == 0600
|
137
|
+
(defvar tdiary-text-directory-mode 448) ;; == 0700
|
138
|
+
|
139
|
+
(defvar tdiary-passwd-cache nil
|
140
|
+
"Cache for username and password.")
|
141
|
+
|
142
|
+
(defvar tdiary-hour-offset 0
|
143
|
+
"Offset to current-time.
|
144
|
+
`tdiary-today' returns (current-time + tdiary-hour-offset).")
|
145
|
+
|
146
|
+
(defvar tdiary-text-suffix ".td")
|
147
|
+
|
148
|
+
(defvar tdiary-text-directory nil
|
149
|
+
"Directory where diary is stored.")
|
150
|
+
|
151
|
+
(defvar tdiary-text-save-p nil
|
152
|
+
"Flag for saving text.
|
153
|
+
If non-nil, tdiary buffer is associated to a real file,
|
154
|
+
named `tdiary-date' + `tdiary-text-suffix'.")
|
155
|
+
|
156
|
+
(defvar tdiary-browser-function nil
|
157
|
+
"Function to call browser.
|
158
|
+
If non-nil, `tdiary-update' calls this function. The function
|
159
|
+
is expected to accept only one argument(URL).")
|
160
|
+
|
161
|
+
(defvar tdiary-mode-hook nil
|
162
|
+
"Hook run when entering tDiary mode.")
|
163
|
+
|
164
|
+
(defvar tdiary-init-file "~/.tdiary"
|
165
|
+
"Init file for tDiary-mode.")
|
166
|
+
|
167
|
+
;(defvar tdiary-plugin-dir nil
|
168
|
+
; "Path to plugins. It must be a mounted file system.")
|
169
|
+
;(defvar tdiary-plugin-definition-regexp "^[ \t]*def[ \t]+\\(.+?\\)[ \t]*\\(?:$\\|;\\|([ \t]*\\(.*?\\)[ \t]*)\\)")
|
170
|
+
|
171
|
+
|
172
|
+
;;; Code:
|
173
|
+
(defun tdiary-tempo-add-tag (def)
|
174
|
+
(let* ((plugin (car def))
|
175
|
+
(element (cadr def))
|
176
|
+
(name (concat "tdiary-" plugin))
|
177
|
+
(completer (concat "<%=" plugin))
|
178
|
+
(doc (concat "Insert `" plugin "'"))
|
179
|
+
(command (tempo-define-template name element completer doc
|
180
|
+
'tdiary-tempo-tags)))
|
181
|
+
(add-to-list 'tdiary-plugin-list (list plugin command))))
|
182
|
+
|
183
|
+
(defun tdiary-tempo-define (l)
|
184
|
+
(mapcar 'tdiary-tempo-add-tag l))
|
185
|
+
|
186
|
+
|
187
|
+
;(defun tdiary-parse-plugin-args (args)
|
188
|
+
; (if (null args)
|
189
|
+
; nil
|
190
|
+
; (mapcar '(lambda (x)
|
191
|
+
; (let ((l (split-string x "[ \t]*=[ \t]*")))
|
192
|
+
; (if (eq (length l) 1)
|
193
|
+
; (car l)
|
194
|
+
; l)))
|
195
|
+
; (split-string args "[ \t]*,[ \t]*"))))
|
196
|
+
|
197
|
+
;(defun tdiary-update-plugin-definition ()
|
198
|
+
; (interactive)
|
199
|
+
; (let ((files (directory-files tdiary-plugin-dir t ".*\\.rb$" nil t))
|
200
|
+
; (buf (generate-new-buffer "*update plugin*")))
|
201
|
+
; (save-excursion
|
202
|
+
; (save-window-excursion
|
203
|
+
; (switch-to-buffer buf)
|
204
|
+
; (mapc 'insert-file-contents files)
|
205
|
+
; (setq tdiary-plugin-definition nil)
|
206
|
+
; (while (re-search-forward tdiary-plugin-definition-regexp nil t)
|
207
|
+
; (add-to-list 'tdiary-plugin-definition
|
208
|
+
; (list (match-string 1)
|
209
|
+
; (tdiary-parse-plugin-args (match-string 2)))))
|
210
|
+
; (kill-buffer buf)))))
|
211
|
+
|
212
|
+
(defun tdiary-do-complete-plugin (&optional name)
|
213
|
+
"Complete function for plugin."
|
214
|
+
(let (command)
|
215
|
+
(when (null name)
|
216
|
+
(setq name
|
217
|
+
(completing-read "plugin: " tdiary-plugin-list nil nil nil
|
218
|
+
'tdiary-complete-plugin-history)))
|
219
|
+
(setq command (cadr (assoc name tdiary-plugin-list)))
|
220
|
+
(when command
|
221
|
+
(funcall command))))
|
222
|
+
|
223
|
+
;; derived from tempo.el
|
224
|
+
(defun tdiary-complete-plugin (&optional silent)
|
225
|
+
"Look for a HTML tag or plugin and expand it.
|
226
|
+
If there are no completable text, call `tdiary-do-complete-plugin'."
|
227
|
+
(interactive "*")
|
228
|
+
(let* ((collection (tempo-build-collection))
|
229
|
+
(match-info (tempo-find-match-string tempo-match-finder))
|
230
|
+
(match-string (car match-info))
|
231
|
+
(match-start (cdr match-info))
|
232
|
+
(exact (assoc match-string collection))
|
233
|
+
(compl (or (car exact)
|
234
|
+
(and match-info (try-completion match-string collection)))))
|
235
|
+
(if compl (delete-region match-start (point)))
|
236
|
+
(cond ((or (null match-info)
|
237
|
+
(null compl))
|
238
|
+
(tdiary-do-complete-plugin))
|
239
|
+
((eq compl t) (tempo-insert-template
|
240
|
+
(cdr (assoc match-string
|
241
|
+
collection))
|
242
|
+
nil))
|
243
|
+
(t (if (setq exact (assoc compl collection))
|
244
|
+
(tempo-insert-template (cdr exact) nil)
|
245
|
+
(insert compl)
|
246
|
+
(or silent (ding))
|
247
|
+
(if tempo-show-completion-buffer
|
248
|
+
(tempo-display-completions match-string
|
249
|
+
collection)))))))
|
250
|
+
|
251
|
+
(defun tdiary-today ()
|
252
|
+
(let* ((offset-second (* tdiary-hour-offset 60 60))
|
253
|
+
(now (current-time))
|
254
|
+
(high (nth 0 now))
|
255
|
+
(low (+ (nth 1 now) offset-second))
|
256
|
+
(micro (nth 2 now)))
|
257
|
+
(setq high (+ high (/ low 65536))
|
258
|
+
low (% low 65536))
|
259
|
+
(when (< low 0)
|
260
|
+
(setq high (1- high)
|
261
|
+
low (+ low 65536)))
|
262
|
+
(list high low micro)))
|
263
|
+
|
264
|
+
(defun tdiary-read-username (url name)
|
265
|
+
(let ((username (tdiary-passwd-cache-read-username url)))
|
266
|
+
(or username
|
267
|
+
(read-string (concat "User Name for '" name "': ")))))
|
268
|
+
|
269
|
+
(defun tdiary-read-password (url name)
|
270
|
+
(let ((password (tdiary-passwd-cache-read-password url)))
|
271
|
+
(or password
|
272
|
+
(read-passwd (concat "Password for '" name "': ")))))
|
273
|
+
|
274
|
+
(defun tdiary-read-date (date)
|
275
|
+
(while (not (string-match
|
276
|
+
"[0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9]"
|
277
|
+
(setq date (read-string "Date: "
|
278
|
+
(or date
|
279
|
+
(format-time-string "%Y%m%d" (tdiary-today)))))))
|
280
|
+
nil)
|
281
|
+
date)
|
282
|
+
|
283
|
+
(defun tdiary-read-title (date)
|
284
|
+
(read-string (concat "Title for " date ": ") tdiary-title))
|
285
|
+
|
286
|
+
(defun tdiary-read-mode (mode)
|
287
|
+
(let ((default (caar tdiary-edit-mode-list)))
|
288
|
+
(completing-read "Editing mode: " tdiary-edit-mode-list
|
289
|
+
nil t (or mode default) nil default)))
|
290
|
+
|
291
|
+
(defun tdiary-passwd-file-load ()
|
292
|
+
"Load password alist."
|
293
|
+
(save-excursion
|
294
|
+
(let ((buf (get-buffer-create "*tdiary-passwd-cache*")))
|
295
|
+
(when (and tdiary-passwd-file
|
296
|
+
(file-readable-p tdiary-passwd-file))
|
297
|
+
(set-buffer buf)
|
298
|
+
(insert-file-contents tdiary-passwd-file)
|
299
|
+
(setq tdiary-passwd-cache (read buf)))
|
300
|
+
(kill-buffer buf))))
|
301
|
+
|
302
|
+
(defun tdiary-passwd-file-save ()
|
303
|
+
"Save password alist.
|
304
|
+
Dangerous!!!"
|
305
|
+
(interactive)
|
306
|
+
(save-excursion
|
307
|
+
(let ((buf (get-buffer-create "*tdiary-passwd-cache*")))
|
308
|
+
(set-buffer buf)
|
309
|
+
(erase-buffer)
|
310
|
+
(prin1 tdiary-passwd-cache buf)
|
311
|
+
(terpri buf)
|
312
|
+
(when (and tdiary-passwd-file
|
313
|
+
(file-writable-p tdiary-passwd-file))
|
314
|
+
(write-region (point-min) (point-max) tdiary-passwd-file)
|
315
|
+
(set-file-modes tdiary-passwd-file tdiary-passwd-file-mode))
|
316
|
+
(kill-buffer buf))))
|
317
|
+
|
318
|
+
(defun tdiary-passwd-cache-clear (url)
|
319
|
+
(setq tdiary-passwd-cache (remassoc url tdiary-passwd-cache)))
|
320
|
+
|
321
|
+
(defun tdiary-passwd-cache-save (url user pass)
|
322
|
+
(tdiary-passwd-cache-clear url)
|
323
|
+
(add-to-list 'tdiary-passwd-cache
|
324
|
+
(cons url (cons user (base64-encode-string pass)))))
|
325
|
+
|
326
|
+
(defun tdiary-passwd-cache-read-username (url)
|
327
|
+
(cadr (assoc url tdiary-passwd-cache)))
|
328
|
+
|
329
|
+
(defun tdiary-passwd-cache-read-password (url)
|
330
|
+
(let ((password (cddr (assoc url tdiary-passwd-cache))))
|
331
|
+
(and password
|
332
|
+
(base64-decode-string password))))
|
333
|
+
|
334
|
+
(defun tdiary-post (mode date data)
|
335
|
+
(let ((url (concat tdiary-diary-url tdiary-update-rb))
|
336
|
+
buf title user pass year month day post-data)
|
337
|
+
(when (not (equal mode "edit"))
|
338
|
+
(setq tdiary-edit-mode (setq mode (tdiary-read-mode mode)))
|
339
|
+
(setq tdiary-date (setq date (tdiary-read-date date)))
|
340
|
+
(setq tdiary-title (setq title (tdiary-read-title date))))
|
341
|
+
(setq user (tdiary-read-username url tdiary-diary-name))
|
342
|
+
(setq pass (tdiary-read-password url tdiary-diary-name))
|
343
|
+
(string-match "\\([0-9][0-9][0-9][0-9]\\)\\([0-9][0-9]\\)\\([0-9][0-9]\\)"
|
344
|
+
date)
|
345
|
+
(setq year (match-string 1 date)
|
346
|
+
month (match-string 2 date)
|
347
|
+
day (match-string 3 date))
|
348
|
+
(add-to-list 'post-data (cons "old" date))
|
349
|
+
(add-to-list 'post-data (cons "year" year))
|
350
|
+
(add-to-list 'post-data (cons "month" month))
|
351
|
+
(add-to-list 'post-data (cons "day" day))
|
352
|
+
(if tdiary-csrf-key (add-to-list 'post-data (cons "csrf_protection_key" tdiary-csrf-key)))
|
353
|
+
(or (equal mode "edit")
|
354
|
+
(add-to-list 'post-data
|
355
|
+
(cons "title" (http-url-hexify-string
|
356
|
+
title
|
357
|
+
tdiary-coding-system))))
|
358
|
+
(add-to-list 'post-data (cons mode mode))
|
359
|
+
(and data
|
360
|
+
(add-to-list 'post-data
|
361
|
+
(cons "body"
|
362
|
+
(http-url-hexify-string data tdiary-coding-system))))
|
363
|
+
(setq buf (http-fetch url 'post user pass post-data))
|
364
|
+
(if (bufferp buf)
|
365
|
+
(save-excursion
|
366
|
+
(tdiary-passwd-cache-save url user pass)
|
367
|
+
(set-buffer buf)
|
368
|
+
(decode-coding-region (point-min) (point-max) tdiary-coding-system)
|
369
|
+
(goto-char (point-min))
|
370
|
+
buf)
|
371
|
+
(tdiary-passwd-cache-clear url)
|
372
|
+
(error "tDiary POST: %s - %s" (car buf) (cdr buf)))))
|
373
|
+
|
374
|
+
(defun tdiary-post-text ()
|
375
|
+
(let* ((dirname (expand-file-name tdiary-diary-name
|
376
|
+
(or tdiary-text-directory
|
377
|
+
(expand-file-name "~/"))))
|
378
|
+
(filename (expand-file-name (concat tdiary-date tdiary-text-suffix)
|
379
|
+
dirname)))
|
380
|
+
(unless (file-directory-p dirname)
|
381
|
+
(make-directory dirname t)
|
382
|
+
(set-file-modes dirname tdiary-text-directory-mode))
|
383
|
+
|
384
|
+
;; If buffer-file-name is tdiary-text-directory/tdiary-diary-name/yyyymmdd.td
|
385
|
+
;; do nothing.
|
386
|
+
(unless (equal filename buffer-file-name)
|
387
|
+
(cond
|
388
|
+
((equal tdiary-edit-mode "replace")
|
389
|
+
(write-region (point-min) (point-max) filename))
|
390
|
+
((equal tdiary-edit-mode "append")
|
391
|
+
(write-region (point-min) (point-max) filename t))))))
|
392
|
+
|
393
|
+
(defun tdiary-update ()
|
394
|
+
"Update diary."
|
395
|
+
(interactive)
|
396
|
+
(unless (and (eq (char-before (point-max)) ?\n)
|
397
|
+
(eq (char-before (1- (point-max))) ?\n))
|
398
|
+
(save-excursion
|
399
|
+
(goto-char (point-max))
|
400
|
+
(insert "\n")))
|
401
|
+
(tdiary-post tdiary-edit-mode tdiary-date
|
402
|
+
(buffer-substring (point-min) (point-max)))
|
403
|
+
(when tdiary-text-save-p
|
404
|
+
(tdiary-post-text))
|
405
|
+
(if buffer-file-name
|
406
|
+
(save-buffer)
|
407
|
+
(set-buffer-modified-p nil))
|
408
|
+
(message "SUCCESS")
|
409
|
+
(and (functionp tdiary-browser-function)
|
410
|
+
(funcall tdiary-browser-function
|
411
|
+
(concat tdiary-diary-url tdiary-index-rb
|
412
|
+
"?date=" tdiary-date))))
|
413
|
+
|
414
|
+
(defun tdiary-do-replace-entity-ref (from to &optional str)
|
415
|
+
(save-excursion
|
416
|
+
(goto-char (point-min))
|
417
|
+
(if (stringp str)
|
418
|
+
(progn
|
419
|
+
(while (string-match from str)
|
420
|
+
(setq str (replace-match to nil nil str)))
|
421
|
+
str)
|
422
|
+
(while (search-forward from nil t)
|
423
|
+
(replace-match to nil nil)))))
|
424
|
+
|
425
|
+
(defun tdiary-replace-entity-refs (&optional str)
|
426
|
+
"Replace entity references.
|
427
|
+
|
428
|
+
If STR is a string, replace entity references within the string.
|
429
|
+
Otherwise replace all entity references within current buffer."
|
430
|
+
(tdiary-do-replace-entity-ref
|
431
|
+
"&" "&"
|
432
|
+
(tdiary-do-replace-entity-ref
|
433
|
+
"<" "<"
|
434
|
+
(tdiary-do-replace-entity-ref
|
435
|
+
">" ">"
|
436
|
+
(tdiary-do-replace-entity-ref """ "\"" str)))))
|
437
|
+
|
438
|
+
;(defun tdiary-read-mode (mode)
|
439
|
+
; (let ((default (caar tdiary-edit-mode-list)))
|
440
|
+
; (completing-read "Editing mode: " tdiary-edit-mode-list
|
441
|
+
; nil t (or mode default) nil default)))
|
442
|
+
|
443
|
+
|
444
|
+
(defun tdiary-obsolete-check ()
|
445
|
+
;; setting tdiary-diary-url in tdiary-init-file is obsolete.
|
446
|
+
(when tdiary-diary-url
|
447
|
+
(message "tdiary-diary-url is OBSOLETE. Use tdiary-diary-list instead of tdiary-diary-url.")
|
448
|
+
(sit-for 5)))
|
449
|
+
|
450
|
+
;(defun tdiary-setup-diary-url (select-url)
|
451
|
+
; (interactive)
|
452
|
+
; (if (interactive-p)
|
453
|
+
; (setq select-url t))
|
454
|
+
(defun tdiary-setup-diary-url (select-url)
|
455
|
+
;; setting tdiary-diary-url in tdiary-init-file is obsolete.
|
456
|
+
(tdiary-obsolete-check)
|
457
|
+
(unless tdiary-diary-url
|
458
|
+
(let* ((selected (car tdiary-diary-list))
|
459
|
+
(default (car selected)))
|
460
|
+
(when select-url
|
461
|
+
(setq selected (assoc (completing-read "Select SITE: " tdiary-diary-list
|
462
|
+
nil t default nil default)
|
463
|
+
tdiary-diary-list)))
|
464
|
+
(setq tdiary-diary-name (nth 0 selected)
|
465
|
+
tdiary-diary-url (nth 1 selected))
|
466
|
+
(and (eq (length selected) 4)
|
467
|
+
(setq tdiary-index-rb (nth 2 selected)
|
468
|
+
tdiary-update-rb (nth 3 selected))))))
|
469
|
+
|
470
|
+
(defun tdiary-new-or-replace (replacep select-url)
|
471
|
+
(let (buf)
|
472
|
+
(setq buf (generate-new-buffer "*tdiary tmp*"))
|
473
|
+
(switch-to-buffer buf)
|
474
|
+
(tdiary-mode)
|
475
|
+
(setq tdiary-edit-mode "append")
|
476
|
+
(let (start end body title csrf-key)
|
477
|
+
(save-excursion
|
478
|
+
(setq buf (tdiary-post "edit" tdiary-date nil))
|
479
|
+
(when (bufferp buf)
|
480
|
+
(save-excursion
|
481
|
+
(set-buffer buf)
|
482
|
+
(if (re-search-forward "<input [^>]+name=\"csrf_protection_key\" [^>]*value=\"\\([^>\"]*\\)\">" nil t nil)
|
483
|
+
(setq csrf-key (match-string 1)))
|
484
|
+
(re-search-forward "<input [^>]+name=\"title\" [^>]+value=\"\\([^>\"]*\\)\">" nil t nil)
|
485
|
+
(setq title (match-string 1))
|
486
|
+
(re-search-forward "<textarea [^>]+>" nil t nil)
|
487
|
+
(setq start (match-end 0))
|
488
|
+
(re-search-forward "</textarea>" nil t nil)
|
489
|
+
(setq end (match-beginning 0))
|
490
|
+
(setq body (buffer-substring start end))
|
491
|
+
)
|
492
|
+
(setq tdiary-csrf-key (and csrf-key (tdiary-replace-entity-refs csrf-key)))
|
493
|
+
(when replacep
|
494
|
+
(insert body)
|
495
|
+
(setq tdiary-edit-mode "replace")
|
496
|
+
(setq tdiary-title (tdiary-replace-entity-refs title))
|
497
|
+
(goto-char (point-min))
|
498
|
+
(tdiary-replace-entity-refs)
|
499
|
+
(set-buffer-modified-p nil)))))))
|
500
|
+
|
501
|
+
(defun tdiary-new (&optional select-url)
|
502
|
+
(interactive "P")
|
503
|
+
(tdiary-new-or-replace nil select-url))
|
504
|
+
|
505
|
+
(defun tdiary-replace (&optional select-url)
|
506
|
+
(interactive "P")
|
507
|
+
(tdiary-new-or-replace t select-url))
|
508
|
+
|
509
|
+
(defvar tdiary-mode-map (make-sparse-keymap)
|
510
|
+
"Set up keymap for tdiary-mode.
|
511
|
+
If you want to set up your own key bindings, use `tdiary-mode-hook'.")
|
512
|
+
|
513
|
+
(define-key tdiary-mode-map [(control return)] 'tdiary-complete-plugin)
|
514
|
+
(define-key tdiary-mode-map "\C-c\C-c" 'tdiary-update)
|
515
|
+
|
516
|
+
(push (cons 'tdiary-date tdiary-mode-map) minor-mode-map-alist)
|
517
|
+
(if (boundp 'minor-mode-list) (push 'tdiary-mode minor-mode-list))
|
518
|
+
(push '(tdiary-date " tDiary") minor-mode-alist)
|
519
|
+
|
520
|
+
(defun tdiary-load-init-file ()
|
521
|
+
"Load init file."
|
522
|
+
(let ((init-file (expand-file-name tdiary-init-file)))
|
523
|
+
(when (file-readable-p init-file)
|
524
|
+
(load init-file t t))))
|
525
|
+
|
526
|
+
(defun tdiary-make-temp-file-name ()
|
527
|
+
(let ((tmpdir (expand-file-name tdiary-diary-name
|
528
|
+
(expand-file-name (user-login-name)
|
529
|
+
temporary-file-directory))))
|
530
|
+
(unless (file-directory-p tmpdir)
|
531
|
+
(make-directory tmpdir t)
|
532
|
+
(set-file-modes tmpdir tdiary-text-directory-mode))
|
533
|
+
(expand-file-name tdiary-date tmpdir)))
|
534
|
+
|
535
|
+
(defun tdiary-html-mode-init ()
|
536
|
+
"Initialize tDiary for default style"
|
537
|
+
(tdiary-tempo-define (append tdiary-plugin-initial-definition
|
538
|
+
tdiary-plugin-definition))
|
539
|
+
(tempo-use-tag-list 'tdiary-tempo-tags tdiary-completion-finder))
|
540
|
+
|
541
|
+
(defun tdiary-rd-mode-init ()
|
542
|
+
"Initialize tDiary for RD style"
|
543
|
+
)
|
544
|
+
|
545
|
+
(defun tdiary-mode ()
|
546
|
+
"tDiary editing mode.
|
547
|
+
The value of `tdiary-style-mode' will be used as actual major mode.
|
548
|
+
|
549
|
+
\\{tdiary-mode-map}"
|
550
|
+
(interactive)
|
551
|
+
(funcall tdiary-style-mode)
|
552
|
+
(and (featurep 'font-lock)
|
553
|
+
(font-lock-set-defaults))
|
554
|
+
(tdiary-mode-setup))
|
555
|
+
|
556
|
+
(defun tdiary-mode-setup ()
|
557
|
+
"Set tDiary mode up."
|
558
|
+
(interactive)
|
559
|
+
(make-local-variable 'require-final-newline)
|
560
|
+
(make-local-variable 'tdiary-date)
|
561
|
+
(make-local-variable 'tdiary-title)
|
562
|
+
(make-local-variable 'tdiary-edit-mode)
|
563
|
+
(make-local-variable 'tdiary-diary-url)
|
564
|
+
(make-local-variable 'tdiary-index-rb)
|
565
|
+
(make-local-variable 'tdiary-update-rb)
|
566
|
+
(make-local-variable 'tdiary-csrf-key)
|
567
|
+
(setq require-final-newline t
|
568
|
+
indent-tabs-mode nil
|
569
|
+
tdiary-edit-mode "replace"
|
570
|
+
tdiary-date (format-time-string "%Y%m%d" (tdiary-today)))
|
571
|
+
|
572
|
+
(tdiary-load-init-file)
|
573
|
+
|
574
|
+
(tdiary-setup-diary-url (if (boundp 'select-url)
|
575
|
+
select-url
|
576
|
+
t))
|
577
|
+
|
578
|
+
(set-buffer-file-coding-system tdiary-coding-system)
|
579
|
+
|
580
|
+
(or tdiary-passwd-cache
|
581
|
+
(tdiary-passwd-file-load))
|
582
|
+
|
583
|
+
(if buffer-file-name
|
584
|
+
(let ((buf-name (file-name-nondirectory buffer-file-name)))
|
585
|
+
(when (string-match
|
586
|
+
"\\([0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9]\\)"
|
587
|
+
buf-name)
|
588
|
+
(setq tdiary-date (match-string 1 buf-name))))
|
589
|
+
(setq tdiary-date (tdiary-read-date nil))
|
590
|
+
(if tdiary-text-save-p
|
591
|
+
(set-visited-file-name (tdiary-make-temp-file-name))
|
592
|
+
(unless (string= (buffer-name) tdiary-date)
|
593
|
+
(rename-buffer tdiary-date t))))
|
594
|
+
|
595
|
+
(let ((init (intern (concat "tdiary-" (symbol-name tdiary-style-mode) "-init"))))
|
596
|
+
(if (fboundp init) (funcall init)))
|
597
|
+
|
598
|
+
(run-hooks 'tdiary-mode-hook))
|
599
|
+
|
600
|
+
(defun tdiary-mode-toggle (&optional arg)
|
601
|
+
(interactive "P")
|
602
|
+
(let ((in-tdiary (and (boundp 'tdiary-date) tdiary-date)))
|
603
|
+
(cond ((not arg)
|
604
|
+
(setq arg (not in-tdiary)))
|
605
|
+
((or (eq arg '-) (and (numberp arg) (< arg 0)))
|
606
|
+
(setq arg nil)))
|
607
|
+
(cond (arg
|
608
|
+
(tdiary-mode-setup))
|
609
|
+
(in-tdiary
|
610
|
+
(setq tdiary-date nil)))))
|
611
|
+
|
612
|
+
(provide 'tdiary-mode)
|
613
|
+
;;; tdiary-mode.el ends here
|
@@ -0,0 +1,25 @@
|
|
1
|
+
2005-07-29 Fri UECHI Yasumasa <uechi@potaway.net>
|
2
|
+
* echo site name and url when select a diary site.
|
3
|
+
* allow to set update script each diary.
|
4
|
+
* use CSRF protection key if exits.
|
5
|
+
|
6
|
+
2005-07-28 Thu UECHI Yasumasa <uechi@potaway.net>
|
7
|
+
* send referer when update a diary.
|
8
|
+
|
9
|
+
2004-11-08 Mon UECHI Yasumasa <uechi@potaway.net>
|
10
|
+
* change substitution order of character entity in TdiaryReplace(). thanx やえもん.
|
11
|
+
|
12
|
+
2004-02-25 Wed UECHI Yasumasa <uechi@potaway.net>
|
13
|
+
* support TrackBack
|
14
|
+
|
15
|
+
2004-02-19 Thu UECHI Yasumasa <uechi@potaway.net>
|
16
|
+
* quote argument of curl's -u option.
|
17
|
+
|
18
|
+
2004-02-17 Tue UECHI Yasumasa <uechi@potaway.net>
|
19
|
+
* use .netrc when g:tdiary_use_netrc = 1
|
20
|
+
|
21
|
+
2004-02-16 Mon UECHI Yasumasa <uechi@potaway.net>
|
22
|
+
* change editing mode, date, title in diary buffer.
|
23
|
+
|
24
|
+
2004-02-13 Fri UECHI Yasumasa <uechi@potaway.net>
|
25
|
+
* commit to CVS repository
|
@@ -0,0 +1,60 @@
|
|
1
|
+
= tdiary.vim
|
2
|
+
tdiary.vim は vim から日記を更新するための vimスクリプトです。
|
3
|
+
|
4
|
+
== 必要なもの
|
5
|
+
tdiary.vim を使用するには以下のものが必要です。
|
6
|
+
|
7
|
+
* cURL - コマンドラインから http や ftp で通信するためのツール
|
8
|
+
* iconv ライブラリ
|
9
|
+
* vim (+iconv でコンパイルしたもの)
|
10
|
+
|
11
|
+
cURL は ((<URL:http://curl.haxx.se/>)) から入手できます。
|
12
|
+
|
13
|
+
== インストール
|
14
|
+
tdiary.vim を $HOME/.vim/plugin ディレクトリにコピーするだけです。
|
15
|
+
|
16
|
+
== 設定
|
17
|
+
$HOME/.vimrc で次のように tDiary サイトの URL を設定します。
|
18
|
+
|
19
|
+
let tdiary_site1_url = "http://www.example.com/tdiary/"
|
20
|
+
|
21
|
+
最低限必要な設定はこれだけですが、複数の日記を更新するなら以下のような設定を追加してください。
|
22
|
+
|
23
|
+
let tdiary_site1_name = "ほげほげ日記"
|
24
|
+
let tdiary_site2_url = "http://www.example.net/tdiary/"
|
25
|
+
let tdiary_site2_name = "foobar日記"
|
26
|
+
|
27
|
+
tDiary を設置するときに update.rb を update.cgi 等に変更している場合は以下も追加してください。
|
28
|
+
|
29
|
+
let tdiary_site1_updatescript = "update.cgi"
|
30
|
+
let tdiary_site2_updatescript = "update.cgi"
|
31
|
+
|
32
|
+
== パスワードの保存
|
33
|
+
cURL は $HOME/.netrc を読めるので、パスワードの保存にその機能を使います。ユーザ名とパスワードを .netrc に保存し、$HOME/.vimrc に
|
34
|
+
|
35
|
+
let tdiary_use_netrc = 1
|
36
|
+
|
37
|
+
と設定すると有効になります。
|
38
|
+
|
39
|
+
== 使い方
|
40
|
+
tdiary.vim では次のコマンドが使えます。
|
41
|
+
|
42
|
+
* :TDiaryNew - 日記を書くための空のバッファを開きます
|
43
|
+
* :TDiaryReplace - 指定した日付の日記を読み込んだバッファを開きます
|
44
|
+
* :TDiaryUpdate - 日記を更新します
|
45
|
+
* :TDiarySelect - 更新する tDiary サイトを選択するためのバッファを開きます
|
46
|
+
* :TDiaryTrackback - TrackBack の excerpt を編修するためのバッファを開きます
|
47
|
+
|
48
|
+
=== 日記に追記
|
49
|
+
:TDiaryNew すると日付が YYYYMMDD 形式で表示されますので、適宜修正してリターンキーを押してください。日記を書いたら :TDiaryUpdate で更新してください。
|
50
|
+
|
51
|
+
=== 日記を修正
|
52
|
+
:TDiaryReplace すると日付が YYYYMMDD 形式で表示されますので、修正したい日付に直してリターンキーを押してください。指定した日の日記が読み込まれます。修正後に :TDiaryUpdate で更新してください。
|
53
|
+
|
54
|
+
=== tDiary サイトの選択
|
55
|
+
:TDiarySelect すると日記の一覧が表示されます。日記にカーソルを合わせてリターンキーを押すことで書き込み先が切り替わります。
|
56
|
+
|
57
|
+
=== TrackBack
|
58
|
+
日記の編修バッファに表示されている TrackBackURL: に TrackBack 先の URL を記
|
59
|
+
入することで TrackBack が送られます。excerpt を編修する場合は :TDiaryTrackback
|
60
|
+
することで編修用のバッファが開きます。
|