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,33 @@
|
|
1
|
+
require 'test/unit'
|
2
|
+
|
3
|
+
require 'rd/inline-element'
|
4
|
+
require 'rd/document-struct'
|
5
|
+
require 'dummy'
|
6
|
+
|
7
|
+
include RD
|
8
|
+
|
9
|
+
DummyStruct.define_relationship(NonterminalInline, DummyElement)
|
10
|
+
|
11
|
+
class TestNonterminalInline < Test::Unit::TestCase
|
12
|
+
def test_children
|
13
|
+
el = NonterminalInline.new
|
14
|
+
assert_equal([], el.children)
|
15
|
+
el.children.push 1
|
16
|
+
assert_equal([1], el.children)
|
17
|
+
end
|
18
|
+
|
19
|
+
def test_to_label
|
20
|
+
one = NonterminalInline.new
|
21
|
+
one.add_child_under_document_struct(DummyElement.new, DummyStruct)
|
22
|
+
assert_equal("label", one.to_label)
|
23
|
+
|
24
|
+
two = NonterminalInline.new
|
25
|
+
two.add_child_under_document_struct(DummyElement.new, DummyStruct)
|
26
|
+
two.add_child_under_document_struct(DummyElement.new, DummyStruct)
|
27
|
+
assert_equal("label label", two.to_label)
|
28
|
+
|
29
|
+
zero = NonterminalInline.new
|
30
|
+
assert_equal("", zero.to_label)
|
31
|
+
end
|
32
|
+
end
|
33
|
+
|
@@ -0,0 +1,48 @@
|
|
1
|
+
require 'test/unit'
|
2
|
+
|
3
|
+
require 'temp-dir'
|
4
|
+
|
5
|
+
require 'rd/output-format-visitor'
|
6
|
+
require 'rd/tree'
|
7
|
+
require 'rd/element'
|
8
|
+
require 'rd/block-element'
|
9
|
+
require 'rd/inline-element'
|
10
|
+
require 'rd/rd-struct'
|
11
|
+
|
12
|
+
include RD
|
13
|
+
|
14
|
+
class TestOFVisitor < Test::Unit::TestCase
|
15
|
+
def setup
|
16
|
+
end
|
17
|
+
|
18
|
+
def test_initialize
|
19
|
+
vis = OutputFormatVisitor.new
|
20
|
+
assert_equal([], vis.include_suffix)
|
21
|
+
vis = SampleVisitor.new
|
22
|
+
assert_equal(["html"], vis.include_suffix)
|
23
|
+
end
|
24
|
+
|
25
|
+
def test_apply_to_include
|
26
|
+
tree = Tree.new_with_document_struct(DocumentStructure::RD,
|
27
|
+
["test/data/sub", "test/data/"])
|
28
|
+
de = DocumentElement.new
|
29
|
+
# test/data/includee1.html
|
30
|
+
inc1 = Include.new("includee1")
|
31
|
+
# test/data/includee2.html, test/data/sub/includee2.html
|
32
|
+
inc2 = Include.new("includee2")
|
33
|
+
# test/data/includee3.nothtml
|
34
|
+
inc3 = Include.new("includee3")
|
35
|
+
tree.root = de
|
36
|
+
de.add_child(inc1)
|
37
|
+
de.add_child(inc2)
|
38
|
+
de.add_child(inc3)
|
39
|
+
vis = SampleVisitor.new
|
40
|
+
assert_equal("includee1.html", vis.apply_to_Include(inc1))
|
41
|
+
assert_equal("sub/includee2.html", vis.apply_to_Include(inc2))
|
42
|
+
assert_equal(nil, vis.apply_to_Include(inc3))
|
43
|
+
end
|
44
|
+
end
|
45
|
+
|
46
|
+
class SampleVisitor < OutputFormatVisitor
|
47
|
+
INCLUDE_SUFFIX = ["html"]
|
48
|
+
end
|
@@ -0,0 +1,41 @@
|
|
1
|
+
require 'test/unit'
|
2
|
+
|
3
|
+
require 'rd/rdblockparser.tab'
|
4
|
+
require 'rd/rd-struct'
|
5
|
+
|
6
|
+
include RD
|
7
|
+
|
8
|
+
class TestParserUtil < Test::Unit::TestCase
|
9
|
+
def setup
|
10
|
+
@p = RDParser.new
|
11
|
+
@tree = tree = Tree.new_with_document_struct(DocumentStructure::RD)
|
12
|
+
@p.instance_eval do
|
13
|
+
@tree = tree
|
14
|
+
end
|
15
|
+
end
|
16
|
+
|
17
|
+
def test_tree
|
18
|
+
obj = Object.new
|
19
|
+
obj.extend(ParserUtility)
|
20
|
+
|
21
|
+
assert_raises(NotImplementedError) do
|
22
|
+
obj.tree
|
23
|
+
end
|
24
|
+
end
|
25
|
+
|
26
|
+
def test_add_children_to_element
|
27
|
+
headline = Headline.new(1)
|
28
|
+
string_element = StringElement.new "string"
|
29
|
+
emphasis = Emphasis.new
|
30
|
+
@p.add_children_to_element(headline, string_element, emphasis)
|
31
|
+
assert_equal([string_element, emphasis], headline.children)
|
32
|
+
|
33
|
+
textblock = TextBlock.new
|
34
|
+
@p.add_children_to_element(textblock, emphasis, string_element)
|
35
|
+
assert_equal([emphasis, string_element], textblock.children)
|
36
|
+
|
37
|
+
textblock_empty = TextBlock.new
|
38
|
+
@p.add_children_to_element(textblock_empty)
|
39
|
+
assert_equal([], textblock_empty.children)
|
40
|
+
end
|
41
|
+
end
|
@@ -0,0 +1,156 @@
|
|
1
|
+
require 'test/unit'
|
2
|
+
|
3
|
+
require 'temp-dir'
|
4
|
+
|
5
|
+
require 'rd/rbl-file'
|
6
|
+
require 'rd/block-element'
|
7
|
+
require 'rd/inline-element'
|
8
|
+
require 'rd/rd-struct'
|
9
|
+
require 'rd/reference-resolver'
|
10
|
+
|
11
|
+
include RD
|
12
|
+
|
13
|
+
class TestRBLFile < Test::Unit::TestCase
|
14
|
+
|
15
|
+
def setup
|
16
|
+
tr_head2 = Tree.new_with_document_struct(DocumentStructure::RD)
|
17
|
+
de_head2 = DocumentElement.new
|
18
|
+
tr_head2.root = de_head2
|
19
|
+
hl1_head2, hl2_head2 = nil
|
20
|
+
|
21
|
+
de_head2.build do
|
22
|
+
hl1_head2 = new Headline, 1 do
|
23
|
+
new StringElement, "label1"
|
24
|
+
end
|
25
|
+
new TextBlock
|
26
|
+
hl2_head2 = new Headline, 2 do
|
27
|
+
new StringElement, "label2"
|
28
|
+
end
|
29
|
+
end
|
30
|
+
|
31
|
+
@resolv_head2 = ReferenceResolver.new(tr_head2, "label:")
|
32
|
+
|
33
|
+
tr_desc = Tree.new_with_document_struct(DocumentStructure::RD)
|
34
|
+
de_desc = DocumentElement.new
|
35
|
+
tr_desc.root = de_desc
|
36
|
+
hl1_desc, dt1_desc = nil
|
37
|
+
de_desc.build do
|
38
|
+
hl1_desc = new(Headline, 1) do
|
39
|
+
new StringElement, "label1"
|
40
|
+
end
|
41
|
+
new DescList do
|
42
|
+
new DescListItem do
|
43
|
+
dt1_desc = make_term do
|
44
|
+
new StringElement, "label2"
|
45
|
+
end
|
46
|
+
end
|
47
|
+
end
|
48
|
+
end
|
49
|
+
@resolv_desc = ReferenceResolver.new(tr_desc, "Label-")
|
50
|
+
|
51
|
+
tr_empty = Tree.new_with_document_struct(DocumentStructure::RD)
|
52
|
+
de_empty = DocumentElement.new
|
53
|
+
tr_empty.root = de_empty
|
54
|
+
@resolv_empty = ReferenceResolver.new(tr_empty, "LABEL")
|
55
|
+
|
56
|
+
tr_arr = Tree.new_with_document_struct(DocumentStructure::RD)
|
57
|
+
de_arr = DocumentElement.new
|
58
|
+
tr_arr.root = de_arr
|
59
|
+
|
60
|
+
de_arr.build do
|
61
|
+
new Headline, 1 do
|
62
|
+
new StringElement, "a => b"
|
63
|
+
end
|
64
|
+
end
|
65
|
+
|
66
|
+
@resolv_arr = ReferenceResolver.new(tr_arr, "label:")
|
67
|
+
|
68
|
+
@rbl_head2 = RBLFile.new("test-head2")
|
69
|
+
@rbl_desc = RBLFile.new("test-desc")
|
70
|
+
@rbl_empty = RBLFile.new("test-empty")
|
71
|
+
@rbl_arr = RBLFile.new("test-arr")
|
72
|
+
end
|
73
|
+
|
74
|
+
def test_labels_to_string
|
75
|
+
res = "label1 => label:0\nlabel2 => label:1"
|
76
|
+
assert_equal(res, RBLFile.labels_to_string(@resolv_head2))
|
77
|
+
|
78
|
+
res2 = "label1 => Label-0\nlabel2 => Label-1"
|
79
|
+
assert_equal(res2, RBLFile.labels_to_string(@resolv_desc))
|
80
|
+
|
81
|
+
res_empty = ""
|
82
|
+
assert_equal(res_empty, RBLFile.labels_to_string(@resolv_empty))
|
83
|
+
|
84
|
+
res_arr = "a => b => label:0"
|
85
|
+
assert_equal(res_arr, RBLFile.labels_to_string(@resolv_arr))
|
86
|
+
end
|
87
|
+
|
88
|
+
def test_string_to_labels
|
89
|
+
rbl = RBLFile.new("test-head2")
|
90
|
+
src_head2 = "label1 => label:0\nlabel2 => label:1"
|
91
|
+
res_head2 = [["label1", "label:0"], ["label2", "label:1"]]
|
92
|
+
assert_equal(res_head2, rbl.string_to_labels(src_head2))
|
93
|
+
|
94
|
+
src_head2 = "label1 =>label:0\nlabel2=> label:1"
|
95
|
+
res_head2 = [["label1", "label:0"], ["label2", "label:1"]]
|
96
|
+
assert_equal(res_head2, rbl.string_to_labels(src_head2))
|
97
|
+
|
98
|
+
src_desc = "label1 => Label-0\nlabel2 => Label-1"
|
99
|
+
res_desc = [["label1", "Label-0"], ["label2", "Label-1"]]
|
100
|
+
assert_equal(res_desc, rbl.string_to_labels(src_desc))
|
101
|
+
|
102
|
+
src_empty = ""
|
103
|
+
res_empty = []
|
104
|
+
assert_equal(res_empty, @rbl_empty.string_to_labels(src_empty))
|
105
|
+
|
106
|
+
src_arr = "a => b => label:0"
|
107
|
+
res_arr = [["a => b", "label:0"]]
|
108
|
+
assert_equal(res_arr, @rbl_arr.string_to_labels(src_arr))
|
109
|
+
end
|
110
|
+
|
111
|
+
def test_rbl_file_path
|
112
|
+
assert_equal("test-head2.rbl", RBLFile.rbl_file_path("test-head2.rd"))
|
113
|
+
assert_equal("test-head2.rbl", RBLFile.rbl_file_path("test-head2.rb"))
|
114
|
+
assert_equal("test-desc.rbl", RBLFile.rbl_file_path("test-desc"))
|
115
|
+
end
|
116
|
+
|
117
|
+
def test_s_create_rbl_file
|
118
|
+
in_temp_dir do
|
119
|
+
begin
|
120
|
+
RBLFile.create_rbl_file("test-head2.rd", @resolv_head2)
|
121
|
+
assert(File.exist?("test-head2.rbl"))
|
122
|
+
ensure
|
123
|
+
remove_file("test-head2.rbl")
|
124
|
+
end
|
125
|
+
end
|
126
|
+
end
|
127
|
+
|
128
|
+
def test_load_rbl_file
|
129
|
+
in_temp_dir do
|
130
|
+
spath = [Dir.pwd]
|
131
|
+
begin
|
132
|
+
RBLFile.create_rbl_file("test-head2.rd", @resolv_head2)
|
133
|
+
|
134
|
+
rbl_rd = RBLFile.new("test-head2.rd")
|
135
|
+
rbl_rd.load_rbl_file(spath)
|
136
|
+
res = [["label1", "label:0"], ["label2", "label:1"]]
|
137
|
+
assert_equal(res, rbl_rd.labels)
|
138
|
+
|
139
|
+
rbl_no = RBLFile.new("test-head2")
|
140
|
+
rbl_no.load_rbl_file(spath)
|
141
|
+
assert_equal(res, rbl_no.labels)
|
142
|
+
ensure
|
143
|
+
remove_file("test-head2.rbl")
|
144
|
+
end
|
145
|
+
end
|
146
|
+
end
|
147
|
+
|
148
|
+
def test_refer
|
149
|
+
spath = ["test/data"]
|
150
|
+
rbl = RBLFile.new("label")
|
151
|
+
rbl.load_rbl_file(spath)
|
152
|
+
assert_equal("label:0", rbl.refer("label1"))
|
153
|
+
assert_equal("label:1", rbl.refer("label2"))
|
154
|
+
assert_equal(nil, rbl.refer("label3"))
|
155
|
+
end
|
156
|
+
end
|
@@ -0,0 +1,43 @@
|
|
1
|
+
require 'test/unit'
|
2
|
+
|
3
|
+
require 'rd/rbl-suite'
|
4
|
+
require 'rd/rbl-file'
|
5
|
+
|
6
|
+
include RD
|
7
|
+
|
8
|
+
class TestRBLSuite < Test::Unit::TestCase
|
9
|
+
|
10
|
+
def setup
|
11
|
+
@suite = RBLSuite.new(["test/data"])
|
12
|
+
end
|
13
|
+
|
14
|
+
def test_get_rbl_file
|
15
|
+
assert_equal([], @suite.rbl_files)
|
16
|
+
rbl = @suite.get_rbl_file("label.rd")
|
17
|
+
assert_equal(rbl, @suite.get_rbl_file("label.rd"))
|
18
|
+
assert_equal(1, @suite.rbl_files.size)
|
19
|
+
end
|
20
|
+
|
21
|
+
def test_add_rbl_file
|
22
|
+
assert_equal([], @suite.rbl_files)
|
23
|
+
rbl = @suite.add_rbl_file("label.rd")
|
24
|
+
assert_kind_of(RBLFile, rbl)
|
25
|
+
assert_equal(1, @suite.rbl_files.size)
|
26
|
+
assert_equal("label", @suite.rbl_files[0].filename)
|
27
|
+
assert_equal(rbl, @suite.rbl_files[0])
|
28
|
+
|
29
|
+
assert_nothing_raised do
|
30
|
+
@suite.add_rbl_file("not-exist-label.rd")
|
31
|
+
end
|
32
|
+
end
|
33
|
+
|
34
|
+
def test_refer
|
35
|
+
assert_equal(["label", "label:0"], @suite.refer("label1", "label.rd"))
|
36
|
+
assert_equal(["label2", "Label-0"], @suite.refer("label1", "label2.rd"))
|
37
|
+
assert_equal(["label", "label:0"], @suite.refer("label1", "label"))
|
38
|
+
assert_equal(["label", "label:1"], @suite.refer("label2", "label.rd"))
|
39
|
+
assert_equal(["label", nil], @suite.refer("label3", "label.rd"))
|
40
|
+
fns = @suite.rbl_files.collect{|i| i.filename }
|
41
|
+
assert_equal(["label", "label2"], fns)
|
42
|
+
end
|
43
|
+
end
|
@@ -0,0 +1,496 @@
|
|
1
|
+
require 'test/unit'
|
2
|
+
|
3
|
+
require 'rd/rd2html-lib'
|
4
|
+
require 'rd/tree'
|
5
|
+
require 'rd/element'
|
6
|
+
require 'rd/block-element'
|
7
|
+
require 'rd/list'
|
8
|
+
require 'rd/desclist'
|
9
|
+
require 'rd/methodlist'
|
10
|
+
require 'rd/inline-element'
|
11
|
+
require 'rd/rd-struct'
|
12
|
+
|
13
|
+
include RD
|
14
|
+
|
15
|
+
class TestRD2HTMLVisitor < Test::Unit::TestCase
|
16
|
+
|
17
|
+
def setup
|
18
|
+
@vis = RD2HTMLVisitor.new
|
19
|
+
@vis.class.module_eval {
|
20
|
+
public :xml_decl
|
21
|
+
public :forward_links, :backward_links
|
22
|
+
public :document_title
|
23
|
+
public :html_content_type
|
24
|
+
public :html_title
|
25
|
+
public :html_open_tag
|
26
|
+
public :link_to_css
|
27
|
+
public :prepare_footnotes
|
28
|
+
public :make_foottext
|
29
|
+
}
|
30
|
+
@ch1 = ["a"]
|
31
|
+
@ch2 = ["a", "b"]
|
32
|
+
@ch3 = ["a\n"]
|
33
|
+
@ch0 = []
|
34
|
+
|
35
|
+
@tr_fn = Tree.new_with_document_struct(DocumentStructure::RD)
|
36
|
+
@tr_fn.root = DocumentElement.new
|
37
|
+
fn1, fn2 = nil
|
38
|
+
@tr_fn.root.build do
|
39
|
+
new TextBlock do
|
40
|
+
fn1 = new Footnote do
|
41
|
+
new StringElement, "footnote 1"
|
42
|
+
end
|
43
|
+
fn2 = new Footnote do
|
44
|
+
new StringElement, "footnote 2"
|
45
|
+
end
|
46
|
+
end
|
47
|
+
end
|
48
|
+
@fn1_fn = fn1
|
49
|
+
@fn2_fn = fn2
|
50
|
+
|
51
|
+
@tr2_fn = Tree.new_with_document_struct(DocumentStructure::RD)
|
52
|
+
@tr2_fn.root = DocumentElement.new
|
53
|
+
@tr2_fn.root.build do
|
54
|
+
new Headline, 1
|
55
|
+
new TextBlock do
|
56
|
+
new StringElement, "string"
|
57
|
+
end
|
58
|
+
end
|
59
|
+
end
|
60
|
+
|
61
|
+
def test_xml_decl
|
62
|
+
vis_with_charset = RD2HTMLVisitor.new
|
63
|
+
vis_with_charset.charset = "CharSet"
|
64
|
+
assert_equal(%|<?xml version="1.0" encoding="CharSet" ?>|,
|
65
|
+
vis_with_charset.xml_decl)
|
66
|
+
vis_no_charset = RD2HTMLVisitor.new
|
67
|
+
assert_equal(%|<?xml version="1.0" ?>|,
|
68
|
+
vis_no_charset.xml_decl)
|
69
|
+
end
|
70
|
+
|
71
|
+
def test_html_open_tag
|
72
|
+
vis_with_lang = RD2HTMLVisitor.new
|
73
|
+
vis_with_lang.lang = "Language"
|
74
|
+
assert_equal(%|<html xmlns="http://www.w3.org/1999/xhtml" lang="Language"|+
|
75
|
+
%| xml:lang="Language">|, vis_with_lang.html_open_tag)
|
76
|
+
|
77
|
+
vis_no_lang = RD2HTMLVisitor.new
|
78
|
+
assert_equal(%|<html xmlns="http://www.w3.org/1999/xhtml">|,
|
79
|
+
vis_no_lang.html_open_tag)
|
80
|
+
end
|
81
|
+
|
82
|
+
def test_html_title
|
83
|
+
vis_with_title = RD2HTMLVisitor.new
|
84
|
+
vis_with_title.title = "Title"
|
85
|
+
assert_equal("<title>Title</title>", vis_with_title.html_title)
|
86
|
+
|
87
|
+
vis_no_title = RD2HTMLVisitor.new
|
88
|
+
assert_equal("<title>Untitled</title>", vis_no_title.html_title)
|
89
|
+
end
|
90
|
+
|
91
|
+
def test_html_content_type
|
92
|
+
vis_with_charset = RD2HTMLVisitor.new
|
93
|
+
vis_with_charset.charset = "CharSet"
|
94
|
+
assert_equal(%|<meta http-equiv="Content-type" | +
|
95
|
+
%|content="text/html; charset=CharSet" | +
|
96
|
+
"/>", vis_with_charset.html_content_type)
|
97
|
+
vis_no_charset = RD2HTMLVisitor.new
|
98
|
+
assert_equal(nil, vis_no_charset.html_content_type)
|
99
|
+
end
|
100
|
+
|
101
|
+
def test_link_to_css
|
102
|
+
vis_with_css = RD2HTMLVisitor.new
|
103
|
+
vis_with_css.css = "CSS.css"
|
104
|
+
assert_equal(%|<link href="CSS.css" type="text/css" rel="stylesheet"| +
|
105
|
+
" />", vis_with_css.link_to_css)
|
106
|
+
vis_no_css = RD2HTMLVisitor.new
|
107
|
+
assert_equal(nil, vis_no_css.link_to_css)
|
108
|
+
end
|
109
|
+
|
110
|
+
def test_forward_links
|
111
|
+
vis_rel1 = RD2HTMLVisitor.new
|
112
|
+
vis_rel1.html_link_rel["rel1"] = "REL1"
|
113
|
+
assert_equal('<link href="REL1" rel="rel1" />', vis_rel1.forward_links)
|
114
|
+
|
115
|
+
vis_rel2 = vis_rel1
|
116
|
+
vis_rel2.html_link_rel["rel2"] = "REL2"
|
117
|
+
assert_equal('<link href="REL1" rel="rel1" />' + "\n" +
|
118
|
+
'<link href="REL2" rel="rel2" />', vis_rel2.forward_links)
|
119
|
+
|
120
|
+
vis_no_rel = RD2HTMLVisitor.new
|
121
|
+
assert_equal(nil, vis_no_rel.forward_links)
|
122
|
+
end
|
123
|
+
|
124
|
+
def test_backward_links
|
125
|
+
vis_rev1 = RD2HTMLVisitor.new
|
126
|
+
vis_rev1.html_link_rev["rev1"] = "REV1"
|
127
|
+
assert_equal('<link href="REV1" rev="rev1" />', vis_rev1.backward_links)
|
128
|
+
|
129
|
+
vis_rev2 = vis_rev1
|
130
|
+
vis_rev2.html_link_rev["rev2"] = "REV2"
|
131
|
+
assert_equal('<link href="REV1" rev="rev1" />' + "\n" +
|
132
|
+
'<link href="REV2" rev="rev2" />', vis_rev2.backward_links)
|
133
|
+
|
134
|
+
vis_no_rev = RD2HTMLVisitor.new
|
135
|
+
assert_equal(nil, vis_no_rev.backward_links)
|
136
|
+
end
|
137
|
+
|
138
|
+
|
139
|
+
def test_document_title
|
140
|
+
vis_titled = RD2HTMLVisitor.new
|
141
|
+
vis_titled.title = "Title"
|
142
|
+
assert_equal("Title", vis_titled.document_title)
|
143
|
+
|
144
|
+
vis_with_filename = RD2HTMLVisitor.new
|
145
|
+
vis_with_filename.filename = "FileName"
|
146
|
+
assert_equal("FileName", vis_with_filename.document_title)
|
147
|
+
|
148
|
+
vis_untitled = RD2HTMLVisitor.new
|
149
|
+
assert_equal("Untitled", vis_untitled.document_title)
|
150
|
+
end
|
151
|
+
|
152
|
+
def test_apply_to_Headline
|
153
|
+
tr = Tree.new_with_document_struct(DocumentStructure::RD)
|
154
|
+
tr.root = DocumentElement.new
|
155
|
+
hl1, hl2 = nil
|
156
|
+
tr.root.build do
|
157
|
+
hl1 = new Headline, 1 do
|
158
|
+
new StringElement, "headline 1"
|
159
|
+
end
|
160
|
+
hl2 = new Headline, 2 do
|
161
|
+
new StringElement, "headline 2"
|
162
|
+
end
|
163
|
+
end
|
164
|
+
@vis.prepare_labels(tr, "label:")
|
165
|
+
|
166
|
+
assert_equal(expect_for_hl1(@ch1), @vis.apply_to_Headline(hl1, @ch1))
|
167
|
+
assert_equal(expect_for_hl1(@ch2), @vis.apply_to_Headline(hl1, @ch2))
|
168
|
+
assert_equal(expect_for_hl1(@ch0), @vis.apply_to_Headline(hl1, @ch0))
|
169
|
+
assert_equal(expect_for_hl2(@ch1), @vis.apply_to_Headline(hl2, @ch1))
|
170
|
+
assert_equal(expect_for_hl2(@ch2), @vis.apply_to_Headline(hl2, @ch2))
|
171
|
+
assert_equal(expect_for_hl2(@ch0), @vis.apply_to_Headline(hl2, @ch0))
|
172
|
+
end
|
173
|
+
|
174
|
+
def expect_for_hl1(children)
|
175
|
+
%|<h1><a name="label:0" id="label:0">#{children.join('')}</a></h1><!-- RDLabel: "headline 1" -->|
|
176
|
+
end
|
177
|
+
|
178
|
+
def expect_for_hl2(children)
|
179
|
+
%|<h2><a name="label:1" id="label:1">#{children.join('')}</a></h2><!-- RDLabel: "headline 2" -->|
|
180
|
+
end
|
181
|
+
|
182
|
+
def test_apply_to_TextBlock
|
183
|
+
tb = TextBlock.new
|
184
|
+
assert_equal("<p>a</p>", @vis.apply_to_TextBlock(tb, @ch1))
|
185
|
+
assert_equal("<p>ab</p>", @vis.apply_to_TextBlock(tb, @ch2))
|
186
|
+
assert_equal("<p>a</p>", @vis.apply_to_TextBlock(tb, @ch3))
|
187
|
+
assert_equal("<p></p>", @vis.apply_to_TextBlock(tb, @ch0))
|
188
|
+
|
189
|
+
tb_in_list = TextBlock.new
|
190
|
+
li = ItemListItem.new
|
191
|
+
li.add_child_under_document_struct(tb_in_list, DocumentStructure::RD)
|
192
|
+
assert_equal("a", @vis.apply_to_TextBlock(tb_in_list, @ch1))
|
193
|
+
assert_equal("ab", @vis.apply_to_TextBlock(tb_in_list, @ch2))
|
194
|
+
assert_equal("a", @vis.apply_to_TextBlock(tb_in_list, @ch3))
|
195
|
+
assert_equal("", @vis.apply_to_TextBlock(tb_in_list, @ch0))
|
196
|
+
|
197
|
+
tb1_in_list2 = TextBlock.new
|
198
|
+
tb2_in_list2 = TextBlock.new
|
199
|
+
li2 = ItemListItem.new
|
200
|
+
li2.add_children_under_document_struct([tb1_in_list2, tb2_in_list2],
|
201
|
+
DocumentStructure::RD)
|
202
|
+
assert_equal("<p>a</p>", @vis.apply_to_TextBlock(tb1_in_list2, @ch1))
|
203
|
+
assert_equal("<p>ab</p>", @vis.apply_to_TextBlock(tb1_in_list2, @ch2))
|
204
|
+
assert_equal("<p>a</p>", @vis.apply_to_TextBlock(tb1_in_list2, @ch3))
|
205
|
+
assert_equal("<p></p>", @vis.apply_to_TextBlock(tb1_in_list2, @ch0))
|
206
|
+
end
|
207
|
+
|
208
|
+
def test_apply_to_Verbatim
|
209
|
+
verb1 = Verbatim.new "aaa"
|
210
|
+
assert_equal("<pre>aaa</pre>", @vis.apply_to_Verbatim(verb1))
|
211
|
+
verb2 = Verbatim.new "aaa\n"
|
212
|
+
assert_equal("<pre>aaa</pre>", @vis.apply_to_Verbatim(verb2))
|
213
|
+
verb3 = Verbatim.new "aaa\nbbb"
|
214
|
+
assert_equal("<pre>aaa\nbbb</pre>", @vis.apply_to_Verbatim(verb3))
|
215
|
+
verb_empty = Verbatim.new ""
|
216
|
+
assert_equal("<pre></pre>", @vis.apply_to_Verbatim(verb_empty))
|
217
|
+
verb_amp = Verbatim.new "&"
|
218
|
+
assert_equal("<pre>&</pre>", @vis.apply_to_Verbatim(verb_amp))
|
219
|
+
verb_lt = Verbatim.new "<"
|
220
|
+
assert_equal("<pre><</pre>", @vis.apply_to_Verbatim(verb_lt))
|
221
|
+
verb_gt = Verbatim.new ">"
|
222
|
+
assert_equal("<pre>></pre>", @vis.apply_to_Verbatim(verb_gt))
|
223
|
+
|
224
|
+
verb3 = Verbatim.new ["aaa\n", "bbb"]
|
225
|
+
assert_equal("<pre>aaa\nbbb</pre>", @vis.apply_to_Verbatim(verb3))
|
226
|
+
end
|
227
|
+
|
228
|
+
def test_apply_to_ItemList
|
229
|
+
list = ItemList.new
|
230
|
+
assert_equal("<ul>\na\n</ul>", @vis.apply_to_ItemList(list, @ch1))
|
231
|
+
assert_equal("<ul>\na\nb\n</ul>", @vis.apply_to_ItemList(list, @ch2))
|
232
|
+
assert_equal("<ul>\na\n</ul>", @vis.apply_to_ItemList(list, @ch3))
|
233
|
+
assert_equal("<ul>\n\n</ul>", @vis.apply_to_ItemList(list, @ch0))
|
234
|
+
end
|
235
|
+
|
236
|
+
def test_apply_to_EnumList
|
237
|
+
list = EnumList.new
|
238
|
+
assert_equal("<ol>\na\n</ol>", @vis.apply_to_EnumList(list, @ch1))
|
239
|
+
assert_equal("<ol>\na\nb\n</ol>", @vis.apply_to_EnumList(list, @ch2))
|
240
|
+
assert_equal("<ol>\na\n</ol>", @vis.apply_to_EnumList(list, @ch3))
|
241
|
+
assert_equal("<ol>\n\n</ol>", @vis.apply_to_EnumList(list, @ch0))
|
242
|
+
end
|
243
|
+
|
244
|
+
def test_apply_to_DescList
|
245
|
+
list = DescList.new
|
246
|
+
assert_equal("<dl>\na\n</dl>", @vis.apply_to_DescList(list, @ch1))
|
247
|
+
assert_equal("<dl>\na\nb\n</dl>", @vis.apply_to_DescList(list, @ch2))
|
248
|
+
assert_equal("<dl>\na\n</dl>", @vis.apply_to_DescList(list, @ch3))
|
249
|
+
assert_equal("<dl>\n\n</dl>", @vis.apply_to_DescList(list, @ch0))
|
250
|
+
end
|
251
|
+
|
252
|
+
def test_apply_to_MethodList
|
253
|
+
list = MethodList.new
|
254
|
+
assert_equal("<dl>\na\n</dl>", @vis.apply_to_MethodList(list, @ch1))
|
255
|
+
assert_equal("<dl>\na\nb\n</dl>", @vis.apply_to_MethodList(list, @ch2))
|
256
|
+
assert_equal("<dl>\na\n</dl>", @vis.apply_to_MethodList(list, @ch3))
|
257
|
+
assert_equal("<dl>\n\n</dl>", @vis.apply_to_MethodList(list, @ch0))
|
258
|
+
end
|
259
|
+
|
260
|
+
def test_apply_to_ItemListItem
|
261
|
+
item = ItemListItem.new
|
262
|
+
assert_equal("<li>a</li>", @vis.apply_to_ItemListItem(item, @ch1))
|
263
|
+
assert_equal("<li>a\nb</li>", @vis.apply_to_ItemListItem(item, @ch2))
|
264
|
+
assert_equal("<li>a</li>", @vis.apply_to_ItemListItem(item, @ch3))
|
265
|
+
assert_equal("<li></li>", @vis.apply_to_ItemListItem(item, @ch0))
|
266
|
+
end
|
267
|
+
|
268
|
+
def test_apply_to_EnumListItem
|
269
|
+
item = EnumListItem.new
|
270
|
+
assert_equal("<li>a</li>", @vis.apply_to_EnumListItem(item, @ch1))
|
271
|
+
assert_equal("<li>a\nb</li>", @vis.apply_to_EnumListItem(item, @ch2))
|
272
|
+
assert_equal("<li>a</li>", @vis.apply_to_EnumListItem(item, @ch3))
|
273
|
+
assert_equal("<li></li>", @vis.apply_to_EnumListItem(item, @ch0))
|
274
|
+
end
|
275
|
+
|
276
|
+
def test_apply_to_DescListItem
|
277
|
+
tr = Tree.new_with_document_struct(DocumentStructure::RD)
|
278
|
+
tr.root = DocumentElement.new
|
279
|
+
di1, di2 = nil
|
280
|
+
tr.root.build do
|
281
|
+
new DescList do
|
282
|
+
di1 = new DescListItem do
|
283
|
+
make_term do
|
284
|
+
new StringElement, "desclist 1"
|
285
|
+
end
|
286
|
+
end
|
287
|
+
di2 = new DescListItem do
|
288
|
+
make_term do
|
289
|
+
new StringElement, "desclist 2"
|
290
|
+
end
|
291
|
+
end
|
292
|
+
end
|
293
|
+
end
|
294
|
+
|
295
|
+
@vis.prepare_labels(tr, "label:")
|
296
|
+
|
297
|
+
assert_equal(expect_for_di1_with_child("term1", @ch1),
|
298
|
+
@vis.apply_to_DescListItem(di1, ["term1"], @ch1))
|
299
|
+
assert_equal(expect_for_di1_with_child("term1term2", @ch1),
|
300
|
+
@vis.apply_to_DescListItem(di1, ["term1", "term2"], @ch1))
|
301
|
+
assert_equal(expect_for_di1_with_child("term1", @ch2),
|
302
|
+
@vis.apply_to_DescListItem(di1, ["term1"], @ch2))
|
303
|
+
assert_equal(expect_for_di1_with_child("term1", @ch3),
|
304
|
+
@vis.apply_to_DescListItem(di1, ["term1"], @ch3))
|
305
|
+
assert_equal(expect_for_di1_no_child("term1"),
|
306
|
+
@vis.apply_to_DescListItem(di1, ["term1"], @ch0))
|
307
|
+
assert_equal(expect_for_di1_no_child("term1term2"),
|
308
|
+
@vis.apply_to_DescListItem(di1, ["term1", "term2"], @ch0))
|
309
|
+
assert_equal(expect_for_di2_with_child("term1", @ch1),
|
310
|
+
@vis.apply_to_DescListItem(di2, ["term1"], @ch1))
|
311
|
+
assert_equal(expect_for_di2_no_child("term1"),
|
312
|
+
@vis.apply_to_DescListItem(di2, ["term1"], @ch0))
|
313
|
+
|
314
|
+
end
|
315
|
+
|
316
|
+
def expect_for_di1_with_child(term, children)
|
317
|
+
%|<dt><a name="label:0" id="label:0">#{term}</a></dt><!-- RDLabel: "desclist 1" -->\n| +
|
318
|
+
%|<dd>\n#{children.join("\n").chomp}\n</dd>|
|
319
|
+
end
|
320
|
+
|
321
|
+
def expect_for_di1_no_child(term)
|
322
|
+
%|<dt><a name="label:0" id="label:0">#{term}</a></dt><!-- RDLabel: "desclist 1" -->|
|
323
|
+
end
|
324
|
+
|
325
|
+
def expect_for_di2_with_child(term, children)
|
326
|
+
%|<dt><a name="label:1" id="label:1">#{term}</a></dt><!-- RDLabel: "desclist 2" -->\n| +
|
327
|
+
%|<dd>\n#{children.join("\n").chomp}\n</dd>|
|
328
|
+
end
|
329
|
+
|
330
|
+
def expect_for_di2_no_child(term)
|
331
|
+
%|<dt><a name="label:1" id="label:1">#{term}</a></dt><!-- RDLabel: "desclist 2" -->|
|
332
|
+
end
|
333
|
+
|
334
|
+
# MethodListItem ...
|
335
|
+
|
336
|
+
def check_apply_to_NonterminalInline(type, tag)
|
337
|
+
element = type.new
|
338
|
+
name = type.to_s.sub(/RD::/, "")
|
339
|
+
|
340
|
+
assert_equal("<#{tag}>a</#{tag}>",
|
341
|
+
@vis.send("apply_to_#{name}", element, @ch1))
|
342
|
+
assert_equal("<#{tag}>ab</#{tag}>",
|
343
|
+
@vis.send("apply_to_#{name}", element, @ch2))
|
344
|
+
assert_equal("<#{tag}>a\n</#{tag}>",
|
345
|
+
@vis.send("apply_to_#{name}", element, @ch3))
|
346
|
+
assert_equal("<#{tag}></#{tag}>",
|
347
|
+
@vis.send("apply_to_#{name}", element, @ch0))
|
348
|
+
end
|
349
|
+
|
350
|
+
def test_apply_to_Emphasis
|
351
|
+
check_apply_to_NonterminalInline(Emphasis, "em")
|
352
|
+
end
|
353
|
+
|
354
|
+
def test_apply_to_Code
|
355
|
+
check_apply_to_NonterminalInline(Code, "code")
|
356
|
+
end
|
357
|
+
|
358
|
+
def test_apply_to_Var
|
359
|
+
check_apply_to_NonterminalInline(Var, "var")
|
360
|
+
end
|
361
|
+
|
362
|
+
def test_apply_to_Keyboard
|
363
|
+
check_apply_to_NonterminalInline(Keyboard, "kbd")
|
364
|
+
end
|
365
|
+
|
366
|
+
def test_apply_to_StringElement
|
367
|
+
se1 = StringElement.new "a"
|
368
|
+
assert_equal("a", @vis.apply_to_StringElement(se1))
|
369
|
+
se2 = StringElement.new "a\nb"
|
370
|
+
assert_equal("a\nb", @vis.apply_to_StringElement(se2))
|
371
|
+
se_empty = StringElement.new ""
|
372
|
+
assert_equal("", @vis.apply_to_StringElement(se_empty))
|
373
|
+
se_ws = StringElement.new " "
|
374
|
+
assert_equal(" ", @vis.apply_to_StringElement(se_ws))
|
375
|
+
se_lt = StringElement.new "<"
|
376
|
+
assert_equal("<", @vis.apply_to_StringElement(se_lt))
|
377
|
+
se_gt = StringElement.new ">"
|
378
|
+
assert_equal(">", @vis.apply_to_StringElement(se_gt))
|
379
|
+
se_amp = StringElement.new "&"
|
380
|
+
assert_equal("&", @vis.apply_to_StringElement(se_amp))
|
381
|
+
end
|
382
|
+
|
383
|
+
def test_apply_to_Verb
|
384
|
+
verb1 = Verb.new "a"
|
385
|
+
assert_equal("a", @vis.apply_to_Verb(verb1))
|
386
|
+
verb2 = Verb.new "a\nb"
|
387
|
+
assert_equal("a\nb", @vis.apply_to_Verb(verb2))
|
388
|
+
verb_empty = Verb.new ""
|
389
|
+
assert_equal("", @vis.apply_to_Verb(verb_empty))
|
390
|
+
verb_ws = Verb.new " "
|
391
|
+
assert_equal(" ", @vis.apply_to_Verb(verb_ws))
|
392
|
+
verb_lt = Verb.new "<"
|
393
|
+
assert_equal("<", @vis.apply_to_Verb(verb_lt))
|
394
|
+
verb_gt = Verb.new ">"
|
395
|
+
assert_equal(">", @vis.apply_to_Verb(verb_gt))
|
396
|
+
verb_amp = Verb.new "&"
|
397
|
+
assert_equal("&", @vis.apply_to_Verb(verb_amp))
|
398
|
+
end
|
399
|
+
|
400
|
+
def test_apply_to_Footnote
|
401
|
+
@vis.prepare_footnotes(@tr_fn)
|
402
|
+
assert_equal([], @vis.foottexts)
|
403
|
+
|
404
|
+
assert_equal(expect_for_footnote(1),
|
405
|
+
@vis.apply_to_Footnote(@fn1_fn, ["footnote 1"]))
|
406
|
+
assert_equal([["footnote 1"]], @vis.foottexts)
|
407
|
+
|
408
|
+
assert_equal(expect_for_footnote(2),
|
409
|
+
@vis.apply_to_Footnote(@fn2_fn, ["footnote", " 2"]))
|
410
|
+
assert_equal([["footnote 1"], ["footnote", " 2"]], @vis.foottexts)
|
411
|
+
|
412
|
+
@vis.prepare_footnotes(@tr2_fn)
|
413
|
+
assert_raises(ArgumentError) do
|
414
|
+
@vis.apply_to_Footnote(@fn2_fn, [])
|
415
|
+
end
|
416
|
+
end
|
417
|
+
|
418
|
+
def expect_for_footnote(num)
|
419
|
+
%Q|<a name="footmark-#{num}" id="footmark-#{num}" href="#foottext-#{num}">|+
|
420
|
+
%Q|<sup><small>*#{num}</small></sup></a>|
|
421
|
+
end
|
422
|
+
|
423
|
+
def test_get_footnote_num
|
424
|
+
@vis.prepare_footnotes(@tr_fn)
|
425
|
+
assert_equal(1, @vis.get_footnote_num(@fn1_fn))
|
426
|
+
assert_equal(2, @vis.get_footnote_num(@fn2_fn))
|
427
|
+
assert_equal(nil, @vis.get_footnote_num(Footnote.new))
|
428
|
+
@vis.prepare_footnotes(@tr2_fn)
|
429
|
+
assert_equal(nil, @vis.get_footnote_num(@fn1_fn))
|
430
|
+
|
431
|
+
assert_raises(ArgumentError) do
|
432
|
+
@vis.get_footnote_num(Headline.new(1))
|
433
|
+
end
|
434
|
+
end
|
435
|
+
|
436
|
+
def test_prepare_footnotes
|
437
|
+
@vis.prepare_footnotes(@tr_fn)
|
438
|
+
assert_equal([@fn1_fn, @fn2_fn], @vis.footnotes)
|
439
|
+
|
440
|
+
@vis.prepare_footnotes(@tr2_fn)
|
441
|
+
assert_equal([], @vis.footnotes)
|
442
|
+
end
|
443
|
+
|
444
|
+
def test_add_foottext
|
445
|
+
@vis.prepare_footnotes(@tr_fn)
|
446
|
+
assert_equal([], @vis.foottexts)
|
447
|
+
@vis.add_foottext(@vis.get_footnote_num(@fn1_fn), ["footnote 1"])
|
448
|
+
assert_equal([["footnote 1"]], @vis.foottexts)
|
449
|
+
@vis.add_foottext(@vis.get_footnote_num(@fn2_fn), ["footnote", "2"])
|
450
|
+
assert_equal([["footnote 1"], ["footnote", "2"]], @vis.foottexts)
|
451
|
+
assert_raises(ArgumentError) do
|
452
|
+
@vis.add_foottext(3, "footnote 3")
|
453
|
+
end
|
454
|
+
end
|
455
|
+
|
456
|
+
def test_apply_to_Foottext
|
457
|
+
@vis.prepare_footnotes(@tr_fn)
|
458
|
+
|
459
|
+
exp1 = %|<a name="foottext-1" id="foottext-1" href="#footmark-1">| +
|
460
|
+
%|<sup><small>*1</small></sup></a>| +
|
461
|
+
%|<small>footnote 1</small><br />|
|
462
|
+
assert_equal(exp1, @vis.apply_to_Foottext(@fn1_fn, ["footnote 1"]))
|
463
|
+
exp2 = %|<a name="foottext-2" id="foottext-2" href="#footmark-2">| +
|
464
|
+
%|<sup><small>*2</small></sup></a>| +
|
465
|
+
%|<small>footnote 2</small><br />|
|
466
|
+
assert_equal(exp2, @vis.apply_to_Foottext(@fn2_fn, ["footnote", " 2"]))
|
467
|
+
|
468
|
+
@vis.prepare_footnotes(@tr2_fn)
|
469
|
+
assert_raises(ArgumentError) do
|
470
|
+
@vis.apply_to_Foottext(@fn1_fn, ["footnote 1"])
|
471
|
+
end
|
472
|
+
end
|
473
|
+
|
474
|
+
def test_make_foottext
|
475
|
+
@vis.prepare_footnotes(@tr_fn)
|
476
|
+
ft1 = ["footnote 1"]
|
477
|
+
ft2 = ["footnote", " 2"]
|
478
|
+
@vis.add_foottext(@vis.get_footnote_num(@fn1_fn), ft1)
|
479
|
+
@vis.add_foottext(@vis.get_footnote_num(@fn2_fn), ft2)
|
480
|
+
exp1 = @vis.apply_to_Foottext(@fn1_fn, ft1)
|
481
|
+
exp2 = @vis.apply_to_Foottext(@fn2_fn, ft2)
|
482
|
+
assert_equal(%|<hr />\n<p class="foottext">\n#{exp1}\n#{exp2}\n</p>|, @vis.make_foottext)
|
483
|
+
|
484
|
+
@vis.prepare_footnotes(@tr2_fn)
|
485
|
+
assert_equal(nil, @vis.make_foottext)
|
486
|
+
end
|
487
|
+
|
488
|
+
def test_hyphen_escape
|
489
|
+
assert_equal("­­", @vis.hyphen_escape("--"))
|
490
|
+
assert_equal("-", @vis.hyphen_escape("-"))
|
491
|
+
assert_equal("­­-", @vis.hyphen_escape("---"))
|
492
|
+
assert_equal("- -", @vis.hyphen_escape("- -"))
|
493
|
+
assert_equal("aa­­bb", @vis.hyphen_escape("aa--bb"))
|
494
|
+
assert_equal("", @vis.hyphen_escape(""))
|
495
|
+
end
|
496
|
+
end
|