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

@ -1,10 +1,9 @@
require './plugins/pygments_code'
module BacktickCodeBlock
include HighlightCode
AllOptions = /([^\s]+)\s+(.+?)\s+(https?:\/\/\S+|\/\S+)\s*(.+)?/i
LangCaption = /([^\s]+)\s*(.+)?/i
def render_code_block(input)
def self.render_code_block(input)
@options = nil
@caption = nil
@lang = nil
@ -26,7 +25,7 @@ module BacktickCodeBlock
str = str.gsub(/^( {4}|\t)/, '')
end
if @lang.nil? || @lang == 'plain'
code = tableize_code(str.gsub('<','&lt;').gsub('>','&gt;'))
code = HighlightCode::tableize_code(str.gsub('<','&lt;').gsub('>','&gt;'))
"<figure class='code'>#{@caption}#{code}</figure>"
else
if @lang.include? "-raw"
@ -34,7 +33,7 @@ module BacktickCodeBlock
raw += str
raw += "\n```\n"
else
code = highlight(str, @lang)
code = HighlightCode::highlight(str, @lang)
"<figure class='code'>#{@caption}#{code}</figure>"
end
end