24 #include "blockcontext.h"
26 #include "exception.h"
28 #include "rendercontext.h"
32 IncludeNodeFactory::IncludeNodeFactory() {}
41 QStringLiteral(
"Error: Include tag takes only one argument"));
43 auto includeName = expr.at(1);
44 auto size = includeName.size();
46 if ((includeName.startsWith(QLatin1Char(
'"'))
47 && includeName.endsWith(QLatin1Char(
'"')))
48 || (includeName.startsWith(QLatin1Char(
'\''))
49 && includeName.endsWith(QLatin1Char(
'\'')))) {
56 :
Node(parent), m_filterExpression(fe)
66 auto t = ti->engine()->loadByName(filename);
70 TagSyntaxError, QStringLiteral(
"Template not found %1").arg(filename));
81 ConstantIncludeNode::ConstantIncludeNode(
const QString &name, QObject *parent)
91 auto t = ti->engine()->loadByName(m_name);
94 TagSyntaxError, QStringLiteral(
"Template not found %1").arg(m_name));
106 auto nodes = t->findChildren<
BlockNode *>();
107 blockContext.remove(nodes);
108 variant.setValue(blockContext);
void render(OutputStream *stream, Context *c) const override
Q_INVOKABLE QStringList smartSplit(const QString &str) const
The Context class holds the context to render a Template with.
RenderContext * renderContext() const
An exception for use when implementing template tags.
A FilterExpression object represents a filter expression in a template.
QVariant resolve(OutputStream *stream, Context *c) const
Base class for all nodes.
TemplateImpl * containerTemplate() const
The OutputStream class is used to render templates to a QTextStream.
The Parser class processes a string template into a tree of nodes.
QVariant & data(const Node *const scopeNode)
Node * getNode(const QString &tagContent, Parser *p) const override
void render(OutputStream *stream, Context *c) const override
Cutelee::SafeString getSafeString(const QVariant &input)
Utility functions used throughout Cutelee.