diff options
author | Brandon Mathis <brandon@imathis.com> | 2014-08-12 10:55:23 -0500 |
---|---|---|
committer | Brandon Mathis <brandon@imathis.com> | 2014-08-12 10:56:45 -0500 |
commit | 73e540409ceb8bc18048b6a96a4b815fc303ea28 (patch) | |
tree | ca3ae0e5cca03c7f0c8012a3ed4fbbf36b11ab9d /plugins/pygments_code.rb | |
parent | 18784a4cb04ed658268a5a4ba9bdf399e0c898ff (diff) | |
download | my_new_personal_website-73e540409ceb8bc18048b6a96a4b815fc303ea28.tar.xz my_new_personal_website-73e540409ceb8bc18048b6a96a4b815fc303ea28.zip |
Support octopress-hooks and octopress-date-format #1622
Diffstat (limited to 'plugins/pygments_code.rb')
-rw-r--r-- | plugins/pygments_code.rb | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/plugins/pygments_code.rb b/plugins/pygments_code.rb index 8b851a3b..c0f4de92 100644 --- a/plugins/pygments_code.rb +++ b/plugins/pygments_code.rb @@ -6,7 +6,7 @@ PYGMENTS_CACHE_DIR = File.expand_path('../../.pygments-cache', __FILE__) FileUtils.mkdir_p(PYGMENTS_CACHE_DIR) module HighlightCode - def highlight(str, lang) + def self.highlight(str, lang) lang = 'ruby' if lang == 'ru' lang = 'objc' if lang == 'm' lang = 'perl' if lang == 'pl' @@ -15,7 +15,7 @@ module HighlightCode tableize_code(str, lang) end - def pygments(code, lang) + def self.pygments(code, lang) if defined?(PYGMENTS_CACHE_DIR) path = File.join(PYGMENTS_CACHE_DIR, "#{lang}-#{Digest::MD5.hexdigest(code)}.html") if File.exist?(path) @@ -33,7 +33,7 @@ module HighlightCode end highlighted_code end - def tableize_code (str, lang = '') + def self.tableize_code (str, lang = '') table = '<div class="highlight"><table><tr><td class="gutter"><pre class="line-numbers">' code = '' str.lines.each_with_index do |line,index| |