diff options
-rw-r--r-- | .themes/classic/sass/base/_typography.scss | 10 | ||||
-rw-r--r-- | .themes/classic/source/_includes/after_footer.html | 1 | ||||
-rw-r--r-- | .themes/classic/source/_includes/article.html | 4 | ||||
-rw-r--r-- | .themes/classic/source/_includes/asides/delicious.html | 2 | ||||
-rw-r--r-- | .themes/classic/source/_includes/disqus.html | 8 | ||||
-rw-r--r-- | .themes/classic/source/_includes/facebook_like.html | 8 | ||||
-rw-r--r-- | .themes/classic/source/_includes/post/sharing.html | 3 | ||||
-rw-r--r-- | .themes/classic/source/_layouts/page.html | 2 | ||||
-rw-r--r-- | Rakefile | 13 | ||||
-rw-r--r-- | _config.yml | 5 | ||||
-rw-r--r-- | plugins/backtick_code_block.rb | 6 | ||||
-rw-r--r-- | plugins/code_block.rb | 1 | ||||
-rw-r--r-- | plugins/pullquote.rb | 13 |
13 files changed, 53 insertions, 23 deletions
diff --git a/.themes/classic/sass/base/_typography.scss b/.themes/classic/sass/base/_typography.scss index ef83065b..60556752 100644 --- a/.themes/classic/sass/base/_typography.scss +++ b/.themes/classic/sass/base/_typography.scss @@ -115,7 +115,8 @@ blockquote { } } -.has-pullquote:before { +.pullquote-right:before, +.pullquote-left:before { /* Reset metrics. */ padding: 0; border: none; @@ -134,6 +135,13 @@ blockquote { font-size: 1.4em; line-height: 1.45em; } + +.pullquote-left:before { + /* Make left pullquotes align properly. */ + float: left; + margin: .5em 1.5em 1em 0; +} + /* @extend this to force long lines of continuous text to wrap */ .force-wrap { white-space: -moz-pre-wrap; diff --git a/.themes/classic/source/_includes/after_footer.html b/.themes/classic/source/_includes/after_footer.html index 80a481eb..b17f5463 100644 --- a/.themes/classic/source/_includes/after_footer.html +++ b/.themes/classic/source/_includes/after_footer.html @@ -1,4 +1,5 @@ {% include disqus.html %} +{% include facebook_like.html %} {% include google_plus_one.html %} {% include twitter_sharing.html %} {% include google_analytics.html %} diff --git a/.themes/classic/source/_includes/article.html b/.themes/classic/source/_includes/article.html index 79e26528..9db07455 100644 --- a/.themes/classic/source/_includes/article.html +++ b/.themes/classic/source/_includes/article.html @@ -1,9 +1,9 @@ {% unless page.no_header %} <header> {% if index %} - <h1 class="entry-title"><a href="{{ root_url }}{{ post.url }}">{{ post.title | titlecase }}</a></h1> + <h1 class="entry-title"><a href="{{ root_url }}{{ post.url }}">{% if site.titlecase %}{{ post.title | titlecase }}{% else %}{{ post.title }}{% endif %}</a></h1> {% else %} - <h1 class="entry-title">{{ page.title | titlecase }}</h1> + <h1 class="entry-title">{% if site.titlecase %}{{ page.title | titlecase }}{% else %}{{ page.title }}{% endif %}</h1> {% endif %} {% unless page.meta == false %} <p class="meta"> diff --git a/.themes/classic/source/_includes/asides/delicious.html b/.themes/classic/source/_includes/asides/delicious.html index 8c75b822..115cdcbc 100644 --- a/.themes/classic/source/_includes/asides/delicious.html +++ b/.themes/classic/source/_includes/asides/delicious.html @@ -2,7 +2,7 @@ <section> <h1>On Delicious</h1> <div id="delicious"></div> - <script type="text/javascript" src="http://feeds.delicious.com/v1/json/{{ site.delicious_user }}?count={{ site.delicious_count }}&sort=date&callback=renderDeliciousLinks"></script> + <script type="text/javascript" src="http://feeds.delicious.com/v2/json/{{ site.delicious_user }}?count={{ site.delicious_count }}&sort=date&callback=renderDeliciousLinks"></script> <p><a href="http://delicious.com/{{ site.delicious_user }}">My Delicious Bookmarks »</a></p> </section> {% endif %}
\ No newline at end of file diff --git a/.themes/classic/source/_includes/disqus.html b/.themes/classic/source/_includes/disqus.html index 4b913534..a58512b5 100644 --- a/.themes/classic/source/_includes/disqus.html +++ b/.themes/classic/source/_includes/disqus.html @@ -1,19 +1,19 @@ {% comment %} Load script if disquss comments are enabled and `page.comments` is either empty (index) or set to true {% endcomment %} {% if site.disqus_short_name and page.comments != false %} <script type="text/javascript"> - (function () { + var disqus_shortname = '{{ site.disqus_short_name }}'; {% if page.comments == true %} {% comment %} `page.comments` can be only be set to true on pages/posts, so we embed the comments here. {% endcomment %} // var disqus_developer = 1; var disqus_identifier = '{{ site.url }}{{ page.url }}'; var disqus_url = '{{ site.url }}{{ page.url }}'; - var disqus_script = 'embed.js' + var disqus_script = 'embed.js'; {% else %} {% comment %} As `page.comments` is empty, we must be on the index page. {% endcomment %} - var disqus_script = 'count.js' + var disqus_script = 'count.js'; {% endif %} - + (function () { var dsq = document.createElement('script'); dsq.type = 'text/javascript'; dsq.async = true; dsq.src = 'http://' + disqus_shortname + '.disqus.com/' + disqus_script; (document.getElementsByTagName('head')[0] || document.getElementsByTagName('body')[0]).appendChild(dsq); diff --git a/.themes/classic/source/_includes/facebook_like.html b/.themes/classic/source/_includes/facebook_like.html new file mode 100644 index 00000000..6c4c2788 --- /dev/null +++ b/.themes/classic/source/_includes/facebook_like.html @@ -0,0 +1,8 @@ +<div id="fb-root"></div> +<script>(function(d, s, id) { + var js, fjs = d.getElementsByTagName(s)[0]; + if (d.getElementById(id)) {return;} + js = d.createElement(s); js.id = id; + js.src = "//connect.facebook.net/en_US/all.js#appId=212934732101925&xfbml=1"; + fjs.parentNode.insertBefore(js, fjs); +}(document, 'script', 'facebook-jssdk'));</script> diff --git a/.themes/classic/source/_includes/post/sharing.html b/.themes/classic/source/_includes/post/sharing.html index f0f9b9db..e32500d0 100644 --- a/.themes/classic/source/_includes/post/sharing.html +++ b/.themes/classic/source/_includes/post/sharing.html @@ -5,4 +5,7 @@ {% if site.google_plus_one %} <div class="g-plusone" data-size="{{ site.google_plus_one_size }}"></div> {% endif %} + {% if site.facebook_like %} + <div class="fb-like" data-send="true" data-width="450" data-show-faces="false"></div> + {% endif %} </div> diff --git a/.themes/classic/source/_layouts/page.html b/.themes/classic/source/_layouts/page.html index 4edd3ed5..8ba6ec94 100644 --- a/.themes/classic/source/_layouts/page.html +++ b/.themes/classic/source/_layouts/page.html @@ -6,7 +6,7 @@ layout: default <article role="article"> {% if page.title %} <header> - <h1 class="entry-title">{{ page.title | titlecase }}</h1> + <h1 class="entry-title">{% if site.titlecase %}{{ page.title | titlecase }}{% else %}{{ page.title }}{% endif %}</h1> {% if page.date %}<p class="meta">{% include post/date.html %}{{ time }}</p>{% endif %} </header> {% endif %} @@ -58,6 +58,7 @@ desc "Watch the site and regenerate when it changes" task :watch do raise "### You haven't set anything up yet. First run `rake install` to set up an Octopress theme." unless File.directory?(source_dir) puts "Starting to watch source with Jekyll and Compass." + system "compass compile --css-dir #{source_dir}/stylesheets" unless File.exist?("#{source_dir}/stylesheets/screen.css") jekyllPid = Process.spawn("jekyll --auto") compassPid = Process.spawn("compass watch") @@ -73,6 +74,7 @@ desc "preview the site in a web browser" task :preview do raise "### You haven't set anything up yet. First run `rake install` to set up an Octopress theme." unless File.directory?(source_dir) puts "Starting to watch source with Jekyll and Compass. Starting Rack on port #{server_port}" + system "compass compile --css-dir #{source_dir}/stylesheets" unless File.exist?("#{source_dir}/stylesheets/screen.css") jekyllPid = Process.spawn("jekyll --auto") compassPid = Process.spawn("compass watch") rackupPid = Process.spawn("rackup --port #{server_port}") @@ -89,7 +91,6 @@ end desc "Begin a new post in #{source_dir}/#{posts_dir}" task :new_post, :title do |t, args| raise "### You haven't set anything up yet. First run `rake install` to set up an Octopress theme." unless File.directory?(source_dir) - require './plugins/titlecase.rb' mkdir_p "#{source_dir}/#{posts_dir}" args.with_defaults(:title => 'new-post') title = args.title @@ -99,10 +100,9 @@ task :new_post, :title do |t, args| end puts "Creating new post: #{filename}" open(filename, 'w') do |post| - system "mkdir -p #{source_dir}/#{posts_dir}/"; post.puts "---" post.puts "layout: post" - post.puts "title: \"#{title.gsub(/&/,'&').titlecase}\"" + post.puts "title: \"#{title.gsub(/&/,'&')}\"" post.puts "date: #{Time.now.strftime('%Y-%m-%d %H:%M')}" post.puts "comments: true" post.puts "categories: " @@ -114,7 +114,6 @@ end desc "Create a new page in #{source_dir}/(filename)/index.#{new_page_ext}" task :new_page, :filename do |t, args| raise "### You haven't set anything up yet. First run `rake install` to set up an Octopress theme." unless File.directory?(source_dir) - require './plugins/titlecase.rb' args.with_defaults(:filename => 'new-page') page_dir = source_dir if args.filename =~ /(^.+\/)?([\w_-]+)(\.)?(.+)?/ @@ -131,7 +130,7 @@ task :new_page, :filename do |t, args| open(file, 'w') do |page| page.puts "---" page.puts "layout: page" - page.puts "title: \"#{$2.gsub(/[-_]/, ' ').titlecase}\"" + page.puts "title: \"#{$2.gsub(/[-_]/, ' ')}\"" page.puts "date: #{Time.now.strftime('%Y-%m-%d %H:%M')}" page.puts "comments: true" page.puts "sharing: true" @@ -231,7 +230,7 @@ multitask :push do (Dir["#{deploy_dir}/*"]).each { |f| rm_rf(f) } Rake::Task[:copydot].invoke(public_dir, deploy_dir) puts "\n## copying #{public_dir} to #{deploy_dir}" - system "cp -R #{public_dir}/* #{deploy_dir}" + cp_r "#{public_dir}/*", deploy_dir cd "#{deploy_dir}" do system "git add ." system "git add -u" @@ -283,7 +282,7 @@ desc "Set up _deploy folder and deploy branch for Github Pages deployment" task :setup_github_pages do repo_url = get_stdin("Enter the read/write url for your repository: ") user = repo_url.match(/:([^\/]+)/)[1] - branch = (repo_url.match(/\/\w+.github.com/).nil?) ? 'gh-pages' : 'master' + branch = (repo_url.match(/\/[\w-]+.github.com/).nil?) ? 'gh-pages' : 'master' project = (branch == 'gh-pages') ? repo_url.match(/\/([^\.]+)/)[1] : '' unless `git remote -v`.match(/origin.+?octopress.git/).nil? # If octopress is still the origin remote (from cloning) rename it to octopress diff --git a/_config.yml b/_config.yml index f40ccf19..f90307ac 100644 --- a/_config.yml +++ b/_config.yml @@ -34,6 +34,8 @@ pagination_dir: blog # Directory base for pagination URLs eg. /blog/page/2/ recent_posts: 5 # Posts in the sidebar Recent Posts section excerpt_link: "Read on →" # "Continue reading" link text at the bottom of excerpted articles +titlecase: true # Converts page and post titles to tilecase + # list each of the sidebar modules you want to include, in the order you want them to appear. # To add custom asides, create files in /source/_includes/custom/asides/ and add them to the list like 'custom/asides/custom_aside_name.html' default_asides: [asides/recent_posts.html, asides/github.html, asides/twitter.html, asides/delicious.html, asides/pinboard.html] @@ -80,3 +82,6 @@ disqus_show_comment_count: false # Google Analytics google_analytics_tracking_id: + +# Facebook Like +facebook_like: true diff --git a/plugins/backtick_code_block.rb b/plugins/backtick_code_block.rb index 6243de6f..40e7900b 100644 --- a/plugins/backtick_code_block.rb +++ b/plugins/backtick_code_block.rb @@ -10,7 +10,7 @@ module BacktickCodeBlock @lang = nil @url = nil @title = nil - input.gsub /^`{3} *([^\n]+)?\n(.+?)\n`{3}/m do + input.gsub(/^`{3} *([^\n]+)?\n(.+?)\n`{3}/m) do @options = $1 || '' str = $2 @@ -22,8 +22,8 @@ module BacktickCodeBlock @caption = "<figcaption><span>#{$2}</span></figcaption>" end - if str.match(/\A {4}/) - str = str.gsub /^ {4}/, '' + if str.match(/\A( {4}|\t)/) + str = str.gsub(/^( {4}|\t)/, '') end if @lang.nil? || @lang == 'plain' code = tableize_code(str.gsub('<','<').gsub('>','>')) diff --git a/plugins/code_block.rb b/plugins/code_block.rb index bf89feab..e175d445 100644 --- a/plugins/code_block.rb +++ b/plugins/code_block.rb @@ -90,6 +90,7 @@ module Jekyll source = safe_wrap(source) source = context['pygments_prefix'] + source if context['pygments_prefix'] source = source + context['pygments_suffix'] if context['pygments_suffix'] + source end end end diff --git a/plugins/pullquote.rb b/plugins/pullquote.rb index 03e307a7..cf8d22f1 100644 --- a/plugins/pullquote.rb +++ b/plugins/pullquote.rb @@ -1,10 +1,10 @@ # # Author: Brandon Mathis -# Based on the sematic pullquote technique by Maykel Loomans at http://miekd.com/articles/pull-quotes-with-html5-and-css/ +# Based on the semantic pullquote technique by Maykel Loomans at http://miekd.com/articles/pull-quotes-with-html5-and-css/ # # Outputs a span with a data-pullquote attribute set from the marked pullquote. Example: # -# {% pullquote %} +# {% pullquote %} # 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. # 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 # to use a CSS only technique for styling pullquotes. @@ -13,15 +13,20 @@ # <p> # <span data-pullquote="pullquotes are merely visual in presentation and should not appear twice in the text."> # 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. -# 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 # for styling pullquotes is prefered. +# 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 +# for styling pullquotes is prefered. # </span> # </p> # +# {% pullquote left %} will create a left-aligned pullquote instead. +# +# Note: this plugin now creates pullquotes with the class of pullquote-right by default module Jekyll class PullquoteTag < Liquid::Block def initialize(tag_name, markup, tokens) + @align = (markup =~ /left/i) ? "left" : "right" super end @@ -29,7 +34,7 @@ module Jekyll output = super if output.join =~ /\{"\s*(.+)\s*"\}/ @quote = $1 - "<span class='has-pullquote' data-pullquote='#{@quote}'>#{output.join.gsub(/\{"\s*|\s*"\}/, '')}</span>" + "<span class='pullquote-#{@align}' data-pullquote='#{@quote}'>#{output.join.gsub(/\{"\s*|\s*"\}/, '')}</span>" else return "Surround your pullquote like this {\" text to be quoted \"}" end |