Class: NanDoc::Filters::General

Inherits:
Nanoc3::Filter
  • Object
show all
Includes:
TerminalColorToHtml, StringFormatting, Nanoc3::Helpers::HTMLEscape
Defined in:
lib/nandoc/filters.rb

Defined Under Namespace

Modules: HackHelpers, TerminalColorToHtml Classes: ProcessSnippet

Instance Method Summary collapse

Methods included from StringFormatting

#basename_no_extension, #indent, #no_blank_lines, #no_leading_ws, #no_trailing_ws, #oxford_comma, #quoted, #reindent, #unindent

Methods included from TerminalColorToHtml

#terminal_color_to_html

Instance Method Details

#render_block_fence_ruby(md) ⇒ Object



304
305
306
307
308
309
310
# File 'lib/nandoc/filters.rb', line 304

def render_block_fence_ruby md
  content = reindent_content md
  content2 = content.strip # i think
  hilited = converter_ruby.convert(content2, false)
  pre_block = "\n<pre class='ruby'>\n#{hilited}\n</pre>\n"
  @chunks.push pre_block
end

#run(content, params = {}) ⇒ String

Returns The filtered content.

Parameters:

  • content (String)

    The content to filter

  • params (Hash) (defaults to: {})
    • not used

Returns:

  • (String)

    The filtered content



82
83
84
85
86
# File 'lib/nandoc/filters.rb', line 82

def run content, params={}
  content = filter_fence(content) if ReFenceFind =~ content
  content = filter_see_test(content) if ReSeeTest =~ content
  content
end

#unindent_generic(str) ⇒ Object



88
89
90
91
# File 'lib/nandoc/filters.rb', line 88

def unindent_generic str
  md = ReUnindent.match(str) or fail("no")
  reindent_content(md)
end