class ExtendedMarkdownFilter

Constants

EMF_CURLY_TAGS

Public Class Methods

convert_curly_to_bracket(text) click to toggle source
# File lib/extended-markdown-filter.rb, line 29
def self.convert_curly_to_bracket(text)
  return text if text.nil?
  text = text.gsub(/\{\{#(#{EMF_CURLY_TAGS})\}\}/, '[[#\1]]')
  text = text.gsub(/\{\{\/(#{EMF_CURLY_TAGS})\}\}/, '[[/\1]]')
  text = text.gsub(/\{\{ (octicon-\S+\s*[^\}]+) \}\}/,  '[[\1]]')

  text
end
new(text, context = nil, result = nil) click to toggle source
Calls superclass method
# File lib/extended-markdown-filter.rb, line 11
def initialize(text, context = nil, result = nil)
  if context[:emf_use_blocks]
    text = self.class.convert_curly_to_bracket(text)
    @front_wrap = '\\[\\['
    @end_wrap = '\\]\\]'
    @wrap_symbol = '\\]'
  else
    @front_wrap = "\{\{"
    @end_wrap = "\}\}"
    @wrap_symbol = '}'
  end

  # do preprocessing, then call HTML::Pipeline::Markdown
  text = format_helper          text

  super text, context, result
end
should_jekyll_replace?(site) click to toggle source
# File lib/extended-markdown-filter.rb, line 38
def self.should_jekyll_replace?(site)
  html_pipeline_context = site.site_payload['site']['html_pipeline'] && site.site_payload['site']['html_pipeline']['context']
  return false if html_pipeline_context.nil?
  pipeline_emf_context = site.site_payload['site']['html_pipeline']['context'][:emf_use_blocks] || site.site_payload['site']['html_pipeline']['context']['emf_use_blocks']
  site.site_payload['site']['markdown'] == 'HTMLPipeline' && html_pipeline_context && pipeline_emf_context
end

Public Instance Methods

call() click to toggle source
Calls superclass method
# File lib/extended-markdown-filter.rb, line 45
def call
  # initialize HTML::Pipeline::Markdown, then do post-processing
  html = super

  format_intro!           html
  format_os_blocks!       html
  format_admonitions!     html
  format_octicons!        html
  format_command_line!    html

  html
end