Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
For the tutorials, I need a way of showing the raw contents of a snip.
- Loading branch information
Showing
1 changed file
with
19 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
require 'vanilla/dynasnip' | ||
|
||
class ShowRawContent < Dynasnip | ||
snip_name "raw" | ||
|
||
usage %| | ||
Displays the raw contents of a snip in <pre> 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 |