typo 3.99.0
Sign up to get free protection for your applications and to get access to all the features.
- data/.DS_Store +0 -0
- data/CHANGELOG +718 -0
- data/MAINTAINERS +30 -0
- data/MIT-LICENSE +21 -0
- data/README +92 -0
- data/Rakefile +10 -0
- data/app/apis/blogger_service.rb +94 -0
- data/app/apis/meta_weblog_service.rb +197 -0
- data/app/apis/movable_type_service.rb +150 -0
- data/app/apis/typo_web_service.rb +26 -0
- data/app/controllers/accounts_controller.rb +52 -0
- data/app/controllers/admin/base_controller.rb +21 -0
- data/app/controllers/admin/blacklist_controller.rb +50 -0
- data/app/controllers/admin/cache_controller.rb +31 -0
- data/app/controllers/admin/categories_controller.rb +64 -0
- data/app/controllers/admin/comments_controller.rb +57 -0
- data/app/controllers/admin/content_controller.rb +147 -0
- data/app/controllers/admin/general_controller.rb +42 -0
- data/app/controllers/admin/pages_controller.rb +50 -0
- data/app/controllers/admin/resources_controller.rb +98 -0
- data/app/controllers/admin/sidebar_controller.rb +74 -0
- data/app/controllers/admin/textfilters_controller.rb +104 -0
- data/app/controllers/admin/themes_controller.rb +20 -0
- data/app/controllers/admin/trackbacks_controller.rb +54 -0
- data/app/controllers/admin/users_controller.rb +41 -0
- data/app/controllers/application.rb +66 -0
- data/app/controllers/articles_controller.rb +218 -0
- data/app/controllers/backend_controller.rb +11 -0
- data/app/controllers/content_controller.rb +98 -0
- data/app/controllers/live_controller.rb +10 -0
- data/app/controllers/redirect_controller.rb +16 -0
- data/app/controllers/sidebar_controller.rb +50 -0
- data/app/controllers/textfilter_controller.rb +22 -0
- data/app/controllers/theme_controller.rb +52 -0
- data/app/controllers/xml_controller.rb +111 -0
- data/app/helpers/accounts_helper.rb +2 -0
- data/app/helpers/admin/base_helper.rb +124 -0
- data/app/helpers/admin/blacklist_helper.rb +2 -0
- data/app/helpers/admin/cache_helper.rb +2 -0
- data/app/helpers/admin/comments_helper.rb +2 -0
- data/app/helpers/admin/content_helper.rb +2 -0
- data/app/helpers/admin/general_helper.rb +2 -0
- data/app/helpers/admin/pages_helper.rb +2 -0
- data/app/helpers/admin/resources_helper.rb +2 -0
- data/app/helpers/admin/sidebar_helper.rb +2 -0
- data/app/helpers/admin/textfilters_helper.rb +2 -0
- data/app/helpers/admin/themes_helper.rb +2 -0
- data/app/helpers/admin/trackbacks_helper.rb +2 -0
- data/app/helpers/admin/users_helper.rb +2 -0
- data/app/helpers/application_helper.rb +92 -0
- data/app/helpers/articles_helper.rb +163 -0
- data/app/helpers/backend_helper.rb +2 -0
- data/app/helpers/content_helper.rb +3 -0
- data/app/helpers/mail_helper.rb +6 -0
- data/app/helpers/redirect_helper.rb +2 -0
- data/app/helpers/sidebar_helper.rb +22 -0
- data/app/helpers/sidebars/plugin_helper.rb +2 -0
- data/app/helpers/text_filter_plugin_helper.rb +2 -0
- data/app/helpers/textfilter_helper.rb +2 -0
- data/app/helpers/theme_helper.rb +23 -0
- data/app/helpers/xml_helper.rb +21 -0
- data/app/models/aggregations/audioscrobbler.rb +54 -0
- data/app/models/aggregations/backpack.rb +57 -0
- data/app/models/aggregations/delicious.rb +57 -0
- data/app/models/aggregations/flickr.rb +89 -0
- data/app/models/aggregations/fortythree.rb +62 -0
- data/app/models/aggregations/magnolia.rb +81 -0
- data/app/models/aggregations/tada.rb +75 -0
- data/app/models/aggregations/technorati.rb +51 -0
- data/app/models/aggregations/upcoming.rb +74 -0
- data/app/models/article.rb +211 -0
- data/app/models/blacklist_pattern.rb +22 -0
- data/app/models/blog.rb +162 -0
- data/app/models/blog_sweeper.rb +23 -0
- data/app/models/category.rb +62 -0
- data/app/models/comment.rb +76 -0
- data/app/models/config_manager.rb +80 -0
- data/app/models/content.rb +222 -0
- data/app/models/content_observer.rb +5 -0
- data/app/models/content_state/base.rb +51 -0
- data/app/models/content_state/draft.rb +40 -0
- data/app/models/content_state/factory.rb +16 -0
- data/app/models/content_state/just_published.rb +47 -0
- data/app/models/content_state/new.rb +45 -0
- data/app/models/content_state/publication_pending.rb +43 -0
- data/app/models/content_state/published.rb +35 -0
- data/app/models/email_notifier.rb +9 -0
- data/app/models/notification_mailer.rb +34 -0
- data/app/models/page.rb +20 -0
- data/app/models/page_cache.rb +29 -0
- data/app/models/ping.rb +129 -0
- data/app/models/redirect.rb +3 -0
- data/app/models/resource.rb +76 -0
- data/app/models/sidebar.rb +32 -0
- data/app/models/simple_cache.rb +37 -0
- data/app/models/tag.rb +63 -0
- data/app/models/text_filter.rb +111 -0
- data/app/models/theme.rb +44 -0
- data/app/models/trackback.rb +51 -0
- data/app/models/trigger.rb +31 -0
- data/app/models/user.rb +113 -0
- data/app/models/web_notifier.rb +7 -0
- data/app/views/accounts/login.rhtml +24 -0
- data/app/views/accounts/logout.rhtml +12 -0
- data/app/views/accounts/signup.rhtml +26 -0
- data/app/views/accounts/welcome.rhtml +13 -0
- data/app/views/admin/base/_recent_comments.rhtml +10 -0
- data/app/views/admin/base/_recent_trackbacks.rhtml +10 -0
- data/app/views/admin/blacklist/_blacklist_patterns.rhtml +16 -0
- data/app/views/admin/blacklist/_form.rhtml +15 -0
- data/app/views/admin/blacklist/_quick_post.rhtml +16 -0
- data/app/views/admin/blacklist/destroy.rhtml +10 -0
- data/app/views/admin/blacklist/edit.rhtml +14 -0
- data/app/views/admin/blacklist/list.rhtml +13 -0
- data/app/views/admin/cache/list.rhtml +8 -0
- data/app/views/admin/categories/_categories.rhtml +14 -0
- data/app/views/admin/categories/_form.rhtml +7 -0
- data/app/views/admin/categories/_quick_post.rhtml +11 -0
- data/app/views/admin/categories/destroy.rhtml +10 -0
- data/app/views/admin/categories/edit.rhtml +13 -0
- data/app/views/admin/categories/list.rhtml +15 -0
- data/app/views/admin/categories/reorder.rhtml +9 -0
- data/app/views/admin/categories/show.rhtml +18 -0
- data/app/views/admin/comments/_form.rhtml +19 -0
- data/app/views/admin/comments/comments.rhtml +4 -0
- data/app/views/admin/comments/destroy.rhtml +11 -0
- data/app/views/admin/comments/edit.rhtml +18 -0
- data/app/views/admin/comments/list.rhtml +31 -0
- data/app/views/admin/comments/new.rhtml +15 -0
- data/app/views/admin/comments/show.rhtml +10 -0
- data/app/views/admin/content/_articles.rhtml +20 -0
- data/app/views/admin/content/_attachment.rhtml +17 -0
- data/app/views/admin/content/_form.rhtml +51 -0
- data/app/views/admin/content/_pages.rhtml +3 -0
- data/app/views/admin/content/_quick_post.rhtml +20 -0
- data/app/views/admin/content/_show_categories.rhtml +9 -0
- data/app/views/admin/content/_show_resources.rhtml +9 -0
- data/app/views/admin/content/destroy.rhtml +11 -0
- data/app/views/admin/content/edit.rhtml +28 -0
- data/app/views/admin/content/list.rhtml +20 -0
- data/app/views/admin/content/new.rhtml +27 -0
- data/app/views/admin/content/preview.rhtml +3 -0
- data/app/views/admin/content/show.rhtml +25 -0
- data/app/views/admin/general/index.rhtml +216 -0
- data/app/views/admin/general/update_database.rhtml +44 -0
- data/app/views/admin/pages/_form.rhtml +19 -0
- data/app/views/admin/pages/_pages.rhtml +18 -0
- data/app/views/admin/pages/_quick_post.rhtml +21 -0
- data/app/views/admin/pages/destroy.rhtml +11 -0
- data/app/views/admin/pages/edit.rhtml +28 -0
- data/app/views/admin/pages/list.rhtml +13 -0
- data/app/views/admin/pages/new.rhtml +24 -0
- data/app/views/admin/pages/preview.rhtml +1 -0
- data/app/views/admin/pages/show.rhtml +14 -0
- data/app/views/admin/resources/_itunes_category_add.rhtml +11 -0
- data/app/views/admin/resources/_itunes_category_edit.rhtml +32 -0
- data/app/views/admin/resources/_metadata_add.rhtml +22 -0
- data/app/views/admin/resources/_metadata_edit.rhtml +22 -0
- data/app/views/admin/resources/_mime_edit.rhtml +8 -0
- data/app/views/admin/resources/_pages.rhtml +3 -0
- data/app/views/admin/resources/_resources.rhtml +40 -0
- data/app/views/admin/resources/destroy.rhtml +11 -0
- data/app/views/admin/resources/list.rhtml +9 -0
- data/app/views/admin/resources/new.rhtml +12 -0
- data/app/views/admin/sidebar/_active.rhtml +14 -0
- data/app/views/admin/sidebar/_actives.rhtml +9 -0
- data/app/views/admin/sidebar/_available.rhtml +5 -0
- data/app/views/admin/sidebar/_availables.rhtml +5 -0
- data/app/views/admin/sidebar/_publish.rhtml +2 -0
- data/app/views/admin/sidebar/_target.rhtml +1 -0
- data/app/views/admin/sidebar/index.rhtml +34 -0
- data/app/views/admin/sidebar/publish.rjs +6 -0
- data/app/views/admin/sidebar/remove.rjs +5 -0
- data/app/views/admin/sidebar/set_active.rjs +10 -0
- data/app/views/admin/textfilters/_form.rhtml +45 -0
- data/app/views/admin/textfilters/_macros.rhtml +16 -0
- data/app/views/admin/textfilters/_textfilters.rhtml +20 -0
- data/app/views/admin/textfilters/destroy.rhtml +10 -0
- data/app/views/admin/textfilters/edit.rhtml +17 -0
- data/app/views/admin/textfilters/list.rhtml +15 -0
- data/app/views/admin/textfilters/macro_help.rhtml +3 -0
- data/app/views/admin/textfilters/new.rhtml +15 -0
- data/app/views/admin/textfilters/preview.rhtml +3 -0
- data/app/views/admin/textfilters/show.rhtml +34 -0
- data/app/views/admin/textfilters/show_help.rhtml +8 -0
- data/app/views/admin/themes/index.rhtml +12 -0
- data/app/views/admin/trackbacks/_form.rhtml +19 -0
- data/app/views/admin/trackbacks/destroy.rhtml +6 -0
- data/app/views/admin/trackbacks/edit.rhtml +14 -0
- data/app/views/admin/trackbacks/list.rhtml +31 -0
- data/app/views/admin/trackbacks/new.rhtml +15 -0
- data/app/views/admin/trackbacks/show.rhtml +14 -0
- data/app/views/admin/users/_form.rhtml +48 -0
- data/app/views/admin/users/_user.rhtml +9 -0
- data/app/views/admin/users/destroy.rhtml +14 -0
- data/app/views/admin/users/edit.rhtml +14 -0
- data/app/views/admin/users/list.rhtml +9 -0
- data/app/views/admin/users/new.rhtml +15 -0
- data/app/views/admin/users/show.rhtml +18 -0
- data/app/views/articles/_article.rhtml +4 -0
- data/app/views/articles/_comment.rhtml +7 -0
- data/app/views/articles/_comment_box.rhtml +43 -0
- data/app/views/articles/_comment_error.rhtml +1 -0
- data/app/views/articles/_trackback.rhtml +7 -0
- data/app/views/articles/archives.rhtml +22 -0
- data/app/views/articles/comment_preview.rhtml +3 -0
- data/app/views/articles/error.rhtml +3 -0
- data/app/views/articles/groupings.rhtml +14 -0
- data/app/views/articles/index.rhtml +11 -0
- data/app/views/articles/read.rhtml +70 -0
- data/app/views/articles/trackback.rxml +5 -0
- data/app/views/articles/view_page.rhtml +3 -0
- data/app/views/layouts/accounts.rhtml +22 -0
- data/app/views/layouts/administration.rhtml +75 -0
- data/app/views/layouts/sidebar.rhtml +40 -0
- data/app/views/live/search.rhtml +10 -0
- data/app/views/notification_mailer/_mail_footer.rhtml +7 -0
- data/app/views/notification_mailer/_mail_header.rhtml +1 -0
- data/app/views/notification_mailer/article.rhtml +6 -0
- data/app/views/notification_mailer/comment.rhtml +11 -0
- data/app/views/notification_mailer/trackback.rhtml +3 -0
- data/app/views/settings/done.rhtml +2 -0
- data/app/views/settings/install.rhtml +12 -0
- data/app/views/shared/_search.rhtml +10 -0
- data/app/views/sidebar/_row.rhtml +1 -0
- data/app/views/sidebar/_sidebar.rhtml +5 -0
- data/app/views/sidebar/display_plugins.rhtml +5 -0
- data/app/views/sidebar/show.rhtml +1 -0
- data/app/views/theme/static_view_test.rhtml +1 -0
- data/app/views/xml/_atom10_item_article.rxml +39 -0
- data/app/views/xml/_atom10_item_comment.rxml +13 -0
- data/app/views/xml/_atom10_item_trackback.rxml +16 -0
- data/app/views/xml/_itunes_item_resource.rxml +30 -0
- data/app/views/xml/_rss20_item_article.rxml +35 -0
- data/app/views/xml/_rss20_item_comment.rxml +7 -0
- data/app/views/xml/_rss20_item_trackback.rxml +7 -0
- data/app/views/xml/atom10_feed.rxml +18 -0
- data/app/views/xml/itunes_feed.rxml +29 -0
- data/app/views/xml/rsd.rxml +19 -0
- data/app/views/xml/rss20_feed.rxml +18 -0
- data/bin/typo +12 -0
- data/cache/META/DATA/ACTION_PARAM/localhost.3000/articles/index/.cache +540 -0
- data/cache/META/DATA/ACTION_PARAM/localhost.3000/articles/permalink/day=09&month=09&title=i-need-a-new-keyboard-and-mouse&year=2005.cache +414 -0
- data/cache/META/META/ACTION_PARAM/localhost.3000/articles/index/.cache +3 -0
- data/cache/META/META/ACTION_PARAM/localhost.3000/articles/permalink/day=09&month=09&title=i-need-a-new-keyboard-and-mouse&year=2005.cache +3 -0
- data/components/plugins/sidebars/aimpresence/content.rhtml +4 -0
- data/components/plugins/sidebars/aimpresence_controller.rb +10 -0
- data/components/plugins/sidebars/amazon/content.rhtml +4 -0
- data/components/plugins/sidebars/amazon_controller.rb +17 -0
- data/components/plugins/sidebars/archives/content.rhtml +11 -0
- data/components/plugins/sidebars/archives_controller.rb +24 -0
- data/components/plugins/sidebars/audioscrobbler/content.rhtml +10 -0
- data/components/plugins/sidebars/audioscrobbler_controller.rb +10 -0
- data/components/plugins/sidebars/backpack/content.rhtml +12 -0
- data/components/plugins/sidebars/backpack_controller.rb +17 -0
- data/components/plugins/sidebars/category/content.rhtml +10 -0
- data/components/plugins/sidebars/category_controller.rb +13 -0
- data/components/plugins/sidebars/delicious/content.rhtml +20 -0
- data/components/plugins/sidebars/delicious_controller.rb +29 -0
- data/components/plugins/sidebars/flickr/content.rhtml +15 -0
- data/components/plugins/sidebars/flickr_controller.rb +16 -0
- data/components/plugins/sidebars/fortythree/content.rhtml +8 -0
- data/components/plugins/sidebars/fortythree_controller.rb +12 -0
- data/components/plugins/sidebars/fortythreeplaces/content.rhtml +8 -0
- data/components/plugins/sidebars/fortythreeplaces_controller.rb +12 -0
- data/components/plugins/sidebars/magnolia/content.rhtml +12 -0
- data/components/plugins/sidebars/magnolia_controller.rb +17 -0
- data/components/plugins/sidebars/recent_comments/content.rhtml +12 -0
- data/components/plugins/sidebars/recent_comments_controller.rb +23 -0
- data/components/plugins/sidebars/static/content.rhtml +2 -0
- data/components/plugins/sidebars/static_controller.rb +23 -0
- data/components/plugins/sidebars/tada/content.rhtml +12 -0
- data/components/plugins/sidebars/tada_controller.rb +12 -0
- data/components/plugins/sidebars/tag/content.rhtml +8 -0
- data/components/plugins/sidebars/tag_controller.rb +18 -0
- data/components/plugins/sidebars/technorati/content.rhtml +8 -0
- data/components/plugins/sidebars/technorati_controller.rb +12 -0
- data/components/plugins/sidebars/upcoming/content.rhtml +8 -0
- data/components/plugins/sidebars/upcoming_controller.rb +11 -0
- data/components/plugins/sidebars/xbox/content.rhtml +2 -0
- data/components/plugins/sidebars/xbox_controller.rb +6 -0
- data/components/plugins/sidebars/xml/content.rhtml +12 -0
- data/components/plugins/sidebars/xml_controller.rb +11 -0
- data/components/plugins/textfilters/amazon_controller.rb +39 -0
- data/components/plugins/textfilters/code_controller.rb +59 -0
- data/components/plugins/textfilters/flickr_controller.rb +75 -0
- data/components/plugins/textfilters/htmlfilter_controller.rb +8 -0
- data/components/plugins/textfilters/lightbox_controller.rb +122 -0
- data/components/plugins/textfilters/macropost_controller.rb +14 -0
- data/components/plugins/textfilters/macropre_controller.rb +14 -0
- data/components/plugins/textfilters/markdown_controller.rb +32 -0
- data/components/plugins/textfilters/none_controller.rb +8 -0
- data/components/plugins/textfilters/smartypants_controller.rb +8 -0
- data/components/plugins/textfilters/sparkline_controller.rb +87 -0
- data/components/plugins/textfilters/textile_controller.rb +8 -0
- data/components/sidebars/README +36 -0
- data/config/boot.rb +44 -0
- data/config/database.yml +17 -0
- data/config/database.yml-pgsql +17 -0
- data/config/database.yml.example +18 -0
- data/config/environment.rb +145 -0
- data/config/environments/development.rb +17 -0
- data/config/environments/production.rb +19 -0
- data/config/environments/test.rb +26 -0
- data/config/iTunes.yml +72 -0
- data/config/lighttpd.conf +46 -0
- data/config/mail.yml +8 -0
- data/config/mail.yml.example +8 -0
- data/config/routes.rb +92 -0
- data/db/DB +0 -0
- data/db/DB.test +0 -0
- data/db/converters/README +14 -0
- data/db/converters/feed.rb +68 -0
- data/db/converters/mt-import.rb +72 -0
- data/db/converters/mt3.rb +172 -0
- data/db/converters/rss.rb +67 -0
- data/db/converters/s9y.rb +182 -0
- data/db/converters/textpattern.rb +137 -0
- data/db/converters/wordpress.rb +187 -0
- data/db/development_structure.sql +691 -0
- data/db/migrate/001_initial_schema.rb +127 -0
- data/db/migrate/002_add_user_email.rb +17 -0
- data/db/migrate/003_add_article_user_id.rb +20 -0
- data/db/migrate/004_add_sidebars.rb +31 -0
- data/db/migrate/005_add_cache_table.rb +20 -0
- data/db/migrate/006_add_pages.rb +17 -0
- data/db/migrate/007_add_permalink.rb +36 -0
- data/db/migrate/008_add_page_title.rb +9 -0
- data/db/migrate/009_add_article_guid.rb +10 -0
- data/db/migrate/010_add_tags.rb +19 -0
- data/db/migrate/011_add_article_id.rb +17 -0
- data/db/migrate/012_enlarge_settings.rb +11 -0
- data/db/migrate/013_add_textfilters.rb +33 -0
- data/db/migrate/014_move_text_filter_to_text_filter_id.rb +43 -0
- data/db/migrate/015_convert_mysql_to_innodb.rb +19 -0
- data/db/migrate/016_fix_is_primary_postgres.rb +19 -0
- data/db/migrate/017_add_comment_user_id.rb +23 -0
- data/db/migrate/018_add_guids.rb +13 -0
- data/db/migrate/019_add_whiteboards_to_content.rb +15 -0
- data/db/migrate/020_superclass_articles.rb +167 -0
- data/db/migrate/021_superclass_comments.rb +94 -0
- data/db/migrate/022_superclass_trackbacks.rb +71 -0
- data/db/migrate/023_superclass_pages.rb +64 -0
- data/db/migrate/024_cleanup_contents.rb +54 -0
- data/db/migrate/025_add_itunes_metadata.rb +29 -0
- data/db/migrate/026_add_redirect_table.rb +13 -0
- data/db/migrate/027_set_comment_published_flag.rb +19 -0
- data/db/migrate/028_rename_redirect_to.rb +12 -0
- data/db/migrate/029_add_user_notification.rb +29 -0
- data/db/migrate/030_index_sessions.rb +9 -0
- data/db/migrate/031_add_notifications_table.rb +14 -0
- data/db/migrate/032_add_jabber_notification.rb +11 -0
- data/db/migrate/033_add_count_caching.rb +34 -0
- data/db/migrate/034_boolify_published.rb +36 -0
- data/db/migrate/035_boolify_content_allow_foo.rb +36 -0
- data/db/migrate/036_add_tag_display_name.rb +53 -0
- data/db/migrate/037_enlarge_ip_field.rb +9 -0
- data/db/migrate/038_add_blog_object.rb +52 -0
- data/db/migrate/039_serialize_blog_attributes.rb +160 -0
- data/db/migrate/040_attach_content_to_blog.rb +28 -0
- data/db/migrate/041_fixup_default_sidebars.rb +18 -0
- data/db/migrate/042_remove_sidebar_staged_config.rb +22 -0
- data/db/migrate/043_create_triggers.rb +14 -0
- data/db/migrate/044_add_published_at_to_content.rb +18 -0
- data/db/migrate/045_fix_contents_published_default.rb +9 -0
- data/db/migrate/046_fixup_forthcoming_publications.rb +40 -0
- data/db/schema.mysql-v3.sql +218 -0
- data/db/schema.mysql.sql +218 -0
- data/db/schema.postgresql.sql +218 -0
- data/db/schema.rb +169 -0
- data/db/schema.sqlite.sql +218 -0
- data/db/schema.sqlserver.sql +232 -0
- data/db/schema_version +1 -0
- data/db/scripts/fix_permalinks.rb +5 -0
- data/db/updates/update.168.to.200.mysql.sql +33 -0
- data/db/updates/update.168.to.200.psql.sql +30 -0
- data/doc/Installer.txt +55 -0
- data/doc/README_FOR_APP +2 -0
- data/installer/rails-installer.rb +488 -0
- data/installer/rails_installer_defaults.yml +4 -0
- data/installer/typo-installer.rb +35 -0
- data/lib/backpack_api.rb +202 -0
- data/lib/bare_migration.rb +142 -0
- data/lib/email_notify.rb +32 -0
- data/lib/format.rb +19 -0
- data/lib/generators/sidebar/sidebar_generator.rb +13 -0
- data/lib/generators/sidebar/templates/components/plugins/sidebars/controller_template.rb +20 -0
- data/lib/generators/sidebar/templates/components/plugins/sidebars/views/content_template.rhtml +4 -0
- data/lib/jabber_notify.rb +32 -0
- data/lib/login_system.rb +85 -0
- data/lib/migrator.rb +28 -0
- data/lib/rails_patch/active_record.rb +36 -0
- data/lib/rails_patch/components.rb +14 -0
- data/lib/sidebars/component_plugin.rb +5 -0
- data/lib/sidebars/plugin.rb +241 -0
- data/lib/spam_protection.rb +126 -0
- data/lib/tasks/release.rake +171 -0
- data/lib/tasks/schemas.rake +6 -0
- data/lib/tasks/sweep_cache.rake +6 -0
- data/lib/text_filter_plugin.rb +97 -0
- data/lib/transforms.rb +26 -0
- data/lib/typo_guid.rb +10 -0
- data/lib/typo_plugins.rb +19 -0
- data/lib/typo_version.rb +1 -0
- data/lib/xmlrpc_fix.rb +13 -0
- data/public/.htaccess +34 -0
- data/public/404.html +8 -0
- data/public/500.html +8 -0
- data/public/dispatch.cgi +10 -0
- data/public/dispatch.fcgi +24 -0
- data/public/dispatch.rb +10 -0
- data/public/favicon.ico +0 -0
- data/public/images/admin/dot-vertical.gif +0 -0
- data/public/images/admin/h-tile.gif +0 -0
- data/public/images/admin/hdr-tile.gif +0 -0
- data/public/images/admin/toggle.gif +0 -0
- data/public/images/bg.jpg +0 -0
- data/public/images/bgcolor.jpg +0 -0
- data/public/images/body_bg.png +0 -0
- data/public/images/branding_bg.png +0 -0
- data/public/images/branding_logo.png +0 -0
- data/public/images/checked.gif +0 -0
- data/public/images/content_bg.png +0 -0
- data/public/images/delete.png +0 -0
- data/public/images/footer.jpg +0 -0
- data/public/images/footer.png +0 -0
- data/public/images/global_bg.png +0 -0
- data/public/images/global_logo.png +0 -0
- data/public/images/go.png +0 -0
- data/public/images/header.jpg +0 -0
- data/public/images/loading.gif +0 -0
- data/public/images/not-checked copy.gif +0 -0
- data/public/images/not-checked.gif +0 -0
- data/public/images/overlay.png +0 -0
- data/public/images/powered.gif +0 -0
- data/public/images/section_bg.png +0 -0
- data/public/images/sections_bg.png +0 -0
- data/public/images/sections_hilite.png +0 -0
- data/public/images/sections_hover.png +0 -0
- data/public/images/spinner-blue.gif +0 -0
- data/public/images/spinner.gif +0 -0
- data/public/images/spot-header.gif +0 -0
- data/public/images/spot-title.gif +0 -0
- data/public/images/x-ed.gif +0 -0
- data/public/javascripts/application.js +2 -0
- data/public/javascripts/controls.js +815 -0
- data/public/javascripts/cookies.js +60 -0
- data/public/javascripts/dragdrop.js +724 -0
- data/public/javascripts/effects.js +953 -0
- data/public/javascripts/lightbox.js +348 -0
- data/public/javascripts/prototype.js +1985 -0
- data/public/javascripts/scriptaculous.js +47 -0
- data/public/javascripts/slider.js +258 -0
- data/public/javascripts/typo.js +85 -0
- data/public/robots.txt +2 -0
- data/public/stylesheets/administration.css +585 -0
- data/public/stylesheets/lightbox.css +22 -0
- data/public/stylesheets/rss.css +54 -0
- data/public/stylesheets/user-styles.css +0 -0
- data/script/about +3 -0
- data/script/benchmarker +19 -0
- data/script/breakpointer +3 -0
- data/script/console +3 -0
- data/script/destroy +3 -0
- data/script/generate +3 -0
- data/script/lighttpd +2 -0
- data/script/logreport +79 -0
- data/script/migrate +31 -0
- data/script/performance/benchmarker +3 -0
- data/script/performance/profiler +3 -0
- data/script/plugin +3 -0
- data/script/process/reaper +3 -0
- data/script/process/spawner +3 -0
- data/script/process/spinner +3 -0
- data/script/profiler +34 -0
- data/script/runner +3 -0
- data/script/server +3 -0
- data/script/spacecheck +40 -0
- data/test/fixtures/articles_categories.yml +31 -0
- data/test/fixtures/articles_tags.yml +19 -0
- data/test/fixtures/blacklist_patterns.yml +10 -0
- data/test/fixtures/blogs.yml +74 -0
- data/test/fixtures/categories.yml +35 -0
- data/test/fixtures/contents.yml +297 -0
- data/test/fixtures/notification_mailer/article +3 -0
- data/test/fixtures/notification_mailer/comment +3 -0
- data/test/fixtures/notification_mailer/trackback +3 -0
- data/test/fixtures/notifications.yml +0 -0
- data/test/fixtures/page_caches.yml +7 -0
- data/test/fixtures/redirects.yml +13 -0
- data/test/fixtures/resources.yml +24 -0
- data/test/fixtures/sidebars.yml +5 -0
- data/test/fixtures/tags.yml +13 -0
- data/test/fixtures/text_filters.yml +42 -0
- data/test/fixtures/triggers.yml +1 -0
- data/test/fixtures/users.yml +56 -0
- data/test/functional/accounts_controller_test.rb +82 -0
- data/test/functional/admin/article_preview_test.rb +67 -0
- data/test/functional/admin/blacklist_controller_test.rb +63 -0
- data/test/functional/admin/categories_controller_test.rb +112 -0
- data/test/functional/admin/comments_controller_test.rb +78 -0
- data/test/functional/admin/content_controller_test.rb +234 -0
- data/test/functional/admin/general_controller_test.rb +26 -0
- data/test/functional/admin/pages_controller_test.rb +103 -0
- data/test/functional/admin/resources_controller_test.rb +49 -0
- data/test/functional/admin/textfilters_controller_test.rb +29 -0
- data/test/functional/admin/themes_controller_test.rb +34 -0
- data/test/functional/admin/trackbacks_controller_test.rb +76 -0
- data/test/functional/admin/users_controller_test.rb +72 -0
- data/test/functional/articles_controller_test.rb +525 -0
- data/test/functional/backend_controller_test.rb +273 -0
- data/test/functional/redirect_controller_test.rb +40 -0
- data/test/functional/textfilter_controller_test.rb +275 -0
- data/test/functional/theme_controller_test.rb +45 -0
- data/test/functional/xml_controller_test.rb +353 -0
- data/test/mocks/test/dns_mock.rb +13 -0
- data/test/mocks/test/flickr_mock.rb +30 -0
- data/test/mocks/test/http_mock.rb +38 -0
- data/test/mocks/test/theme_mock.rb +5 -0
- data/test/mocks/test/xmlrpc_mock.rb +27 -0
- data/test/mocks/themes/123-numbers-in-path/about.markdown +0 -0
- data/test/mocks/themes/CamelCaseDirectory/about.markdown +0 -0
- data/test/mocks/themes/azure/about.markdown +5 -0
- data/test/mocks/themes/azure/layouts/default.rhtml +50 -0
- data/test/mocks/themes/azure/preview.png +0 -0
- data/test/mocks/themes/azure/views/theme/static_view_test.rhtml +1 -0
- data/test/mocks/themes/i-have-special-chars/about.markdown +0 -0
- data/test/test_helper.rb +95 -0
- data/test/unit/article_test.rb +245 -0
- data/test/unit/assumptions_tests.rb +54 -0
- data/test/unit/audioscrobbler_test.rb +132 -0
- data/test/unit/blacklist_pattern_test.rb +14 -0
- data/test/unit/blog_test.rb +83 -0
- data/test/unit/category_test.rb +37 -0
- data/test/unit/comment_test.rb +117 -0
- data/test/unit/configuration_test.rb +21 -0
- data/test/unit/content_state/factory_test.rb +84 -0
- data/test/unit/delicious_test.rb +96 -0
- data/test/unit/flickr_test.rb +134 -0
- data/test/unit/fortythree_test.rb +66 -0
- data/test/unit/magnolia_test.rb +87 -0
- data/test/unit/metafragment_test.rb +63 -0
- data/test/unit/notification_mailer_test.rb +55 -0
- data/test/unit/observer_test.rb +40 -0
- data/test/unit/page_cache_test.rb +34 -0
- data/test/unit/page_test.rb +25 -0
- data/test/unit/ping_test.rb +111 -0
- data/test/unit/redirect_test.rb +19 -0
- data/test/unit/resource_test.rb +71 -0
- data/test/unit/sidebar_test.rb +14 -0
- data/test/unit/tag_test.rb +66 -0
- data/test/unit/text_filter_test.rb +126 -0
- data/test/unit/theme_test.rb +44 -0
- data/test/unit/trackback_test.rb +45 -0
- data/test/unit/trigger_test.rb +40 -0
- data/test/unit/user_test.rb +111 -0
- data/themes/azure/about.markdown +5 -0
- data/themes/azure/images/bg-tile.gif +0 -0
- data/themes/azure/images/bracket.gif +0 -0
- data/themes/azure/images/bullet.gif +0 -0
- data/themes/azure/images/hdr.gif +0 -0
- data/themes/azure/images/q-close.gif +0 -0
- data/themes/azure/images/q-open.gif +0 -0
- data/themes/azure/images/sbar-tile.gif +0 -0
- data/themes/azure/images/spinner.gif +0 -0
- data/themes/azure/images/xlink.gif +0 -0
- data/themes/azure/layouts/default.rhtml +50 -0
- data/themes/azure/preview.png +0 -0
- data/themes/azure/stylesheets/azure.css +436 -0
- data/themes/azure/stylesheets/print.css +30 -0
- data/themes/azure/views/theme/static_view_test.rhtml +1 -0
- data/vendor/akismet/Akismet.rb +140 -0
- data/vendor/bluecloth/CHANGES +366 -0
- data/vendor/bluecloth/LICENSE +340 -0
- data/vendor/bluecloth/README +99 -0
- data/vendor/bluecloth/bin/bluecloth +83 -0
- data/vendor/bluecloth/install.rb +150 -0
- data/vendor/bluecloth/lib/bluecloth.rb +1144 -0
- data/vendor/bluecloth/test.rb +117 -0
- data/vendor/bluecloth/tests/00_Class.tests.rb +71 -0
- data/vendor/bluecloth/tests/05_Markdown.tests.rb +1527 -0
- data/vendor/bluecloth/tests/10_Bug.tests.rb +57 -0
- data/vendor/bluecloth/tests/15_Contrib.tests.rb +132 -0
- data/vendor/bluecloth/tests/bctestcase.rb +274 -0
- data/vendor/bluecloth/tests/data/antsugar.txt +34 -0
- data/vendor/bluecloth/tests/data/ml-announce.txt +17 -0
- data/vendor/bluecloth/tests/data/re-overflow.txt +67 -0
- data/vendor/bluecloth/tests/data/re-overflow2.txt +281 -0
- data/vendor/bluecloth/utils.rb +553 -0
- data/vendor/flickr/Rakefile +36 -0
- data/vendor/flickr/flickr.rb +490 -0
- data/vendor/flickr/index.html +129 -0
- data/vendor/flickr/test_flickr.rb +173 -0
- data/vendor/jabber4r/CHANGES +8 -0
- data/vendor/jabber4r/LICENSE.txt +12 -0
- data/vendor/jabber4r/README +180 -0
- data/vendor/jabber4r/Rakefile.rb +143 -0
- data/vendor/jabber4r/lib/jabber4r/jabber4r.rb +22 -0
- data/vendor/jabber4r/lib/jabber4r/jid.rb +93 -0
- data/vendor/jabber4r/lib/jabber4r/protocol.rb +1384 -0
- data/vendor/jabber4r/lib/jabber4r/rexml_1.8_patch.rb +16 -0
- data/vendor/jabber4r/lib/jabber4r/roster.rb +322 -0
- data/vendor/jabber4r/lib/jabber4r/session.rb +615 -0
- data/vendor/jabber4r/lib/jabber4r/vcard.rb +42 -0
- data/vendor/plugins/expiring_action_cache/init.rb +2 -0
- data/vendor/plugins/expiring_action_cache/lib/actionparamcache.rb +113 -0
- data/vendor/plugins/expiring_action_cache/lib/metafragment.rb +46 -0
- data/vendor/plugins/upload_progress/CHANGELOG +3 -0
- data/vendor/plugins/upload_progress/MIT-LICENSE +20 -0
- data/vendor/plugins/upload_progress/README +45 -0
- data/vendor/plugins/upload_progress/Rakefile +23 -0
- data/vendor/plugins/upload_progress/init.rb +7 -0
- data/vendor/plugins/upload_progress/lib/multipart_progress.rb +169 -0
- data/vendor/plugins/upload_progress/lib/progress.rb +145 -0
- data/vendor/plugins/upload_progress/lib/upload_progress.rb +303 -0
- data/vendor/plugins/upload_progress/lib/upload_progress_helper.rb +424 -0
- data/vendor/plugins/upload_progress/public/stylesheets/upload_progress.css +21 -0
- data/vendor/plugins/upload_progress/test/multipart_progress_testx.rb +364 -0
- data/vendor/plugins/upload_progress/test/upload_progress_helper_testx.rb +134 -0
- data/vendor/plugins/upload_progress/test/upload_progress_testx.rb +88 -0
- data/vendor/redcloth/RedCloth.gemspec +52 -0
- data/vendor/redcloth/bin/redcloth +3 -0
- data/vendor/redcloth/doc/CHANGELOG +160 -0
- data/vendor/redcloth/doc/COPYING +25 -0
- data/vendor/redcloth/doc/README +106 -0
- data/vendor/redcloth/doc/REFERENCE +216 -0
- data/vendor/redcloth/doc/make.rb +359 -0
- data/vendor/redcloth/install.rb +1032 -0
- data/vendor/redcloth/lib/redcloth.rb +1130 -0
- data/vendor/redcloth/run-tests.rb +28 -0
- data/vendor/redcloth/setup.rb +1376 -0
- data/vendor/redcloth/tests/code.yml +105 -0
- data/vendor/redcloth/tests/hard_breaks.yml +26 -0
- data/vendor/redcloth/tests/images.yml +171 -0
- data/vendor/redcloth/tests/instiki.yml +39 -0
- data/vendor/redcloth/tests/links.yml +155 -0
- data/vendor/redcloth/tests/lists.yml +77 -0
- data/vendor/redcloth/tests/markdown.yml +218 -0
- data/vendor/redcloth/tests/poignant.yml +64 -0
- data/vendor/redcloth/tests/table.yml +198 -0
- data/vendor/redcloth/tests/textism.yml +406 -0
- data/vendor/ruby-mp3info/lib/mp3info.rb +720 -0
- data/vendor/rubypants/README +114 -0
- data/vendor/rubypants/Rakefile +55 -0
- data/vendor/rubypants/html/classes/RubyPants.html +924 -0
- data/vendor/rubypants/html/created.rid +1 -0
- data/vendor/rubypants/html/files/README.html +248 -0
- data/vendor/rubypants/html/files/rubypants_rb.html +125 -0
- data/vendor/rubypants/html/fr_class_index.html +27 -0
- data/vendor/rubypants/html/fr_file_index.html +28 -0
- data/vendor/rubypants/html/fr_method_index.html +38 -0
- data/vendor/rubypants/html/index.html +24 -0
- data/vendor/rubypants/html/rdoc-style.css +172 -0
- data/vendor/rubypants/install.rb +9 -0
- data/vendor/rubypants/rubypants.rb +490 -0
- data/vendor/rubypants/test_rubypants.rb +162 -0
- data/vendor/sparklines/README.txt +47 -0
- data/vendor/sparklines/USAGE +14 -0
- data/vendor/sparklines/lib/sparklines.rb +435 -0
- data/vendor/sparklines/samples/sparklinestest.rb +26 -0
- data/vendor/sparklines/sparklines_generator.rb +9 -0
- data/vendor/sparklines/templates/sparklines_controller.rb +30 -0
- data/vendor/sparklines/templates/sparklines_helper.rb +30 -0
- data/vendor/syntax/LICENSE +27 -0
- data/vendor/syntax/NEWS +16 -0
- data/vendor/syntax/README +38 -0
- data/vendor/syntax/Rakefile +194 -0
- data/vendor/syntax/api/classes/Syntax.html +173 -0
- data/vendor/syntax/api/classes/Syntax/Convertors.html +91 -0
- data/vendor/syntax/api/classes/Syntax/Convertors/Abstract.html +159 -0
- data/vendor/syntax/api/classes/Syntax/Convertors/HTML.html +149 -0
- data/vendor/syntax/api/classes/Syntax/Default.html +123 -0
- data/vendor/syntax/api/classes/Syntax/Ruby.html +319 -0
- data/vendor/syntax/api/classes/Syntax/Token.html +151 -0
- data/vendor/syntax/api/classes/Syntax/Tokenizer.html +324 -0
- data/vendor/syntax/api/classes/Syntax/Version.html +109 -0
- data/vendor/syntax/api/classes/Syntax/XML.html +205 -0
- data/vendor/syntax/api/classes/Syntax/YAML.html +189 -0
- data/vendor/syntax/api/created.rid +1 -0
- data/vendor/syntax/api/files/README.html +155 -0
- data/vendor/syntax/api/files/lib/syntax/common_rb.html +96 -0
- data/vendor/syntax/api/files/lib/syntax/convertors/abstract_rb.html +96 -0
- data/vendor/syntax/api/files/lib/syntax/convertors/html_rb.html +96 -0
- data/vendor/syntax/api/files/lib/syntax/lang/ruby_rb.html +96 -0
- data/vendor/syntax/api/files/lib/syntax/lang/xml_rb.html +96 -0
- data/vendor/syntax/api/files/lib/syntax/lang/yaml_rb.html +96 -0
- data/vendor/syntax/api/files/lib/syntax/version_rb.html +92 -0
- data/vendor/syntax/api/files/lib/syntax_rb.html +96 -0
- data/vendor/syntax/api/fr_class_index.html +56 -0
- data/vendor/syntax/api/fr_file_index.html +54 -0
- data/vendor/syntax/api/fr_method_index.html +65 -0
- data/vendor/syntax/api/index.html +26 -0
- data/vendor/syntax/api/rdoc-style.css +175 -0
- data/vendor/syntax/doc/manual-html/chapter-1.html +198 -0
- data/vendor/syntax/doc/manual-html/chapter-2.html +262 -0
- data/vendor/syntax/doc/manual-html/chapter-3.html +266 -0
- data/vendor/syntax/doc/manual-html/chapter-4.html +267 -0
- data/vendor/syntax/doc/manual-html/index.html +152 -0
- data/vendor/syntax/doc/manual-html/stylesheets/manual.css +270 -0
- data/vendor/syntax/doc/manual-html/stylesheets/ruby.css +17 -0
- data/vendor/syntax/doc/manual/chapter.erb +38 -0
- data/vendor/syntax/doc/manual/example.erb +18 -0
- data/vendor/syntax/doc/manual/index.erb +29 -0
- data/vendor/syntax/doc/manual/manual.rb +311 -0
- data/vendor/syntax/doc/manual/manual.yml +43 -0
- data/vendor/syntax/doc/manual/page.erb +87 -0
- data/vendor/syntax/doc/manual/parts/0000.txt +5 -0
- data/vendor/syntax/doc/manual/parts/0001.txt +16 -0
- data/vendor/syntax/doc/manual/parts/0002.txt +24 -0
- data/vendor/syntax/doc/manual/parts/0003.txt +6 -0
- data/vendor/syntax/doc/manual/parts/0004.txt +32 -0
- data/vendor/syntax/doc/manual/parts/0005.txt +18 -0
- data/vendor/syntax/doc/manual/parts/0006.txt +62 -0
- data/vendor/syntax/doc/manual/parts/0007.txt +3 -0
- data/vendor/syntax/doc/manual/parts/0008.txt +5 -0
- data/vendor/syntax/doc/manual/parts/0009.txt +29 -0
- data/vendor/syntax/doc/manual/parts/0010.txt +21 -0
- data/vendor/syntax/doc/manual/stylesheets/manual.css +270 -0
- data/vendor/syntax/doc/manual/stylesheets/ruby.css +17 -0
- data/vendor/syntax/doc/manual/tutorial.erb +30 -0
- data/vendor/syntax/lib/syntax.rb +38 -0
- data/vendor/syntax/lib/syntax/common.rb +163 -0
- data/vendor/syntax/lib/syntax/convertors/abstract.rb +27 -0
- data/vendor/syntax/lib/syntax/convertors/html.rb +51 -0
- data/vendor/syntax/lib/syntax/lang/ruby.rb +317 -0
- data/vendor/syntax/lib/syntax/lang/xml.rb +108 -0
- data/vendor/syntax/lib/syntax/lang/yaml.rb +105 -0
- data/vendor/syntax/lib/syntax/version.rb +9 -0
- data/vendor/syntax/setup.rb +1331 -0
- data/vendor/syntax/syntax.gemspec +24 -0
- data/vendor/syntax/test/ALL-TESTS.rb +5 -0
- data/vendor/syntax/test/syntax/tc_ruby.rb +871 -0
- data/vendor/syntax/test/syntax/tc_xml.rb +202 -0
- data/vendor/syntax/test/syntax/tc_yaml.rb +228 -0
- data/vendor/syntax/test/syntax/tokenizer_testcase.rb +40 -0
- data/vendor/syntax/test/tc_syntax.rb +22 -0
- data/vendor/uuidtools/CHANGELOG +4 -0
- data/vendor/uuidtools/README +13 -0
- data/vendor/uuidtools/install.rb +30 -0
- data/vendor/uuidtools/lib/uuidtools.rb +555 -0
- data/vendor/uuidtools/rakefile +112 -0
- metadata +1022 -0
@@ -0,0 +1,114 @@
|
|
1
|
+
= RubyPants -- SmartyPants ported to Ruby
|
2
|
+
|
3
|
+
Ported by Christian Neukirchen <mailto:chneukirchen@gmail.com>
|
4
|
+
Copyright (C) 2004 Christian Neukirchen
|
5
|
+
|
6
|
+
Incooporates ideas, comments and documentation by Chad Miller
|
7
|
+
Copyright (C) 2004 Chad Miller
|
8
|
+
|
9
|
+
Original SmartyPants by John Gruber
|
10
|
+
Copyright (C) 2003 John Gruber
|
11
|
+
|
12
|
+
|
13
|
+
== RubyPants
|
14
|
+
|
15
|
+
RubyPants is a Ruby port of the smart-quotes library SmartyPants.
|
16
|
+
|
17
|
+
The original "SmartyPants" is a free web publishing plug-in for
|
18
|
+
Movable Type, Blosxom, and BBEdit that easily translates plain ASCII
|
19
|
+
punctuation characters into "smart" typographic punctuation HTML
|
20
|
+
entities.
|
21
|
+
|
22
|
+
See rubypants.rb for more information.
|
23
|
+
|
24
|
+
|
25
|
+
== Incompatibilities
|
26
|
+
|
27
|
+
RubyPants uses a different API than SmartyPants; it is compatible to
|
28
|
+
Red- and BlueCloth. Usually, you call RubyPants like this:
|
29
|
+
|
30
|
+
nicehtml = RubyPants.new(uglyhtml, options).to_html
|
31
|
+
|
32
|
+
where +options+ is an Array of Integers and/or Symbols (if you don't
|
33
|
+
pass any options, RubyPants will use <tt>[2]</tt> as default.)
|
34
|
+
|
35
|
+
*Note*:: This is incompatible to SmartyPants, which uses <tt>[1]</tt>
|
36
|
+
for default.
|
37
|
+
|
38
|
+
The exact meaning of numbers and symbols is documented at RubyPants#new.
|
39
|
+
|
40
|
+
|
41
|
+
== SmartyPants license:
|
42
|
+
|
43
|
+
Copyright (c) 2003 John Gruber
|
44
|
+
(http://daringfireball.net)
|
45
|
+
All rights reserved.
|
46
|
+
|
47
|
+
Redistribution and use in source and binary forms, with or without
|
48
|
+
modification, are permitted provided that the following conditions
|
49
|
+
are met:
|
50
|
+
|
51
|
+
* Redistributions of source code must retain the above copyright
|
52
|
+
notice, this list of conditions and the following disclaimer.
|
53
|
+
|
54
|
+
* Redistributions in binary form must reproduce the above copyright
|
55
|
+
notice, this list of conditions and the following disclaimer in
|
56
|
+
the documentation and/or other materials provided with the
|
57
|
+
distribution.
|
58
|
+
|
59
|
+
* Neither the name "SmartyPants" nor the names of its contributors
|
60
|
+
may be used to endorse or promote products derived from this
|
61
|
+
software without specific prior written permission.
|
62
|
+
|
63
|
+
This software is provided by the copyright holders and contributors
|
64
|
+
"as is" and any express or implied warranties, including, but not
|
65
|
+
limited to, the implied warranties of merchantability and fitness
|
66
|
+
for a particular purpose are disclaimed. In no event shall the
|
67
|
+
copyright owner or contributors be liable for any direct, indirect,
|
68
|
+
incidental, special, exemplary, or consequential damages (including,
|
69
|
+
but not limited to, procurement of substitute goods or services;
|
70
|
+
loss of use, data, or profits; or business interruption) however
|
71
|
+
caused and on any theory of liability, whether in contract, strict
|
72
|
+
liability, or tort (including negligence or otherwise) arising in
|
73
|
+
any way out of the use of this software, even if advised of the
|
74
|
+
possibility of such damage.
|
75
|
+
|
76
|
+
|
77
|
+
== RubyPants license
|
78
|
+
|
79
|
+
Copyright (C) 2004 Christian Neukirchen
|
80
|
+
|
81
|
+
RubyPants is a derivative work of SmartyPants and smartypants.py.
|
82
|
+
|
83
|
+
Redistribution and use in source and binary forms, with or without
|
84
|
+
modification, are permitted provided that the following conditions
|
85
|
+
are met:
|
86
|
+
|
87
|
+
* Redistributions of source code must retain the above copyright
|
88
|
+
notice, this list of conditions and the following disclaimer.
|
89
|
+
|
90
|
+
* Redistributions in binary form must reproduce the above copyright
|
91
|
+
notice, this list of conditions and the following disclaimer in
|
92
|
+
the documentation and/or other materials provided with the
|
93
|
+
distribution.
|
94
|
+
|
95
|
+
This software is provided by the copyright holders and contributors
|
96
|
+
"as is" and any express or implied warranties, including, but not
|
97
|
+
limited to, the implied warranties of merchantability and fitness
|
98
|
+
for a particular purpose are disclaimed. In no event shall the
|
99
|
+
copyright owner or contributors be liable for any direct, indirect,
|
100
|
+
incidental, special, exemplary, or consequential damages (including,
|
101
|
+
but not limited to, procurement of substitute goods or services;
|
102
|
+
loss of use, data, or profits; or business interruption) however
|
103
|
+
caused and on any theory of liability, whether in contract, strict
|
104
|
+
liability, or tort (including negligence or otherwise) arising in
|
105
|
+
any way out of the use of this software, even if advised of the
|
106
|
+
possibility of such damage.
|
107
|
+
|
108
|
+
|
109
|
+
== Links
|
110
|
+
|
111
|
+
John Gruber:: http://daringfireball.net
|
112
|
+
SmartyPants:: http://daringfireball.net/projects/smartypants
|
113
|
+
Chad Miller:: http://web.chad.org
|
114
|
+
Christian Neukirchen:: http://kronavita.de/chris
|
@@ -0,0 +1,55 @@
|
|
1
|
+
# Rakefile for rubypants -*-ruby-*-
|
2
|
+
require 'rake/rdoctask'
|
3
|
+
|
4
|
+
|
5
|
+
desc "Run all the tests"
|
6
|
+
task :default => [:test]
|
7
|
+
|
8
|
+
desc "Do predistribution stuff"
|
9
|
+
task :predist => [:doc]
|
10
|
+
|
11
|
+
|
12
|
+
desc "Run all the tests"
|
13
|
+
task :test do
|
14
|
+
ruby 'test_rubypants.rb'
|
15
|
+
end
|
16
|
+
|
17
|
+
desc "Make an archive as .tar.gz"
|
18
|
+
task :dist => :test do
|
19
|
+
system "darcs dist -d rubypants#{get_darcs_tree_version}"
|
20
|
+
end
|
21
|
+
|
22
|
+
|
23
|
+
desc "Generate RDoc documentation"
|
24
|
+
Rake::RDocTask.new(:doc) do |rdoc|
|
25
|
+
rdoc.options << '--line-numbers --inline-source --all'
|
26
|
+
rdoc.rdoc_files.include 'README'
|
27
|
+
rdoc.rdoc_files.include 'rubypants.rb'
|
28
|
+
end
|
29
|
+
|
30
|
+
|
31
|
+
# Helper to retrieve the "revision number" of the darcs tree.
|
32
|
+
def get_darcs_tree_version
|
33
|
+
return "" unless File.directory? "_darcs"
|
34
|
+
|
35
|
+
changes = `darcs changes`
|
36
|
+
count = 0
|
37
|
+
tag = "0.0"
|
38
|
+
|
39
|
+
changes.each("\n\n") { |change|
|
40
|
+
head, title, desc = change.split("\n", 3)
|
41
|
+
|
42
|
+
if title =~ /^ \*/
|
43
|
+
# Normal change.
|
44
|
+
count += 1
|
45
|
+
elsif title =~ /tagged (.*)/
|
46
|
+
# Tag. We look for these.
|
47
|
+
tag = $1
|
48
|
+
break
|
49
|
+
else
|
50
|
+
warn "Unparsable change: #{change}"
|
51
|
+
end
|
52
|
+
}
|
53
|
+
|
54
|
+
"-" + tag + "." + count.to_s
|
55
|
+
end
|
@@ -0,0 +1,924 @@
|
|
1
|
+
<?xml version="1.0" encoding="iso-8859-1"?>
|
2
|
+
<!DOCTYPE html
|
3
|
+
PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
|
4
|
+
"DTD/xhtml1-transitional.dtd">
|
5
|
+
|
6
|
+
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
|
7
|
+
<head>
|
8
|
+
<title>Class: RubyPants</title>
|
9
|
+
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
|
10
|
+
<meta http-equiv="Content-Script-Type" content="text/javascript" />
|
11
|
+
<link rel="stylesheet" href=".././rdoc-style.css" type="text/css" media="screen" />
|
12
|
+
<script type="text/javascript">
|
13
|
+
// <![CDATA[
|
14
|
+
|
15
|
+
function popupCode( url ) {
|
16
|
+
window.open(url, "Code", "resizable=yes,scrollbars=yes,toolbar=no,status=no,height=150,width=400")
|
17
|
+
}
|
18
|
+
|
19
|
+
function toggleCode( id ) {
|
20
|
+
if ( document.getElementById )
|
21
|
+
elem = document.getElementById( id );
|
22
|
+
else if ( document.all )
|
23
|
+
elem = eval( "document.all." + id );
|
24
|
+
else
|
25
|
+
return false;
|
26
|
+
|
27
|
+
elemStyle = elem.style;
|
28
|
+
|
29
|
+
if ( elemStyle.display != "block" ) {
|
30
|
+
elemStyle.display = "block"
|
31
|
+
} else {
|
32
|
+
elemStyle.display = "none"
|
33
|
+
}
|
34
|
+
|
35
|
+
return true;
|
36
|
+
}
|
37
|
+
|
38
|
+
// Make codeblocks hidden by default
|
39
|
+
document.writeln( "<style type=\"text/css\">div.method-source-code { display: none }</style>" )
|
40
|
+
|
41
|
+
// ]]>
|
42
|
+
</script>
|
43
|
+
|
44
|
+
</head>
|
45
|
+
<body>
|
46
|
+
|
47
|
+
|
48
|
+
|
49
|
+
<div id="classHeader">
|
50
|
+
<h1>RubyPants <sup class="type-note">(Class)</sup></h1>
|
51
|
+
<table class="header-table">
|
52
|
+
<tr class="top-aligned-row">
|
53
|
+
<td><strong>In:</strong></td>
|
54
|
+
<td>
|
55
|
+
<a href="../files/rubypants_rb.html">
|
56
|
+
rubypants.rb
|
57
|
+
</a>
|
58
|
+
<br />
|
59
|
+
</td>
|
60
|
+
</tr>
|
61
|
+
|
62
|
+
<tr class="top-aligned-row">
|
63
|
+
<td><strong>Parent:</strong></td>
|
64
|
+
<td>
|
65
|
+
String
|
66
|
+
</td>
|
67
|
+
</tr>
|
68
|
+
</table>
|
69
|
+
</div>
|
70
|
+
<!-- banner header -->
|
71
|
+
|
72
|
+
<div id="bodyContent">
|
73
|
+
|
74
|
+
|
75
|
+
<div id="contextContent">
|
76
|
+
|
77
|
+
<div id="description">
|
78
|
+
<h1><a href="RubyPants.html">RubyPants</a> — SmartyPants ported to Ruby</h1>
|
79
|
+
<h2>Synopsis</h2>
|
80
|
+
<p>
|
81
|
+
<a href="RubyPants.html">RubyPants</a> is a Ruby port of the smart-quotes
|
82
|
+
library SmartyPants.
|
83
|
+
</p>
|
84
|
+
<p>
|
85
|
+
The original "SmartyPants" is a free web publishing plug-in for
|
86
|
+
Movable Type, Blosxom, and BBEdit that easily translates plain ASCII
|
87
|
+
punctuation characters into "smart" typographic punctuation HTML
|
88
|
+
entities.
|
89
|
+
</p>
|
90
|
+
<h2>Description</h2>
|
91
|
+
<p>
|
92
|
+
<a href="RubyPants.html">RubyPants</a> can perform the following
|
93
|
+
transformations:
|
94
|
+
</p>
|
95
|
+
<ul>
|
96
|
+
<li>Straight quotes (<tt>"</tt> and <tt>‘</tt>) into
|
97
|
+
"curly" quote HTML entities
|
98
|
+
|
99
|
+
</li>
|
100
|
+
<li>Backticks-style quotes (<tt>``like this’‘</tt>) into
|
101
|
+
"curly" quote HTML entities
|
102
|
+
|
103
|
+
</li>
|
104
|
+
<li>Dashes (<tt>—</tt> and <tt>—</tt>) into en- and em-dash
|
105
|
+
entities
|
106
|
+
|
107
|
+
</li>
|
108
|
+
<li>Three consecutive dots (<tt>…</tt> or <tt>. . .</tt>) into an
|
109
|
+
ellipsis entity
|
110
|
+
|
111
|
+
</li>
|
112
|
+
</ul>
|
113
|
+
<p>
|
114
|
+
This means you can write, edit, and save your posts using plain old ASCII
|
115
|
+
straight quotes, plain dashes, and plain dots, but your published posts
|
116
|
+
(and final HTML output) will appear with smart quotes, em-dashes, and
|
117
|
+
proper ellipses.
|
118
|
+
</p>
|
119
|
+
<p>
|
120
|
+
<a href="RubyPants.html">RubyPants</a> does not modify characters within
|
121
|
+
<tt><pre></tt>, <tt><code></tt>, <tt><kbd></tt>,
|
122
|
+
<tt><math></tt> or <tt><script></tt> tag blocks. Typically,
|
123
|
+
these tags are used to display text where smart quotes and other
|
124
|
+
"smart punctuation" would not be appropriate, such as source code
|
125
|
+
or example markup.
|
126
|
+
</p>
|
127
|
+
<h2>Backslash Escapes</h2>
|
128
|
+
<p>
|
129
|
+
If you need to use literal straight quotes (or plain hyphens and periods),
|
130
|
+
<a href="RubyPants.html">RubyPants</a> accepts the following backslash
|
131
|
+
escape sequences to force non-smart punctuation. It does so by transforming
|
132
|
+
the escape sequence into a decimal-encoded HTML entity:
|
133
|
+
</p>
|
134
|
+
<pre>
|
135
|
+
\\ \" \' \. \- \`
|
136
|
+
</pre>
|
137
|
+
<p>
|
138
|
+
This is useful, for example, when you want to use straight quotes as foot
|
139
|
+
and inch marks: 6’2" tall; a 17" iMac. (Use
|
140
|
+
<tt>6\’2\"</tt> resp. <tt>17\"</tt>.)
|
141
|
+
</p>
|
142
|
+
<h2>Algorithmic Shortcomings</h2>
|
143
|
+
<p>
|
144
|
+
One situation in which quotes will get curled the wrong way is when
|
145
|
+
apostrophes are used at the start of leading contractions. For example:
|
146
|
+
</p>
|
147
|
+
<pre>
|
148
|
+
'Twas the night before Christmas.
|
149
|
+
</pre>
|
150
|
+
<p>
|
151
|
+
In the case above, <a href="RubyPants.html">RubyPants</a> will turn the
|
152
|
+
apostrophe into an opening single-quote, when in fact it should be a
|
153
|
+
closing one. I don’t think this problem can be solved in the general
|
154
|
+
case—every word processor I’ve tried gets this wrong as well.
|
155
|
+
In such cases, it’s best to use the proper HTML entity for closing
|
156
|
+
single-quotes ("<tt>&8217;</tt>") by hand.
|
157
|
+
</p>
|
158
|
+
<h2>Bugs</h2>
|
159
|
+
<p>
|
160
|
+
To file bug reports or feature requests (except see above) please send
|
161
|
+
email to: <a
|
162
|
+
href="mailto:chneukirchen@gmail.com">chneukirchen@gmail.com</a>
|
163
|
+
</p>
|
164
|
+
<p>
|
165
|
+
If the bug involves quotes being curled the wrong way, please send example
|
166
|
+
text to illustrate.
|
167
|
+
</p>
|
168
|
+
<h2>Authors</h2>
|
169
|
+
<p>
|
170
|
+
John Gruber did all of the hard work of writing this software in Perl for
|
171
|
+
Movable Type and almost all of this useful documentation. Chad Miller
|
172
|
+
ported it to Python to use with Pyblosxom.
|
173
|
+
</p>
|
174
|
+
<p>
|
175
|
+
Christian Neukirchen provided the Ruby port, as a general-purpose library
|
176
|
+
that follows the *Cloth API.
|
177
|
+
</p>
|
178
|
+
<h2>Copyright and License</h2>
|
179
|
+
<h3>SmartyPants license:</h3>
|
180
|
+
<p>
|
181
|
+
Copyright © 2003 John Gruber (<a
|
182
|
+
href="http://daringfireball.net">daringfireball.net</a>) All rights
|
183
|
+
reserved.
|
184
|
+
</p>
|
185
|
+
<p>
|
186
|
+
Redistribution and use in source and binary forms, with or without
|
187
|
+
modification, are permitted provided that the following conditions are met:
|
188
|
+
</p>
|
189
|
+
<ul>
|
190
|
+
<li>Redistributions of source code must retain the above copyright notice, this
|
191
|
+
list of conditions and the following disclaimer.
|
192
|
+
|
193
|
+
</li>
|
194
|
+
<li>Redistributions in binary form must reproduce the above copyright notice,
|
195
|
+
this list of conditions and the following disclaimer in the documentation
|
196
|
+
and/or other materials provided with the distribution.
|
197
|
+
|
198
|
+
</li>
|
199
|
+
<li>Neither the name "SmartyPants" nor the names of its contributors
|
200
|
+
may be used to endorse or promote products derived from this software
|
201
|
+
without specific prior written permission.
|
202
|
+
|
203
|
+
</li>
|
204
|
+
</ul>
|
205
|
+
<p>
|
206
|
+
This software is provided by the copyright holders and contributors
|
207
|
+
"as is" and any express or implied warranties, including, but not
|
208
|
+
limited to, the implied warranties of merchantability and fitness for a
|
209
|
+
particular purpose are disclaimed. In no event shall the copyright owner or
|
210
|
+
contributors be liable for any direct, indirect, incidental, special,
|
211
|
+
exemplary, or consequential damages (including, but not limited to,
|
212
|
+
procurement of substitute goods or services; loss of use, data, or profits;
|
213
|
+
or business interruption) however caused and on any theory of liability,
|
214
|
+
whether in contract, strict liability, or tort (including negligence or
|
215
|
+
otherwise) arising in any way out of the use of this software, even if
|
216
|
+
advised of the possibility of such damage.
|
217
|
+
</p>
|
218
|
+
<h3><a href="RubyPants.html">RubyPants</a> license</h3>
|
219
|
+
<p>
|
220
|
+
<a href="RubyPants.html">RubyPants</a> is a derivative work of SmartyPants
|
221
|
+
and smartypants.py.
|
222
|
+
</p>
|
223
|
+
<p>
|
224
|
+
Redistribution and use in source and binary forms, with or without
|
225
|
+
modification, are permitted provided that the following conditions are met:
|
226
|
+
</p>
|
227
|
+
<ul>
|
228
|
+
<li>Redistributions of source code must retain the above copyright notice, this
|
229
|
+
list of conditions and the following disclaimer.
|
230
|
+
|
231
|
+
</li>
|
232
|
+
<li>Redistributions in binary form must reproduce the above copyright notice,
|
233
|
+
this list of conditions and the following disclaimer in the documentation
|
234
|
+
and/or other materials provided with the distribution.
|
235
|
+
|
236
|
+
</li>
|
237
|
+
</ul>
|
238
|
+
<p>
|
239
|
+
This software is provided by the copyright holders and contributors
|
240
|
+
"as is" and any express or implied warranties, including, but not
|
241
|
+
limited to, the implied warranties of merchantability and fitness for a
|
242
|
+
particular purpose are disclaimed. In no event shall the copyright owner or
|
243
|
+
contributors be liable for any direct, indirect, incidental, special,
|
244
|
+
exemplary, or consequential damages (including, but not limited to,
|
245
|
+
procurement of substitute goods or services; loss of use, data, or profits;
|
246
|
+
or business interruption) however caused and on any theory of liability,
|
247
|
+
whether in contract, strict liability, or tort (including negligence or
|
248
|
+
otherwise) arising in any way out of the use of this software, even if
|
249
|
+
advised of the possibility of such damage.
|
250
|
+
</p>
|
251
|
+
<h2>Links</h2>
|
252
|
+
<table>
|
253
|
+
<tr><td valign="top">John Gruber:</td><td><a href="http://daringfireball.net">daringfireball.net</a>
|
254
|
+
|
255
|
+
</td></tr>
|
256
|
+
<tr><td valign="top">SmartyPants:</td><td><a
|
257
|
+
href="http://daringfireball.net/projects/smartypants">daringfireball.net/projects/smartypants</a>
|
258
|
+
|
259
|
+
</td></tr>
|
260
|
+
<tr><td valign="top">Chad Miller:</td><td><a href="http://web.chad.org">web.chad.org</a>
|
261
|
+
|
262
|
+
</td></tr>
|
263
|
+
<tr><td valign="top">Christian Neukirchen:</td><td><a href="http://kronavita.de/chris">kronavita.de/chris</a>
|
264
|
+
|
265
|
+
</td></tr>
|
266
|
+
</table>
|
267
|
+
|
268
|
+
</div>
|
269
|
+
|
270
|
+
|
271
|
+
<div id="method-list">
|
272
|
+
<h2 class="section-bar">Methods</h2>
|
273
|
+
|
274
|
+
<div class="name-list">
|
275
|
+
<a href="#M000008">educate_backticks</a>
|
276
|
+
<a href="#M000004">educate_dashes</a>
|
277
|
+
<a href="#M000006">educate_dashes_inverted</a>
|
278
|
+
<a href="#M000005">educate_dashes_oldschool</a>
|
279
|
+
<a href="#M000007">educate_ellipses</a>
|
280
|
+
<a href="#M000010">educate_quotes</a>
|
281
|
+
<a href="#M000009">educate_single_backticks</a>
|
282
|
+
<a href="#M000001">new</a>
|
283
|
+
<a href="#M000003">process_escapes</a>
|
284
|
+
<a href="#M000011">stupefy_entities</a>
|
285
|
+
<a href="#M000002">to_html</a>
|
286
|
+
<a href="#M000012">tokenize</a>
|
287
|
+
</div>
|
288
|
+
</div>
|
289
|
+
|
290
|
+
<div id="constants-list">
|
291
|
+
<h2 class="section-bar">Constants</h2>
|
292
|
+
|
293
|
+
<div class="name-list">
|
294
|
+
<table summary="Constants">
|
295
|
+
<tr class="top-aligned-row context-row">
|
296
|
+
<td class="context-item-name">VERSION</td>
|
297
|
+
<td>=</td>
|
298
|
+
<td class="context-item-value">"0.2"</td>
|
299
|
+
</tr>
|
300
|
+
</table>
|
301
|
+
</div>
|
302
|
+
</div>
|
303
|
+
|
304
|
+
|
305
|
+
|
306
|
+
|
307
|
+
|
308
|
+
</div>
|
309
|
+
|
310
|
+
|
311
|
+
|
312
|
+
<!-- if includes -->
|
313
|
+
|
314
|
+
|
315
|
+
<!-- if method_list -->
|
316
|
+
<div id="methods">
|
317
|
+
<h2 class="section-bar">Public Class methods</h2>
|
318
|
+
|
319
|
+
<div id="method-M000001" class="method-detail">
|
320
|
+
<a name="M000001"></a>
|
321
|
+
|
322
|
+
<div class="method-heading">
|
323
|
+
<a href="#M000001" class="method-signature">
|
324
|
+
<span class="method-name">new</span><span class="method-args">(string, options=[2])</span>
|
325
|
+
</a>
|
326
|
+
</div>
|
327
|
+
|
328
|
+
<div class="method-description">
|
329
|
+
<p>
|
330
|
+
Create a new <a href="RubyPants.html">RubyPants</a> instance with the text
|
331
|
+
in <tt>string</tt>.
|
332
|
+
</p>
|
333
|
+
<p>
|
334
|
+
Allowed elements in the options array:
|
335
|
+
</p>
|
336
|
+
<table>
|
337
|
+
<tr><td valign="top">0 :</td><td>do nothing
|
338
|
+
|
339
|
+
</td></tr>
|
340
|
+
<tr><td valign="top">1 :</td><td>enable all, using only em-dash shortcuts
|
341
|
+
|
342
|
+
</td></tr>
|
343
|
+
<tr><td valign="top">2 :</td><td>enable all, using old school en- and em-dash shortcuts (<b>default</b>)
|
344
|
+
|
345
|
+
</td></tr>
|
346
|
+
<tr><td valign="top">3 :</td><td>enable all, using inverted old school en and em-dash shortcuts
|
347
|
+
|
348
|
+
</td></tr>
|
349
|
+
<tr><td valign="top">-1 :</td><td>stupefy (translate HTML entities to their ASCII-counterparts)
|
350
|
+
|
351
|
+
</td></tr>
|
352
|
+
</table>
|
353
|
+
<p>
|
354
|
+
If you don’t like any of these defaults, you can pass symbols to
|
355
|
+
change <a href="RubyPants.html">RubyPants</a>’ behavior:
|
356
|
+
</p>
|
357
|
+
<table>
|
358
|
+
<tr><td valign="top"><tt>:quotes</tt> :</td><td>quotes
|
359
|
+
|
360
|
+
</td></tr>
|
361
|
+
<tr><td valign="top"><tt>:backticks</tt> :</td><td>backtick quotes (``double’’ only)
|
362
|
+
|
363
|
+
</td></tr>
|
364
|
+
<tr><td valign="top"><tt>:allbackticks</tt> :</td><td>backtick quotes (``double’’ and `single’)
|
365
|
+
|
366
|
+
</td></tr>
|
367
|
+
<tr><td valign="top"><tt>:dashes</tt> :</td><td>dashes
|
368
|
+
|
369
|
+
</td></tr>
|
370
|
+
<tr><td valign="top"><tt>:oldschool</tt> :</td><td>old school dashes
|
371
|
+
|
372
|
+
</td></tr>
|
373
|
+
<tr><td valign="top"><tt>:inverted</tt> :</td><td>inverted old school dashes
|
374
|
+
|
375
|
+
</td></tr>
|
376
|
+
<tr><td valign="top"><tt>:ellipses</tt> :</td><td>ellipses
|
377
|
+
|
378
|
+
</td></tr>
|
379
|
+
<tr><td valign="top"><tt>:convertquotes</tt> :</td><td>convert <tt>&quot;</tt> entities to <tt>"</tt> for Dreamweaver
|
380
|
+
users
|
381
|
+
|
382
|
+
</td></tr>
|
383
|
+
<tr><td valign="top"><tt>:stupefy</tt> :</td><td>translate <a href="RubyPants.html">RubyPants</a> HTML entities to their
|
384
|
+
ASCII counterparts.
|
385
|
+
|
386
|
+
</td></tr>
|
387
|
+
</table>
|
388
|
+
<p><a class="source-toggle" href="#"
|
389
|
+
onclick="toggleCode('M000001-source');return false;">[Source]</a></p>
|
390
|
+
<div class="method-source-code" id="M000001-source">
|
391
|
+
<pre>
|
392
|
+
<span class="ruby-comment cmt"># File rubypants.rb, line 207</span>
|
393
|
+
207: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">initialize</span>(<span class="ruby-identifier">string</span>, <span class="ruby-identifier">options</span>=[<span class="ruby-value">2</span>])
|
394
|
+
208: <span class="ruby-keyword kw">super</span> <span class="ruby-identifier">string</span>
|
395
|
+
209: <span class="ruby-ivar">@options</span> = [<span class="ruby-operator">*</span><span class="ruby-identifier">options</span>]
|
396
|
+
210: <span class="ruby-keyword kw">end</span>
|
397
|
+
</pre>
|
398
|
+
</div>
|
399
|
+
</div>
|
400
|
+
</div>
|
401
|
+
|
402
|
+
<h2 class="section-bar">Public Instance methods</h2>
|
403
|
+
|
404
|
+
<div id="method-M000002" class="method-detail">
|
405
|
+
<a name="M000002"></a>
|
406
|
+
|
407
|
+
<div class="method-heading">
|
408
|
+
<a href="#M000002" class="method-signature">
|
409
|
+
<span class="method-name">to_html</span><span class="method-args">()</span>
|
410
|
+
</a>
|
411
|
+
</div>
|
412
|
+
|
413
|
+
<div class="method-description">
|
414
|
+
<p>
|
415
|
+
Apply SmartyPants transformations.
|
416
|
+
</p>
|
417
|
+
<p><a class="source-toggle" href="#"
|
418
|
+
onclick="toggleCode('M000002-source');return false;">[Source]</a></p>
|
419
|
+
<div class="method-source-code" id="M000002-source">
|
420
|
+
<pre>
|
421
|
+
<span class="ruby-comment cmt"># File rubypants.rb, line 213</span>
|
422
|
+
213: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">to_html</span>
|
423
|
+
214: <span class="ruby-identifier">do_quotes</span> = <span class="ruby-identifier">do_backticks</span> = <span class="ruby-identifier">do_dashes</span> = <span class="ruby-identifier">do_ellipses</span> = <span class="ruby-identifier">do_stupify</span> = <span class="ruby-keyword kw">nil</span>
|
424
|
+
215: <span class="ruby-identifier">convert_quotes</span> = <span class="ruby-keyword kw">false</span>
|
425
|
+
216:
|
426
|
+
217: <span class="ruby-keyword kw">if</span> <span class="ruby-ivar">@options</span>.<span class="ruby-identifier">include?</span> <span class="ruby-value">0</span>
|
427
|
+
218: <span class="ruby-comment cmt"># Do nothing.</span>
|
428
|
+
219: <span class="ruby-keyword kw">return</span> <span class="ruby-keyword kw">self</span>
|
429
|
+
220: <span class="ruby-keyword kw">elsif</span> <span class="ruby-ivar">@options</span>.<span class="ruby-identifier">include?</span> <span class="ruby-value">1</span>
|
430
|
+
221: <span class="ruby-comment cmt"># Do everything, turn all options on.</span>
|
431
|
+
222: <span class="ruby-identifier">do_quotes</span> = <span class="ruby-identifier">do_backticks</span> = <span class="ruby-identifier">do_ellipses</span> = <span class="ruby-keyword kw">true</span>
|
432
|
+
223: <span class="ruby-identifier">do_dashes</span> = <span class="ruby-identifier">:normal</span>
|
433
|
+
224: <span class="ruby-keyword kw">elsif</span> <span class="ruby-ivar">@options</span>.<span class="ruby-identifier">include?</span> <span class="ruby-value">2</span>
|
434
|
+
225: <span class="ruby-comment cmt"># Do everything, turn all options on, use old school dash shorthand.</span>
|
435
|
+
226: <span class="ruby-identifier">do_quotes</span> = <span class="ruby-identifier">do_backticks</span> = <span class="ruby-identifier">do_ellipses</span> = <span class="ruby-keyword kw">true</span>
|
436
|
+
227: <span class="ruby-identifier">do_dashes</span> = <span class="ruby-identifier">:oldschool</span>
|
437
|
+
228: <span class="ruby-keyword kw">elsif</span> <span class="ruby-ivar">@options</span>.<span class="ruby-identifier">include?</span> <span class="ruby-value">3</span>
|
438
|
+
229: <span class="ruby-comment cmt"># Do everything, turn all options on, use inverted old school</span>
|
439
|
+
230: <span class="ruby-comment cmt"># dash shorthand.</span>
|
440
|
+
231: <span class="ruby-identifier">do_quotes</span> = <span class="ruby-identifier">do_backticks</span> = <span class="ruby-identifier">do_ellipses</span> = <span class="ruby-keyword kw">true</span>
|
441
|
+
232: <span class="ruby-identifier">do_dashes</span> = <span class="ruby-identifier">:inverted</span>
|
442
|
+
233: <span class="ruby-keyword kw">elsif</span> <span class="ruby-ivar">@options</span>.<span class="ruby-identifier">include?</span>(<span class="ruby-value">-1</span>)
|
443
|
+
234: <span class="ruby-identifier">do_stupefy</span> = <span class="ruby-keyword kw">true</span>
|
444
|
+
235: <span class="ruby-keyword kw">else</span>
|
445
|
+
236: <span class="ruby-identifier">do_quotes</span> = <span class="ruby-ivar">@options</span>.<span class="ruby-identifier">include?</span> <span class="ruby-identifier">:quotes</span>
|
446
|
+
237: <span class="ruby-identifier">do_backticks</span> = <span class="ruby-ivar">@options</span>.<span class="ruby-identifier">include?</span> <span class="ruby-identifier">:backticks</span>
|
447
|
+
238: <span class="ruby-identifier">do_backticks</span> = <span class="ruby-identifier">:both</span> <span class="ruby-keyword kw">if</span> <span class="ruby-ivar">@options</span>.<span class="ruby-identifier">include?</span> <span class="ruby-identifier">:allbackticks</span>
|
448
|
+
239: <span class="ruby-identifier">do_dashes</span> = <span class="ruby-identifier">:normal</span> <span class="ruby-keyword kw">if</span> <span class="ruby-ivar">@options</span>.<span class="ruby-identifier">include?</span> <span class="ruby-identifier">:dashes</span>
|
449
|
+
240: <span class="ruby-identifier">do_dashes</span> = <span class="ruby-identifier">:oldschool</span> <span class="ruby-keyword kw">if</span> <span class="ruby-ivar">@options</span>.<span class="ruby-identifier">include?</span> <span class="ruby-identifier">:oldschool</span>
|
450
|
+
241: <span class="ruby-identifier">do_dashes</span> = <span class="ruby-identifier">:inverted</span> <span class="ruby-keyword kw">if</span> <span class="ruby-ivar">@options</span>.<span class="ruby-identifier">include?</span> <span class="ruby-identifier">:inverted</span>
|
451
|
+
242: <span class="ruby-identifier">do_ellipses</span> = <span class="ruby-ivar">@options</span>.<span class="ruby-identifier">include?</span> <span class="ruby-identifier">:ellipses</span>
|
452
|
+
243: <span class="ruby-identifier">convert_quotes</span> = <span class="ruby-ivar">@options</span>.<span class="ruby-identifier">include?</span> <span class="ruby-identifier">:convertquotes</span>
|
453
|
+
244: <span class="ruby-identifier">do_stupefy</span> = <span class="ruby-ivar">@options</span>.<span class="ruby-identifier">include?</span> <span class="ruby-identifier">:stupefy</span>
|
454
|
+
245: <span class="ruby-keyword kw">end</span>
|
455
|
+
246:
|
456
|
+
247: <span class="ruby-comment cmt"># Parse the HTML</span>
|
457
|
+
248: <span class="ruby-identifier">tokens</span> = <span class="ruby-identifier">tokenize</span>
|
458
|
+
249:
|
459
|
+
250: <span class="ruby-comment cmt"># Keep track of when we're inside <pre> or <code> tags.</span>
|
460
|
+
251: <span class="ruby-identifier">in_pre</span> = <span class="ruby-keyword kw">false</span>
|
461
|
+
252:
|
462
|
+
253: <span class="ruby-comment cmt"># Here is the result stored in.</span>
|
463
|
+
254: <span class="ruby-identifier">result</span> = <span class="ruby-value str">""</span>
|
464
|
+
255:
|
465
|
+
256: <span class="ruby-comment cmt"># This is a cheat, used to get some context for one-character</span>
|
466
|
+
257: <span class="ruby-comment cmt"># tokens that consist of just a quote char. What we do is remember</span>
|
467
|
+
258: <span class="ruby-comment cmt"># the last character of the previous text token, to use as context</span>
|
468
|
+
259: <span class="ruby-comment cmt"># to curl single- character quote tokens correctly.</span>
|
469
|
+
260: <span class="ruby-identifier">prev_token_last_char</span> = <span class="ruby-keyword kw">nil</span>
|
470
|
+
261:
|
471
|
+
262: <span class="ruby-identifier">tokens</span>.<span class="ruby-identifier">each</span> { <span class="ruby-operator">|</span><span class="ruby-identifier">token</span><span class="ruby-operator">|</span>
|
472
|
+
263: <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">token</span>.<span class="ruby-identifier">first</span> <span class="ruby-operator">==</span> <span class="ruby-identifier">:tag</span>
|
473
|
+
264: <span class="ruby-identifier">result</span> <span class="ruby-operator"><<</span> <span class="ruby-identifier">token</span>[<span class="ruby-value">1</span>]
|
474
|
+
265: <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">token</span>[<span class="ruby-value">1</span>] <span class="ruby-operator">=~</span> <span class="ruby-regexp re">%!<(/?)(?:pre|code|kbd|script|math)[\s>]!</span>
|
475
|
+
266: <span class="ruby-identifier">in_pre</span> = (<span class="ruby-identifier">$1</span> <span class="ruby-operator">!=</span> <span class="ruby-value str">"/"</span>) <span class="ruby-comment cmt"># Opening or closing tag?</span>
|
476
|
+
267: <span class="ruby-keyword kw">end</span>
|
477
|
+
268: <span class="ruby-keyword kw">else</span>
|
478
|
+
269: <span class="ruby-identifier">t</span> = <span class="ruby-identifier">token</span>[<span class="ruby-value">1</span>]
|
479
|
+
270:
|
480
|
+
271: <span class="ruby-comment cmt"># Remember last char of this token before processing.</span>
|
481
|
+
272: <span class="ruby-identifier">last_char</span> = <span class="ruby-identifier">t</span>[<span class="ruby-value">-1</span>].<span class="ruby-identifier">chr</span>
|
482
|
+
273:
|
483
|
+
274: <span class="ruby-keyword kw">unless</span> <span class="ruby-identifier">in_pre</span>
|
484
|
+
275: <span class="ruby-identifier">t</span> = <span class="ruby-identifier">process_escapes</span> <span class="ruby-identifier">t</span>
|
485
|
+
276:
|
486
|
+
277: <span class="ruby-identifier">t</span>.<span class="ruby-identifier">gsub!</span>(<span class="ruby-regexp re">/&quot;/</span>, <span class="ruby-value str">'"'</span>) <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">convert_quotes</span>
|
487
|
+
278:
|
488
|
+
279: <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">do_dashes</span>
|
489
|
+
280: <span class="ruby-identifier">t</span> = <span class="ruby-identifier">educate_dashes</span> <span class="ruby-identifier">t</span> <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">do_dashes</span> <span class="ruby-operator">==</span> <span class="ruby-identifier">:normal</span>
|
490
|
+
281: <span class="ruby-identifier">t</span> = <span class="ruby-identifier">educate_dashes_oldschool</span> <span class="ruby-identifier">t</span> <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">do_dashes</span> <span class="ruby-operator">==</span> <span class="ruby-identifier">:oldschool</span>
|
491
|
+
282: <span class="ruby-identifier">t</span> = <span class="ruby-identifier">educate_dashes_inverted</span> <span class="ruby-identifier">t</span> <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">do_dashes</span> <span class="ruby-operator">==</span> <span class="ruby-identifier">:inverted</span>
|
492
|
+
283: <span class="ruby-keyword kw">end</span>
|
493
|
+
284:
|
494
|
+
285: <span class="ruby-identifier">t</span> = <span class="ruby-identifier">educate_ellipses</span> <span class="ruby-identifier">t</span> <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">do_ellipses</span>
|
495
|
+
286:
|
496
|
+
287: <span class="ruby-comment cmt"># Note: backticks need to be processed before quotes.</span>
|
497
|
+
288: <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">do_backticks</span>
|
498
|
+
289: <span class="ruby-identifier">t</span> = <span class="ruby-identifier">educate_backticks</span> <span class="ruby-identifier">t</span>
|
499
|
+
290: <span class="ruby-identifier">t</span> = <span class="ruby-identifier">educate_single_backticks</span> <span class="ruby-identifier">t</span> <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">do_backticks</span> <span class="ruby-operator">==</span> <span class="ruby-identifier">:both</span>
|
500
|
+
291: <span class="ruby-keyword kw">end</span>
|
501
|
+
292:
|
502
|
+
293: <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">do_quotes</span>
|
503
|
+
294: <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">t</span> <span class="ruby-operator">==</span> <span class="ruby-value str">"'"</span>
|
504
|
+
295: <span class="ruby-comment cmt"># Special case: single-character ' token</span>
|
505
|
+
296: <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">prev_token_last_char</span> <span class="ruby-operator">=~</span> <span class="ruby-regexp re">/\S/</span>
|
506
|
+
297: <span class="ruby-identifier">t</span> = <span class="ruby-value str">"&#8217;"</span>
|
507
|
+
298: <span class="ruby-keyword kw">else</span>
|
508
|
+
299: <span class="ruby-identifier">t</span> = <span class="ruby-value str">"&#8216;"</span>
|
509
|
+
300: <span class="ruby-keyword kw">end</span>
|
510
|
+
301: <span class="ruby-keyword kw">elsif</span> <span class="ruby-identifier">t</span> <span class="ruby-operator">==</span> <span class="ruby-value str">'"'</span>
|
511
|
+
302: <span class="ruby-comment cmt"># Special case: single-character " token</span>
|
512
|
+
303: <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">prev_token_last_char</span> <span class="ruby-operator">=~</span> <span class="ruby-regexp re">/\S/</span>
|
513
|
+
304: <span class="ruby-identifier">t</span> = <span class="ruby-value str">"&#8221;"</span>
|
514
|
+
305: <span class="ruby-keyword kw">else</span>
|
515
|
+
306: <span class="ruby-identifier">t</span> = <span class="ruby-value str">"&#8220;"</span>
|
516
|
+
307: <span class="ruby-keyword kw">end</span>
|
517
|
+
308: <span class="ruby-keyword kw">else</span>
|
518
|
+
309: <span class="ruby-comment cmt"># Normal case: </span>
|
519
|
+
310: <span class="ruby-identifier">t</span> = <span class="ruby-identifier">educate_quotes</span> <span class="ruby-identifier">t</span>
|
520
|
+
311: <span class="ruby-keyword kw">end</span>
|
521
|
+
312: <span class="ruby-keyword kw">end</span>
|
522
|
+
313:
|
523
|
+
314: <span class="ruby-identifier">t</span> = <span class="ruby-identifier">stupefy_entities</span> <span class="ruby-identifier">t</span> <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">do_stupefy</span>
|
524
|
+
315: <span class="ruby-keyword kw">end</span>
|
525
|
+
316:
|
526
|
+
317: <span class="ruby-identifier">prev_token_last_char</span> = <span class="ruby-identifier">last_char</span>
|
527
|
+
318: <span class="ruby-identifier">result</span> <span class="ruby-operator"><<</span> <span class="ruby-identifier">t</span>
|
528
|
+
319: <span class="ruby-keyword kw">end</span>
|
529
|
+
320: }
|
530
|
+
321:
|
531
|
+
322: <span class="ruby-comment cmt"># Done</span>
|
532
|
+
323: <span class="ruby-identifier">result</span>
|
533
|
+
324: <span class="ruby-keyword kw">end</span>
|
534
|
+
</pre>
|
535
|
+
</div>
|
536
|
+
</div>
|
537
|
+
</div>
|
538
|
+
|
539
|
+
<h2 class="section-bar">Protected Instance methods</h2>
|
540
|
+
|
541
|
+
<div id="method-M000008" class="method-detail">
|
542
|
+
<a name="M000008"></a>
|
543
|
+
|
544
|
+
<div class="method-heading">
|
545
|
+
<a href="#M000008" class="method-signature">
|
546
|
+
<span class="method-name">educate_backticks</span><span class="method-args">(str)</span>
|
547
|
+
</a>
|
548
|
+
</div>
|
549
|
+
|
550
|
+
<div class="method-description">
|
551
|
+
<p>
|
552
|
+
Return the string, with
|
553
|
+
"<tt>``backticks’‘</tt>"-style single quotes
|
554
|
+
translated into HTML curly quote entities.
|
555
|
+
</p>
|
556
|
+
<p><a class="source-toggle" href="#"
|
557
|
+
onclick="toggleCode('M000008-source');return false;">[Source]</a></p>
|
558
|
+
<div class="method-source-code" id="M000008-source">
|
559
|
+
<pre>
|
560
|
+
<span class="ruby-comment cmt"># File rubypants.rb, line 384</span>
|
561
|
+
384: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">educate_backticks</span>(<span class="ruby-identifier">str</span>)
|
562
|
+
385: <span class="ruby-identifier">str</span>.<span class="ruby-identifier">gsub</span>(<span class="ruby-value str">"``"</span>, <span class="ruby-value str">'&#8220;'</span>).<span class="ruby-identifier">gsub</span>(<span class="ruby-value str">"''"</span>, <span class="ruby-value str">'&#8221;'</span>)
|
563
|
+
386: <span class="ruby-keyword kw">end</span>
|
564
|
+
</pre>
|
565
|
+
</div>
|
566
|
+
</div>
|
567
|
+
</div>
|
568
|
+
|
569
|
+
<div id="method-M000004" class="method-detail">
|
570
|
+
<a name="M000004"></a>
|
571
|
+
|
572
|
+
<div class="method-heading">
|
573
|
+
<a href="#M000004" class="method-signature">
|
574
|
+
<span class="method-name">educate_dashes</span><span class="method-args">(str)</span>
|
575
|
+
</a>
|
576
|
+
</div>
|
577
|
+
|
578
|
+
<div class="method-description">
|
579
|
+
<p>
|
580
|
+
The string, with each instance of "<tt>—</tt>" translated
|
581
|
+
to an em-dash HTML entity.
|
582
|
+
</p>
|
583
|
+
<p><a class="source-toggle" href="#"
|
584
|
+
onclick="toggleCode('M000004-source');return false;">[Source]</a></p>
|
585
|
+
<div class="method-source-code" id="M000004-source">
|
586
|
+
<pre>
|
587
|
+
<span class="ruby-comment cmt"># File rubypants.rb, line 347</span>
|
588
|
+
347: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">educate_dashes</span>(<span class="ruby-identifier">str</span>)
|
589
|
+
348: <span class="ruby-identifier">str</span>.<span class="ruby-identifier">gsub</span>(<span class="ruby-regexp re">/--/</span>, <span class="ruby-value str">'&#8212;'</span>)
|
590
|
+
349: <span class="ruby-keyword kw">end</span>
|
591
|
+
</pre>
|
592
|
+
</div>
|
593
|
+
</div>
|
594
|
+
</div>
|
595
|
+
|
596
|
+
<div id="method-M000006" class="method-detail">
|
597
|
+
<a name="M000006"></a>
|
598
|
+
|
599
|
+
<div class="method-heading">
|
600
|
+
<a href="#M000006" class="method-signature">
|
601
|
+
<span class="method-name">educate_dashes_inverted</span><span class="method-args">(str)</span>
|
602
|
+
</a>
|
603
|
+
</div>
|
604
|
+
|
605
|
+
<div class="method-description">
|
606
|
+
<p>
|
607
|
+
Return the string, with each instance of "<tt>—</tt>"
|
608
|
+
translated to an em-dash HTML entity, and each "<tt>—</tt>"
|
609
|
+
translated to an en-dash HTML entity. Two reasons why: First, unlike the
|
610
|
+
en- and em-dash syntax supported by <tt><a
|
611
|
+
href="RubyPants.html#M000005">educate_dashes_oldschool</a></tt>, it’s
|
612
|
+
compatible with existing entries written before SmartyPants 1.1, back when
|
613
|
+
"<tt>—</tt>" was only used for em-dashes. Second, em-dashes
|
614
|
+
are more common than en-dashes, and so it sort of makes sense that the
|
615
|
+
shortcut should be shorter to type. (Thanks to Aaron Swartz for the idea.)
|
616
|
+
</p>
|
617
|
+
<p><a class="source-toggle" href="#"
|
618
|
+
onclick="toggleCode('M000006-source');return false;">[Source]</a></p>
|
619
|
+
<div class="method-source-code" id="M000006-source">
|
620
|
+
<pre>
|
621
|
+
<span class="ruby-comment cmt"># File rubypants.rb, line 369</span>
|
622
|
+
369: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">educate_dashes_inverted</span>(<span class="ruby-identifier">str</span>)
|
623
|
+
370: <span class="ruby-identifier">str</span>.<span class="ruby-identifier">gsub</span>(<span class="ruby-regexp re">/---/</span>, <span class="ruby-value str">'&#8211;'</span>).<span class="ruby-identifier">gsub</span>(<span class="ruby-regexp re">/--/</span>, <span class="ruby-value str">'&#8212;'</span>)
|
624
|
+
371: <span class="ruby-keyword kw">end</span>
|
625
|
+
</pre>
|
626
|
+
</div>
|
627
|
+
</div>
|
628
|
+
</div>
|
629
|
+
|
630
|
+
<div id="method-M000005" class="method-detail">
|
631
|
+
<a name="M000005"></a>
|
632
|
+
|
633
|
+
<div class="method-heading">
|
634
|
+
<a href="#M000005" class="method-signature">
|
635
|
+
<span class="method-name">educate_dashes_oldschool</span><span class="method-args">(str)</span>
|
636
|
+
</a>
|
637
|
+
</div>
|
638
|
+
|
639
|
+
<div class="method-description">
|
640
|
+
<p>
|
641
|
+
The string, with each instance of "<tt>—</tt>" translated
|
642
|
+
to an en-dash HTML entity, and each "<tt>—</tt>" translated
|
643
|
+
to an em-dash HTML entity.
|
644
|
+
</p>
|
645
|
+
<p><a class="source-toggle" href="#"
|
646
|
+
onclick="toggleCode('M000005-source');return false;">[Source]</a></p>
|
647
|
+
<div class="method-source-code" id="M000005-source">
|
648
|
+
<pre>
|
649
|
+
<span class="ruby-comment cmt"># File rubypants.rb, line 355</span>
|
650
|
+
355: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">educate_dashes_oldschool</span>(<span class="ruby-identifier">str</span>)
|
651
|
+
356: <span class="ruby-identifier">str</span>.<span class="ruby-identifier">gsub</span>(<span class="ruby-regexp re">/---/</span>, <span class="ruby-value str">'&#8212;'</span>).<span class="ruby-identifier">gsub</span>(<span class="ruby-regexp re">/--/</span>, <span class="ruby-value str">'&#8211;'</span>)
|
652
|
+
357: <span class="ruby-keyword kw">end</span>
|
653
|
+
</pre>
|
654
|
+
</div>
|
655
|
+
</div>
|
656
|
+
</div>
|
657
|
+
|
658
|
+
<div id="method-M000007" class="method-detail">
|
659
|
+
<a name="M000007"></a>
|
660
|
+
|
661
|
+
<div class="method-heading">
|
662
|
+
<a href="#M000007" class="method-signature">
|
663
|
+
<span class="method-name">educate_ellipses</span><span class="method-args">(str)</span>
|
664
|
+
</a>
|
665
|
+
</div>
|
666
|
+
|
667
|
+
<div class="method-description">
|
668
|
+
<p>
|
669
|
+
Return the string, with each instance of "<tt>…</tt>"
|
670
|
+
translated to an ellipsis HTML entity. Also converts the case where there
|
671
|
+
are spaces between the dots.
|
672
|
+
</p>
|
673
|
+
<p><a class="source-toggle" href="#"
|
674
|
+
onclick="toggleCode('M000007-source');return false;">[Source]</a></p>
|
675
|
+
<div class="method-source-code" id="M000007-source">
|
676
|
+
<pre>
|
677
|
+
<span class="ruby-comment cmt"># File rubypants.rb, line 377</span>
|
678
|
+
377: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">educate_ellipses</span>(<span class="ruby-identifier">str</span>)
|
679
|
+
378: <span class="ruby-identifier">str</span>.<span class="ruby-identifier">gsub</span>(<span class="ruby-value str">'...'</span>, <span class="ruby-value str">'&#8230;'</span>).<span class="ruby-identifier">gsub</span>(<span class="ruby-value str">'. . .'</span>, <span class="ruby-value str">'&#8230;'</span>)
|
680
|
+
379: <span class="ruby-keyword kw">end</span>
|
681
|
+
</pre>
|
682
|
+
</div>
|
683
|
+
</div>
|
684
|
+
</div>
|
685
|
+
|
686
|
+
<div id="method-M000010" class="method-detail">
|
687
|
+
<a name="M000010"></a>
|
688
|
+
|
689
|
+
<div class="method-heading">
|
690
|
+
<a href="#M000010" class="method-signature">
|
691
|
+
<span class="method-name">educate_quotes</span><span class="method-args">(str)</span>
|
692
|
+
</a>
|
693
|
+
</div>
|
694
|
+
|
695
|
+
<div class="method-description">
|
696
|
+
<p>
|
697
|
+
Return the string, with "educated" curly quote HTML entities.
|
698
|
+
</p>
|
699
|
+
<p><a class="source-toggle" href="#"
|
700
|
+
onclick="toggleCode('M000010-source');return false;">[Source]</a></p>
|
701
|
+
<div class="method-source-code" id="M000010-source">
|
702
|
+
<pre>
|
703
|
+
<span class="ruby-comment cmt"># File rubypants.rb, line 397</span>
|
704
|
+
397: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">educate_quotes</span>(<span class="ruby-identifier">str</span>)
|
705
|
+
398: <span class="ruby-identifier">punct_class</span> = <span class="ruby-value str">'[!"#\$\%\'()*+,\-.\/:;<=>?\@\[\\\\\]\^^_`{|}~]'</span>
|
706
|
+
399:
|
707
|
+
400: <span class="ruby-identifier">str</span> = <span class="ruby-identifier">str</span>.<span class="ruby-identifier">dup</span>
|
708
|
+
401:
|
709
|
+
402: <span class="ruby-comment cmt"># Special case if the very first character is a quote followed by</span>
|
710
|
+
403: <span class="ruby-comment cmt"># punctuation at a non-word-break. Close the quotes by brute</span>
|
711
|
+
404: <span class="ruby-comment cmt"># force:</span>
|
712
|
+
405: <span class="ruby-identifier">str</span>.<span class="ruby-identifier">gsub!</span>(<span class="ruby-node">/^'(?=#{punct_class}\B)/</span>, <span class="ruby-value str">'&#8217;'</span>)
|
713
|
+
406: <span class="ruby-identifier">str</span>.<span class="ruby-identifier">gsub!</span>(<span class="ruby-node">/^"(?=#{punct_class}\B)/</span>, <span class="ruby-value str">'&#8221;'</span>)
|
714
|
+
407:
|
715
|
+
408: <span class="ruby-comment cmt"># Special case for double sets of quotes, e.g.:</span>
|
716
|
+
409: <span class="ruby-comment cmt"># <p>He said, "'Quoted' words in a larger quote."</p></span>
|
717
|
+
410: <span class="ruby-identifier">str</span>.<span class="ruby-identifier">gsub!</span>(<span class="ruby-regexp re">/"'(?=\w)/</span>, <span class="ruby-value str">'&#8220;&#8216;'</span>)
|
718
|
+
411: <span class="ruby-identifier">str</span>.<span class="ruby-identifier">gsub!</span>(<span class="ruby-regexp re">/'"(?=\w)/</span>, <span class="ruby-value str">'&#8216;&#8220;'</span>)
|
719
|
+
412:
|
720
|
+
413: <span class="ruby-comment cmt"># Special case for decade abbreviations (the '80s):</span>
|
721
|
+
414: <span class="ruby-identifier">str</span>.<span class="ruby-identifier">gsub!</span>(<span class="ruby-regexp re">/'(?=\d\ds)/</span>, <span class="ruby-value str">'&#8217;'</span>)
|
722
|
+
415:
|
723
|
+
416: <span class="ruby-identifier">close_class</span> = <span class="ruby-value str">%![^\ \t\r\n\\[\{\(\-]!</span>
|
724
|
+
417: <span class="ruby-identifier">dec_dashes</span> = <span class="ruby-value str">'&#8211;|&#8212;'</span>
|
725
|
+
418:
|
726
|
+
419: <span class="ruby-comment cmt"># Get most opening single quotes:</span>
|
727
|
+
420: <span class="ruby-identifier">str</span>.<span class="ruby-identifier">gsub!</span>(<span class="ruby-node">/(\s|&nbsp;|--|&[mn]dash;|#{dec_dashes}|&#x201[34];)'(?=\w)/</span>,
|
728
|
+
421: <span class="ruby-value str">'\1&#8216;'</span>)
|
729
|
+
422: <span class="ruby-comment cmt"># Single closing quotes:</span>
|
730
|
+
423: <span class="ruby-identifier">str</span>.<span class="ruby-identifier">gsub!</span>(<span class="ruby-node">/(#{close_class})'/</span>, <span class="ruby-value str">'\1&#8217;'</span>)
|
731
|
+
424: <span class="ruby-identifier">str</span>.<span class="ruby-identifier">gsub!</span>(<span class="ruby-regexp re">/'(\s|s\b|$)/</span>, <span class="ruby-value str">'&#8217;\1'</span>)
|
732
|
+
425: <span class="ruby-comment cmt"># Any remaining single quotes should be opening ones:</span>
|
733
|
+
426: <span class="ruby-identifier">str</span>.<span class="ruby-identifier">gsub!</span>(<span class="ruby-regexp re">/'/</span>, <span class="ruby-value str">'&#8216;'</span>)
|
734
|
+
427:
|
735
|
+
428: <span class="ruby-comment cmt"># Get most opening double quotes:</span>
|
736
|
+
429: <span class="ruby-identifier">str</span>.<span class="ruby-identifier">gsub!</span>(<span class="ruby-node">/(\s|&nbsp;|--|&[mn]dash;|#{dec_dashes}|&#x201[34];)"(?=\w)/</span>,
|
737
|
+
430: <span class="ruby-value str">'\1&#8220;'</span>)
|
738
|
+
431: <span class="ruby-comment cmt"># Double closing quotes:</span>
|
739
|
+
432: <span class="ruby-identifier">str</span>.<span class="ruby-identifier">gsub!</span>(<span class="ruby-node">/(#{close_class})"/</span>, <span class="ruby-value str">'\1&#8221;'</span>)
|
740
|
+
433: <span class="ruby-identifier">str</span>.<span class="ruby-identifier">gsub!</span>(<span class="ruby-regexp re">/"(\s|s\b|$)/</span>, <span class="ruby-value str">'&#8221;\1'</span>)
|
741
|
+
434: <span class="ruby-comment cmt"># Any remaining quotes should be opening ones:</span>
|
742
|
+
435: <span class="ruby-identifier">str</span>.<span class="ruby-identifier">gsub!</span>(<span class="ruby-regexp re">/"/</span>, <span class="ruby-value str">'&#8220;'</span>)
|
743
|
+
436:
|
744
|
+
437: <span class="ruby-identifier">str</span>
|
745
|
+
438: <span class="ruby-keyword kw">end</span>
|
746
|
+
</pre>
|
747
|
+
</div>
|
748
|
+
</div>
|
749
|
+
</div>
|
750
|
+
|
751
|
+
<div id="method-M000009" class="method-detail">
|
752
|
+
<a name="M000009"></a>
|
753
|
+
|
754
|
+
<div class="method-heading">
|
755
|
+
<a href="#M000009" class="method-signature">
|
756
|
+
<span class="method-name">educate_single_backticks</span><span class="method-args">(str)</span>
|
757
|
+
</a>
|
758
|
+
</div>
|
759
|
+
|
760
|
+
<div class="method-description">
|
761
|
+
<p>
|
762
|
+
Return the string, with "<tt>`backticks’</tt>"-style single
|
763
|
+
quotes translated into HTML curly quote entities.
|
764
|
+
</p>
|
765
|
+
<p><a class="source-toggle" href="#"
|
766
|
+
onclick="toggleCode('M000009-source');return false;">[Source]</a></p>
|
767
|
+
<div class="method-source-code" id="M000009-source">
|
768
|
+
<pre>
|
769
|
+
<span class="ruby-comment cmt"># File rubypants.rb, line 391</span>
|
770
|
+
391: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">educate_single_backticks</span>(<span class="ruby-identifier">str</span>)
|
771
|
+
392: <span class="ruby-identifier">str</span>.<span class="ruby-identifier">gsub</span>(<span class="ruby-value str">"`"</span>, <span class="ruby-value str">'&#8216;'</span>).<span class="ruby-identifier">gsub</span>(<span class="ruby-value str">"'"</span>, <span class="ruby-value str">'&#8217;'</span>)
|
772
|
+
393: <span class="ruby-keyword kw">end</span>
|
773
|
+
</pre>
|
774
|
+
</div>
|
775
|
+
</div>
|
776
|
+
</div>
|
777
|
+
|
778
|
+
<div id="method-M000003" class="method-detail">
|
779
|
+
<a name="M000003"></a>
|
780
|
+
|
781
|
+
<div class="method-heading">
|
782
|
+
<a href="#M000003" class="method-signature">
|
783
|
+
<span class="method-name">process_escapes</span><span class="method-args">(str)</span>
|
784
|
+
</a>
|
785
|
+
</div>
|
786
|
+
|
787
|
+
<div class="method-description">
|
788
|
+
<p>
|
789
|
+
Return the string, with after processing the following backslash escape
|
790
|
+
sequences. This is useful if you want to force a "dumb" quote or
|
791
|
+
other character to appear.
|
792
|
+
</p>
|
793
|
+
<p>
|
794
|
+
Escaped are:
|
795
|
+
</p>
|
796
|
+
<pre>
|
797
|
+
\\ \" \' \. \- \`
|
798
|
+
</pre>
|
799
|
+
<p><a class="source-toggle" href="#"
|
800
|
+
onclick="toggleCode('M000003-source');return false;">[Source]</a></p>
|
801
|
+
<div class="method-source-code" id="M000003-source">
|
802
|
+
<pre>
|
803
|
+
<span class="ruby-comment cmt"># File rubypants.rb, line 335</span>
|
804
|
+
335: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">process_escapes</span>(<span class="ruby-identifier">str</span>)
|
805
|
+
336: <span class="ruby-identifier">str</span>.<span class="ruby-identifier">gsub</span>(<span class="ruby-value str">'\\\\'</span>, <span class="ruby-value str">'&#92;'</span>).
|
806
|
+
337: <span class="ruby-identifier">gsub</span>(<span class="ruby-value str">'\"'</span>, <span class="ruby-value str">'&#34;'</span>).
|
807
|
+
338: <span class="ruby-identifier">gsub</span>(<span class="ruby-value str">"\\\'"</span>, <span class="ruby-value str">'&#39;'</span>).
|
808
|
+
339: <span class="ruby-identifier">gsub</span>(<span class="ruby-value str">'\.'</span>, <span class="ruby-value str">'&#46;'</span>).
|
809
|
+
340: <span class="ruby-identifier">gsub</span>(<span class="ruby-value str">'\-'</span>, <span class="ruby-value str">'&#45;'</span>).
|
810
|
+
341: <span class="ruby-identifier">gsub</span>(<span class="ruby-value str">'\`'</span>, <span class="ruby-value str">'&#96;'</span>)
|
811
|
+
342: <span class="ruby-keyword kw">end</span>
|
812
|
+
</pre>
|
813
|
+
</div>
|
814
|
+
</div>
|
815
|
+
</div>
|
816
|
+
|
817
|
+
<div id="method-M000011" class="method-detail">
|
818
|
+
<a name="M000011"></a>
|
819
|
+
|
820
|
+
<div class="method-heading">
|
821
|
+
<a href="#M000011" class="method-signature">
|
822
|
+
<span class="method-name">stupefy_entities</span><span class="method-args">(str)</span>
|
823
|
+
</a>
|
824
|
+
</div>
|
825
|
+
|
826
|
+
<div class="method-description">
|
827
|
+
<p>
|
828
|
+
Return the string, with each <a href="RubyPants.html">RubyPants</a> HTML
|
829
|
+
entity translated to its ASCII counterpart.
|
830
|
+
</p>
|
831
|
+
<p>
|
832
|
+
Note: This is not reversible (but exactly the same as in SmartyPants)
|
833
|
+
</p>
|
834
|
+
<p><a class="source-toggle" href="#"
|
835
|
+
onclick="toggleCode('M000011-source');return false;">[Source]</a></p>
|
836
|
+
<div class="method-source-code" id="M000011-source">
|
837
|
+
<pre>
|
838
|
+
<span class="ruby-comment cmt"># File rubypants.rb, line 445</span>
|
839
|
+
445: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">stupefy_entities</span>(<span class="ruby-identifier">str</span>)
|
840
|
+
446: <span class="ruby-identifier">str</span>.
|
841
|
+
447: <span class="ruby-identifier">gsub</span>(<span class="ruby-regexp re">/&#8211;/</span>, <span class="ruby-value str">'-'</span>). <span class="ruby-comment cmt"># en-dash</span>
|
842
|
+
448: <span class="ruby-identifier">gsub</span>(<span class="ruby-regexp re">/&#8212;/</span>, <span class="ruby-value str">'--'</span>). <span class="ruby-comment cmt"># em-dash</span>
|
843
|
+
449:
|
844
|
+
450: <span class="ruby-identifier">gsub</span>(<span class="ruby-regexp re">/&#8216;/</span>, <span class="ruby-value str">"'"</span>). <span class="ruby-comment cmt"># open single quote</span>
|
845
|
+
451: <span class="ruby-identifier">gsub</span>(<span class="ruby-regexp re">/&#8217;/</span>, <span class="ruby-value str">"'"</span>). <span class="ruby-comment cmt"># close single quote</span>
|
846
|
+
452:
|
847
|
+
453: <span class="ruby-identifier">gsub</span>(<span class="ruby-regexp re">/&#8220;/</span>, <span class="ruby-value str">'"'</span>). <span class="ruby-comment cmt"># open double quote</span>
|
848
|
+
454: <span class="ruby-identifier">gsub</span>(<span class="ruby-regexp re">/&#8221;/</span>, <span class="ruby-value str">'"'</span>). <span class="ruby-comment cmt"># close double quote</span>
|
849
|
+
455:
|
850
|
+
456: <span class="ruby-identifier">gsub</span>(<span class="ruby-regexp re">/&#8230;/</span>, <span class="ruby-value str">'...'</span>) <span class="ruby-comment cmt"># ellipsis</span>
|
851
|
+
457: <span class="ruby-keyword kw">end</span>
|
852
|
+
</pre>
|
853
|
+
</div>
|
854
|
+
</div>
|
855
|
+
</div>
|
856
|
+
|
857
|
+
<div id="method-M000012" class="method-detail">
|
858
|
+
<a name="M000012"></a>
|
859
|
+
|
860
|
+
<div class="method-heading">
|
861
|
+
<a href="#M000012" class="method-signature">
|
862
|
+
<span class="method-name">tokenize</span><span class="method-args">()</span>
|
863
|
+
</a>
|
864
|
+
</div>
|
865
|
+
|
866
|
+
<div class="method-description">
|
867
|
+
<p>
|
868
|
+
Return an array of the tokens comprising the string. Each token is either a
|
869
|
+
tag (possibly with nested, tags contained therein, such as <tt><a
|
870
|
+
href="<MTFoo>"></tt>, or a run of text between tags.
|
871
|
+
Each element of the array is a two-element array; the first is either :tag
|
872
|
+
or :text; the second is the actual value.
|
873
|
+
</p>
|
874
|
+
<p>
|
875
|
+
Based on the <tt>_tokenize()</tt> subroutine from Brad Choate’s
|
876
|
+
MTRegex plugin. <<a
|
877
|
+
href="http://www.bradchoate.com/past/mtregex.php">www.bradchoate.com/past/mtregex.php</a>>
|
878
|
+
</p>
|
879
|
+
<p>
|
880
|
+
This is actually the easier variant using tag_soup, as used by Chad Miller
|
881
|
+
in the Python port of SmartyPants.
|
882
|
+
</p>
|
883
|
+
<p><a class="source-toggle" href="#"
|
884
|
+
onclick="toggleCode('M000012-source');return false;">[Source]</a></p>
|
885
|
+
<div class="method-source-code" id="M000012-source">
|
886
|
+
<pre>
|
887
|
+
<span class="ruby-comment cmt"># File rubypants.rb, line 471</span>
|
888
|
+
471: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">tokenize</span>
|
889
|
+
472: <span class="ruby-identifier">tag_soup</span> = <span class="ruby-regexp re">/([^<]*)(<[^>]*>)/</span>
|
890
|
+
473:
|
891
|
+
474: <span class="ruby-identifier">tokens</span> = []
|
892
|
+
475:
|
893
|
+
476: <span class="ruby-identifier">prev_end</span> = <span class="ruby-value">0</span>
|
894
|
+
477: <span class="ruby-identifier">scan</span>(<span class="ruby-identifier">tag_soup</span>) {
|
895
|
+
478: <span class="ruby-identifier">tokens</span> <span class="ruby-operator"><<</span> [<span class="ruby-identifier">:text</span>, <span class="ruby-identifier">$1</span>] <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">$1</span> <span class="ruby-operator">!=</span> <span class="ruby-value str">""</span>
|
896
|
+
479: <span class="ruby-identifier">tokens</span> <span class="ruby-operator"><<</span> [<span class="ruby-identifier">:tag</span>, <span class="ruby-identifier">$2</span>]
|
897
|
+
480:
|
898
|
+
481: <span class="ruby-identifier">prev_end</span> = <span class="ruby-identifier">$~</span>.<span class="ruby-identifier">end</span>(<span class="ruby-value">0</span>)
|
899
|
+
482: }
|
900
|
+
483:
|
901
|
+
484: <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">prev_end</span> <span class="ruby-operator"><</span> <span class="ruby-identifier">size</span>
|
902
|
+
485: <span class="ruby-identifier">tokens</span> <span class="ruby-operator"><<</span> [<span class="ruby-identifier">:text</span>, <span class="ruby-keyword kw">self</span>[<span class="ruby-identifier">prev_end</span><span class="ruby-operator">..</span><span class="ruby-value">-1</span>]]
|
903
|
+
486: <span class="ruby-keyword kw">end</span>
|
904
|
+
487:
|
905
|
+
488: <span class="ruby-identifier">tokens</span>
|
906
|
+
489: <span class="ruby-keyword kw">end</span>
|
907
|
+
</pre>
|
908
|
+
</div>
|
909
|
+
</div>
|
910
|
+
</div>
|
911
|
+
|
912
|
+
|
913
|
+
</div>
|
914
|
+
|
915
|
+
|
916
|
+
</div>
|
917
|
+
|
918
|
+
|
919
|
+
<div id="validator-badges">
|
920
|
+
<p><small><a href="http://validator.w3.org/check/referer">[Validate]</a></small></p>
|
921
|
+
</div>
|
922
|
+
|
923
|
+
</body>
|
924
|
+
</html>
|