Add a {% verbatim %} template tag. #51

Closed
wants to merge 1 commit into
from

5 participants

@SmileyChris
Django member

Fixes #14502.

@ramiro ramiro and 1 other commented on an outdated diff May 9, 2012
django/template/defaulttags.py
@@ -1273,6 +1280,21 @@ def url(parser, token):
return URLNode(viewname, args, kwargs, asvar)
@register.tag
+def verbatim(parser, token):
+ """
+ Output the content of this tag (usually template source) content of this
@ramiro
Django member
ramiro added a line comment May 9, 2012

Docstring is a bit confusing.

@SmileyChris
Django member
SmileyChris added a line comment May 9, 2012

Thanks, I always end up half-writing my docstrings :P (fixed now)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
@alex
Django member

Is there a reason that this was done by modifying the core parser, rather than as a tag which reinterprets the tokens?

@ogier

@alex Template tag tokens strip whitespace, so you need support all the way up to the tokenizer to do verbatim properly.

@SmileyChris
Django member

Yup, that's why.

@apollo13
Django member

Fixed in 4464bbb

@claudep
Django member

Committed in 4464bbb

@claudep claudep closed this Jun 9, 2012
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment