Support octopress-hooks and octopress-date-format #1622

This commit is contained in:
Brandon Mathis 2014-08-12 10:55:23 -05:00
parent 18784a4cb0
commit 73e540409c
11 changed files with 47 additions and 58 deletions

View file

@ -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|