diff options
Diffstat (limited to '_includes/helpers/liquid_raw.html')
-rw-r--r-- | _includes/helpers/liquid_raw.html | 29 |
1 files changed, 29 insertions, 0 deletions
diff --git a/_includes/helpers/liquid_raw.html b/_includes/helpers/liquid_raw.html new file mode 100644 index 0000000..54a15e4 --- /dev/null +++ b/_includes/helpers/liquid_raw.html @@ -0,0 +1,29 @@ +{% comment%}<!-- +The liquid_raw helper is a way to display raw liquid code, as opposed to parsing it. +Normally you'd use Liquid's built in 'raw' tag. +The problem is GitHub Jekyll does not support the current Liquid release. +GitHub Jekyll supports the deprecated 'literal' tag. +Using one will break the other if you plan to deploy to GitHub pages. + see: https://github.com/mojombo/jekyll/issues/425 + +Since I don't want to mess with Liquid versions, I'll just rewrite the way I +intend to give liquid examples. It's not an elegant by any means: + +Usage: + 1) Define a 'text' variable with the block of liquid code you intend to display. + 2) Pass the text variable to include helpers/liquid_raw.html. + + example: + {% capture text %}|.% for tag in tags_list %.| + <li><a href="|.{ site.var.tags_path }.||.{ tag[0] }.|-ref">|.{ tag[0] }.| <span>|.{tag[1].size}.|</span></a></li> + |.% endfor %.| + + |.% assign tags_list = null %.|{% endcapture %} + {% include helpers/liquid_raw.html %} + + As seen here, you must use "|." and ".|" as opening and closing brackets. +-->{% endcomment%} + +<pre><code>{{text | replace:"|.", "{" | replace:".|", "}" | replace:">", ">" | replace:"<", "<" }}</code></pre> + +{% assign text = null %}
\ No newline at end of file |