aboutsummaryrefslogtreecommitdiff
path: root/_plugins/pygments_cache_patch.rb
diff options
context:
space:
mode:
authorBrandon Mathis <brandon@imathis.com>2011-06-11 15:58:53 -0400
committerBrandon Mathis <brandon@imathis.com>2011-06-11 15:58:53 -0400
commit913fa105c4a6793e6522ca45b85d8f06c803c6b9 (patch)
tree8047baaf313f6a0966b03c8a26a8988cdfa3c172 /_plugins/pygments_cache_patch.rb
parent814be44c151088dfb90d6a01281c9206151b0a88 (diff)
downloadmy_new_personal_website-913fa105c4a6793e6522ca45b85d8f06c803c6b9.tar.xz
my_new_personal_website-913fa105c4a6793e6522ca45b85d8f06c803c6b9.zip
1. Moved _plugins into themes/classic/_plugins
I think it's probably better to ship plugins with themes to make it easier to update them. 2. Improved 'install' rake task and made nicer output
Diffstat (limited to '_plugins/pygments_cache_patch.rb')
-rw-r--r--_plugins/pygments_cache_patch.rb30
1 files changed, 0 insertions, 30 deletions
diff --git a/_plugins/pygments_cache_patch.rb b/_plugins/pygments_cache_patch.rb
deleted file mode 100644
index 36c78d20..00000000
--- a/_plugins/pygments_cache_patch.rb
+++ /dev/null
@@ -1,30 +0,0 @@
-#
-# Author: Raimonds Simanovskis, http://blog.rayapps.com/
-# Source URL: https://github.com/rsim/blog.rayapps.com/blob/master/_plugins/pygments_cache_patch.rb
-#
-
-require 'fileutils'
-require 'digest/md5'
-
-PYGMENTS_CACHE_DIR = File.expand_path('../../_cache', __FILE__)
-FileUtils.mkdir_p(PYGMENTS_CACHE_DIR)
-
-Jekyll::HighlightBlock.class_eval do
- def render_pygments(context, code)
- if defined?(PYGMENTS_CACHE_DIR)
- path = File.join(PYGMENTS_CACHE_DIR, "#{@lang}-#{Digest::MD5.hexdigest(code)}.html")
- if File.exist?(path)
- highlighted_code = File.read(path)
- else
- highlighted_code = Albino.new(code, @lang).to_s(@options)
- File.open(path, 'w') {|f| f.print(highlighted_code) }
- end
- else
- highlighted_code = Albino.new(code, @lang).to_s(@options)
- end
- output = add_code_tags(highlighted_code, @lang)
- output = context["pygments_prefix"] + output if context["pygments_prefix"]
- output = output + context["pygments_suffix"] if context["pygments_suffix"]
- output
- end
-end