Explorar o código

add literal tag for displaying {% ... %}

Jake Vanderplas %!s(int64=11) %!d(string=hai) anos
pai
achega
ce11ec8b20
Modificáronse 1 ficheiros con 27 adicións e 0 borrados
  1. 27 0
      liquid_tags/literal.py

+ 27 - 0
liquid_tags/literal.py

@@ -0,0 +1,27 @@
+"""
+Literal Tag
+-----------
+This implements a tag that allows explicitly showing commands which would
+otherwise be interpreted as a liquid tag.
+
+For example, the line
+
+    {% literal video arg1 arg2 %}
+
+would result in the following line:
+
+    {% video arg1 arg2 %}
+
+This is useful when the resulting line would be interpreted as another
+liquid-style tag.
+"""
+from .mdx_liquid_tags import LiquidTags
+
+@LiquidTags.register('literal')
+def literal(preprocessor, tag, markup):
+    return '{%% %s %%}' % markup
+
+#----------------------------------------------------------------------
+# This import allows image tag to be a Pelican plugin
+from liquid_tags import register
+