Class: NanDoc::Filters::Fence::Terminal

Inherits:
Object
  • Object
show all
Includes:
SpecDoc::Playback::Terminal::ColorToHtml, SpecDoc::Ruby2RubyStandin
Defined in:
lib/nandoc/filters/builtin-tags/fence/terminal.rb

Constant Summary

Constants included from SpecDoc::Playback::Terminal::ColorToHtml

SpecDoc::Playback::Terminal::ColorToHtml::Code2CssClass

Class Method Summary collapse

Instance Method Summary collapse

Methods included from SpecDoc::Playback::Terminal::ColorToHtml

#prompt_highlight, #prompt_highlight2, #terminal_color_to_html

Methods included from SpecDoc::Ruby2RubyStandin

#leading_indent, #re_for_here, #re_for_line_with_same_indent_as, #re_for_unindent_gsub, #reindent_content, #string_diff_assert

Class Method Details

.=~(str) ⇒ Object



10
11
12
# File 'lib/nandoc/filters/builtin-tags/fence/terminal.rb', line 10

def =~ str
  str =~ /\Afrom the command line\Z/
end

Instance Method Details

#run(out, indent, label, content) ⇒ Object



15
16
17
18
19
20
21
22
# File 'lib/nandoc/filters/builtin-tags/fence/terminal.rb', line 15

def run out, indent, label, content
  content_ind = reindent_content content, indent
  # if color codes colorize color codes, else prompts
  html = terminal_color_to_html(content_ind)
  html ||= prompt_highlight(content_ind)
  out.push_tag_now 'pre', 'terminal', html
  nil
end