21 #include "autoescape.h" 23 #include "exception.h" 28 #include <QtCore/QFile> 30 AutoescapeNodeFactory::AutoescapeNodeFactory() {}
34 #if QT_VERSION < QT_VERSION_CHECK(5, 14, 0) 40 if (expr.size() != 2) {
42 TagSyntaxError, QStringLiteral(
"autoescape takes two arguments."));
45 auto strState = expr.at(1);
47 if (strState == QStringLiteral(
"on"))
48 state = AutoescapeNode::On;
49 else if (strState == QStringLiteral(
"off"))
50 state = AutoescapeNode::Off;
53 QStringLiteral(
"argument must be 'on' or 'off'"));
58 auto list = p->
parse(n, QStringLiteral(
"endautoescape"));
66 AutoescapeNode::AutoescapeNode(
int state,
QObject *parent)
67 :
Node(parent), m_state(state)
71 void AutoescapeNode::setList(
const NodeList &list) { m_list = list; }
75 const auto old_setting = c->autoEscape();
76 c->setAutoEscape(m_state == On);
78 c->setAutoEscape(old_setting);
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.
The Parser class processes a string template into a tree of nodes.
Node * getNode(const QString &tagContent, Parser *p) const override
A list of Nodes with some convenience API for rendering them.
void render(OutputStream *stream, Context *c) const override
void render(OutputStream *stream, Context *c) const
An exception for use when implementing template tags.