Class: CodeHighlighter
- Inherits:
-
Dynasnip
- Object
- Vanilla::Renderers::Base
- Dynasnip
- CodeHighlighter
- Defined in:
- lib/vanilla/dynasnips/code.rb
Instance Attribute Summary
Attributes inherited from Vanilla::Renderers::Base
Instance Method Summary collapse
Methods inherited from Dynasnip
all, attribute, build_snip, #method_missing, persist!, persist_all!, snip_attributes, snip_name, usage
Methods inherited from Vanilla::Renderers::Base
escape_curly_braces, #include_snips, #initialize, #prepare, #process_text, #raw_content, render, #render, #render_without_including_snips, snip_regexp
Constructor Details
This class inherits a constructor from Vanilla::Renderers::Base
Dynamic Method Handling
This class handles dynamic methods through the method_missing method in the class Dynasnip
Instance Method Details
#handle(language, snip_to_render, part_to_render = 'content') ⇒ Object
7 8 9 10 11 12 13 |
# File 'lib/vanilla/dynasnips/code.rb', line 7 def handle(language, snip_to_render, part_to_render='content') snip = Vanilla.snip(snip_to_render) text = snip.__send__(part_to_render.to_sym) convertor = Syntax::Convertors::HTML.for_syntax(language) code = convertor.convert(text, false) %(<span class="code ) + language + %("><code>) + code + %(</code></span>) end |