diff --git a/.themes/classic/source/javascripts/octopress.js b/.themes/classic/source/javascripts/octopress.js index 12ca23e..5266ecb 100644 --- a/.themes/classic/source/javascripts/octopress.js +++ b/.themes/classic/source/javascripts/octopress.js @@ -48,8 +48,7 @@ function testFeatures() { function addCodeLineNumbers(){ if (navigator.appName == 'Microsoft Internet Explorer') { return } - $('div.highlight pre code').each(function(el){ addDivLines(el); }); - $('div.highlight, div.gist-highlight').each(function(code){ + $('div.gist-highlight').each(function(code){ var tableStart = '
';
var lineNumbers = ''; var tableMiddle = ' | ';
@@ -62,16 +61,6 @@ function addCodeLineNumbers(){
$(code).html(table);
});
}
-function addDivLines(el){
- var content = $(el).html();
- var lines = content.replace(/\s*$/g, '').split(/\n/);
- var count = lines.length;
- $(lines).each(function(line, index){
- if(line == '') line = ' ';
- lines[index] = ' ' + line + ' ';
- });
- $(el).html(lines.join(''));
-}
function flashVideoFallback(){
var flashplayerlocation = "/assets/jwplayer/player.swf",
diff --git a/Gemfile b/Gemfile
index 8b7de0f..5bb57ed 100644
--- a/Gemfile
+++ b/Gemfile
@@ -4,6 +4,7 @@ gem 'rake'
gem 'rack'
gem 'jekyll'
gem 'rdiscount'
+gem 'pygments.rb'
gem 'RedCloth'
gem 'haml', '>= 3.1'
gem 'compass', '>= 0.11'
diff --git a/Gemfile.lock b/Gemfile.lock
index 302cc44..c9235cb 100644
--- a/Gemfile.lock
+++ b/Gemfile.lock
@@ -4,6 +4,7 @@ GEM
RedCloth (4.2.7)
albino (1.3.3)
posix-spawn (>= 0.3.6)
+ blankslate (2.1.2.4)
chunky_png (1.2.0)
classifier (1.3.3)
fast-stemmer (>= 1.0.0)
@@ -13,6 +14,7 @@ GEM
sass (~> 3.1)
directory_watcher (1.4.0)
fast-stemmer (1.0.0)
+ ffi (1.0.9)
fssm (0.2.7)
haml (3.1.2)
jekyll (0.11.0)
@@ -27,12 +29,17 @@ GEM
maruku (0.6.0)
syntax (>= 1.0.0)
posix-spawn (0.3.6)
- rack (1.3.1)
+ pygments.rb (0.1.2)
+ rubypython (>= 0.5.1)
+ rack (1.3.2)
rake (0.9.2)
rb-fsevent (0.4.1)
rdiscount (1.6.8)
rubypants (0.2.0)
- sass (3.1.4)
+ rubypython (0.5.1)
+ blankslate (>= 2.1.2.3)
+ ffi (~> 1.0.7)
+ sass (3.1.5)
syntax (1.0.0)
PLATFORMS
@@ -43,6 +50,7 @@ DEPENDENCIES
compass (>= 0.11)
haml (>= 3.1)
jekyll
+ pygments.rb
rack
rake
rb-fsevent
diff --git a/_config.yml b/_config.yml
index b801db1..25783c8 100644
--- a/_config.yml
+++ b/_config.yml
@@ -28,7 +28,7 @@ plugins: plugins
code_dir: downloads/code
category_dir: blog/categories
markdown: rdiscount
-pygments: true
+pygments: false
paginate: 10 # Posts per page on the blog index
recent_posts: 5 # Posts in the sidebar Recent Posts section
diff --git a/plugins/code_block.rb b/plugins/code_block.rb
index 4cf2817..af64e03 100644
--- a/plugins/code_block.rb
+++ b/plugins/code_block.rb
@@ -41,9 +41,12 @@
#
#
#
+require './plugins/pygments_code'
+
module Jekyll
class CodeBlock < Liquid::Block
+ include HighlightCode
CaptionUrlTitle = /(\S[\S\s]*)\s+(https?:\/\/)(\S+)\s+(.+)/i
CaptionUrl = /(\S[\S\s]*)\s+(https?:\/\/)(\S+)/i
Caption = /(\S[\S\s]*)/
@@ -75,7 +78,7 @@ module Jekyll
if @filetype
@filetype = 'objc' if @filetype == 'm'
@filetype = 'perl' if @filetype == 'pl'
- source += "{% highlight #{@filetype} %}\n" + code + "\n{% endhighlight %}"
+ source += " #{highlight(code, @filetype)}"
else
source += " "
end
diff --git a/plugins/include_code.rb b/plugins/include_code.rb
index b0258a4..93db78a 100644
--- a/plugins/include_code.rb
+++ b/plugins/include_code.rb
@@ -20,11 +20,13 @@
# will output a figcaption with the title: Example 2 (test.js)
#
+require './plugins/pygments_code'
require 'pathname'
module Jekyll
class IncludeCodeTag < Liquid::Tag
+ include HighlightCode
def initialize(tag_name, markup, tokens)
@title = nil
@file = nil
@@ -50,13 +52,13 @@ module Jekyll
Dir.chdir(code_path) do
code = file.read
- @filetype = file.extname
+ @filetype = file.extname.sub('.','')
@filetype = 'objc' if @filetype == 'm'
@filetype = 'perl' if @filetype == 'pl'
title = @title ? "#{@title} (#{file.basename})" : file.basename
url = "#{context.registers[:site].config['url']}/#{code_dir}/#{@file}"
source = "(.+)<\/pre>/m)[1].to_s.gsub(/\s*$/, '') #strip out divs |