diff options
-rw-r--r-- | .themes/classic/source/_includes/article.html | 4 | ||||
-rw-r--r-- | .themes/classic/source/_layouts/page.html | 2 | ||||
-rw-r--r-- | Rakefile | 9 | ||||
-rw-r--r-- | _config.yml | 2 | ||||
-rw-r--r-- | plugins/backtick_code_block.rb | 6 |
5 files changed, 11 insertions, 12 deletions
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/_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 %} @@ -91,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 @@ -101,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: " @@ -116,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_-]+)(\.)?(.+)?/ @@ -133,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" @@ -233,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" diff --git a/_config.yml b/_config.yml index 26881bc4..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] 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('>','>')) |