Skip to content

Commit

Permalink
For the tutorials, I need a way of showing the raw contents of a snip.
Browse files Browse the repository at this point in the history
  • Loading branch information
lazyatom committed Jun 1, 2008
1 parent 806f2b9 commit 97690f8
Showing 1 changed file with 19 additions and 0 deletions.
19 changes: 19 additions & 0 deletions lib/vanilla/dynasnips/raw.rb
@@ -0,0 +1,19 @@
require 'vanilla/dynasnip'

class ShowRawContent < Dynasnip
snip_name "raw"

usage %|
Displays the raw contents of a snip in &lt;pre&gt; tags, e.g.
{raw my_snip}
You can specify a part to show, should you wish:
{raw my_snip,specific_part}
|

def handle(snip_name, part=:content)
%{<pre>#{Dynasnip.escape_curly_braces(Vanilla.snip(snip_name).__send__(part || :content))}</pre>}
end
end

0 comments on commit 97690f8

Please sign in to comment.