aboutsummaryrefslogtreecommitdiff
path: root/plugins/backtick_code_block.rb
diff options
context:
space:
mode:
authorZhiming Wang <zmwangx@gmail.com>2015-05-04 14:55:10 -0700
committerZhiming Wang <zmwangx@gmail.com>2015-05-04 14:55:10 -0700
commit301679861a2440a10c9eac746cec86459f445ef9 (patch)
tree5aad22ead01cf0da226623f603f33867896c0fea /plugins/backtick_code_block.rb
parentd0a07c64afba47bbe8bfb56ba9893296a73fc7db (diff)
downloadmy_new_personal_website-301679861a2440a10c9eac746cec86459f445ef9.tar.xz
my_new_personal_website-301679861a2440a10c9eac746cec86459f445ef9.zip
remove all Octopress stuff
Diffstat (limited to '')
-rw-r--r--plugins/backtick_code_block.rb42
1 files changed, 0 insertions, 42 deletions
diff --git a/plugins/backtick_code_block.rb b/plugins/backtick_code_block.rb
deleted file mode 100644
index ae4a0472..00000000
--- a/plugins/backtick_code_block.rb
+++ /dev/null
@@ -1,42 +0,0 @@
-require './plugins/pygments_code'
-
-module BacktickCodeBlock
- AllOptions = /([^\s]+)\s+(.+?)\s+(https?:\/\/\S+|\/\S+)\s*(.+)?/i
- LangCaption = /([^\s]+)\s*(.+)?/i
- def self.render_code_block(input)
- @options = nil
- @caption = nil
- @lang = nil
- @url = nil
- @title = nil
- input.gsub(/^`{3} *([^\n]+)?\n(.+?)\n`{3}/m) do
- @options = $1 || ''
- str = $2
-
- if @options =~ AllOptions
- @lang = $1
- @caption = "<figcaption><span>#{$2}</span><a href='#{$3}'>#{$4 || 'link'}</a></figcaption>"
- elsif @options =~ LangCaption
- @lang = $1
- @caption = "<figcaption><span>#{$2}</span></figcaption>"
- end
-
- if str.match(/\A( {4}|\t)/)
- str = str.gsub(/^( {4}|\t)/, '')
- end
- if @lang.nil? || @lang == 'plain'
- code = HighlightCode::tableize_code(str.gsub('<','&lt;').gsub('>','&gt;'))
- "<figure class='code'>#{@caption}#{code}</figure>"
- else
- if @lang.include? "-raw"
- raw = "``` #{@options.sub('-raw', '')}\n"
- raw += str
- raw += "\n```\n"
- else
- code = HighlightCode::highlight(str, @lang)
- "<figure class='code'>#{@caption}#{code}</figure>"
- end
- end
- end
- end
-end