21#include "autoescape.h"
28#include <QtCore/QFile>
30AutoescapeNodeFactory::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"));
66AutoescapeNode::AutoescapeNode(
int state,
QObject *parent)
67 :
Node(parent), m_state(state)
71void 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);
Node * getNode(const QString &tagContent, Parser *p) const override
void render(OutputStream *stream, Context *c) const override
The Context class holds the context to render a Template with.
An exception for use when implementing template tags.
A list of Nodes with some convenience API for rendering them.
void render(OutputStream *stream, Context *c) const
Base class for all nodes.
The OutputStream class is used to render templates to a QTextStream.
The Parser class processes a string template into a tree of nodes.
NodeList parse(Node *parent, const QStringList &stopAt={})
QStringList split(const QString &sep, QString::SplitBehavior behavior, Qt::CaseSensitivity cs) const const
Utility functions used throughout Cutelee.