21 #include "filtertag.h" 23 #include "../lib/exception.h" 24 #include "filterexpression.h" 28 FilterNodeFactory::FilterNodeFactory() {}
33 #if QT_VERSION < QT_VERSION_CHECK(5, 14, 0) 44 auto filters = fe.filters();
45 if (filters.contains(QStringLiteral(
"safe"))
46 || filters.contains(QStringLiteral(
"escape"))) {
48 TagSyntaxError, QStringLiteral(
"Use the \"autoescape\" tag instead."));
53 auto filterNodes = p->
parse(n, QStringLiteral(
"endfilter"));
56 n->setNodeList(filterNodes);
61 :
Node(parent), m_fe(fe)
65 void FilterNode::setNodeList(
const NodeList &filterList)
67 m_filterList = filterList;
74 auto temp = stream->
clone(&textStream);
75 m_filterList.
render(temp.get(), c);
77 c->
insert(QStringLiteral(
"var"), output);
NodeList parse(Node *parent, const QStringList &stopAt={})
The Context class holds the context to render a Template with.
QStringList split(const QString &sep, QString::SplitBehavior behavior, Qt::CaseSensitivity cs) const const
Base class for all nodes.
Utility functions used throughout Cutelee.
The OutputStream class is used to render templates to a QTextStream.
QVariant resolve(OutputStream *stream, Context *c) const
The Parser class processes a string template into a tree of nodes.
A list of Nodes with some convenience API for rendering them.
virtual std::shared_ptr< OutputStream > clone(QTextStream *stream) const
A FilterExpression object represents a filter expression in a template.
void render(OutputStream *stream, Context *c) const override
Node * getNode(const QString &tagContent, Parser *p) const override
void insert(const QString &name, QObject *object)
void render(OutputStream *stream, Context *c) const
An exception for use when implementing template tags.