mirror of
https://github.com/WatchOutNewsAgency/wona.github.com.git
synced 2026-01-01 01:16:26 +00:00
1. Vastly improved backtick code blocks and added support for Textile
2. Refactored Octopress filters into Liquid filters and pre/post render filters (using post_filters plugin) 3. Added methods to raw plugin to prevent Markdown and Textile from parsing blocks 4. Updated render partial to invoke the pre_render method of post_filters 5. Moved Rubypants filter out of default.html into Octopress post_render filters 6. Added raw's safe_wrapper method to codeblock and include_code filters
This commit is contained in:
@ -42,11 +42,13 @@
|
||||
# </figure>
|
||||
#
|
||||
require './plugins/pygments_code'
|
||||
require './plugins/raw'
|
||||
|
||||
module Jekyll
|
||||
|
||||
class CodeBlock < Liquid::Block
|
||||
include HighlightCode
|
||||
include TemplateWrapper
|
||||
CaptionUrlTitle = /(\S[\S\s]*)\s+(https?:\/\/)(\S+)\s+(.+)/i
|
||||
CaptionUrl = /(\S[\S\s]*)\s+(https?:\/\/)(\S+)/i
|
||||
Caption = /(\S[\S\s]*)/
|
||||
@ -78,14 +80,15 @@ module Jekyll
|
||||
def render(context)
|
||||
output = super
|
||||
code = super.join
|
||||
source = "<div><figure role=code>"
|
||||
source = "<figure role=code>"
|
||||
source += @caption if @caption
|
||||
source = context['pygments_prefix'] + source if context['pygments_prefix']
|
||||
if @filetype
|
||||
source += " #{highlight(code, @filetype)}</figure></div>"
|
||||
source += " #{highlight(code, @filetype)}</figure>"
|
||||
else
|
||||
source += "#{tableize_code(code.lstrip.rstrip.gsub(/</,'<'))}</figure></div>"
|
||||
source += "#{tableize_code(code.lstrip.rstrip.gsub(/</,'<'))}</figure>"
|
||||
end
|
||||
source = safe_wrap(source)
|
||||
source = context['pygments_prefix'] + source if context['pygments_prefix']
|
||||
source = source + context['pygments_suffix'] if context['pygments_suffix']
|
||||
end
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user