diff options
Diffstat (limited to 'src/template.cpp')
-rw-r--r-- | src/template.cpp | 29 |
1 files changed, 25 insertions, 4 deletions
diff --git a/src/template.cpp b/src/template.cpp index 100de16..9fa03aa 100644 --- a/src/template.cpp +++ b/src/template.cpp @@ -1976,10 +1976,21 @@ class ExpressionParser ExprAst *parseLiteral() { TRACE(("{parseLiteral(%s)\n",m_curToken.id.data())); - ExprAst *lit = new ExprAstLiteral(m_curToken.id); + ExprAst *expr = new ExprAstLiteral(m_curToken.id); getNextToken(); + if (expr) + { + while (m_curToken.type==ExprToken::Operator && + m_curToken.op==Operator::Filter) + { + getNextToken(); + ExprAstFilter *filter = parseFilter(); + if (!filter) break; + expr = new ExprAstFilterAppl(expr,filter); + } + } TRACE(("}parseLiteral()\n")); - return lit; + return expr; } ExprAst *parseIdentifierOptionalArgs() @@ -3550,6 +3561,7 @@ class TemplateNodeCreate : public TemplateNodeCreator<TemplateNodeCreate> { outputFile.prepend(ci->outputDirectory()+"/"); } + //printf("NoteCreate(%s)\n",outputFile.data()); QFile f(outputFile); if (f.open(IO_WriteOnly)) { @@ -3622,9 +3634,11 @@ class TemplateNodeTree : public TemplateNodeCreator<TemplateNodeTree> { //printf("TemplateNodeTree::renderChildren(%d)\n",ctx->list->count()); // render all children of node to a string and return it + TemplateContext *c = ctx->templateCtx; + TemplateContextImpl* ci = dynamic_cast<TemplateContextImpl*>(c); + if (ci==0) return QCString(); // should not happen QGString result; FTextStream ss(&result); - TemplateContext *c = ctx->templateCtx; c->push(); TemplateVariant node; TemplateListIntf::ConstIterator *it = ctx->list->createIterator(); @@ -3642,14 +3656,21 @@ class TemplateNodeTree : public TemplateNodeCreator<TemplateNodeTree> if (list && list->count()>0) // non-empty list { TreeContext childCtx(this,list,ctx->templateCtx); -// TemplateVariant children(&childCtx,renderChildrenStub); TemplateVariant children(TemplateVariant::Delegate::fromFunction(&childCtx,renderChildrenStub)); children.setRaw(TRUE); c->set("children",children); m_treeNodes.render(ss,c); hasChildren=TRUE; } + else if (list==0) + { + ci->warn(m_templateName,m_line,"recursetree: children attribute has type '%s' instead of list\n",v.typeAsString().data()); + } } + //else + //{ + // ci->warn(m_templateName,m_line,"recursetree: children attribute is not valid"); + //} } if (!hasChildren) { |