link-checker 0.0.0
Sign up to get free protection for your applications and to get access to all the features.
- data/.rvmrc +81 -0
- data/Gemfile +12 -0
- data/Gemfile.lock +56 -0
- data/LICENSE.txt +20 -0
- data/README.md +15 -0
- data/Rakefile +29 -0
- data/VERSION +1 -0
- data/bin/check-links +8 -0
- data/lib/link_checker.rb +80 -0
- data/link-checker.gemspec +404 -0
- data/spec/link-checker_spec.rb +92 -0
- data/spec/spec_helper.rb +4 -0
- data/spec/test-site/.gitignore +12 -0
- data/spec/test-site/.powrc +5 -0
- data/spec/test-site/.rbenv-version +1 -0
- data/spec/test-site/.rvmrc +1 -0
- data/spec/test-site/.slugignore +3 -0
- data/spec/test-site/.themes/classic/sass/_base.scss +5 -0
- data/spec/test-site/.themes/classic/sass/_partials.scss +8 -0
- data/spec/test-site/.themes/classic/sass/base/_layout.scss +192 -0
- data/spec/test-site/.themes/classic/sass/base/_solarized.scss +46 -0
- data/spec/test-site/.themes/classic/sass/base/_theme.scss +86 -0
- data/spec/test-site/.themes/classic/sass/base/_typography.scss +161 -0
- data/spec/test-site/.themes/classic/sass/base/_utilities.scss +28 -0
- data/spec/test-site/.themes/classic/sass/custom/_colors.scss +43 -0
- data/spec/test-site/.themes/classic/sass/custom/_fonts.scss +10 -0
- data/spec/test-site/.themes/classic/sass/custom/_layout.scss +21 -0
- data/spec/test-site/.themes/classic/sass/custom/_styles.scss +2 -0
- data/spec/test-site/.themes/classic/sass/partials/_archive.scss +72 -0
- data/spec/test-site/.themes/classic/sass/partials/_blog.scss +141 -0
- data/spec/test-site/.themes/classic/sass/partials/_footer.scss +19 -0
- data/spec/test-site/.themes/classic/sass/partials/_header.scss +18 -0
- data/spec/test-site/.themes/classic/sass/partials/_navigation.scss +137 -0
- data/spec/test-site/.themes/classic/sass/partials/_sharing.scss +8 -0
- data/spec/test-site/.themes/classic/sass/partials/_sidebar.scss +5 -0
- data/spec/test-site/.themes/classic/sass/partials/_syntax.scss +253 -0
- data/spec/test-site/.themes/classic/sass/partials/sidebar/_base.scss +106 -0
- data/spec/test-site/.themes/classic/sass/partials/sidebar/_delicious.scss +4 -0
- data/spec/test-site/.themes/classic/sass/partials/sidebar/_googleplus.scss +26 -0
- data/spec/test-site/.themes/classic/sass/partials/sidebar/_pinboard.scss +12 -0
- data/spec/test-site/.themes/classic/sass/partials/sidebar/_twitter.scss +34 -0
- data/spec/test-site/.themes/classic/sass/screen.scss +10 -0
- data/spec/test-site/.themes/classic/source/_includes/after_footer.html +5 -0
- data/spec/test-site/.themes/classic/source/_includes/archive_post.html +8 -0
- data/spec/test-site/.themes/classic/source/_includes/article.html +28 -0
- data/spec/test-site/.themes/classic/source/_includes/asides/delicious.html +8 -0
- data/spec/test-site/.themes/classic/source/_includes/asides/github.html +30 -0
- data/spec/test-site/.themes/classic/source/_includes/asides/googleplus.html +11 -0
- data/spec/test-site/.themes/classic/source/_includes/asides/pinboard.html +19 -0
- data/spec/test-site/.themes/classic/source/_includes/asides/recent_posts.html +10 -0
- data/spec/test-site/.themes/classic/source/_includes/asides/twitter.html +19 -0
- data/spec/test-site/.themes/classic/source/_includes/custom/after_footer.html +3 -0
- data/spec/test-site/.themes/classic/source/_includes/custom/asides/about.html +4 -0
- data/spec/test-site/.themes/classic/source/_includes/custom/category_feed.xml +27 -0
- data/spec/test-site/.themes/classic/source/_includes/custom/footer.html +4 -0
- data/spec/test-site/.themes/classic/source/_includes/custom/head.html +3 -0
- data/spec/test-site/.themes/classic/source/_includes/custom/header.html +6 -0
- data/spec/test-site/.themes/classic/source/_includes/custom/navigation.html +4 -0
- data/spec/test-site/.themes/classic/source/_includes/disqus.html +21 -0
- data/spec/test-site/.themes/classic/source/_includes/facebook_like.html +10 -0
- data/spec/test-site/.themes/classic/source/_includes/footer.html +1 -0
- data/spec/test-site/.themes/classic/source/_includes/google_analytics.html +13 -0
- data/spec/test-site/.themes/classic/source/_includes/google_plus_one.html +9 -0
- data/spec/test-site/.themes/classic/source/_includes/head.html +29 -0
- data/spec/test-site/.themes/classic/source/_includes/header.html +1 -0
- data/spec/test-site/.themes/classic/source/_includes/navigation.html +15 -0
- data/spec/test-site/.themes/classic/source/_includes/post/author.html +8 -0
- data/spec/test-site/.themes/classic/source/_includes/post/categories.html +10 -0
- data/spec/test-site/.themes/classic/source/_includes/post/date.html +15 -0
- data/spec/test-site/.themes/classic/source/_includes/post/disqus_thread.html +1 -0
- data/spec/test-site/.themes/classic/source/_includes/post/sharing.html +11 -0
- data/spec/test-site/.themes/classic/source/_includes/twitter_sharing.html +11 -0
- data/spec/test-site/.themes/classic/source/_layouts/category_index.html +17 -0
- data/spec/test-site/.themes/classic/source/_layouts/default.html +14 -0
- data/spec/test-site/.themes/classic/source/_layouts/page.html +42 -0
- data/spec/test-site/.themes/classic/source/_layouts/post.html +43 -0
- data/spec/test-site/.themes/classic/source/assets/jwplayer/glow/controlbar/background.png +0 -0
- data/spec/test-site/.themes/classic/source/assets/jwplayer/glow/controlbar/blankButton.png +0 -0
- data/spec/test-site/.themes/classic/source/assets/jwplayer/glow/controlbar/divider.png +0 -0
- data/spec/test-site/.themes/classic/source/assets/jwplayer/glow/controlbar/fullscreenButton.png +0 -0
- data/spec/test-site/.themes/classic/source/assets/jwplayer/glow/controlbar/fullscreenButtonOver.png +0 -0
- data/spec/test-site/.themes/classic/source/assets/jwplayer/glow/controlbar/muteButton.png +0 -0
- data/spec/test-site/.themes/classic/source/assets/jwplayer/glow/controlbar/muteButtonOver.png +0 -0
- data/spec/test-site/.themes/classic/source/assets/jwplayer/glow/controlbar/normalscreenButton.png +0 -0
- data/spec/test-site/.themes/classic/source/assets/jwplayer/glow/controlbar/normalscreenButtonOver.png +0 -0
- data/spec/test-site/.themes/classic/source/assets/jwplayer/glow/controlbar/pauseButton.png +0 -0
- data/spec/test-site/.themes/classic/source/assets/jwplayer/glow/controlbar/pauseButtonOver.png +0 -0
- data/spec/test-site/.themes/classic/source/assets/jwplayer/glow/controlbar/playButton.png +0 -0
- data/spec/test-site/.themes/classic/source/assets/jwplayer/glow/controlbar/playButtonOver.png +0 -0
- data/spec/test-site/.themes/classic/source/assets/jwplayer/glow/controlbar/timeSliderBuffer.png +0 -0
- data/spec/test-site/.themes/classic/source/assets/jwplayer/glow/controlbar/timeSliderCapLeft.png +0 -0
- data/spec/test-site/.themes/classic/source/assets/jwplayer/glow/controlbar/timeSliderCapRight.png +0 -0
- data/spec/test-site/.themes/classic/source/assets/jwplayer/glow/controlbar/timeSliderProgress.png +0 -0
- data/spec/test-site/.themes/classic/source/assets/jwplayer/glow/controlbar/timeSliderRail.png +0 -0
- data/spec/test-site/.themes/classic/source/assets/jwplayer/glow/controlbar/unmuteButton.png +0 -0
- data/spec/test-site/.themes/classic/source/assets/jwplayer/glow/controlbar/unmuteButtonOver.png +0 -0
- data/spec/test-site/.themes/classic/source/assets/jwplayer/glow/display/background.png +0 -0
- data/spec/test-site/.themes/classic/source/assets/jwplayer/glow/display/bufferIcon.png +0 -0
- data/spec/test-site/.themes/classic/source/assets/jwplayer/glow/display/muteIcon.png +0 -0
- data/spec/test-site/.themes/classic/source/assets/jwplayer/glow/display/playIcon.png +0 -0
- data/spec/test-site/.themes/classic/source/assets/jwplayer/glow/dock/button.png +0 -0
- data/spec/test-site/.themes/classic/source/assets/jwplayer/glow/glow.xml +115 -0
- data/spec/test-site/.themes/classic/source/assets/jwplayer/glow/playlist/item.png +0 -0
- data/spec/test-site/.themes/classic/source/assets/jwplayer/glow/playlist/itemOver.png +0 -0
- data/spec/test-site/.themes/classic/source/assets/jwplayer/glow/playlist/sliderCapBottom.png +0 -0
- data/spec/test-site/.themes/classic/source/assets/jwplayer/glow/playlist/sliderCapTop.png +0 -0
- data/spec/test-site/.themes/classic/source/assets/jwplayer/glow/playlist/sliderRail.png +0 -0
- data/spec/test-site/.themes/classic/source/assets/jwplayer/glow/playlist/sliderThumb.png +0 -0
- data/spec/test-site/.themes/classic/source/assets/jwplayer/glow/sharing/embedIcon.png +0 -0
- data/spec/test-site/.themes/classic/source/assets/jwplayer/glow/sharing/embedScreen.png +0 -0
- data/spec/test-site/.themes/classic/source/assets/jwplayer/glow/sharing/shareIcon.png +0 -0
- data/spec/test-site/.themes/classic/source/assets/jwplayer/glow/sharing/shareScreen.png +0 -0
- data/spec/test-site/.themes/classic/source/assets/jwplayer/player.swf +0 -0
- data/spec/test-site/.themes/classic/source/atom.xml +27 -0
- data/spec/test-site/.themes/classic/source/blog/archives/index.html +18 -0
- data/spec/test-site/.themes/classic/source/favicon.png +0 -0
- data/spec/test-site/.themes/classic/source/images/bird_32_gray.png +0 -0
- data/spec/test-site/.themes/classic/source/images/bird_32_gray_fail.png +0 -0
- data/spec/test-site/.themes/classic/source/images/code_bg.png +0 -0
- data/spec/test-site/.themes/classic/source/images/dotted-border.png +0 -0
- data/spec/test-site/.themes/classic/source/images/email.png +0 -0
- data/spec/test-site/.themes/classic/source/images/line-tile.png +0 -0
- data/spec/test-site/.themes/classic/source/images/noise.png +0 -0
- data/spec/test-site/.themes/classic/source/images/rss.png +0 -0
- data/spec/test-site/.themes/classic/source/images/search.png +0 -0
- data/spec/test-site/.themes/classic/source/index.html +29 -0
- data/spec/test-site/.themes/classic/source/javascripts/ender.js +45 -0
- data/spec/test-site/.themes/classic/source/javascripts/github.js +37 -0
- data/spec/test-site/.themes/classic/source/javascripts/libs/ender.js +1497 -0
- data/spec/test-site/.themes/classic/source/javascripts/libs/jXHR.js +85 -0
- data/spec/test-site/.themes/classic/source/javascripts/libs/swfobject-dynamic.js +298 -0
- data/spec/test-site/.themes/classic/source/javascripts/modernizr-2.0.js +5 -0
- data/spec/test-site/.themes/classic/source/javascripts/octopress.js +161 -0
- data/spec/test-site/.themes/classic/source/javascripts/pinboard.js +56 -0
- data/spec/test-site/.themes/classic/source/javascripts/twitter.js +78 -0
- data/spec/test-site/CHANGELOG.markdown +29 -0
- data/spec/test-site/Gemfile +18 -0
- data/spec/test-site/Gemfile.lock +69 -0
- data/spec/test-site/README.markdown +36 -0
- data/spec/test-site/Rakefile +379 -0
- data/spec/test-site/_config.yml +99 -0
- data/spec/test-site/config.rb +16 -0
- data/spec/test-site/config.ru +25 -0
- data/spec/test-site/plugins/backtick_code_block.rb +43 -0
- data/spec/test-site/plugins/blockquote.rb +83 -0
- data/spec/test-site/plugins/category_generator.rb +174 -0
- data/spec/test-site/plugins/code_block.rb +98 -0
- data/spec/test-site/plugins/date.rb +98 -0
- data/spec/test-site/plugins/gist_tag.rb +100 -0
- data/spec/test-site/plugins/haml.rb +24 -0
- data/spec/test-site/plugins/image_tag.rb +50 -0
- data/spec/test-site/plugins/include_array.rb +58 -0
- data/spec/test-site/plugins/include_code.rb +73 -0
- data/spec/test-site/plugins/jsfiddle.rb +40 -0
- data/spec/test-site/plugins/octopress_filters.rb +135 -0
- data/spec/test-site/plugins/pagination.rb +121 -0
- data/spec/test-site/plugins/post_filters.rb +176 -0
- data/spec/test-site/plugins/preview_unpublished.rb +48 -0
- data/spec/test-site/plugins/pullquote.rb +45 -0
- data/spec/test-site/plugins/pygments_code.rb +41 -0
- data/spec/test-site/plugins/raw.rb +40 -0
- data/spec/test-site/plugins/render_partial.rb +69 -0
- data/spec/test-site/plugins/rubypants.rb +489 -0
- data/spec/test-site/plugins/sitemap_generator.rb +312 -0
- data/spec/test-site/plugins/titlecase.rb +36 -0
- data/spec/test-site/plugins/video_tag.rb +47 -0
- data/spec/test-site/public/assets/jwplayer/glow/controlbar/background.png +0 -0
- data/spec/test-site/public/assets/jwplayer/glow/controlbar/blankButton.png +0 -0
- data/spec/test-site/public/assets/jwplayer/glow/controlbar/divider.png +0 -0
- data/spec/test-site/public/assets/jwplayer/glow/controlbar/fullscreenButton.png +0 -0
- data/spec/test-site/public/assets/jwplayer/glow/controlbar/fullscreenButtonOver.png +0 -0
- data/spec/test-site/public/assets/jwplayer/glow/controlbar/muteButton.png +0 -0
- data/spec/test-site/public/assets/jwplayer/glow/controlbar/muteButtonOver.png +0 -0
- data/spec/test-site/public/assets/jwplayer/glow/controlbar/normalscreenButton.png +0 -0
- data/spec/test-site/public/assets/jwplayer/glow/controlbar/normalscreenButtonOver.png +0 -0
- data/spec/test-site/public/assets/jwplayer/glow/controlbar/pauseButton.png +0 -0
- data/spec/test-site/public/assets/jwplayer/glow/controlbar/pauseButtonOver.png +0 -0
- data/spec/test-site/public/assets/jwplayer/glow/controlbar/playButton.png +0 -0
- data/spec/test-site/public/assets/jwplayer/glow/controlbar/playButtonOver.png +0 -0
- data/spec/test-site/public/assets/jwplayer/glow/controlbar/timeSliderBuffer.png +0 -0
- data/spec/test-site/public/assets/jwplayer/glow/controlbar/timeSliderCapLeft.png +0 -0
- data/spec/test-site/public/assets/jwplayer/glow/controlbar/timeSliderCapRight.png +0 -0
- data/spec/test-site/public/assets/jwplayer/glow/controlbar/timeSliderProgress.png +0 -0
- data/spec/test-site/public/assets/jwplayer/glow/controlbar/timeSliderRail.png +0 -0
- data/spec/test-site/public/assets/jwplayer/glow/controlbar/unmuteButton.png +0 -0
- data/spec/test-site/public/assets/jwplayer/glow/controlbar/unmuteButtonOver.png +0 -0
- data/spec/test-site/public/assets/jwplayer/glow/display/background.png +0 -0
- data/spec/test-site/public/assets/jwplayer/glow/display/bufferIcon.png +0 -0
- data/spec/test-site/public/assets/jwplayer/glow/display/muteIcon.png +0 -0
- data/spec/test-site/public/assets/jwplayer/glow/display/playIcon.png +0 -0
- data/spec/test-site/public/assets/jwplayer/glow/dock/button.png +0 -0
- data/spec/test-site/public/assets/jwplayer/glow/glow.xml +115 -0
- data/spec/test-site/public/assets/jwplayer/glow/playlist/item.png +0 -0
- data/spec/test-site/public/assets/jwplayer/glow/playlist/itemOver.png +0 -0
- data/spec/test-site/public/assets/jwplayer/glow/playlist/sliderCapBottom.png +0 -0
- data/spec/test-site/public/assets/jwplayer/glow/playlist/sliderCapTop.png +0 -0
- data/spec/test-site/public/assets/jwplayer/glow/playlist/sliderRail.png +0 -0
- data/spec/test-site/public/assets/jwplayer/glow/playlist/sliderThumb.png +0 -0
- data/spec/test-site/public/assets/jwplayer/glow/sharing/embedIcon.png +0 -0
- data/spec/test-site/public/assets/jwplayer/glow/sharing/embedScreen.png +0 -0
- data/spec/test-site/public/assets/jwplayer/glow/sharing/shareIcon.png +0 -0
- data/spec/test-site/public/assets/jwplayer/glow/sharing/shareScreen.png +0 -0
- data/spec/test-site/public/assets/jwplayer/player.swf +0 -0
- data/spec/test-site/public/atom.xml +27 -0
- data/spec/test-site/public/blog/2012/10/02/a-list-of-links/index.html +196 -0
- data/spec/test-site/public/blog/archives/index.html +149 -0
- data/spec/test-site/public/favicon.png +0 -0
- data/spec/test-site/public/images/bird_32_gray.png +0 -0
- data/spec/test-site/public/images/bird_32_gray_fail.png +0 -0
- data/spec/test-site/public/images/code_bg.png +0 -0
- data/spec/test-site/public/images/dotted-border.png +0 -0
- data/spec/test-site/public/images/email.png +0 -0
- data/spec/test-site/public/images/line-tile.png +0 -0
- data/spec/test-site/public/images/noise.png +0 -0
- data/spec/test-site/public/images/rss.png +0 -0
- data/spec/test-site/public/images/search.png +0 -0
- data/spec/test-site/public/index.html +165 -0
- data/spec/test-site/public/javascripts/ender.js +45 -0
- data/spec/test-site/public/javascripts/github.js +37 -0
- data/spec/test-site/public/javascripts/libs/ender.js +1497 -0
- data/spec/test-site/public/javascripts/libs/jXHR.js +85 -0
- data/spec/test-site/public/javascripts/libs/swfobject-dynamic.js +298 -0
- data/spec/test-site/public/javascripts/modernizr-2.0.js +5 -0
- data/spec/test-site/public/javascripts/octopress.js +161 -0
- data/spec/test-site/public/javascripts/pinboard.js +56 -0
- data/spec/test-site/public/javascripts/twitter.js +78 -0
- data/spec/test-site/public/sitemap.xml +15 -0
- data/spec/test-site/public/stylesheets/screen.css +1 -0
- data/spec/test-site/sass/_base.scss +5 -0
- data/spec/test-site/sass/_partials.scss +8 -0
- data/spec/test-site/sass/base/_layout.scss +192 -0
- data/spec/test-site/sass/base/_solarized.scss +46 -0
- data/spec/test-site/sass/base/_theme.scss +86 -0
- data/spec/test-site/sass/base/_typography.scss +161 -0
- data/spec/test-site/sass/base/_utilities.scss +28 -0
- data/spec/test-site/sass/custom/_colors.scss +43 -0
- data/spec/test-site/sass/custom/_fonts.scss +10 -0
- data/spec/test-site/sass/custom/_layout.scss +21 -0
- data/spec/test-site/sass/custom/_styles.scss +2 -0
- data/spec/test-site/sass/partials/_archive.scss +72 -0
- data/spec/test-site/sass/partials/_blog.scss +141 -0
- data/spec/test-site/sass/partials/_footer.scss +19 -0
- data/spec/test-site/sass/partials/_header.scss +18 -0
- data/spec/test-site/sass/partials/_navigation.scss +137 -0
- data/spec/test-site/sass/partials/_sharing.scss +8 -0
- data/spec/test-site/sass/partials/_sidebar.scss +5 -0
- data/spec/test-site/sass/partials/_syntax.scss +253 -0
- data/spec/test-site/sass/partials/sidebar/_base.scss +106 -0
- data/spec/test-site/sass/partials/sidebar/_delicious.scss +4 -0
- data/spec/test-site/sass/partials/sidebar/_googleplus.scss +26 -0
- data/spec/test-site/sass/partials/sidebar/_pinboard.scss +12 -0
- data/spec/test-site/sass/partials/sidebar/_twitter.scss +34 -0
- data/spec/test-site/sass/screen.scss +10 -0
- data/spec/test-site/source/_includes/after_footer.html +5 -0
- data/spec/test-site/source/_includes/archive_post.html +8 -0
- data/spec/test-site/source/_includes/article.html +28 -0
- data/spec/test-site/source/_includes/asides/delicious.html +8 -0
- data/spec/test-site/source/_includes/asides/github.html +30 -0
- data/spec/test-site/source/_includes/asides/googleplus.html +11 -0
- data/spec/test-site/source/_includes/asides/pinboard.html +19 -0
- data/spec/test-site/source/_includes/asides/recent_posts.html +10 -0
- data/spec/test-site/source/_includes/asides/twitter.html +19 -0
- data/spec/test-site/source/_includes/custom/after_footer.html +3 -0
- data/spec/test-site/source/_includes/custom/asides/about.html +4 -0
- data/spec/test-site/source/_includes/custom/category_feed.xml +27 -0
- data/spec/test-site/source/_includes/custom/footer.html +4 -0
- data/spec/test-site/source/_includes/custom/head.html +3 -0
- data/spec/test-site/source/_includes/custom/header.html +6 -0
- data/spec/test-site/source/_includes/custom/navigation.html +4 -0
- data/spec/test-site/source/_includes/disqus.html +21 -0
- data/spec/test-site/source/_includes/facebook_like.html +10 -0
- data/spec/test-site/source/_includes/footer.html +1 -0
- data/spec/test-site/source/_includes/google_analytics.html +13 -0
- data/spec/test-site/source/_includes/google_plus_one.html +9 -0
- data/spec/test-site/source/_includes/head.html +29 -0
- data/spec/test-site/source/_includes/header.html +1 -0
- data/spec/test-site/source/_includes/navigation.html +15 -0
- data/spec/test-site/source/_includes/post/author.html +8 -0
- data/spec/test-site/source/_includes/post/categories.html +10 -0
- data/spec/test-site/source/_includes/post/date.html +15 -0
- data/spec/test-site/source/_includes/post/disqus_thread.html +1 -0
- data/spec/test-site/source/_includes/post/sharing.html +11 -0
- data/spec/test-site/source/_includes/twitter_sharing.html +11 -0
- data/spec/test-site/source/_layouts/category_index.html +17 -0
- data/spec/test-site/source/_layouts/default.html +14 -0
- data/spec/test-site/source/_layouts/page.html +42 -0
- data/spec/test-site/source/_layouts/post.html +43 -0
- data/spec/test-site/source/_posts/2012-10-02-a-list-of-links.markdown +11 -0
- data/spec/test-site/source/assets/jwplayer/glow/controlbar/background.png +0 -0
- data/spec/test-site/source/assets/jwplayer/glow/controlbar/blankButton.png +0 -0
- data/spec/test-site/source/assets/jwplayer/glow/controlbar/divider.png +0 -0
- data/spec/test-site/source/assets/jwplayer/glow/controlbar/fullscreenButton.png +0 -0
- data/spec/test-site/source/assets/jwplayer/glow/controlbar/fullscreenButtonOver.png +0 -0
- data/spec/test-site/source/assets/jwplayer/glow/controlbar/muteButton.png +0 -0
- data/spec/test-site/source/assets/jwplayer/glow/controlbar/muteButtonOver.png +0 -0
- data/spec/test-site/source/assets/jwplayer/glow/controlbar/normalscreenButton.png +0 -0
- data/spec/test-site/source/assets/jwplayer/glow/controlbar/normalscreenButtonOver.png +0 -0
- data/spec/test-site/source/assets/jwplayer/glow/controlbar/pauseButton.png +0 -0
- data/spec/test-site/source/assets/jwplayer/glow/controlbar/pauseButtonOver.png +0 -0
- data/spec/test-site/source/assets/jwplayer/glow/controlbar/playButton.png +0 -0
- data/spec/test-site/source/assets/jwplayer/glow/controlbar/playButtonOver.png +0 -0
- data/spec/test-site/source/assets/jwplayer/glow/controlbar/timeSliderBuffer.png +0 -0
- data/spec/test-site/source/assets/jwplayer/glow/controlbar/timeSliderCapLeft.png +0 -0
- data/spec/test-site/source/assets/jwplayer/glow/controlbar/timeSliderCapRight.png +0 -0
- data/spec/test-site/source/assets/jwplayer/glow/controlbar/timeSliderProgress.png +0 -0
- data/spec/test-site/source/assets/jwplayer/glow/controlbar/timeSliderRail.png +0 -0
- data/spec/test-site/source/assets/jwplayer/glow/controlbar/unmuteButton.png +0 -0
- data/spec/test-site/source/assets/jwplayer/glow/controlbar/unmuteButtonOver.png +0 -0
- data/spec/test-site/source/assets/jwplayer/glow/display/background.png +0 -0
- data/spec/test-site/source/assets/jwplayer/glow/display/bufferIcon.png +0 -0
- data/spec/test-site/source/assets/jwplayer/glow/display/muteIcon.png +0 -0
- data/spec/test-site/source/assets/jwplayer/glow/display/playIcon.png +0 -0
- data/spec/test-site/source/assets/jwplayer/glow/dock/button.png +0 -0
- data/spec/test-site/source/assets/jwplayer/glow/glow.xml +115 -0
- data/spec/test-site/source/assets/jwplayer/glow/playlist/item.png +0 -0
- data/spec/test-site/source/assets/jwplayer/glow/playlist/itemOver.png +0 -0
- data/spec/test-site/source/assets/jwplayer/glow/playlist/sliderCapBottom.png +0 -0
- data/spec/test-site/source/assets/jwplayer/glow/playlist/sliderCapTop.png +0 -0
- data/spec/test-site/source/assets/jwplayer/glow/playlist/sliderRail.png +0 -0
- data/spec/test-site/source/assets/jwplayer/glow/playlist/sliderThumb.png +0 -0
- data/spec/test-site/source/assets/jwplayer/glow/sharing/embedIcon.png +0 -0
- data/spec/test-site/source/assets/jwplayer/glow/sharing/embedScreen.png +0 -0
- data/spec/test-site/source/assets/jwplayer/glow/sharing/shareIcon.png +0 -0
- data/spec/test-site/source/assets/jwplayer/glow/sharing/shareScreen.png +0 -0
- data/spec/test-site/source/assets/jwplayer/player.swf +0 -0
- data/spec/test-site/source/atom.xml +27 -0
- data/spec/test-site/source/blog/archives/index.html +18 -0
- data/spec/test-site/source/favicon.png +0 -0
- data/spec/test-site/source/images/bird_32_gray.png +0 -0
- data/spec/test-site/source/images/bird_32_gray_fail.png +0 -0
- data/spec/test-site/source/images/code_bg.png +0 -0
- data/spec/test-site/source/images/dotted-border.png +0 -0
- data/spec/test-site/source/images/email.png +0 -0
- data/spec/test-site/source/images/line-tile.png +0 -0
- data/spec/test-site/source/images/noise.png +0 -0
- data/spec/test-site/source/images/rss.png +0 -0
- data/spec/test-site/source/images/search.png +0 -0
- data/spec/test-site/source/index.html +29 -0
- data/spec/test-site/source/javascripts/ender.js +45 -0
- data/spec/test-site/source/javascripts/github.js +37 -0
- data/spec/test-site/source/javascripts/libs/ender.js +1497 -0
- data/spec/test-site/source/javascripts/libs/jXHR.js +85 -0
- data/spec/test-site/source/javascripts/libs/swfobject-dynamic.js +298 -0
- data/spec/test-site/source/javascripts/modernizr-2.0.js +5 -0
- data/spec/test-site/source/javascripts/octopress.js +161 -0
- data/spec/test-site/source/javascripts/pinboard.js +56 -0
- data/spec/test-site/source/javascripts/twitter.js +78 -0
- metadata +475 -0
@@ -0,0 +1,45 @@
|
|
1
|
+
#
|
2
|
+
# Author: Brandon Mathis
|
3
|
+
# Based on the semantic pullquote technique by Maykel Loomans at http://miekd.com/articles/pull-quotes-with-html5-and-css/
|
4
|
+
#
|
5
|
+
# Outputs a span with a data-pullquote attribute set from the marked pullquote. Example:
|
6
|
+
#
|
7
|
+
# {% pullquote %}
|
8
|
+
# When writing longform posts, I find it helpful to include pullquotes, which help those scanning a post discern whether or not a post is helpful.
|
9
|
+
# It is important to note, {" pullquotes are merely visual in presentation and should not appear twice in the text. "} That is why it is prefered
|
10
|
+
# to use a CSS only technique for styling pullquotes.
|
11
|
+
# {% endpullquote %}
|
12
|
+
# ...will output...
|
13
|
+
# <p>
|
14
|
+
# <span data-pullquote="pullquotes are merely visual in presentation and should not appear twice in the text.">
|
15
|
+
# When writing longform posts, I find it helpful to include pullquotes, which help those scanning a post discern whether or not a post is helpful.
|
16
|
+
# It is important to note, pullquotes are merely visual in presentation and should not appear twice in the text. This is why a CSS only approach
|
17
|
+
# for styling pullquotes is prefered.
|
18
|
+
# </span>
|
19
|
+
# </p>
|
20
|
+
#
|
21
|
+
# {% pullquote left %} will create a left-aligned pullquote instead.
|
22
|
+
#
|
23
|
+
# Note: this plugin now creates pullquotes with the class of pullquote-right by default
|
24
|
+
|
25
|
+
module Jekyll
|
26
|
+
|
27
|
+
class PullquoteTag < Liquid::Block
|
28
|
+
def initialize(tag_name, markup, tokens)
|
29
|
+
@align = (markup =~ /left/i) ? "left" : "right"
|
30
|
+
super
|
31
|
+
end
|
32
|
+
|
33
|
+
def render(context)
|
34
|
+
output = super
|
35
|
+
if output =~ /\{"\s*(.+?)\s*"\}/m
|
36
|
+
@quote = RubyPants.new($1).to_html
|
37
|
+
"<span class='pullquote-#{@align}' data-pullquote='#{@quote}'>#{output.gsub(/\{"\s*|\s*"\}/, '')}</span>"
|
38
|
+
else
|
39
|
+
return "Surround your pullquote like this {\" text to be quoted \"}"
|
40
|
+
end
|
41
|
+
end
|
42
|
+
end
|
43
|
+
end
|
44
|
+
|
45
|
+
Liquid::Template.register_tag('pullquote', Jekyll::PullquoteTag)
|
@@ -0,0 +1,41 @@
|
|
1
|
+
require 'pygments'
|
2
|
+
require 'fileutils'
|
3
|
+
require 'digest/md5'
|
4
|
+
|
5
|
+
PYGMENTS_CACHE_DIR = File.expand_path('../../.pygments-cache', __FILE__)
|
6
|
+
FileUtils.mkdir_p(PYGMENTS_CACHE_DIR)
|
7
|
+
|
8
|
+
module HighlightCode
|
9
|
+
def highlight(str, lang)
|
10
|
+
lang = 'ruby' if lang == 'ru'
|
11
|
+
lang = 'objc' if lang == 'm'
|
12
|
+
lang = 'perl' if lang == 'pl'
|
13
|
+
lang = 'yaml' if lang == 'yml'
|
14
|
+
str = pygments(str, lang).match(/<pre>(.+)<\/pre>/m)[1].to_s.gsub(/ *$/, '') #strip out divs <div class="highlight">
|
15
|
+
tableize_code(str, lang)
|
16
|
+
end
|
17
|
+
|
18
|
+
def pygments(code, lang)
|
19
|
+
if defined?(PYGMENTS_CACHE_DIR)
|
20
|
+
path = File.join(PYGMENTS_CACHE_DIR, "#{lang}-#{Digest::MD5.hexdigest(code)}.html")
|
21
|
+
if File.exist?(path)
|
22
|
+
highlighted_code = File.read(path)
|
23
|
+
else
|
24
|
+
highlighted_code = Pygments.highlight(code, :lexer => lang, :formatter => 'html', :options => {:encoding => 'utf-8'})
|
25
|
+
File.open(path, 'w') {|f| f.print(highlighted_code) }
|
26
|
+
end
|
27
|
+
else
|
28
|
+
highlighted_code = Pygments.highlight(code, :lexer => lang, :formatter => 'html', :options => {:encoding => 'utf-8'})
|
29
|
+
end
|
30
|
+
highlighted_code
|
31
|
+
end
|
32
|
+
def tableize_code (str, lang = '')
|
33
|
+
table = '<div class="highlight"><table><tr><td class="gutter"><pre class="line-numbers">'
|
34
|
+
code = ''
|
35
|
+
str.lines.each_with_index do |line,index|
|
36
|
+
table += "<span class='line-number'>#{index+1}</span>\n"
|
37
|
+
code += "<span class='line'>#{line}</span>"
|
38
|
+
end
|
39
|
+
table += "</pre></td><td class='code'><pre><code class='#{lang}'>#{code}</code></pre></td></tr></table></div>"
|
40
|
+
end
|
41
|
+
end
|
@@ -0,0 +1,40 @@
|
|
1
|
+
# Author: Brandon Mathis
|
2
|
+
# Description: Provides plugins with a method for wrapping and unwrapping input to prevent Markdown and Textile from parsing it.
|
3
|
+
# Purpose: This is useful for preventing Markdown and Textile from being too aggressive and incorrectly parsing in-line HTML.
|
4
|
+
module TemplateWrapper
|
5
|
+
# Wrap input with a <div>
|
6
|
+
def safe_wrap(input)
|
7
|
+
"<div class='bogus-wrapper'><notextile>#{input}</notextile></div>"
|
8
|
+
end
|
9
|
+
# This must be applied after the
|
10
|
+
def unwrap(input)
|
11
|
+
input.gsub /<div class='bogus-wrapper'><notextile>(.+?)<\/notextile><\/div>/m do
|
12
|
+
$1
|
13
|
+
end
|
14
|
+
end
|
15
|
+
end
|
16
|
+
|
17
|
+
# Author: phaer, https://github.com/phaer
|
18
|
+
# Source: https://gist.github.com/1020852
|
19
|
+
# Description: Raw tag for jekyll. Keeps liquid from parsing text betweeen {% raw %} and {% endraw %}
|
20
|
+
|
21
|
+
module Jekyll
|
22
|
+
class RawTag < Liquid::Block
|
23
|
+
def parse(tokens)
|
24
|
+
@nodelist ||= []
|
25
|
+
@nodelist.clear
|
26
|
+
|
27
|
+
while token = tokens.shift
|
28
|
+
if token =~ FullToken
|
29
|
+
if block_delimiter == $1
|
30
|
+
end_tag
|
31
|
+
return
|
32
|
+
end
|
33
|
+
end
|
34
|
+
@nodelist << token if not token.empty?
|
35
|
+
end
|
36
|
+
end
|
37
|
+
end
|
38
|
+
end
|
39
|
+
|
40
|
+
Liquid::Template.register_tag('raw', Jekyll::RawTag)
|
@@ -0,0 +1,69 @@
|
|
1
|
+
# Title: Render Partial Tag for Jekyll
|
2
|
+
# Author: Brandon Mathis http://brandonmathis.com
|
3
|
+
# Description: Import files on your filesystem into any blog post and render them inline.
|
4
|
+
# Note: Paths are relative to the source directory, if you import a file with yaml front matter, the yaml will be stripped out.
|
5
|
+
#
|
6
|
+
# Syntax {% render_partial path/to/file %}
|
7
|
+
#
|
8
|
+
# Example 1:
|
9
|
+
# {% render_partial about/_bio.markdown %}
|
10
|
+
#
|
11
|
+
# This will import source/about/_bio.markdown and render it inline.
|
12
|
+
# In this example I used an underscore at the beginning of the filename to prevent Jekyll
|
13
|
+
# from generating an about/bio.html (Jekyll doesn't convert files beginning with underscores)
|
14
|
+
#
|
15
|
+
# Example 2:
|
16
|
+
# {% render_partial ../README.markdown %}
|
17
|
+
#
|
18
|
+
# You can use relative pathnames, to include files outside of the source directory.
|
19
|
+
# This might be useful if you want to have a page for a project's README without having
|
20
|
+
# to duplicated the contents
|
21
|
+
#
|
22
|
+
#
|
23
|
+
|
24
|
+
require 'pathname'
|
25
|
+
require './plugins/octopress_filters'
|
26
|
+
|
27
|
+
module Jekyll
|
28
|
+
|
29
|
+
class RenderPartialTag < Liquid::Tag
|
30
|
+
include OctopressFilters
|
31
|
+
def initialize(tag_name, markup, tokens)
|
32
|
+
@file = nil
|
33
|
+
@raw = false
|
34
|
+
if markup =~ /^(\S+)\s?(\w+)?/
|
35
|
+
@file = $1.strip
|
36
|
+
@raw = $2 == 'raw'
|
37
|
+
end
|
38
|
+
super
|
39
|
+
end
|
40
|
+
|
41
|
+
def render(context)
|
42
|
+
file_dir = (context.registers[:site].source || 'source')
|
43
|
+
file_path = Pathname.new(file_dir).expand_path
|
44
|
+
file = file_path + @file
|
45
|
+
|
46
|
+
unless file.file?
|
47
|
+
return "File #{file} could not be found"
|
48
|
+
end
|
49
|
+
|
50
|
+
Dir.chdir(file_path) do
|
51
|
+
contents = file.read
|
52
|
+
if contents =~ /\A-{3}.+[^\A]-{3}\n(.+)/m
|
53
|
+
contents = $1.lstrip
|
54
|
+
end
|
55
|
+
contents = pre_filter(contents)
|
56
|
+
if @raw
|
57
|
+
contents
|
58
|
+
else
|
59
|
+
partial = Liquid::Template.parse(contents)
|
60
|
+
context.stack do
|
61
|
+
partial.render(context)
|
62
|
+
end
|
63
|
+
end
|
64
|
+
end
|
65
|
+
end
|
66
|
+
end
|
67
|
+
end
|
68
|
+
|
69
|
+
Liquid::Template.register_tag('render_partial', Jekyll::RenderPartialTag)
|
@@ -0,0 +1,489 @@
|
|
1
|
+
#
|
2
|
+
# = RubyPants -- SmartyPants ported to Ruby
|
3
|
+
#
|
4
|
+
# Ported by Christian Neukirchen <mailto:chneukirchen@gmail.com>
|
5
|
+
# Copyright (C) 2004 Christian Neukirchen
|
6
|
+
#
|
7
|
+
# Incooporates ideas, comments and documentation by Chad Miller
|
8
|
+
# Copyright (C) 2004 Chad Miller
|
9
|
+
#
|
10
|
+
# Original SmartyPants by John Gruber
|
11
|
+
# Copyright (C) 2003 John Gruber
|
12
|
+
#
|
13
|
+
|
14
|
+
#
|
15
|
+
# = RubyPants -- SmartyPants ported to Ruby
|
16
|
+
#
|
17
|
+
# == Synopsis
|
18
|
+
#
|
19
|
+
# RubyPants is a Ruby port of the smart-quotes library SmartyPants.
|
20
|
+
#
|
21
|
+
# The original "SmartyPants" is a free web publishing plug-in for
|
22
|
+
# Movable Type, Blosxom, and BBEdit that easily translates plain ASCII
|
23
|
+
# punctuation characters into "smart" typographic punctuation HTML
|
24
|
+
# entities.
|
25
|
+
#
|
26
|
+
#
|
27
|
+
# == Description
|
28
|
+
#
|
29
|
+
# RubyPants can perform the following transformations:
|
30
|
+
#
|
31
|
+
# * Straight quotes (<tt>"</tt> and <tt>'</tt>) into "curly" quote
|
32
|
+
# HTML entities
|
33
|
+
# * Backticks-style quotes (<tt>``like this''</tt>) into "curly" quote
|
34
|
+
# HTML entities
|
35
|
+
# * Dashes (<tt>--</tt> and <tt>---</tt>) into en- and em-dash
|
36
|
+
# entities
|
37
|
+
# * Three consecutive dots (<tt>...</tt> or <tt>. . .</tt>) into an
|
38
|
+
# ellipsis entity
|
39
|
+
#
|
40
|
+
# This means you can write, edit, and save your posts using plain old
|
41
|
+
# ASCII straight quotes, plain dashes, and plain dots, but your
|
42
|
+
# published posts (and final HTML output) will appear with smart
|
43
|
+
# quotes, em-dashes, and proper ellipses.
|
44
|
+
#
|
45
|
+
# RubyPants does not modify characters within <tt><pre></tt>,
|
46
|
+
# <tt><code></tt>, <tt><kbd></tt>, <tt><math></tt> or
|
47
|
+
# <tt><script></tt> tag blocks. Typically, these tags are used to
|
48
|
+
# display text where smart quotes and other "smart punctuation" would
|
49
|
+
# not be appropriate, such as source code or example markup.
|
50
|
+
#
|
51
|
+
#
|
52
|
+
# == Backslash Escapes
|
53
|
+
#
|
54
|
+
# If you need to use literal straight quotes (or plain hyphens and
|
55
|
+
# periods), RubyPants accepts the following backslash escape sequences
|
56
|
+
# to force non-smart punctuation. It does so by transforming the
|
57
|
+
# escape sequence into a decimal-encoded HTML entity:
|
58
|
+
#
|
59
|
+
# \\ \" \' \. \- \`
|
60
|
+
#
|
61
|
+
# This is useful, for example, when you want to use straight quotes as
|
62
|
+
# foot and inch marks: 6'2" tall; a 17" iMac. (Use <tt>6\'2\"</tt>
|
63
|
+
# resp. <tt>17\"</tt>.)
|
64
|
+
#
|
65
|
+
#
|
66
|
+
# == Algorithmic Shortcomings
|
67
|
+
#
|
68
|
+
# One situation in which quotes will get curled the wrong way is when
|
69
|
+
# apostrophes are used at the start of leading contractions. For
|
70
|
+
# example:
|
71
|
+
#
|
72
|
+
# 'Twas the night before Christmas.
|
73
|
+
#
|
74
|
+
# In the case above, RubyPants will turn the apostrophe into an
|
75
|
+
# opening single-quote, when in fact it should be a closing one. I
|
76
|
+
# don't think this problem can be solved in the general case--every
|
77
|
+
# word processor I've tried gets this wrong as well. In such cases,
|
78
|
+
# it's best to use the proper HTML entity for closing single-quotes
|
79
|
+
# ("<tt>’</tt>") by hand.
|
80
|
+
#
|
81
|
+
#
|
82
|
+
# == Bugs
|
83
|
+
#
|
84
|
+
# To file bug reports or feature requests (except see above) please
|
85
|
+
# send email to: mailto:chneukirchen@gmail.com
|
86
|
+
#
|
87
|
+
# If the bug involves quotes being curled the wrong way, please send
|
88
|
+
# example text to illustrate.
|
89
|
+
#
|
90
|
+
#
|
91
|
+
# == Authors
|
92
|
+
#
|
93
|
+
# John Gruber did all of the hard work of writing this software in
|
94
|
+
# Perl for Movable Type and almost all of this useful documentation.
|
95
|
+
# Chad Miller ported it to Python to use with Pyblosxom.
|
96
|
+
#
|
97
|
+
# Christian Neukirchen provided the Ruby port, as a general-purpose
|
98
|
+
# library that follows the *Cloth API.
|
99
|
+
#
|
100
|
+
#
|
101
|
+
# == Copyright and License
|
102
|
+
#
|
103
|
+
# === SmartyPants license:
|
104
|
+
#
|
105
|
+
# Copyright (c) 2003 John Gruber
|
106
|
+
# (http://daringfireball.net)
|
107
|
+
# All rights reserved.
|
108
|
+
#
|
109
|
+
# Redistribution and use in source and binary forms, with or without
|
110
|
+
# modification, are permitted provided that the following conditions
|
111
|
+
# are met:
|
112
|
+
#
|
113
|
+
# * Redistributions of source code must retain the above copyright
|
114
|
+
# notice, this list of conditions and the following disclaimer.
|
115
|
+
#
|
116
|
+
# * Redistributions in binary form must reproduce the above copyright
|
117
|
+
# notice, this list of conditions and the following disclaimer in
|
118
|
+
# the documentation and/or other materials provided with the
|
119
|
+
# distribution.
|
120
|
+
#
|
121
|
+
# * Neither the name "SmartyPants" nor the names of its contributors
|
122
|
+
# may be used to endorse or promote products derived from this
|
123
|
+
# software without specific prior written permission.
|
124
|
+
#
|
125
|
+
# This software is provided by the copyright holders and contributors
|
126
|
+
# "as is" and any express or implied warranties, including, but not
|
127
|
+
# limited to, the implied warranties of merchantability and fitness
|
128
|
+
# for a particular purpose are disclaimed. In no event shall the
|
129
|
+
# copyright owner or contributors be liable for any direct, indirect,
|
130
|
+
# incidental, special, exemplary, or consequential damages (including,
|
131
|
+
# but not limited to, procurement of substitute goods or services;
|
132
|
+
# loss of use, data, or profits; or business interruption) however
|
133
|
+
# caused and on any theory of liability, whether in contract, strict
|
134
|
+
# liability, or tort (including negligence or otherwise) arising in
|
135
|
+
# any way out of the use of this software, even if advised of the
|
136
|
+
# possibility of such damage.
|
137
|
+
#
|
138
|
+
# === RubyPants license
|
139
|
+
#
|
140
|
+
# RubyPants is a derivative work of SmartyPants and smartypants.py.
|
141
|
+
#
|
142
|
+
# Redistribution and use in source and binary forms, with or without
|
143
|
+
# modification, are permitted provided that the following conditions
|
144
|
+
# are met:
|
145
|
+
#
|
146
|
+
# * Redistributions of source code must retain the above copyright
|
147
|
+
# notice, this list of conditions and the following disclaimer.
|
148
|
+
#
|
149
|
+
# * Redistributions in binary form must reproduce the above copyright
|
150
|
+
# notice, this list of conditions and the following disclaimer in
|
151
|
+
# the documentation and/or other materials provided with the
|
152
|
+
# distribution.
|
153
|
+
#
|
154
|
+
# This software is provided by the copyright holders and contributors
|
155
|
+
# "as is" and any express or implied warranties, including, but not
|
156
|
+
# limited to, the implied warranties of merchantability and fitness
|
157
|
+
# for a particular purpose are disclaimed. In no event shall the
|
158
|
+
# copyright owner or contributors be liable for any direct, indirect,
|
159
|
+
# incidental, special, exemplary, or consequential damages (including,
|
160
|
+
# but not limited to, procurement of substitute goods or services;
|
161
|
+
# loss of use, data, or profits; or business interruption) however
|
162
|
+
# caused and on any theory of liability, whether in contract, strict
|
163
|
+
# liability, or tort (including negligence or otherwise) arising in
|
164
|
+
# any way out of the use of this software, even if advised of the
|
165
|
+
# possibility of such damage.
|
166
|
+
#
|
167
|
+
#
|
168
|
+
# == Links
|
169
|
+
#
|
170
|
+
# John Gruber:: http://daringfireball.net
|
171
|
+
# SmartyPants:: http://daringfireball.net/projects/smartypants
|
172
|
+
#
|
173
|
+
# Chad Miller:: http://web.chad.org
|
174
|
+
#
|
175
|
+
# Christian Neukirchen:: http://kronavita.de/chris
|
176
|
+
#
|
177
|
+
|
178
|
+
|
179
|
+
class RubyPants < String
|
180
|
+
|
181
|
+
# Create a new RubyPants instance with the text in +string+.
|
182
|
+
#
|
183
|
+
# Allowed elements in the options array:
|
184
|
+
#
|
185
|
+
# 0 :: do nothing
|
186
|
+
# 1 :: enable all, using only em-dash shortcuts
|
187
|
+
# 2 :: enable all, using old school en- and em-dash shortcuts (*default*)
|
188
|
+
# 3 :: enable all, using inverted old school en and em-dash shortcuts
|
189
|
+
# -1 :: stupefy (translate HTML entities to their ASCII-counterparts)
|
190
|
+
#
|
191
|
+
# If you don't like any of these defaults, you can pass symbols to change
|
192
|
+
# RubyPants' behavior:
|
193
|
+
#
|
194
|
+
# <tt>:quotes</tt> :: quotes
|
195
|
+
# <tt>:backticks</tt> :: backtick quotes (``double'' only)
|
196
|
+
# <tt>:allbackticks</tt> :: backtick quotes (``double'' and `single')
|
197
|
+
# <tt>:dashes</tt> :: dashes
|
198
|
+
# <tt>:oldschool</tt> :: old school dashes
|
199
|
+
# <tt>:inverted</tt> :: inverted old school dashes
|
200
|
+
# <tt>:ellipses</tt> :: ellipses
|
201
|
+
# <tt>:convertquotes</tt> :: convert <tt>"</tt> entities to
|
202
|
+
# <tt>"</tt> for Dreamweaver users
|
203
|
+
# <tt>:stupefy</tt> :: translate RubyPants HTML entities
|
204
|
+
# to their ASCII counterparts.
|
205
|
+
#
|
206
|
+
def initialize(string, options=[2])
|
207
|
+
super string
|
208
|
+
@options = [*options]
|
209
|
+
end
|
210
|
+
|
211
|
+
# Apply SmartyPants transformations.
|
212
|
+
def to_html
|
213
|
+
do_quotes = do_backticks = do_dashes = do_ellipses = do_stupify = nil
|
214
|
+
convert_quotes = false
|
215
|
+
|
216
|
+
if @options.include? 0
|
217
|
+
# Do nothing.
|
218
|
+
return self
|
219
|
+
elsif @options.include? 1
|
220
|
+
# Do everything, turn all options on.
|
221
|
+
do_quotes = do_backticks = do_ellipses = true
|
222
|
+
do_dashes = :normal
|
223
|
+
elsif @options.include? 2
|
224
|
+
# Do everything, turn all options on, use old school dash shorthand.
|
225
|
+
do_quotes = do_backticks = do_ellipses = true
|
226
|
+
do_dashes = :oldschool
|
227
|
+
elsif @options.include? 3
|
228
|
+
# Do everything, turn all options on, use inverted old school
|
229
|
+
# dash shorthand.
|
230
|
+
do_quotes = do_backticks = do_ellipses = true
|
231
|
+
do_dashes = :inverted
|
232
|
+
elsif @options.include?(-1)
|
233
|
+
do_stupefy = true
|
234
|
+
else
|
235
|
+
do_quotes = @options.include? :quotes
|
236
|
+
do_backticks = @options.include? :backticks
|
237
|
+
do_backticks = :both if @options.include? :allbackticks
|
238
|
+
do_dashes = :normal if @options.include? :dashes
|
239
|
+
do_dashes = :oldschool if @options.include? :oldschool
|
240
|
+
do_dashes = :inverted if @options.include? :inverted
|
241
|
+
do_ellipses = @options.include? :ellipses
|
242
|
+
convert_quotes = @options.include? :convertquotes
|
243
|
+
do_stupefy = @options.include? :stupefy
|
244
|
+
end
|
245
|
+
|
246
|
+
# Parse the HTML
|
247
|
+
tokens = tokenize
|
248
|
+
|
249
|
+
# Keep track of when we're inside <pre> or <code> tags.
|
250
|
+
in_pre = false
|
251
|
+
|
252
|
+
# Here is the result stored in.
|
253
|
+
result = ""
|
254
|
+
|
255
|
+
# This is a cheat, used to get some context for one-character
|
256
|
+
# tokens that consist of just a quote char. What we do is remember
|
257
|
+
# the last character of the previous text token, to use as context
|
258
|
+
# to curl single- character quote tokens correctly.
|
259
|
+
prev_token_last_char = nil
|
260
|
+
|
261
|
+
tokens.each { |token|
|
262
|
+
if token.first == :tag
|
263
|
+
result << token[1]
|
264
|
+
if token[1] =~ %r!<(/?)(?:pre|code|kbd|script|math)[\s>]!
|
265
|
+
in_pre = ($1 != "/") # Opening or closing tag?
|
266
|
+
end
|
267
|
+
else
|
268
|
+
t = token[1]
|
269
|
+
|
270
|
+
# Remember last char of this token before processing.
|
271
|
+
last_char = t[-1].chr
|
272
|
+
|
273
|
+
unless in_pre
|
274
|
+
t = process_escapes t
|
275
|
+
|
276
|
+
t.gsub!(/"/, '"') if convert_quotes
|
277
|
+
|
278
|
+
if do_dashes
|
279
|
+
t = educate_dashes t if do_dashes == :normal
|
280
|
+
t = educate_dashes_oldschool t if do_dashes == :oldschool
|
281
|
+
t = educate_dashes_inverted t if do_dashes == :inverted
|
282
|
+
end
|
283
|
+
|
284
|
+
t = educate_ellipses t if do_ellipses
|
285
|
+
|
286
|
+
# Note: backticks need to be processed before quotes.
|
287
|
+
if do_backticks
|
288
|
+
t = educate_backticks t
|
289
|
+
t = educate_single_backticks t if do_backticks == :both
|
290
|
+
end
|
291
|
+
|
292
|
+
if do_quotes
|
293
|
+
if t == "'"
|
294
|
+
# Special case: single-character ' token
|
295
|
+
if prev_token_last_char =~ /\S/
|
296
|
+
t = "’"
|
297
|
+
else
|
298
|
+
t = "‘"
|
299
|
+
end
|
300
|
+
elsif t == '"'
|
301
|
+
# Special case: single-character " token
|
302
|
+
if prev_token_last_char =~ /\S/
|
303
|
+
t = "”"
|
304
|
+
else
|
305
|
+
t = "“"
|
306
|
+
end
|
307
|
+
else
|
308
|
+
# Normal case:
|
309
|
+
t = educate_quotes t
|
310
|
+
end
|
311
|
+
end
|
312
|
+
|
313
|
+
t = stupefy_entities t if do_stupefy
|
314
|
+
end
|
315
|
+
|
316
|
+
prev_token_last_char = last_char
|
317
|
+
result << t
|
318
|
+
end
|
319
|
+
}
|
320
|
+
|
321
|
+
# Done
|
322
|
+
result
|
323
|
+
end
|
324
|
+
|
325
|
+
protected
|
326
|
+
|
327
|
+
# Return the string, with after processing the following backslash
|
328
|
+
# escape sequences. This is useful if you want to force a "dumb" quote
|
329
|
+
# or other character to appear.
|
330
|
+
#
|
331
|
+
# Escaped are:
|
332
|
+
# \\ \" \' \. \- \`
|
333
|
+
#
|
334
|
+
def process_escapes(str)
|
335
|
+
str.gsub('\\\\', '\').
|
336
|
+
gsub('\"', '"').
|
337
|
+
gsub("\\\'", ''').
|
338
|
+
gsub('\.', '.').
|
339
|
+
gsub('\-', '-').
|
340
|
+
gsub('\`', '`')
|
341
|
+
end
|
342
|
+
|
343
|
+
# The string, with each instance of "<tt>--</tt>" translated to an
|
344
|
+
# em-dash HTML entity.
|
345
|
+
#
|
346
|
+
def educate_dashes(str)
|
347
|
+
str.gsub(/--/, '—')
|
348
|
+
end
|
349
|
+
|
350
|
+
# The string, with each instance of "<tt>--</tt>" translated to an
|
351
|
+
# en-dash HTML entity, and each "<tt>---</tt>" translated to an
|
352
|
+
# em-dash HTML entity.
|
353
|
+
#
|
354
|
+
def educate_dashes_oldschool(str)
|
355
|
+
str.gsub(/---/, '—').gsub(/--/, '–')
|
356
|
+
end
|
357
|
+
|
358
|
+
# Return the string, with each instance of "<tt>--</tt>" translated
|
359
|
+
# to an em-dash HTML entity, and each "<tt>---</tt>" translated to
|
360
|
+
# an en-dash HTML entity. Two reasons why: First, unlike the en- and
|
361
|
+
# em-dash syntax supported by +educate_dashes_oldschool+, it's
|
362
|
+
# compatible with existing entries written before SmartyPants 1.1,
|
363
|
+
# back when "<tt>--</tt>" was only used for em-dashes. Second,
|
364
|
+
# em-dashes are more common than en-dashes, and so it sort of makes
|
365
|
+
# sense that the shortcut should be shorter to type. (Thanks to
|
366
|
+
# Aaron Swartz for the idea.)
|
367
|
+
#
|
368
|
+
def educate_dashes_inverted(str)
|
369
|
+
str.gsub(/---/, '–').gsub(/--/, '—')
|
370
|
+
end
|
371
|
+
|
372
|
+
# Return the string, with each instance of "<tt>...</tt>" translated
|
373
|
+
# to an ellipsis HTML entity. Also converts the case where there are
|
374
|
+
# spaces between the dots.
|
375
|
+
#
|
376
|
+
def educate_ellipses(str)
|
377
|
+
str.gsub('...', '…').gsub('. . .', '…')
|
378
|
+
end
|
379
|
+
|
380
|
+
# Return the string, with "<tt>``backticks''</tt>"-style single quotes
|
381
|
+
# translated into HTML curly quote entities.
|
382
|
+
#
|
383
|
+
def educate_backticks(str)
|
384
|
+
str.gsub("``", '“').gsub("''", '”')
|
385
|
+
end
|
386
|
+
|
387
|
+
# Return the string, with "<tt>`backticks'</tt>"-style single quotes
|
388
|
+
# translated into HTML curly quote entities.
|
389
|
+
#
|
390
|
+
def educate_single_backticks(str)
|
391
|
+
str.gsub("`", '‘').gsub("'", '’')
|
392
|
+
end
|
393
|
+
|
394
|
+
# Return the string, with "educated" curly quote HTML entities.
|
395
|
+
#
|
396
|
+
def educate_quotes(str)
|
397
|
+
punct_class = '[!"#\$\%\'()*+,\-.\/:;<=>?\@\[\\\\\]\^_`{|}~]'
|
398
|
+
|
399
|
+
str = str.dup
|
400
|
+
|
401
|
+
# Special case if the very first character is a quote followed by
|
402
|
+
# punctuation at a non-word-break. Close the quotes by brute
|
403
|
+
# force:
|
404
|
+
str.gsub!(/^'(?=#{punct_class}\B)/, '’')
|
405
|
+
str.gsub!(/^"(?=#{punct_class}\B)/, '”')
|
406
|
+
|
407
|
+
# Special case for double sets of quotes, e.g.:
|
408
|
+
# <p>He said, "'Quoted' words in a larger quote."</p>
|
409
|
+
str.gsub!(/"'(?=\w)/, '“‘')
|
410
|
+
str.gsub!(/'"(?=\w)/, '‘“')
|
411
|
+
|
412
|
+
# Special case for decade abbreviations (the '80s):
|
413
|
+
str.gsub!(/'(?=\d\ds)/, '’')
|
414
|
+
|
415
|
+
close_class = %![^\ \t\r\n\\[\{\(\-]!
|
416
|
+
dec_dashes = '–|—'
|
417
|
+
|
418
|
+
# Get most opening single quotes:
|
419
|
+
str.gsub!(/(\s| |--|&[mn]dash;|#{dec_dashes}|ȁ[34];)'(?=\w)/,
|
420
|
+
'\1‘')
|
421
|
+
# Single closing quotes:
|
422
|
+
str.gsub!(/(#{close_class})'/, '\1’')
|
423
|
+
str.gsub!(/'(\s|s\b|$)/, '’\1')
|
424
|
+
# Any remaining single quotes should be opening ones:
|
425
|
+
str.gsub!(/'/, '‘')
|
426
|
+
|
427
|
+
# Get most opening double quotes:
|
428
|
+
str.gsub!(/(\s| |--|&[mn]dash;|#{dec_dashes}|ȁ[34];)"(?=\w)/,
|
429
|
+
'\1“')
|
430
|
+
# Double closing quotes:
|
431
|
+
str.gsub!(/(#{close_class})"/, '\1”')
|
432
|
+
str.gsub!(/"(\s|s\b|$)/, '”\1')
|
433
|
+
# Any remaining quotes should be opening ones:
|
434
|
+
str.gsub!(/"/, '“')
|
435
|
+
|
436
|
+
str
|
437
|
+
end
|
438
|
+
|
439
|
+
# Return the string, with each RubyPants HTML entity translated to
|
440
|
+
# its ASCII counterpart.
|
441
|
+
#
|
442
|
+
# Note: This is not reversible (but exactly the same as in SmartyPants)
|
443
|
+
#
|
444
|
+
def stupefy_entities(str)
|
445
|
+
str.
|
446
|
+
gsub(/–/, '-'). # en-dash
|
447
|
+
gsub(/—/, '--'). # em-dash
|
448
|
+
|
449
|
+
gsub(/‘/, "'"). # open single quote
|
450
|
+
gsub(/’/, "'"). # close single quote
|
451
|
+
|
452
|
+
gsub(/“/, '"'). # open double quote
|
453
|
+
gsub(/”/, '"'). # close double quote
|
454
|
+
|
455
|
+
gsub(/…/, '...') # ellipsis
|
456
|
+
end
|
457
|
+
|
458
|
+
# Return an array of the tokens comprising the string. Each token is
|
459
|
+
# either a tag (possibly with nested, tags contained therein, such
|
460
|
+
# as <tt><a href="<MTFoo>"></tt>, or a run of text between
|
461
|
+
# tags. Each element of the array is a two-element array; the first
|
462
|
+
# is either :tag or :text; the second is the actual value.
|
463
|
+
#
|
464
|
+
# Based on the <tt>_tokenize()</tt> subroutine from Brad Choate's
|
465
|
+
# MTRegex plugin. <http://www.bradchoate.com/past/mtregex.php>
|
466
|
+
#
|
467
|
+
# This is actually the easier variant using tag_soup, as used by
|
468
|
+
# Chad Miller in the Python port of SmartyPants.
|
469
|
+
#
|
470
|
+
def tokenize
|
471
|
+
tag_soup = /([^<]*)(<[^>]*>)/
|
472
|
+
|
473
|
+
tokens = []
|
474
|
+
|
475
|
+
prev_end = 0
|
476
|
+
scan(tag_soup) {
|
477
|
+
tokens << [:text, $1] if $1 != ""
|
478
|
+
tokens << [:tag, $2]
|
479
|
+
|
480
|
+
prev_end = $~.end(0)
|
481
|
+
}
|
482
|
+
|
483
|
+
if prev_end < size
|
484
|
+
tokens << [:text, self[prev_end..-1]]
|
485
|
+
end
|
486
|
+
|
487
|
+
tokens
|
488
|
+
end
|
489
|
+
end
|