diff options
-rw-r--r-- | .themes/classic/source/_includes/head.html | 6 | ||||
-rw-r--r-- | .themes/classic/source/_includes/post/author.html | 2 | ||||
-rw-r--r-- | .themes/classic/source/_layouts/page.html | 6 | ||||
-rw-r--r-- | Rakefile | 1 | ||||
-rw-r--r-- | _config.yml | 2 | ||||
-rw-r--r-- | plugins/image_tag.rb | 18 | ||||
-rw-r--r-- | plugins/include_code.rb | 2 | ||||
-rw-r--r-- | plugins/octopress_filters.rb | 33 |
8 files changed, 57 insertions, 13 deletions
diff --git a/.themes/classic/source/_includes/head.html b/.themes/classic/source/_includes/head.html index d04d0d09..e7663eaf 100644 --- a/.themes/classic/source/_includes/head.html +++ b/.themes/classic/source/_includes/head.html @@ -1,5 +1,5 @@ <!DOCTYPE html> -<!--[if IEMobile 7 ]><html class="no-js iem7" manifest="default.appcache?v=1"><![endif]--> +<!--[if IEMobile 7 ]><html class="no-js iem7"><![endif]--> <!--[if lt IE 9]><html class="no-js lte-ie8"><![endif]--> <!--[if (gt IE 8)|(gt IEMobile 7)|!(IEMobile)|!(IE)]><!--><html class="no-js" lang="en"><!--<![endif]--> <head> @@ -19,6 +19,7 @@ <meta name="keywords" content="{{page.keywords}}"/> {% endif %} + <link rel="canonical" href="{{ site.url }}{{ page.url }}"/> <link href="{{ root_url }}/favicon.png" rel="shortcut icon" /> <link href="{{ root_url }}/stylesheets/screen.css" media="screen, projection" rel="stylesheet" type="text/css"> <script src="{{ root_url }}/javascripts/modernizr-2.0.js"></script> @@ -26,7 +27,8 @@ <script src="{{ root_url }}/javascripts/octopress.js" type="text/javascript"></script> <link href='http://fonts.googleapis.com/css?family=PT+Serif:regular,italic,bold,bolditalic' rel='stylesheet' type='text/css'> <link href='http://fonts.googleapis.com/css?family=PT+Sans:regular,italic,bold,bolditalic' rel='stylesheet' type='text/css'> - <link href="{{ root_url }}/atom.xml" rel="alternate" title="{{site.title}}" type="application/atom+xml"/> + {% capture rss_url %}{% if site.subscribe_rss contains ':' %}{{ site.subscribe_rss }}{% else %}{{ root_url }}{{ site.subscribe_rss }}{% endif %}{% endcapture %} + <link href="{{ rss_url }}" rel="alternate" title="{{site.title}}" type="application/atom+xml"/> {% include google_analytics.html %} {% include google_plus_one.html %} {% include twitter_sharing.html %} diff --git a/.themes/classic/source/_includes/post/author.html b/.themes/classic/source/_includes/post/author.html index b2db9043..83dd6a89 100644 --- a/.themes/classic/source/_includes/post/author.html +++ b/.themes/classic/source/_includes/post/author.html @@ -1,5 +1,7 @@ {% if post.author %} {% assign author = post.author %} +{% elsif page.author %} + {% assign author = page.author %} {% else %} {% assign author = site.author %} {% endif %} diff --git a/.themes/classic/source/_layouts/page.html b/.themes/classic/source/_layouts/page.html index a2fc41ed..34cb3430 100644 --- a/.themes/classic/source/_layouts/page.html +++ b/.themes/classic/source/_layouts/page.html @@ -11,7 +11,11 @@ layout: default {{ content }} {% unless page.footer == false %} <footer> - {% if page.date %}<p class="meta">{% include post/date.html %}</p>{% endif %} + {% if page.date or page.author %}<p class="meta"> + {% if page.author %}{% include post/author.html %}{% endif %} + {% include post/date.html %} + {% if page.categories %}{% include post/categories.html %}{% endif %} + </p>{% endif %} {% unless page.sharing == false %} {% include post/sharing.html %} {% endunless %} @@ -150,6 +150,7 @@ task :update_source, :theme do |t, args| system "mkdir -p #{source_dir}; cp -R #{themes_dir}/"+theme+"/source/. #{source_dir}" system "cp -Rn #{source_dir}.old/. #{source_dir}" system "cp -f #{source_dir}.old/_includes/navigation.html #{source_dir}/_includes/navigation.html" + system "cp -f #{source_dir}.old/_includes/footer.html #{source_dir}/_includes/footer.html" puts "## Updated #{source_dir} ##" end diff --git a/_config.yml b/_config.yml index 38d5bdbf..1fc5ad80 100644 --- a/_config.yml +++ b/_config.yml @@ -21,7 +21,7 @@ email: # If publishing to a subdirectory as in http://site.com/project set 'root: /project' root: / port: 4000 -permalink: /blog/:year/:month/:day/:title +permalink: /blog/:year/:month/:day/:title/ source: source destination: public plugins: plugins diff --git a/plugins/image_tag.rb b/plugins/image_tag.rb index 7be4003d..25a38df5 100644 --- a/plugins/image_tag.rb +++ b/plugins/image_tag.rb @@ -17,12 +17,20 @@ module Jekyll @img = nil @title = nil @class = '' + @width = '' + @height = '' def initialize(tag_name, markup, tokens) - if markup =~ /(\S.*\s+)?(https?:\/\/|\/)(\S+)(\s+.+)?/i - @class = $1 + if markup =~ /(\S.*\s+)?(https?:\/\/|\/)(\S+)(\s+\d+\s+\d+)?(\s+.+)?/i + @class = $1 || '' @img = $2 + $3 - @title = $4 + if $5 + @title = $5.strip + end + if $4 =~ /\s*(\d+)\s+(\d+)/ + @width = $1 + @height = $2 + end end super end @@ -30,9 +38,9 @@ module Jekyll def render(context) output = super if @img - "<img class='#{@class}' src='#{@img}' alt='#{@title}' title='#{@title}'>" + "<img class='#{@class}' src='#{@img}' width='#{@width}' height='#{@height}' alt='#{@title}' title='#{@title}'>" else - "Error processing input, expected syntax: {% img [class name(s)] /url/to/image [title text] %}" + "Error processing input, expected syntax: {% img [class name(s)] /url/to/image [width height] [title text] %}" end end end diff --git a/plugins/include_code.rb b/plugins/include_code.rb index 93db78a3..ec72006c 100644 --- a/plugins/include_code.rb +++ b/plugins/include_code.rb @@ -38,7 +38,7 @@ module Jekyll end def render(context) - code_dir = (context.registers[:site].config['code_dir'] || 'downloads/code') + code_dir = (context.registers[:site].config['code_dir'].sub(/^\//,'') || 'downloads/code') code_path = (Pathname.new(context.registers[:site].source) + code_dir).expand_path file = code_path + @file diff --git a/plugins/octopress_filters.rb b/plugins/octopress_filters.rb index 7d73bdec..f2a5073b 100644 --- a/plugins/octopress_filters.rb +++ b/plugins/octopress_filters.rb @@ -26,10 +26,37 @@ module OctopressFilters # code snippet # ``` def backtick_codeblock(input) - input.gsub /<p>`{3}\s(\w+)<\/p>\n\n<pre><code>([^<]+)<\/code><\/pre>\n\n<p>`{3}<\/p>/m do + # Markdown support + input = input.gsub /<p>`{3}\s*(\w+)?<\/p>\s*<pre><code>\s*(.+?)\s*<\/code><\/pre>\s*<p>`{3}<\/p>/m do lang = $1 - str = $2.gsub('<','<').gsub('>','>') - highlight(str, lang) + if lang != '' + str = $2.gsub('<','<').gsub('>','>') + highlight(str, lang) + else + "<pre><code>#{$2}</code></pre>" + end + end + + # Textile support + input = input.gsub /<p>`{3}\s*(\w+)?<br\s*\/>\n(.+?)`{3}<\/p>/m do + lang = $1 + str = $2.gsub('<','<').gsub('>','>').gsub(/^\s{4}/, '').gsub(/(<br\s\/>)?$/, '') + if lang != '' + highlight(str, lang) + else + "<pre><code>#{$2}</code></pre>" + end + end + + # Regular HTML support + input.gsub /^`{3}\s*(\w+)?\n(.+?)\n`{3}/m do + lang = $1 + str = $2.gsub(/^\s{4}/, '') + if lang != '' + highlight(str, lang) + else + "<pre><code>#{$2.gsub('<','<').gsub('>','>')}</code></pre>" + end end end |