aboutsummaryrefslogtreecommitdiff
path: root/site/src/main/jekyll/_plugins/raw.rb
diff options
context:
space:
mode:
authorIvan Topolnjak <ivantopo@gmail.com>2014-03-05 08:04:57 -0300
committerIvan Topolnjak <ivantopo@gmail.com>2014-03-16 23:24:23 -0300
commit34f38dc1cc22b20f007f19a28f8c42c26e034a69 (patch)
tree68b2d31a1b64d4ab0ff7801c1bfacd64577447e8 /site/src/main/jekyll/_plugins/raw.rb
parenta8b465358fac2534f98dcbcac6c076ac98015abc (diff)
downloadKamon-34f38dc1cc22b20f007f19a28f8c42c26e034a69.tar.gz
Kamon-34f38dc1cc22b20f007f19a28f8c42c26e034a69.tar.bz2
Kamon-34f38dc1cc22b20f007f19a28f8c42c26e034a69.zip
basic traces documentation
Diffstat (limited to 'site/src/main/jekyll/_plugins/raw.rb')
-rw-r--r--site/src/main/jekyll/_plugins/raw.rb40
1 files changed, 40 insertions, 0 deletions
diff --git a/site/src/main/jekyll/_plugins/raw.rb b/site/src/main/jekyll/_plugins/raw.rb
new file mode 100644
index 00000000..069469ae
--- /dev/null
+++ b/site/src/main/jekyll/_plugins/raw.rb
@@ -0,0 +1,40 @@
+# Author: Brandon Mathis
+# Description: Provides plugins with a method for wrapping and unwrapping input to prevent Markdown and Textile from parsing it.
+# Purpose: This is useful for preventing Markdown and Textile from being too aggressive and incorrectly parsing in-line HTML.
+module TemplateWrapper
+ # Wrap input with a <div>
+ def safe_wrap(input)
+ "<div class='bogus-wrapper'><notextile>#{input}</notextile></div>"
+ end
+ # This must be applied after the
+ def unwrap(input)
+ input.gsub /<div class='bogus-wrapper'><notextile>(.+?)<\/notextile><\/div>/m do
+ $1
+ end
+ end
+end
+
+# Author: phaer, https://github.com/phaer
+# Source: https://gist.github.com/1020852
+# Description: Raw tag for jekyll. Keeps liquid from parsing text betweeen {% raw %} and {% endraw %}
+
+module Jekyll
+ class RawTag < Liquid::Block
+ def parse(tokens)
+ @nodelist ||= []
+ @nodelist.clear
+
+ while token = tokens.shift
+ if token =~ FullToken
+ if block_delimiter == $1
+ end_tag
+ return
+ end
+ end
+ @nodelist << token if not token.empty?
+ end
+ end
+ end
+end
+
+Liquid::Template.register_tag('raw', Jekyll::RawTag) \ No newline at end of file