tdiary 3.2.2.20130507
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.coveralls.yml +1 -0
- data/.gitignore +16 -0
- data/.travis.yml +29 -0
- data/Capfile +2 -0
- data/ChangeLog +3173 -0
- data/Gemfile +58 -0
- data/Gemfile.lock +201 -0
- data/LICENSE +340 -0
- data/Procfile +1 -0
- data/README.md +33 -0
- data/Rakefile +26 -0
- data/bin/tdiary +7 -0
- data/config.ru +61 -0
- data/data/.htaccess +2 -0
- data/doc/HOWTO-authenticate-in-rack.md +89 -0
- data/doc/HOWTO-make-io.md +305 -0
- data/doc/HOWTO-make-plugin.md +279 -0
- data/doc/HOWTO-make-theme.md +67 -0
- data/doc/HOWTO-testing-tDiary.md +44 -0
- data/doc/HOWTO-use-plugin.md +148 -0
- data/doc/HOWTO-write-tDiary.en.md +131 -0
- data/doc/HOWTO-write-tDiary.md +136 -0
- data/doc/INSTALL-paas.md +202 -0
- data/doc/INSTALL.md +160 -0
- data/doc/README.en.md +174 -0
- data/doc/README.md +56 -0
- data/doc/UPGRADE.md +164 -0
- data/doc/doc.css +115 -0
- data/dot.htaccess +27 -0
- data/index.fcgi +45 -0
- data/index.rb +57 -0
- data/js/00default.js +60 -0
- data/js/01conf.js +62 -0
- data/js/02edit.coffee +5 -0
- data/js/02edit.js +15 -0
- data/js/amazon.js +43 -0
- data/js/calendar3.js +130 -0
- data/js/caretposition.js +170 -0
- data/js/category.js +29 -0
- data/js/category_autocomplete.js +96 -0
- data/js/comment_ajax.js +27 -0
- data/js/draft.js +149 -0
- data/js/highlight.js +36 -0
- data/js/image.js +181 -0
- data/misc/convert2.rb +123 -0
- data/misc/filter/antispamservice.rb +101 -0
- data/misc/filter/limitdays.rb +40 -0
- data/misc/filter/linkcheck.rb +81 -0
- data/misc/filter/plugin/antispamservice.rb +82 -0
- data/misc/filter/plugin/en/antispamservice.rb +21 -0
- data/misc/filter/plugin/ja/antispamservice.rb +20 -0
- data/misc/lib/README +4 -0
- data/misc/lib/compatible.rb +1 -0
- data/misc/lib/fcgi_patch.rb +90 -0
- data/misc/migrate.rb +157 -0
- data/misc/paas/cloudfoundry/Gemfile +26 -0
- data/misc/paas/cloudfoundry/Gemfile.lock +85 -0
- data/misc/paas/heroku/Gemfile +22 -0
- data/misc/paas/heroku/Gemfile.lock +85 -0
- data/misc/paas/sqale/Gemfile +19 -0
- data/misc/paas/sqale/Gemfile.lock +85 -0
- data/misc/paas/sqale/Procfile +1 -0
- data/misc/paas/sqale/dot.env +1 -0
- data/misc/plugin/ChangeLog.DO_NOT_UPDATE +2333 -0
- data/misc/plugin/a.rb +211 -0
- data/misc/plugin/amazon.rb +403 -0
- data/misc/plugin/amazon/README.en +17 -0
- data/misc/plugin/amazon/README.ja +29 -0
- data/misc/plugin/amazon/amazonimg.rb +113 -0
- data/misc/plugin/amazon/large.png +0 -0
- data/misc/plugin/amazon/medium.png +0 -0
- data/misc/plugin/amazon/small.png +0 -0
- data/misc/plugin/append-css.rb +51 -0
- data/misc/plugin/bq.rb +48 -0
- data/misc/plugin/calendar2.rb +184 -0
- data/misc/plugin/calendar3.rb +256 -0
- data/misc/plugin/category.rb +779 -0
- data/misc/plugin/category_autocomplete.rb +33 -0
- data/misc/plugin/comment_ajax.rb +11 -0
- data/misc/plugin/comment_mail-qmail.rb +57 -0
- data/misc/plugin/comment_mail-sendmail.rb +56 -0
- data/misc/plugin/comment_mail-smtp.rb +59 -0
- data/misc/plugin/comment_rank.rb +36 -0
- data/misc/plugin/counter.rb +631 -0
- data/misc/plugin/daily_theme.rb +55 -0
- data/misc/plugin/disp_referrer.rb +1486 -0
- data/misc/plugin/doctype-html401tr.rb +16 -0
- data/misc/plugin/draft.rb +20 -0
- data/misc/plugin/dropdown_calendar.rb +32 -0
- data/misc/plugin/edit_today.rb +50 -0
- data/misc/plugin/en/a.rb +10 -0
- data/misc/plugin/en/amazon.rb +71 -0
- data/misc/plugin/en/append-css.rb +17 -0
- data/misc/plugin/en/bq.rb +12 -0
- data/misc/plugin/en/calendar2.rb +12 -0
- data/misc/plugin/en/category.rb +204 -0
- data/misc/plugin/en/counter.rb +48 -0
- data/misc/plugin/en/daily_theme.rb +14 -0
- data/misc/plugin/en/disp_referrer.rb +387 -0
- data/misc/plugin/en/dropdown_calendar.rb +14 -0
- data/misc/plugin/en/edit_today.rb +22 -0
- data/misc/plugin/en/hide-mail-field.rb +19 -0
- data/misc/plugin/en/highlight.rb +29 -0
- data/misc/plugin/en/image.rb +54 -0
- data/misc/plugin/en/kw.rb +22 -0
- data/misc/plugin/en/makerss.rb +47 -0
- data/misc/plugin/en/pb-show.rb +21 -0
- data/misc/plugin/en/ping.rb +16 -0
- data/misc/plugin/en/recent_comment.rb +44 -0
- data/misc/plugin/en/recent_comment3.rb +56 -0
- data/misc/plugin/en/recent_rss.rb +33 -0
- data/misc/plugin/en/referer_scheme.rb +48 -0
- data/misc/plugin/en/search_control.rb +74 -0
- data/misc/plugin/en/search_form.rb +22 -0
- data/misc/plugin/en/speed_comment.rb +19 -0
- data/misc/plugin/en/tb-show.rb +37 -0
- data/misc/plugin/en/todo.rb +43 -0
- data/misc/plugin/en/weather.rb +185 -0
- data/misc/plugin/en/xmlrpc.rb +14 -0
- data/misc/plugin/footnote.rb +92 -0
- data/misc/plugin/gradation.rb +39 -0
- data/misc/plugin/gradient.rb +36 -0
- data/misc/plugin/hide-mail-field.rb +50 -0
- data/misc/plugin/highlight.rb +22 -0
- data/misc/plugin/html_anchor.rb +34 -0
- data/misc/plugin/image.rb +290 -0
- data/misc/plugin/ja/amazon.rb +89 -0
- data/misc/plugin/ja/bq.rb +13 -0
- data/misc/plugin/ja/calendar2.rb +12 -0
- data/misc/plugin/ja/category.rb +212 -0
- data/misc/plugin/ja/daily_theme.rb +15 -0
- data/misc/plugin/ja/disp_referrer.rb +644 -0
- data/misc/plugin/ja/edit_today.rb +23 -0
- data/misc/plugin/ja/hide-mail-field.rb +20 -0
- data/misc/plugin/ja/highlight.rb +30 -0
- data/misc/plugin/ja/makerss.rb +44 -0
- data/misc/plugin/ja/my-sequel.rb +52 -0
- data/misc/plugin/ja/pb-show.rb +23 -0
- data/misc/plugin/ja/ping.rb +17 -0
- data/misc/plugin/ja/recent_comment.rb +45 -0
- data/misc/plugin/ja/recent_comment3.rb +57 -0
- data/misc/plugin/ja/recent_rss.rb +34 -0
- data/misc/plugin/ja/referer_scheme.rb +86 -0
- data/misc/plugin/ja/search_control.rb +75 -0
- data/misc/plugin/ja/search_form.rb +32 -0
- data/misc/plugin/ja/tb-show.rb +38 -0
- data/misc/plugin/ja/todo.rb +46 -0
- data/misc/plugin/ja/weather.rb +402 -0
- data/misc/plugin/ja/xmlrpc.rb +15 -0
- data/misc/plugin/kw.rb +150 -0
- data/misc/plugin/list.rb +40 -0
- data/misc/plugin/makelirs.rb +89 -0
- data/misc/plugin/makerss.rb +744 -0
- data/misc/plugin/my-ex.rb +68 -0
- data/misc/plugin/my-sequel.rb +539 -0
- data/misc/plugin/navi_user.rb +19 -0
- data/misc/plugin/number_anchor.rb +47 -0
- data/misc/plugin/pb-show.rb +165 -0
- data/misc/plugin/ping.rb +99 -0
- data/misc/plugin/pre_wrap.rb +19 -0
- data/misc/plugin/random_google.rb +165 -0
- data/misc/plugin/recent_comment.rb +82 -0
- data/misc/plugin/recent_comment3.rb +192 -0
- data/misc/plugin/recent_list.rb +91 -0
- data/misc/plugin/recent_namazu.rb +50 -0
- data/misc/plugin/recent_rss.rb +305 -0
- data/misc/plugin/referer-antibot.rb +53 -0
- data/misc/plugin/referer-utf8.rb +12 -0
- data/misc/plugin/referer_scheme.rb +87 -0
- data/misc/plugin/search_control.rb +227 -0
- data/misc/plugin/search_form.rb +53 -0
- data/misc/plugin/sn.rb +107 -0
- data/misc/plugin/speed_comment.rb +68 -0
- data/misc/plugin/squeeze.rb +272 -0
- data/misc/plugin/src.rb +30 -0
- data/misc/plugin/tb-show.rb +212 -0
- data/misc/plugin/title_list.rb +41 -0
- data/misc/plugin/title_tag.rb +80 -0
- data/misc/plugin/tlink.rb +163 -0
- data/misc/plugin/todo.rb +182 -0
- data/misc/plugin/weather.rb +505 -0
- data/misc/plugin/whatsnew.rb +100 -0
- data/misc/plugin/xmlrpc.rb +80 -0
- data/misc/plugin/xmlrpc/README +20 -0
- data/misc/plugin/xmlrpc/xmlrpc.rb +575 -0
- data/misc/style/emptdiary/README.rd +83 -0
- data/misc/style/emptdiary/README.rd.en +78 -0
- data/misc/style/emptdiary/emptdiary_style.rb +199 -0
- data/misc/style/etdiary/README.rd +83 -0
- data/misc/style/etdiary/etdiary_style.rb +446 -0
- data/misc/style/gfm/gfm_style.rb +194 -0
- data/misc/style/rd/README.rd +71 -0
- data/misc/style/rd/rd_style.rb +366 -0
- data/misc/style/wiki/README +116 -0
- data/misc/style/wiki/README.en +101 -0
- data/misc/style/wiki/wiki_parser.rb +273 -0
- data/misc/style/wiki/wiki_style.rb +478 -0
- data/misc/theme_convert/Readme.rd +21 -0
- data/misc/theme_convert/append.rcss +150 -0
- data/misc/theme_convert/theme_convert.rb +453 -0
- data/plugin/00default.rb +1015 -0
- data/plugin/05referer.rb +298 -0
- data/plugin/10spamfilter.rb +183 -0
- data/plugin/50sp.rb +146 -0
- data/plugin/60sf.rb +152 -0
- data/plugin/90migrate.rb +109 -0
- data/plugin/en/00default.rb +390 -0
- data/plugin/en/05referer.rb +49 -0
- data/plugin/en/10spamfilter.rb +81 -0
- data/plugin/en/50sp.rb +56 -0
- data/plugin/en/60sf.rb +60 -0
- data/plugin/ja/00default.rb +401 -0
- data/plugin/ja/05referer.rb +47 -0
- data/plugin/ja/10spamfilter.rb +79 -0
- data/plugin/ja/50sp.rb +66 -0
- data/plugin/ja/60sf.rb +73 -0
- data/public/.gitkeep +0 -0
- data/public/images/.gitkeep +0 -0
- data/public/javascripts/.gitkeep +0 -0
- data/public/stylesheets/.gitkeep +0 -0
- data/skel/category.rhtml +9 -0
- data/skel/conf.rhtml +23 -0
- data/skel/day.rhtml +33 -0
- data/skel/diary.rhtml +83 -0
- data/skel/footer.rhtml +8 -0
- data/skel/header.rhtml +10 -0
- data/skel/i.category.rhtml +6 -0
- data/skel/i.conf.rhtml +14 -0
- data/skel/i.day.rhtml +28 -0
- data/skel/i.diary.rhtml +17 -0
- data/skel/i.footer.rhtml +2 -0
- data/skel/i.header.rhtml +3 -0
- data/skel/i.latest.rhtml +24 -0
- data/skel/i.month.rhtml +39 -0
- data/skel/i.search.rhtml +5 -0
- data/skel/i.update.rhtml +40 -0
- data/skel/i.update.rhtml.en +40 -0
- data/skel/latest.rhtml +27 -0
- data/skel/mail.rtxt +18 -0
- data/skel/mail.rtxt.en +18 -0
- data/skel/month.rhtml +27 -0
- data/skel/plugin_error.rhtml +27 -0
- data/skel/preview.rhtml +85 -0
- data/skel/preview.rhtml.en +72 -0
- data/skel/referer.rhtml +24 -0
- data/skel/search.rhtml +14 -0
- data/skel/tdiary.rconf +76 -0
- data/skel/update.rhtml +103 -0
- data/skel/update.rhtml.en +83 -0
- data/spec/acceptance/append_comment_spec.rb +94 -0
- data/spec/acceptance/append_diary_spec.rb +98 -0
- data/spec/acceptance/bugfix/encoding_error_spec.rb +27 -0
- data/spec/acceptance/save_conf_comment_spec.rb +87 -0
- data/spec/acceptance/save_conf_default_spec.rb +169 -0
- data/spec/acceptance/save_conf_dnsbl_spec.rb +152 -0
- data/spec/acceptance/save_conf_filter_spec.rb +50 -0
- data/spec/acceptance/save_conf_plugin_spec.rb +69 -0
- data/spec/acceptance/save_conf_referer_spec.rb +60 -0
- data/spec/acceptance/save_conf_security_spec.rb +280 -0
- data/spec/acceptance/support/helpers.rb +49 -0
- data/spec/acceptance/support/paths.rb +7 -0
- data/spec/acceptance/update_diary_spec.rb +113 -0
- data/spec/acceptance/view_category_spec.rb +38 -0
- data/spec/acceptance/view_comment_spec.rb +67 -0
- data/spec/acceptance/view_diary_spec.rb +126 -0
- data/spec/acceptance/view_referer_spec.rb +31 -0
- data/spec/acceptance_helper.rb +101 -0
- data/spec/core/compatible_spec.rb +54 -0
- data/spec/core/core_ext_spec.rb +59 -0
- data/spec/core/plugin_spec.rb +389 -0
- data/spec/core/rack/assets/precompile_spec.rb +76 -0
- data/spec/core/rack/html_anchor_spec.rb +57 -0
- data/spec/core/rack/valid_request_path_spec.rb +67 -0
- data/spec/core/style/emptdiary_style_spec.rb +165 -0
- data/spec/core/style/etdiary_style_spec.rb +512 -0
- data/spec/core/style/gfm_style_spec.rb +334 -0
- data/spec/core/style/rd_style_spec.rb +202 -0
- data/spec/core/style/tdiary_style_spec.rb +240 -0
- data/spec/core/style/wiki_style_spec.rb +441 -0
- data/spec/fixtures/ascii8bit-pstore.db +0 -0
- data/spec/fixtures/invalid-sequence-volatile.tdr +9 -0
- data/spec/fixtures/just_installed.conf +1 -0
- data/spec/fixtures/plugin/ja/sample.rb +4 -0
- data/spec/fixtures/plugin/sample.rb +6 -0
- data/spec/fixtures/sample.rb +12 -0
- data/spec/fixtures/tdiary.conf.gem +212 -0
- data/spec/fixtures/tdiary.conf.rack +212 -0
- data/spec/fixtures/tdiary.conf.rdb +227 -0
- data/spec/fixtures/tdiary.conf.secure +204 -0
- data/spec/fixtures/tdiary.conf.webrick +212 -0
- data/spec/javascripts/00default_spec.js +35 -0
- data/spec/javascripts/fixtures/00default.html +1 -0
- data/spec/javascripts/support/jasmine.yml +76 -0
- data/spec/plugin/bq_spec.rb +24 -0
- data/spec/plugin/plugin_helper.rb +203 -0
- data/spec/spec_helper.rb +32 -0
- data/tdiary.conf.beginner +244 -0
- data/tdiary.conf.sample +345 -0
- data/tdiary.conf.sample-en +333 -0
- data/tdiary.gemspec +26 -0
- data/tdiary.rb +151 -0
- data/tdiary/admin.rb +236 -0
- data/tdiary/application.rb +57 -0
- data/tdiary/author_only_base.rb +171 -0
- data/tdiary/base.rb +220 -0
- data/tdiary/cli.rb +116 -0
- data/tdiary/comment.rb +40 -0
- data/tdiary/comment_manager.rb +94 -0
- data/tdiary/compatible.rb +72 -0
- data/tdiary/config.rb +270 -0
- data/tdiary/core_ext.rb +122 -0
- data/tdiary/deploy.rb +50 -0
- data/tdiary/dispatcher.rb +77 -0
- data/tdiary/dispatcher/index_main.rb +122 -0
- data/tdiary/dispatcher/update_main.rb +101 -0
- data/tdiary/environment.rb +15 -0
- data/tdiary/filter.rb +48 -0
- data/tdiary/filter/default.rb +54 -0
- data/tdiary/filter/spam.rb +304 -0
- data/tdiary/io/base.rb +70 -0
- data/tdiary/io/cache/file.rb +123 -0
- data/tdiary/io/cache/memcached.rb +88 -0
- data/tdiary/io/cache/redis.rb +100 -0
- data/tdiary/io/default.rb +297 -0
- data/tdiary/io/pstore.rb +252 -0
- data/tdiary/io/rdb.rb +213 -0
- data/tdiary/lang/en.rb +79 -0
- data/tdiary/lang/ja.rb +72 -0
- data/tdiary/plugin.rb +375 -0
- data/tdiary/rack/assets/precompile.rb +37 -0
- data/tdiary/rack/auth/basic.rb +38 -0
- data/tdiary/rack/auth/omniauth.rb +51 -0
- data/tdiary/rack/html_anchor.rb +31 -0
- data/tdiary/rack/valid_request_path.rb +36 -0
- data/tdiary/referer_manager.rb +80 -0
- data/tdiary/request.rb +217 -0
- data/tdiary/response.rb +29 -0
- data/tdiary/server.rb +85 -0
- data/tdiary/style.rb +194 -0
- data/tdiary/style/tdiary_style.rb +198 -0
- data/tdiary/style/wiki_style.rb +213 -0
- data/tdiary/tasks.rb +1 -0
- data/tdiary/tasks/assets.rake +31 -0
- data/tdiary/tasks/auth.rake +28 -0
- data/tdiary/tasks/db.rake +110 -0
- data/tdiary/tasks/doc.rake +31 -0
- data/tdiary/tasks/heroku.rake +37 -0
- data/tdiary/tasks/jasmine.rake +16 -0
- data/tdiary/tasks/rdoc.rake +24 -0
- data/tdiary/tasks/release.rake +122 -0
- data/tdiary/tasks/rspec.rake +51 -0
- data/tdiary/tasks/server.rake +33 -0
- data/tdiary/tasks/test.rake +17 -0
- data/tdiary/version.rb +3 -0
- data/tdiary/view.rb +468 -0
- data/tdiary/view_helper.rb +15 -0
- data/test/disp_referrer_test.rb +93 -0
- data/test/my-sequel_test.rb +238 -0
- data/test/test_helper.rb +7 -0
- data/test/test_plugin_helper.rb +64 -0
- data/test/test_plugin_helper_test.rb +28 -0
- data/test/weather_test.rb +33 -0
- data/theme/base.css +268 -0
- data/theme/conf.block.png +0 -0
- data/theme/conf.css +254 -0
- data/theme/default/README +11 -0
- data/theme/default/body.png +0 -0
- data/theme/default/default.css +743 -0
- data/theme/help.png +0 -0
- data/theme/loading.gif +0 -0
- data/theme/tdiary1/README +7 -0
- data/theme/tdiary1/tdiary1.css +394 -0
- data/theme/tdiary2/README +19 -0
- data/theme/tdiary2/tdiary2.css +624 -0
- data/update.fcgi +45 -0
- data/update.rb +57 -0
- data/vendor/hikidoc-0.0.6/COPYING +28 -0
- data/vendor/hikidoc-0.0.6/NEWS +30 -0
- data/vendor/hikidoc-0.0.6/NEWS.ja +30 -0
- data/vendor/hikidoc-0.0.6/README +86 -0
- data/vendor/hikidoc-0.0.6/README.ja +83 -0
- data/vendor/hikidoc-0.0.6/Rakefile +68 -0
- data/vendor/hikidoc-0.0.6/TextFormattingRules +320 -0
- data/vendor/hikidoc-0.0.6/TextFormattingRules.ja +318 -0
- data/vendor/hikidoc-0.0.6/bin/hikidoc +66 -0
- data/vendor/hikidoc-0.0.6/lib/hikidoc.rb +914 -0
- data/vendor/hikidoc-0.0.6/setup.rb +1360 -0
- data/vendor/hikidoc-0.0.6/test/run-test.rb +13 -0
- data/vendor/hikidoc-0.0.6/test/test_hikidoc.rb +506 -0
- data/vendor/imagesize-0.1.1/Manifest.txt +19 -0
- data/vendor/imagesize-0.1.1/README.txt +49 -0
- data/vendor/imagesize-0.1.1/lib/image_size.rb +305 -0
- data/vendor/imagesize-0.1.1/lib/image_size/version.rb +9 -0
- data/vendor/imagesize-0.1.1/setup.rb +1585 -0
- data/vendor/imagesize-0.1.1/test/2-4-7.png +0 -0
- data/vendor/imagesize-0.1.1/test/4_1_2.gif +0 -0
- data/vendor/imagesize-0.1.1/test/bmp.bmp +0 -0
- data/vendor/imagesize-0.1.1/test/cursor.xbm +6 -0
- data/vendor/imagesize-0.1.1/test/detect.swf +0 -0
- data/vendor/imagesize-0.1.1/test/pbm.pbm +0 -0
- data/vendor/imagesize-0.1.1/test/pcx.pcx +0 -0
- data/vendor/imagesize-0.1.1/test/pgm.pgm +5 -0
- data/vendor/imagesize-0.1.1/test/test.xpm +38 -0
- data/vendor/imagesize-0.1.1/test/test_helper.rb +2 -0
- data/vendor/imagesize-0.1.1/test/test_image_size.rb +71 -0
- data/vendor/imagesize-0.1.1/test/tiff.tiff +0 -0
- data/vendor/imagesize-0.1.1/test/tokyo_tower.jpg +0 -0
- data/vendor/imagesize-0.1.1/test/tower_e.gif.psd +0 -0
- data/vendor/jasmine-jquery-1.4.2/jasmine-jquery.js +548 -0
- data/vendor/jquery-1.8/jquery.js +9227 -0
- data/vendor/rdtool-0.6.38/COPYING.txt +339 -0
- data/vendor/rdtool-0.6.38/Gemfile +3 -0
- data/vendor/rdtool-0.6.38/HISTORY +318 -0
- data/vendor/rdtool-0.6.38/LGPL-2.1 +502 -0
- data/vendor/rdtool-0.6.38/LICENSE.txt +58 -0
- data/vendor/rdtool-0.6.38/README.html +66 -0
- data/vendor/rdtool-0.6.38/README.ja.html +73 -0
- data/vendor/rdtool-0.6.38/README.rd +76 -0
- data/vendor/rdtool-0.6.38/README.rd.ja +85 -0
- data/vendor/rdtool-0.6.38/Rakefile +152 -0
- data/vendor/rdtool-0.6.38/TODO +22 -0
- data/vendor/rdtool-0.6.38/bin/rd2 +283 -0
- data/vendor/rdtool-0.6.38/bin/rdswap.rb +207 -0
- data/vendor/rdtool-0.6.38/doc/rd-draft.html +456 -0
- data/vendor/rdtool-0.6.38/doc/rd-draft.ja.html +466 -0
- data/vendor/rdtool-0.6.38/doc/rd-draft.rd +479 -0
- data/vendor/rdtool-0.6.38/doc/rd-draft.rd.ja +487 -0
- data/vendor/rdtool-0.6.38/lib/rd/block-element.rb +114 -0
- data/vendor/rdtool-0.6.38/lib/rd/complex-list-item.rb +65 -0
- data/vendor/rdtool-0.6.38/lib/rd/desclist.rb +55 -0
- data/vendor/rdtool-0.6.38/lib/rd/document-struct.rb +46 -0
- data/vendor/rdtool-0.6.38/lib/rd/dot.rd2rc +18 -0
- data/vendor/rdtool-0.6.38/lib/rd/element.rb +160 -0
- data/vendor/rdtool-0.6.38/lib/rd/filter.rb +255 -0
- data/vendor/rdtool-0.6.38/lib/rd/head-filter.rb +14 -0
- data/vendor/rdtool-0.6.38/lib/rd/inline-element.rb +233 -0
- data/vendor/rdtool-0.6.38/lib/rd/labeled-element.rb +14 -0
- data/vendor/rdtool-0.6.38/lib/rd/list.rb +57 -0
- data/vendor/rdtool-0.6.38/lib/rd/loose-struct.rb +11 -0
- data/vendor/rdtool-0.6.38/lib/rd/methodlist.rb +57 -0
- data/vendor/rdtool-0.6.38/lib/rd/output-format-visitor.rb +30 -0
- data/vendor/rdtool-0.6.38/lib/rd/package.rb +4 -0
- data/vendor/rdtool-0.6.38/lib/rd/parser-util.rb +14 -0
- data/vendor/rdtool-0.6.38/lib/rd/post-install +1 -0
- data/vendor/rdtool-0.6.38/lib/rd/pre-setup.rb +18 -0
- data/vendor/rdtool-0.6.38/lib/rd/rbl-file.rb +69 -0
- data/vendor/rdtool-0.6.38/lib/rd/rbl-suite.rb +37 -0
- data/vendor/rdtool-0.6.38/lib/rd/rd-struct.rb +86 -0
- data/vendor/rdtool-0.6.38/lib/rd/rd2html-ext-lib.rb +266 -0
- data/vendor/rdtool-0.6.38/lib/rd/rd2html-ext-opt.rb +34 -0
- data/vendor/rdtool-0.6.38/lib/rd/rd2html-lib.rb +490 -0
- data/vendor/rdtool-0.6.38/lib/rd/rd2html-opt.rb +67 -0
- data/vendor/rdtool-0.6.38/lib/rd/rd2man-lib.rb +251 -0
- data/vendor/rdtool-0.6.38/lib/rd/rd2rdo-lib.rb +19 -0
- data/vendor/rdtool-0.6.38/lib/rd/rd2rmi-lib.rb +32 -0
- data/vendor/rdtool-0.6.38/lib/rd/rdblockparser.ry +518 -0
- data/vendor/rdtool-0.6.38/lib/rd/rdblockparser.tab.rb +1061 -0
- data/vendor/rdtool-0.6.38/lib/rd/rdfmt.rb +15 -0
- data/vendor/rdtool-0.6.38/lib/rd/rdinlineparser.ry +503 -0
- data/vendor/rdtool-0.6.38/lib/rd/rdinlineparser.tab.rb +1243 -0
- data/vendor/rdtool-0.6.38/lib/rd/rdvisitor.rb +214 -0
- data/vendor/rdtool-0.6.38/lib/rd/reference-resolver.rb +114 -0
- data/vendor/rdtool-0.6.38/lib/rd/search-file.rb +14 -0
- data/vendor/rdtool-0.6.38/lib/rd/tree.rb +103 -0
- data/vendor/rdtool-0.6.38/lib/rd/version.rb +41 -0
- data/vendor/rdtool-0.6.38/lib/rd/visitor.rb +86 -0
- data/vendor/rdtool-0.6.38/rdtool.gemspec +125 -0
- data/vendor/rdtool-0.6.38/setup.rb +1596 -0
- data/vendor/rdtool-0.6.38/test/data/includee1.html +1 -0
- data/vendor/rdtool-0.6.38/test/data/includee2.html +1 -0
- data/vendor/rdtool-0.6.38/test/data/includee3.nothtml +1 -0
- data/vendor/rdtool-0.6.38/test/data/includee4.xhtml +0 -0
- data/vendor/rdtool-0.6.38/test/data/label.rbl +2 -0
- data/vendor/rdtool-0.6.38/test/data/label2.rbl +2 -0
- data/vendor/rdtool-0.6.38/test/data/sub/includee2.html +1 -0
- data/vendor/rdtool-0.6.38/test/data/sub/includee4.html +0 -0
- data/vendor/rdtool-0.6.38/test/dummy-observer.rb +6 -0
- data/vendor/rdtool-0.6.38/test/dummy.rb +33 -0
- data/vendor/rdtool-0.6.38/test/temp-dir.rb +19 -0
- data/vendor/rdtool-0.6.38/test/test-block-parser.rb +46 -0
- data/vendor/rdtool-0.6.38/test/test-desclist-item.rb +219 -0
- data/vendor/rdtool-0.6.38/test/test-document-element.rb +46 -0
- data/vendor/rdtool-0.6.38/test/test-document-struct.rb +66 -0
- data/vendor/rdtool-0.6.38/test/test-element.rb +46 -0
- data/vendor/rdtool-0.6.38/test/test-headline.rb +80 -0
- data/vendor/rdtool-0.6.38/test/test-inline-parser.rb +46 -0
- data/vendor/rdtool-0.6.38/test/test-list-item.rb +54 -0
- data/vendor/rdtool-0.6.38/test/test-list.rb +53 -0
- data/vendor/rdtool-0.6.38/test/test-methodlist-item.rb +73 -0
- data/vendor/rdtool-0.6.38/test/test-nonterminal-element.rb +170 -0
- data/vendor/rdtool-0.6.38/test/test-nonterminal-inline.rb +33 -0
- data/vendor/rdtool-0.6.38/test/test-output-format-visitor.rb +48 -0
- data/vendor/rdtool-0.6.38/test/test-parser-util.rb +41 -0
- data/vendor/rdtool-0.6.38/test/test-rbl-file.rb +156 -0
- data/vendor/rdtool-0.6.38/test/test-rbl-suite.rb +43 -0
- data/vendor/rdtool-0.6.38/test/test-rd2html-lib.rb +496 -0
- data/vendor/rdtool-0.6.38/test/test-rdtree.rb +17 -0
- data/vendor/rdtool-0.6.38/test/test-rdvisitor.rb +29 -0
- data/vendor/rdtool-0.6.38/test/test-reference-resolver.rb +202 -0
- data/vendor/rdtool-0.6.38/test/test-reference.rb +132 -0
- data/vendor/rdtool-0.6.38/test/test-search-file.rb +22 -0
- data/vendor/rdtool-0.6.38/test/test-terminal-inline.rb +41 -0
- data/vendor/rdtool-0.6.38/test/test-textblock.rb +44 -0
- data/vendor/rdtool-0.6.38/test/test-tree.rb +82 -0
- data/vendor/rdtool-0.6.38/test/test-version.rb +57 -0
- data/vendor/rdtool-0.6.38/test/test-visitor.rb +230 -0
- data/vendor/rdtool-0.6.38/utils/rd-mode.el +464 -0
- metadata +666 -0
@@ -0,0 +1,15 @@
|
|
1
|
+
# -*- coding: utf-8 -*-
|
2
|
+
def label_xmlrpc_url; 'XML-RPC API 設置先URL'; end
|
3
|
+
def label_xmlrpc_blogid; 'Blog ID'; end
|
4
|
+
def label_xmlrpc_username; 'ユーザ名'; end
|
5
|
+
def label_xmlrpc_password; 'パスワード'; end
|
6
|
+
def label_xmlrpc_lastname; '名'; end
|
7
|
+
def label_xmlrpc_firstname; '姓'; end
|
8
|
+
def label_xmlrpc_userid; 'ユーザID'; end
|
9
|
+
|
10
|
+
# Local Variables:
|
11
|
+
# mode: ruby
|
12
|
+
# indent-tabs-mode: t
|
13
|
+
# tab-width: 3
|
14
|
+
# ruby-indent-level: 3
|
15
|
+
# End:
|
data/misc/plugin/kw.rb
ADDED
@@ -0,0 +1,150 @@
|
|
1
|
+
# -*- coding: utf-8 -*-
|
2
|
+
# kw.rb
|
3
|
+
#
|
4
|
+
# kw: keyword link generator
|
5
|
+
# Parameters:
|
6
|
+
# keyword: keyword or InterWikiName (separated by ':').
|
7
|
+
# name: anchor string (optional).
|
8
|
+
# title: title attribute (optional).
|
9
|
+
#
|
10
|
+
# @options['kw.dic']
|
11
|
+
# array of dictionary table array. an item of array is:
|
12
|
+
#
|
13
|
+
# [key, URL, style]
|
14
|
+
#
|
15
|
+
# key: nil or string of key.
|
16
|
+
# If keyword is 'foo', it has key nil.
|
17
|
+
# If keyword is 'google:foo', it has key 'google'.
|
18
|
+
# URL: the URL for link. '$1' is replace by keyword.
|
19
|
+
# style: encoding style as: 'euc-jp', 'sjis', 'jis', 'utf-8' or nil.
|
20
|
+
#
|
21
|
+
# if there isn't @options['kw.dic'], the plugin links to google.
|
22
|
+
#
|
23
|
+
# @options['kw.show_inter']
|
24
|
+
# Show InterWikiName.
|
25
|
+
# If this options is true, the keyword 'google:foo' shows 'google:foo'.
|
26
|
+
# But it is false, that shows only 'foo'.
|
27
|
+
# The default of this option is true.
|
28
|
+
#
|
29
|
+
# Copyright (C) 2003, TADA Tadashi <sho@spc.gr.jp>
|
30
|
+
# You can distribute this under GPL.
|
31
|
+
#
|
32
|
+
|
33
|
+
unless String.method_defined?(:encode)
|
34
|
+
require 'nkf'
|
35
|
+
end
|
36
|
+
|
37
|
+
def kw_parse( str )
|
38
|
+
kw_list = []
|
39
|
+
str.each_line do |pair|
|
40
|
+
k, u, s = pair.sub( /[\r\n]+/, '' ).split( /[ \t]+/, 3 )
|
41
|
+
k = nil if k == '' or k == 'nil'
|
42
|
+
s = nil if s != 'euc-jp' && s != 'sjis' && s != 'jis' && s != 'utf-8'
|
43
|
+
kw_list << [k, u, s] if u
|
44
|
+
end
|
45
|
+
kw_list
|
46
|
+
end
|
47
|
+
|
48
|
+
def kw_generate_dic
|
49
|
+
kw_dic = {nil => ['http://www.google.com/search?ie=utf-8&q=$1', 'utf-8']}
|
50
|
+
|
51
|
+
kw_list = []
|
52
|
+
case @conf['kw.dic'].class.to_s
|
53
|
+
when "String"
|
54
|
+
kw_list = kw_parse( @conf['kw.dic'] )
|
55
|
+
when "Array"
|
56
|
+
kw_list = @conf['kw.dic']
|
57
|
+
end
|
58
|
+
kw_list.each do |pair|
|
59
|
+
kw_dic[pair[0]] = pair[1..-1]
|
60
|
+
end
|
61
|
+
kw_dic
|
62
|
+
end
|
63
|
+
|
64
|
+
def kw( keyword, name = nil, title = nil )
|
65
|
+
@kw_dic = kw_generate_dic unless @kw_dic
|
66
|
+
show_inter = @options['kw.show_inter'] == nil ? true : @options['kw.show_inter']
|
67
|
+
|
68
|
+
inter, key = keyword.split( /:/, 2 )
|
69
|
+
unless key then
|
70
|
+
inter = nil
|
71
|
+
key = keyword
|
72
|
+
end
|
73
|
+
keyword = key unless show_inter
|
74
|
+
name = keyword unless name
|
75
|
+
title = title ? %Q[ title="#{h title}"] : ''
|
76
|
+
|
77
|
+
unless @kw_dic.has_key?(inter)
|
78
|
+
inter = nil
|
79
|
+
end
|
80
|
+
style = @kw_dic[inter][1]
|
81
|
+
if String.method_defined?(:encode)
|
82
|
+
if style
|
83
|
+
key = key.encode({'jis'=>'ISO-2022-JP', 'sjis'=>'Shift_JIS'}[style] || style)
|
84
|
+
end
|
85
|
+
else
|
86
|
+
key = case style
|
87
|
+
when 'euc-jp'
|
88
|
+
NKF::nkf( '-m0 -W -e', key )
|
89
|
+
when 'sjis'
|
90
|
+
NKF::nkf( '-m0 -W -s', key )
|
91
|
+
when 'jis'
|
92
|
+
NKF::nkf( '-m0 -W -j', key )
|
93
|
+
when 'utf-8'
|
94
|
+
key
|
95
|
+
else # none
|
96
|
+
key
|
97
|
+
end
|
98
|
+
end
|
99
|
+
%Q[<a href="#{h @kw_dic[inter][0].sub( /\$1/, u( key ))}"#{title}>#{h name}</a>]
|
100
|
+
end
|
101
|
+
|
102
|
+
#
|
103
|
+
# config
|
104
|
+
#
|
105
|
+
unless @resource_loaded then
|
106
|
+
def kw_label
|
107
|
+
"キーワード"
|
108
|
+
end
|
109
|
+
|
110
|
+
def kw_desc
|
111
|
+
<<-HTML
|
112
|
+
<h3>リンクリストの指定</h3>
|
113
|
+
<p>特定のサイトへのリンクを、簡単な記述で生成するためのプラグイン(kw)です。
|
114
|
+
「キー URL エンコードスタイル」と空白で区切って指定します。例えば、</p>
|
115
|
+
<pre>google http://www.google.com/search?ie=utf-8&q=$1 utf-8</pre>
|
116
|
+
<p>と指定すると、</p>
|
117
|
+
<pre><%=kw('google:tdiary')%></pre>
|
118
|
+
<p>のように日記に書けばgoogleでtdiaryを検索するリンクになります
|
119
|
+
(記述方法はスタイルによって変わります)。なお、キーにnilを指定すると、
|
120
|
+
「google:」の部分を書かない場合の指定ができます。</p>
|
121
|
+
HTML
|
122
|
+
end
|
123
|
+
end
|
124
|
+
|
125
|
+
add_conf_proc( 'kw', kw_label ) do
|
126
|
+
if @mode == 'saveconf' then
|
127
|
+
kw_list = kw_parse( @conf.to_native( @cgi.params['kw.dic'][0] ) )
|
128
|
+
if kw_list.empty? then
|
129
|
+
@conf.delete( 'kw.dic' )
|
130
|
+
else
|
131
|
+
@conf['kw.dic'] = kw_list.collect{|a|a.join( ' ' )}.join( "\n" )
|
132
|
+
end
|
133
|
+
end
|
134
|
+
dic = kw_generate_dic
|
135
|
+
if dic[nil] then
|
136
|
+
dic['nil'] = dic[nil]
|
137
|
+
dic.delete( nil )
|
138
|
+
end
|
139
|
+
<<-HTML
|
140
|
+
#{kw_desc}
|
141
|
+
<p><textarea name="kw.dic" cols="60" rows="10">#{h dic.collect{|a|a.flatten.join( " " )}.join( "\n" )}</textarea></p>
|
142
|
+
HTML
|
143
|
+
end
|
144
|
+
|
145
|
+
# Local Variables:
|
146
|
+
# mode: ruby
|
147
|
+
# indent-tabs-mode: t
|
148
|
+
# tab-width: 3
|
149
|
+
# ruby-indent-level: 3
|
150
|
+
# End:
|
data/misc/plugin/list.rb
ADDED
@@ -0,0 +1,40 @@
|
|
1
|
+
# -*- coding: utf-8 -*-
|
2
|
+
# list.rb
|
3
|
+
#
|
4
|
+
# <ol> 順番付きリスト生成
|
5
|
+
# <%= ol l %>
|
6
|
+
# パラメタ:
|
7
|
+
# l: リスト文字列(\nくぎり)
|
8
|
+
#
|
9
|
+
# <ul> 順番無しリスト
|
10
|
+
# <%= ul l , t %>
|
11
|
+
# パラメタ:
|
12
|
+
# l: リスト文字列(\nくぎり)
|
13
|
+
#
|
14
|
+
# Copyright (c) 2002 abbey <inlet@cello.no-ip.org>
|
15
|
+
# Distributed under the GPL.
|
16
|
+
#
|
17
|
+
|
18
|
+
def ol( l, t = nil, s = nil )
|
19
|
+
apply_plugin( %Q[<ol>#{li l}</ol>] )
|
20
|
+
end
|
21
|
+
|
22
|
+
def ul( l, t = nil)
|
23
|
+
apply_plugin( %Q[<ul>#{li l}</ul>] )
|
24
|
+
end
|
25
|
+
|
26
|
+
def li( text )
|
27
|
+
list = ""
|
28
|
+
text.each_line do |line|
|
29
|
+
list << ("<li>" + line.chomp + "</li>")
|
30
|
+
end
|
31
|
+
result = list
|
32
|
+
end
|
33
|
+
|
34
|
+
|
35
|
+
# Local Variables:
|
36
|
+
# mode: ruby
|
37
|
+
# indent-tabs-mode: t
|
38
|
+
# tab-width: 3
|
39
|
+
# ruby-indent-level: 3
|
40
|
+
# End:
|
@@ -0,0 +1,89 @@
|
|
1
|
+
# -*- coding: utf-8 -*-
|
2
|
+
# makelirs.rb
|
3
|
+
#
|
4
|
+
# 更新情報をLIRSフォーマットのファイルに吐き出す
|
5
|
+
#
|
6
|
+
# pluginディレクトリに置くだけで動作します。
|
7
|
+
#
|
8
|
+
# tdiary.confにおいて、@options['makelirs.file']に
|
9
|
+
# ファイル名を指定すると、そのファイルを出力先の
|
10
|
+
# LIRSファイルとします。無指定時にはindex.rbと同じ
|
11
|
+
# パスにantenna.lirsというファイルになります。
|
12
|
+
# いずれも、Webサーバから書き込める権限が必要です。
|
13
|
+
#
|
14
|
+
# Copyright (C) 2002 by Kazuhiro NISHIYAMA
|
15
|
+
# You can redistribute it and/or modify it under GPL2.
|
16
|
+
#
|
17
|
+
|
18
|
+
add_header_proc do
|
19
|
+
<<-LINK
|
20
|
+
<!--link rel="alternate" type="application/x-lirs" title="lirs" href="#{File::basename( @options['makelirs.file'] || 'antenna.lirs' )}"-->
|
21
|
+
LINK
|
22
|
+
end
|
23
|
+
|
24
|
+
|
25
|
+
add_update_proc do
|
26
|
+
eval( <<-MODIFY_CLASS, TOPLEVEL_BINDING )
|
27
|
+
unless Time.method_defined?(:utc_offset)
|
28
|
+
class Time
|
29
|
+
def utc_offset
|
30
|
+
l = self.dup.localtime
|
31
|
+
u = self.dup.utc
|
32
|
+
|
33
|
+
if l.year != u.year
|
34
|
+
off = l.year < u.year ? -1 : 1
|
35
|
+
elsif l.mon != u.mon
|
36
|
+
off = l.mon < u.mon ? -1 : 1
|
37
|
+
elsif l.mday != u.mday
|
38
|
+
off = l.mday < u.mday ? -1 : 1
|
39
|
+
else
|
40
|
+
off = 0
|
41
|
+
end
|
42
|
+
|
43
|
+
off = off * 24 + l.hour - u.hour
|
44
|
+
off = off * 60 + l.min - u.min
|
45
|
+
off = off * 60 + l.sec - u.sec
|
46
|
+
|
47
|
+
return off
|
48
|
+
end
|
49
|
+
end
|
50
|
+
end
|
51
|
+
MODIFY_CLASS
|
52
|
+
|
53
|
+
file = @options['makelirs.file'] || 'antenna.lirs'
|
54
|
+
|
55
|
+
# create_lirs
|
56
|
+
cgi = @cgi.clone
|
57
|
+
conf = @conf.clone
|
58
|
+
def cgi.mobile_agent?; false; end
|
59
|
+
def cgi.mobile_agent?; false; end
|
60
|
+
|
61
|
+
t = TDiaryLatest::new( cgi, "latest.rhtml", conf )
|
62
|
+
body = t.eval_rhtml
|
63
|
+
# escape comma
|
64
|
+
e = proc{|str| str.gsub(/[,\\]/){ "\\#{$&}" }.gsub( /[\r\n]/, '' ) }
|
65
|
+
|
66
|
+
now = Time.now
|
67
|
+
utc_offset = now.utc_offset
|
68
|
+
|
69
|
+
uri = @index.dup
|
70
|
+
uri[0, 0] = base_url if %r|^https?://|i !~ @index
|
71
|
+
uri.gsub!( %r|/\./|, '/' )
|
72
|
+
|
73
|
+
lirs = "LIRS,#{t.last_modified.tv_sec},#{Time.now.tv_sec},#{utc_offset},#{body.size},#{e[uri]},#{e[@html_title]},#{e[@author_name]},,\n"
|
74
|
+
File::open( file, 'w' ) do |o|
|
75
|
+
o.puts lirs
|
76
|
+
end
|
77
|
+
begin
|
78
|
+
File::utime( t.last_modified.tv_sec, t.last_modified.tv_sec, file )
|
79
|
+
rescue
|
80
|
+
end
|
81
|
+
end
|
82
|
+
|
83
|
+
|
84
|
+
# Local Variables:
|
85
|
+
# mode: ruby
|
86
|
+
# indent-tabs-mode: t
|
87
|
+
# tab-width: 3
|
88
|
+
# ruby-indent-level: 3
|
89
|
+
# End:
|
@@ -0,0 +1,744 @@
|
|
1
|
+
# makerss.rb
|
2
|
+
#
|
3
|
+
# generate RSS file when updating.
|
4
|
+
#
|
5
|
+
# options configurable through settings:
|
6
|
+
# @conf['makerss.hidecontent'] : hide full-text content. default: false
|
7
|
+
# @conf['makerss.shortdesc'] : shorter description. default: false
|
8
|
+
# @conf['makerss.comment_link'] : insert tsukkomi's link. default: false
|
9
|
+
#
|
10
|
+
# options to be edited in tdiary.conf:
|
11
|
+
# @conf['makerss.file'] : local file name of RSS file. default: 'index.rdf'.
|
12
|
+
# @conf['makerss.url'] : URL of RSS file.
|
13
|
+
# @conf['makerss.no_comments.file'] : local file name of RSS file without
|
14
|
+
# comments. default: 'no_comments.rdf'.
|
15
|
+
# @conf['makerss.no_comments.url'] : URL of RSS file without TSUKOMI.
|
16
|
+
# @conf.banner : URL of site banner image (can be relative)
|
17
|
+
# @conf.description : desciption of the diary
|
18
|
+
# @conf['makerss.partial'] : how much portion of body to be in description
|
19
|
+
# used when makerss.shortdesc, default: 0.25
|
20
|
+
# @conf['makerss.suffix'] : strings which are appended to the title tag.
|
21
|
+
# @conf['makerss.no_comments.suffix'] : strings which are appended to
|
22
|
+
# the title tag of the commentless rdf.
|
23
|
+
#
|
24
|
+
# CAUTION: Before using, make 'index.rdf' and 'no_comments.rdf' file
|
25
|
+
# into the directory of your diary, and permit writable to httpd.
|
26
|
+
#
|
27
|
+
# Copyright (c) 2009 TADA Tadashi <t@tdtds.jp>
|
28
|
+
# Distributed under the GPL
|
29
|
+
#
|
30
|
+
|
31
|
+
if /^append|replace|comment|showcomment$/ =~ @mode then
|
32
|
+
unless @conf.description
|
33
|
+
@conf.description = @conf['whatsnew_list.rdf.description']
|
34
|
+
end
|
35
|
+
module ::TDiary
|
36
|
+
class RDFSection
|
37
|
+
attr_reader :id, :time, :section, :diary_title
|
38
|
+
|
39
|
+
# 'id' has 'YYYYMMDDpNN' format (p or c).
|
40
|
+
# 'time' is Last-Modified this section as a Time object.
|
41
|
+
def initialize( id, time, section )
|
42
|
+
@id, @time, @section, @diary_title = id, time, section, diary_title
|
43
|
+
end
|
44
|
+
|
45
|
+
def time_string
|
46
|
+
g = @time.dup.gmtime
|
47
|
+
l = Time::local( g.year, g.month, g.day, g.hour, g.min, g.sec )
|
48
|
+
tz = (g.to_i - l.to_i)
|
49
|
+
zone = sprintf( "%+03d:%02d", tz / 3600, tz % 3600 / 60 )
|
50
|
+
@time.strftime( "%Y-%m-%dT%H:%M:%S" ) + zone
|
51
|
+
end
|
52
|
+
|
53
|
+
def <=>( other )
|
54
|
+
other.time <=> @time
|
55
|
+
end
|
56
|
+
end
|
57
|
+
end
|
58
|
+
end
|
59
|
+
|
60
|
+
@makerss_rsses = @makerss_rsses || []
|
61
|
+
|
62
|
+
class MakeRssFull
|
63
|
+
include ERB::Util
|
64
|
+
include TDiary::ViewHelper
|
65
|
+
|
66
|
+
def initialize(conf, cgi = CGI.new)
|
67
|
+
@conf, @cgi = conf, cgi
|
68
|
+
@item_num = 0
|
69
|
+
end
|
70
|
+
|
71
|
+
def title
|
72
|
+
@conf['makerss.suffix'] || ''
|
73
|
+
end
|
74
|
+
|
75
|
+
def head( str )
|
76
|
+
@head = str
|
77
|
+
@head.sub!( /<\/title>/, "#{h title}</title>" )
|
78
|
+
end
|
79
|
+
|
80
|
+
def foot( str ); @foot = str; end
|
81
|
+
def image( str ); @image = str; end
|
82
|
+
def banner( str ); @banner = str; end
|
83
|
+
|
84
|
+
def item( seq, body, rdfsec )
|
85
|
+
@item_num += 1
|
86
|
+
return if @item_num > 15
|
87
|
+
@seq = '' unless @seq
|
88
|
+
@seq << seq
|
89
|
+
@body = '' unless @body
|
90
|
+
@body << body
|
91
|
+
end
|
92
|
+
|
93
|
+
def xml
|
94
|
+
xml = @head.to_s
|
95
|
+
xml << @image.to_s
|
96
|
+
xml << "<items><rdf:Seq>\n"
|
97
|
+
xml << @seq.to_s
|
98
|
+
xml << "</rdf:Seq></items>\n</channel>\n"
|
99
|
+
xml << @banner.to_s
|
100
|
+
xml << @body.to_s
|
101
|
+
xml << @foot.to_s
|
102
|
+
xml.gsub( /[\x00-\x1f]/ ){|s| s =~ /[\r\n\t]/ ? s : ""}
|
103
|
+
end
|
104
|
+
|
105
|
+
def file
|
106
|
+
f = @conf['makerss.file'] || 'index.rdf'
|
107
|
+
f = 'index.rdf' if f.empty?
|
108
|
+
f =~ %r|^/| ? f : "#{TDiary.document_root}/#{f}"
|
109
|
+
end
|
110
|
+
|
111
|
+
def writable?
|
112
|
+
if FileTest::writable?( file ) then
|
113
|
+
return true
|
114
|
+
elsif FileTest::exist?( file )
|
115
|
+
return false
|
116
|
+
else # try to create
|
117
|
+
begin
|
118
|
+
File::open( file, 'w' ){|f|}
|
119
|
+
return true
|
120
|
+
rescue
|
121
|
+
return false
|
122
|
+
end
|
123
|
+
end
|
124
|
+
end
|
125
|
+
|
126
|
+
def write( encoder )
|
127
|
+
begin
|
128
|
+
File::open( file, 'w' ) do |f|
|
129
|
+
f.write( encoder.call( xml ) )
|
130
|
+
end
|
131
|
+
rescue
|
132
|
+
end
|
133
|
+
end
|
134
|
+
|
135
|
+
def url
|
136
|
+
u = @conf['makerss.url'] || "#{base_url}#{File.basename(file)}"
|
137
|
+
u = "#{base_url}#{File.basename(file)}" if u.empty?
|
138
|
+
u
|
139
|
+
end
|
140
|
+
end
|
141
|
+
|
142
|
+
@makerss_rsses << MakeRssFull::new(@conf, @cgi)
|
143
|
+
|
144
|
+
class MakeRssNoComments < MakeRssFull
|
145
|
+
def title
|
146
|
+
@conf['makerss.no_comments.suffix'] || '(without comments)'
|
147
|
+
end
|
148
|
+
|
149
|
+
def item( seq, body, rdfsec )
|
150
|
+
return unless rdfsec.section.respond_to?( :body_to_html )
|
151
|
+
super
|
152
|
+
end
|
153
|
+
|
154
|
+
def file
|
155
|
+
f = @conf['makerss.no_comments.file'] || 'no_comments.rdf'
|
156
|
+
f = 'no_comments.rdf' if f.empty?
|
157
|
+
f =~ %r|^/| ? f : "#{TDiary.document_root}/#{f}"
|
158
|
+
end
|
159
|
+
|
160
|
+
def write( encoder )
|
161
|
+
return unless @conf['makerss.no_comments']
|
162
|
+
super( encoder )
|
163
|
+
end
|
164
|
+
|
165
|
+
def url
|
166
|
+
return nil unless @conf['makerss.no_comments']
|
167
|
+
u = @conf['makerss.no_comments.url'] || "#{base_url}#{File.basename(file)}"
|
168
|
+
u = "#{base_url}#{File.basename(file)}" if u.empty?
|
169
|
+
u
|
170
|
+
end
|
171
|
+
end
|
172
|
+
|
173
|
+
@makerss_rsses << MakeRssNoComments::new(@conf, @cgi)
|
174
|
+
|
175
|
+
def makerss_update
|
176
|
+
date = @date.strftime( "%Y%m%d" )
|
177
|
+
diary = @diaries[date]
|
178
|
+
|
179
|
+
uri = @conf.index.dup
|
180
|
+
uri[0, 0] = base_url if %r|^https?://|i !~ @conf.index
|
181
|
+
uri.gsub!( %r|/\./|, '/' )
|
182
|
+
|
183
|
+
require 'pstore'
|
184
|
+
cache = {}
|
185
|
+
rsses = @makerss_rsses
|
186
|
+
|
187
|
+
begin
|
188
|
+
PStore::new( "#{@cache_path}/makerss.cache" ).transaction do |db|
|
189
|
+
begin
|
190
|
+
cache = db['cache'] if db.root?( 'cache' )
|
191
|
+
|
192
|
+
if /^append|replace$/ =~ @mode then
|
193
|
+
format = "#{date}p%02d"
|
194
|
+
index = 0
|
195
|
+
diary.each_section do |section|
|
196
|
+
index += 1
|
197
|
+
id = format % index
|
198
|
+
if diary.visible? and !cache[id] then
|
199
|
+
cache[id] = RDFSection::new( id, Time::now, section )
|
200
|
+
elsif !diary.visible? and cache[id]
|
201
|
+
cache.delete( id )
|
202
|
+
elsif diary.visible? and cache[id]
|
203
|
+
if cache[id].section.body_to_html != section.body_to_html or
|
204
|
+
cache[id].section.subtitle_to_html != section.subtitle_to_html then
|
205
|
+
cache[id] = RDFSection::new( id, Time::now, section )
|
206
|
+
end
|
207
|
+
end
|
208
|
+
end
|
209
|
+
|
210
|
+
loop do
|
211
|
+
index += 1
|
212
|
+
id = format % index
|
213
|
+
if cache[id] then
|
214
|
+
cache.delete( id )
|
215
|
+
else
|
216
|
+
break
|
217
|
+
end
|
218
|
+
end
|
219
|
+
elsif /^comment$/ =~ @mode and @conf.show_comment
|
220
|
+
id = "#{date}c%02d" % diary.count_comments( true )
|
221
|
+
cache[id] = RDFSection::new( id, @comment.date, @comment )
|
222
|
+
elsif /^showcomment$/ =~ @mode
|
223
|
+
index = 0
|
224
|
+
diary.each_comment do |comment|
|
225
|
+
index += 1
|
226
|
+
id = "#{date}c%02d" % index
|
227
|
+
if !cache[id] and (@conf.show_comment and comment.visible? and /^(TrackBack|Pingback)$/i !~ comment.name) then
|
228
|
+
cache[id] = RDFSection::new( id, comment.date, comment )
|
229
|
+
elsif cache[id] and !(@conf.show_comment and comment.visible? and /^(TrackBack|Pingback)$/i !~ comment.name)
|
230
|
+
cache.delete( id )
|
231
|
+
end
|
232
|
+
end
|
233
|
+
end
|
234
|
+
|
235
|
+
rsses.each{|rss| rss.head( makerss_header( uri ) ) }
|
236
|
+
cache.values.sort{|a,b| b.time <=> a.time}.each_with_index do |rdfsec, idx|
|
237
|
+
unless rdfsec.section.respond_to?( :visible? ) and !rdfsec.section.visible?
|
238
|
+
rsses.each {|rss|
|
239
|
+
rss.item( makerss_seq( uri, rdfsec ), makerss_body( uri, rdfsec ), rdfsec )
|
240
|
+
}
|
241
|
+
end
|
242
|
+
if idx > 50
|
243
|
+
cache.delete( rdfsec.id )
|
244
|
+
end
|
245
|
+
end
|
246
|
+
|
247
|
+
db['cache'] = cache
|
248
|
+
rescue PStore::Error
|
249
|
+
end
|
250
|
+
end
|
251
|
+
rescue ArgumentError
|
252
|
+
File.unlink( "#{@cache_path}/makerss.cache" )
|
253
|
+
retry
|
254
|
+
end
|
255
|
+
|
256
|
+
if @conf.banner and not @conf.banner.empty?
|
257
|
+
if /^http/ =~ @conf.banner
|
258
|
+
rdf_image = @conf.banner
|
259
|
+
else
|
260
|
+
rdf_image = base_url + @conf.banner
|
261
|
+
end
|
262
|
+
rsses.each {|r| r.image( %Q[<image rdf:resource="#{h rdf_image}" />\n] ) }
|
263
|
+
end
|
264
|
+
|
265
|
+
rsses.each {|r|
|
266
|
+
r.banner( makerss_banner( uri, rdf_image ) ) if rdf_image
|
267
|
+
r.foot( makerss_footer )
|
268
|
+
r.write( Proc::new{|s| replace_entities( to_utf8( s ) )} )
|
269
|
+
}
|
270
|
+
end
|
271
|
+
|
272
|
+
def makerss_header( uri )
|
273
|
+
rdf_url = @conf['makerss.url'] || "#{base_url}index.rdf"
|
274
|
+
rdf_url = "#{base_url}index.rdf" if rdf_url.empty?
|
275
|
+
|
276
|
+
desc = @conf.description || ''
|
277
|
+
|
278
|
+
copyright = Time::now.strftime( "Copyright %Y #{@conf.author_name}" )
|
279
|
+
copyright += " <#{@conf.author_mail}>" if @conf.author_mail and not @conf.author_mail.empty?
|
280
|
+
copyright += ", copyright of comments by respective authors"
|
281
|
+
|
282
|
+
xml = %Q[<?xml version="1.0" encoding="UTF-8"?>
|
283
|
+
<?xml-stylesheet href="rss.css" type="text/css"?>
|
284
|
+
<rdf:RDF xmlns="http://purl.org/rss/1.0/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:xhtml="http://www.w3.org/1999/xhtml" xml:lang="#{h @conf.html_lang}">
|
285
|
+
<channel rdf:about="#{h rdf_url}">
|
286
|
+
<title>#{h @conf.html_title}</title>
|
287
|
+
<link>#{h uri}</link>
|
288
|
+
<xhtml:link xhtml:rel="alternate" xhtml:media="handheld" xhtml:type="text/html" xhtml:href="#{h uri}" />
|
289
|
+
<description>#{h desc}</description>
|
290
|
+
<dc:creator>#{h @conf.author_name}</dc:creator>
|
291
|
+
<dc:rights>#{h copyright}</dc:rights>
|
292
|
+
]
|
293
|
+
end
|
294
|
+
|
295
|
+
def makerss_seq( uri, rdfsec )
|
296
|
+
%Q|<rdf:li rdf:resource="#{h uri}#{anchor rdfsec.id}"/>\n|
|
297
|
+
end
|
298
|
+
|
299
|
+
def makerss_banner( uri, rdf_image )
|
300
|
+
%Q[<image rdf:about="#{h rdf_image}">
|
301
|
+
<title>#{h @conf.html_title}</title>
|
302
|
+
<url>#{h rdf_image}</url>
|
303
|
+
<link>#{h uri}</link>
|
304
|
+
</image>
|
305
|
+
]
|
306
|
+
end
|
307
|
+
|
308
|
+
def makerss_desc_shorten( text )
|
309
|
+
if @conf['makerss.shortdesc'] then
|
310
|
+
@conf['makerss.partial'] = 0.25 unless @conf['makerss.partial']
|
311
|
+
len = ( text.size.to_f * @conf['makerss.partial'] ).ceil.to_i
|
312
|
+
len = 500 if len > 500
|
313
|
+
else
|
314
|
+
len = 500
|
315
|
+
end
|
316
|
+
@conf.shorten( text, len )
|
317
|
+
end
|
318
|
+
|
319
|
+
def feed?
|
320
|
+
@makerss_in_feed
|
321
|
+
end
|
322
|
+
|
323
|
+
def makerss_body( uri, rdfsec )
|
324
|
+
rdf = ""
|
325
|
+
if rdfsec.section.respond_to?( :body_to_html ) then
|
326
|
+
rdf = %Q|<item rdf:about="#{h uri}#{anchor rdfsec.id}">\n|
|
327
|
+
rdf << %Q|<link>#{h uri}#{anchor rdfsec.id}</link>\n|
|
328
|
+
rdf << %Q|<xhtml:link xhtml:rel="alternate" xhtml:media="handheld" xhtml:type="text/html" xhtml:href="#{h uri}#{anchor rdfsec.id}" />\n|
|
329
|
+
rdf << %Q|<dc:date>#{h rdfsec.time_string}</dc:date>\n|
|
330
|
+
a = rdfsec.id.scan( /(\d{4})(\d\d)(\d\d)/ ).flatten.map{|s| s.to_i}
|
331
|
+
date = Time::local( *a )
|
332
|
+
old_apply_plugin = @conf['apply_plugin']
|
333
|
+
@conf['apply_plugin'] = true
|
334
|
+
|
335
|
+
@makerss_in_feed = true
|
336
|
+
subtitle = rdfsec.section.subtitle_to_html
|
337
|
+
sec_id = rdfsec.id[9,2].to_i
|
338
|
+
body_enter = body_enter_proc( date )
|
339
|
+
body = apply_plugin( rdfsec.section.body_to_html )
|
340
|
+
body_leave = body_leave_proc( date )
|
341
|
+
@makerss_in_feed = false
|
342
|
+
|
343
|
+
sub = (subtitle || '').sub( /^(\[([^\]]+)\])+ */, '' )
|
344
|
+
sub = apply_plugin( sub, true ).strip
|
345
|
+
if sub.empty?
|
346
|
+
sub = @conf.shorten( remove_tag( body ).strip, 20 )
|
347
|
+
end
|
348
|
+
rdf << %Q|<title>#{sub}</title>\n|
|
349
|
+
rdf << %Q|<dc:creator>#{h @conf.author_name}</dc:creator>\n|
|
350
|
+
unless rdfsec.section.categories.empty?
|
351
|
+
rdfsec.section.categories.each do |category|
|
352
|
+
rdf << %Q|<dc:subject>#{h category}</dc:subject>\n|
|
353
|
+
end
|
354
|
+
end
|
355
|
+
desc = remove_tag( body ).strip
|
356
|
+
desc.gsub!( /&.*?;/, '' )
|
357
|
+
rdf << %Q|<description>#{h makerss_desc_shorten( desc )}</description>\n|
|
358
|
+
unless @conf['makerss.hidecontent']
|
359
|
+
text = ''
|
360
|
+
text << '<h3>' + apply_plugin( subtitle.sub( /^(\[([^\]]+)\])+ */, '' ) ).strip + '</h3>' if subtitle and not subtitle.empty?
|
361
|
+
text << body_enter
|
362
|
+
text << body
|
363
|
+
text << body_leave
|
364
|
+
unless text.empty?
|
365
|
+
uri = @conf.index.dup
|
366
|
+
uri[0, 0] = base_url unless %r|^https?://|i =~ uri
|
367
|
+
uri.gsub!( %r|/\./|, '/' )
|
368
|
+
text = absolutify( text, uri )
|
369
|
+
text.gsub!( /\]\]>/, ']]]]><![CDATA[>' )
|
370
|
+
rdf << %Q|<content:encoded><![CDATA[#{text}|
|
371
|
+
unless @conf['makerss.comment_link']
|
372
|
+
ymd = date.strftime( "%Y%m%d" )
|
373
|
+
rdf << %Q|\n<p><a href="#{h uri}#{anchor "#{ymd}c"}">#{comment_new}</a></p>|
|
374
|
+
end
|
375
|
+
rdf << %Q|]]></content:encoded>\n|
|
376
|
+
end
|
377
|
+
end
|
378
|
+
|
379
|
+
@conf['apply_plugin'] = old_apply_plugin
|
380
|
+
rdf << "</item>\n"
|
381
|
+
else # TSUKKOMI
|
382
|
+
rdf = %Q|<item rdf:about="#{h uri}#{anchor rdfsec.id}">\n|
|
383
|
+
rdf << %Q|<link>#{h uri}#{anchor rdfsec.id}</link>\n|
|
384
|
+
rdf << %Q|<dc:date>#{h rdfsec.time_string}</dc:date>\n|
|
385
|
+
rdf << %Q|<title>#{makerss_tsukkomi_label( rdfsec.id )} (#{h rdfsec.section.name})</title>\n|
|
386
|
+
rdf << %Q|<dc:creator>#{h rdfsec.section.name}</dc:creator>\n|
|
387
|
+
text = rdfsec.section.body
|
388
|
+
rdf << %Q|<description>#{h makerss_desc_shorten( text )}</description>\n|
|
389
|
+
unless @conf['makerss.hidecontent']
|
390
|
+
rdf << %Q|<content:encoded><![CDATA[#{text.make_link.gsub( /\n/, '<br>' ).gsub( /<br><br>\Z/, '' ).gsub( /\]\]>/, ']]]]><![CDATA[>' )}]]></content:encoded>\n|
|
391
|
+
end
|
392
|
+
rdf << "</item>\n"
|
393
|
+
end
|
394
|
+
rdf
|
395
|
+
end
|
396
|
+
|
397
|
+
def makerss_footer
|
398
|
+
"</rdf:RDF>\n"
|
399
|
+
end
|
400
|
+
|
401
|
+
add_update_proc do
|
402
|
+
makerss_update unless @cgi.params['makerss_update'][0] == 'false'
|
403
|
+
end
|
404
|
+
|
405
|
+
add_header_proc {
|
406
|
+
html = ''
|
407
|
+
@makerss_rsses.each do |rss|
|
408
|
+
next unless rss.url
|
409
|
+
html << %Q|\t<link rel="alternate" type="application/rss+xml" title="RSS#{h rss.title}" href="#{h rss.url}">\n|
|
410
|
+
end
|
411
|
+
html
|
412
|
+
}
|
413
|
+
|
414
|
+
add_conf_proc( 'makerss', @makerss_conf_label, 'update' ) do
|
415
|
+
if @mode == 'saveconf' then
|
416
|
+
%w( hidecontent shortdesc comment_link no_comments).each do |s|
|
417
|
+
item = "makerss.#{s}"
|
418
|
+
@conf[item] = ( 't' == @cgi.params[item][0] )
|
419
|
+
end
|
420
|
+
end
|
421
|
+
|
422
|
+
@makerss_rsses.each do |rss|
|
423
|
+
if rss.class == MakeRssFull then
|
424
|
+
@makerss_full = rss
|
425
|
+
elsif rss.class == MakeRssNoComments
|
426
|
+
@makerss_no_comments = rss
|
427
|
+
end
|
428
|
+
end
|
429
|
+
makerss_conf_html
|
430
|
+
end
|
431
|
+
|
432
|
+
add_edit_proc do
|
433
|
+
checked = if @cgi.params['makerss_update'][0] == 'false' then
|
434
|
+
' checked'
|
435
|
+
elsif @date < (Time::now - 30*24*60*60) # older over a month
|
436
|
+
' checked'
|
437
|
+
else
|
438
|
+
''
|
439
|
+
end
|
440
|
+
r = <<-HTML
|
441
|
+
<div class="makerss"><label for="makerss_update">
|
442
|
+
<input type="checkbox" id="makerss_update" name="makerss_update" value="false"#{checked} tabindex="390">
|
443
|
+
#{@makerss_edit_label}
|
444
|
+
</label></div>
|
445
|
+
HTML
|
446
|
+
end
|
447
|
+
|
448
|
+
def replace_entities( text )
|
449
|
+
unless @xml_entity_table then
|
450
|
+
@xml_entity_table = {
|
451
|
+
' ' => ' ',
|
452
|
+
'¡' => '¡',
|
453
|
+
'¢' => '¢',
|
454
|
+
'£' => '£',
|
455
|
+
'¤' => '¤',
|
456
|
+
'¥' => '¥',
|
457
|
+
'¦' => '¦',
|
458
|
+
'§' => '§',
|
459
|
+
'¨' => '¨',
|
460
|
+
'©' => '©',
|
461
|
+
'ª' => 'ª',
|
462
|
+
'«' => '«',
|
463
|
+
'¬' => '¬',
|
464
|
+
'­' => '­',
|
465
|
+
'®' => '®',
|
466
|
+
'¯' => '¯',
|
467
|
+
'°' => '°',
|
468
|
+
'±' => '±',
|
469
|
+
'²' => '²',
|
470
|
+
'³' => '³',
|
471
|
+
'´' => '´',
|
472
|
+
'µ' => 'µ',
|
473
|
+
'¶' => '¶',
|
474
|
+
'·' => '·',
|
475
|
+
'¸' => '¸',
|
476
|
+
'¹' => '¹',
|
477
|
+
'º' => 'º',
|
478
|
+
'»' => '»',
|
479
|
+
'¼' => '¼',
|
480
|
+
'½' => '½',
|
481
|
+
'¾' => '¾',
|
482
|
+
'¿' => '¿',
|
483
|
+
'À' => 'À',
|
484
|
+
'Á' => 'Á',
|
485
|
+
'Â' => 'Â',
|
486
|
+
'Ã' => 'Ã',
|
487
|
+
'Ä' => 'Ä',
|
488
|
+
'Å' => 'Å',
|
489
|
+
'&Aelig;' => 'Æ',
|
490
|
+
'Ç' => 'Ç',
|
491
|
+
'È' => 'È',
|
492
|
+
'É' => 'É',
|
493
|
+
'Ê' => 'Ê',
|
494
|
+
'Ë' => 'Ë',
|
495
|
+
'Ì' => 'Ì',
|
496
|
+
'Í' => 'Í',
|
497
|
+
'Î' => 'Î',
|
498
|
+
'Ï' => 'Ï',
|
499
|
+
'Ð' => 'Ð',
|
500
|
+
'Ñ' => 'Ñ',
|
501
|
+
'Ò' => 'Ò',
|
502
|
+
'Ó' => 'Ó',
|
503
|
+
'Ô' => 'Ô',
|
504
|
+
'Õ' => 'Õ',
|
505
|
+
'Ö' => 'Ö',
|
506
|
+
'×' => '×',
|
507
|
+
'Ø' => 'Ø',
|
508
|
+
'Ù' => 'Ù',
|
509
|
+
'Ú' => 'Ú',
|
510
|
+
'Û' => 'Û',
|
511
|
+
'Ü' => 'Ü',
|
512
|
+
'Ý' => 'Ý',
|
513
|
+
'Þ' => 'Þ',
|
514
|
+
'ß' => 'ß',
|
515
|
+
'à' => 'à',
|
516
|
+
'á' => 'á',
|
517
|
+
'â' => 'â',
|
518
|
+
'ã' => 'ã',
|
519
|
+
'ä' => 'ä',
|
520
|
+
'å' => 'å',
|
521
|
+
'æ' => 'æ',
|
522
|
+
'ç' => 'ç',
|
523
|
+
'è' => 'è',
|
524
|
+
'é' => 'é',
|
525
|
+
'ê' => 'ê',
|
526
|
+
'ë' => 'ë',
|
527
|
+
'ì' => 'ì',
|
528
|
+
'í' => 'í',
|
529
|
+
'î' => 'î',
|
530
|
+
'ï' => 'ï',
|
531
|
+
'ð' => 'ð',
|
532
|
+
'ñ' => 'ñ',
|
533
|
+
'ò' => 'ò',
|
534
|
+
'ó' => 'ó',
|
535
|
+
'ô' => 'ô',
|
536
|
+
'õ' => 'õ',
|
537
|
+
'ö' => 'ö',
|
538
|
+
'÷' => '÷',
|
539
|
+
'ø' => 'ø',
|
540
|
+
'ù' => 'ù',
|
541
|
+
'ú' => 'ú',
|
542
|
+
'û' => 'û',
|
543
|
+
'ü' => 'ü',
|
544
|
+
'ý' => 'ý',
|
545
|
+
'þ' => 'þ',
|
546
|
+
'ÿ' => 'ÿ',
|
547
|
+
'œ' => 'Œ',
|
548
|
+
'œ' => 'œ',
|
549
|
+
'š' => 'Š',
|
550
|
+
'š' => 'š',
|
551
|
+
'ÿ' => 'Ÿ',
|
552
|
+
'ˆ' => 'ˆ',
|
553
|
+
'˜' => '˜',
|
554
|
+
' ' => ' ',
|
555
|
+
' ' => ' ',
|
556
|
+
' ' => ' ',
|
557
|
+
'‌' => '‌',
|
558
|
+
'‍' => '‍',
|
559
|
+
'‎' => '‎',
|
560
|
+
'‏' => '‏',
|
561
|
+
'–' => '–',
|
562
|
+
'—' => '—',
|
563
|
+
'‘' => '‘',
|
564
|
+
'’' => '’',
|
565
|
+
'‚' => '‚',
|
566
|
+
'“' => '“',
|
567
|
+
'”' => '”',
|
568
|
+
'„' => '„',
|
569
|
+
'†' => '†',
|
570
|
+
'‡' => '‡',
|
571
|
+
'‰' => '‰',
|
572
|
+
'‹' => '‹',
|
573
|
+
'›' => '›',
|
574
|
+
'€' => '€',
|
575
|
+
'ƒ' => 'ƒ',
|
576
|
+
'Α' => 'Α',
|
577
|
+
'Β' => 'Β',
|
578
|
+
'Γ' => 'Γ',
|
579
|
+
'Δ' => 'Δ',
|
580
|
+
'Ε' => 'Ε',
|
581
|
+
'Ζ' => 'Ζ',
|
582
|
+
'Η' => 'Η',
|
583
|
+
'Θ' => 'Θ',
|
584
|
+
'Ι' => 'Ι',
|
585
|
+
'Κ' => 'Κ',
|
586
|
+
'Λ' => 'Λ',
|
587
|
+
'Μ' => 'Μ',
|
588
|
+
'Ν' => 'Ν',
|
589
|
+
'Ξ' => 'Ξ',
|
590
|
+
'Ο' => 'Ο',
|
591
|
+
'Π' => 'Π',
|
592
|
+
'Ρ' => 'Ρ',
|
593
|
+
'Σ' => 'Σ',
|
594
|
+
'Τ' => 'Τ',
|
595
|
+
'Υ' => 'Υ',
|
596
|
+
'Φ' => 'Φ',
|
597
|
+
'Χ' => 'Χ',
|
598
|
+
'Ψ' => 'Ψ',
|
599
|
+
'Ω' => 'Ω',
|
600
|
+
'α' => 'α',
|
601
|
+
'β' => 'β',
|
602
|
+
'γ' => 'γ',
|
603
|
+
'δ' => 'δ',
|
604
|
+
'ε' => 'ε',
|
605
|
+
'ζ' => 'ζ',
|
606
|
+
'η' => 'η',
|
607
|
+
'θ' => 'θ',
|
608
|
+
'ι' => 'ι',
|
609
|
+
'κ' => 'κ',
|
610
|
+
'λ' => 'λ',
|
611
|
+
'μ' => 'μ',
|
612
|
+
'ν' => 'ν',
|
613
|
+
'ξ' => 'ξ',
|
614
|
+
'ο' => 'ο',
|
615
|
+
'π' => 'π',
|
616
|
+
'ρ' => 'ρ',
|
617
|
+
'ς' => 'ς',
|
618
|
+
'σ' => 'σ',
|
619
|
+
'τ' => 'τ',
|
620
|
+
'υ' => 'υ',
|
621
|
+
'φ' => 'φ',
|
622
|
+
'χ' => 'χ',
|
623
|
+
'ψ' => 'ψ',
|
624
|
+
'ω' => 'ω',
|
625
|
+
'ϑ' => 'ϑ',
|
626
|
+
'ϒ' => 'ϒ',
|
627
|
+
'ϖ' => 'ϖ',
|
628
|
+
'•' => '•',
|
629
|
+
'…' => '…',
|
630
|
+
'′' => '′',
|
631
|
+
'′' => '″',
|
632
|
+
'‾' => '‾',
|
633
|
+
'⁄' => '⁄',
|
634
|
+
'℘' => '℘',
|
635
|
+
'ℑ' => 'ℑ',
|
636
|
+
'ℜ' => 'ℜ',
|
637
|
+
'™' => '™',
|
638
|
+
'ℵ' => 'ℵ',
|
639
|
+
'←' => '←',
|
640
|
+
'→' => '→',
|
641
|
+
'↓' => '↓',
|
642
|
+
'↔' => '↔',
|
643
|
+
'↵' => '↵',
|
644
|
+
'⇐' => '⇐',
|
645
|
+
'⇑' => '⇑',
|
646
|
+
'⇒' => '⇒',
|
647
|
+
'⇓' => '⇓',
|
648
|
+
'⇔' => '⇔',
|
649
|
+
'∀' => '∀',
|
650
|
+
'∂' => '∂',
|
651
|
+
'∃' => '∃',
|
652
|
+
'∅' => '∅',
|
653
|
+
'∇' => '∇',
|
654
|
+
'∈' => '∈',
|
655
|
+
'∉' => '∉',
|
656
|
+
'∋' => '∋',
|
657
|
+
'∏' => '∏',
|
658
|
+
'∑' => '∑',
|
659
|
+
'−' => '−',
|
660
|
+
'∗' => '∗',
|
661
|
+
'√' => '√',
|
662
|
+
'∝' => '∝',
|
663
|
+
'∞' => '∞',
|
664
|
+
'∠' => '∠',
|
665
|
+
'∧' => '∧',
|
666
|
+
'∨' => '∨',
|
667
|
+
'∩' => '∩',
|
668
|
+
'∪' => '∪',
|
669
|
+
'∫' => '∫',
|
670
|
+
'∴' => '∴',
|
671
|
+
'∼' => '∼',
|
672
|
+
'≅' => '≅',
|
673
|
+
'≈' => '≈',
|
674
|
+
'≠' => '≠',
|
675
|
+
'≡' => '≡',
|
676
|
+
'≤' => '≤',
|
677
|
+
'≥' => '≥',
|
678
|
+
'⊂' => '⊂',
|
679
|
+
'⊃' => '⊃',
|
680
|
+
'⊄' => '⊄',
|
681
|
+
'⊆' => '⊆',
|
682
|
+
'⊇' => '⊇',
|
683
|
+
'⊕' => '⊕',
|
684
|
+
'⊗' => '⊗',
|
685
|
+
'⊥' => '⊥',
|
686
|
+
'⋅' => '⋅',
|
687
|
+
'⌈' => '⌈',
|
688
|
+
'⌉' => '⌉',
|
689
|
+
'⌊' => '⌊',
|
690
|
+
'⌋' => '⌋',
|
691
|
+
'⟨' => '〈',
|
692
|
+
'⟩' => '〉',
|
693
|
+
'◊' => '◊',
|
694
|
+
'♠' => '♠',
|
695
|
+
'♣' => '♣',
|
696
|
+
'♥' => '♥',
|
697
|
+
'♦' => '♦'
|
698
|
+
}
|
699
|
+
end
|
700
|
+
text.gsub( /&[a-z]+;/im ) do |e|
|
701
|
+
@xml_entity_table[e] || e
|
702
|
+
end
|
703
|
+
end
|
704
|
+
|
705
|
+
# Copied from below which includes some tests
|
706
|
+
# http://github.com/zunda/ruby-absolutify/tree/master
|
707
|
+
def absolutify(html, baseurl)
|
708
|
+
@@_absolutify_attr_regexp ||= Hash.new
|
709
|
+
baseuri = URI.parse(URI.encode(baseurl))
|
710
|
+
r = html.gsub(%r|<\S[^>]*/?>|) do |tag|
|
711
|
+
type = tag.scan(/\A<(\S+)/)[0][0].downcase
|
712
|
+
if attr = {'a' => 'href', 'img' => 'src'}[type]
|
713
|
+
@@_absolutify_attr_regexp[attr] ||= %r|(.*#{attr}\s*=\s*)(['"]?)([^\2>]+?)(\2.*)|im
|
714
|
+
m = tag.match(@@_absolutify_attr_regexp[attr])
|
715
|
+
unless m.nil?
|
716
|
+
prefix = m[1] + m[2]
|
717
|
+
location = m[3]
|
718
|
+
postfix = m[4]
|
719
|
+
begin
|
720
|
+
uri = URI.parse(location)
|
721
|
+
if uri.relative?
|
722
|
+
location = (baseuri + location).to_s
|
723
|
+
elsif not uri.host and uri.path
|
724
|
+
path = uri.path
|
725
|
+
path += '?' + uri.query if uri.query
|
726
|
+
path += '#' + uri.fragment if uri.fragment
|
727
|
+
location = (baseuri + path).to_s
|
728
|
+
end
|
729
|
+
tag = prefix + location + postfix
|
730
|
+
rescue URI::InvalidURIError
|
731
|
+
end
|
732
|
+
end
|
733
|
+
end
|
734
|
+
tag
|
735
|
+
end
|
736
|
+
return r
|
737
|
+
end
|
738
|
+
|
739
|
+
# Local Variables:
|
740
|
+
# mode: ruby
|
741
|
+
# indent-tabs-mode: t
|
742
|
+
# tab-width: 3
|
743
|
+
# ruby-indent-level: 3
|
744
|
+
# End:
|