diff options
author | Dimitri van Heesch <dimitri@stack.nl> | 2014-12-30 12:57:27 (GMT) |
---|---|---|
committer | Dimitri van Heesch <dimitri@stack.nl> | 2015-08-27 13:43:31 (GMT) |
commit | 6bb0d2908b4ca7908a8e655a5abcf7615a5f4c77 (patch) | |
tree | 1153cbbc2ea585505b9b08f2756fa3d0cade6b2c /src/template.cpp | |
parent | cfac0824b1d201fac37772ac42662901efc88ba7 (diff) | |
download | Doxygen-6bb0d2908b4ca7908a8e655a5abcf7615a5f4c77.zip Doxygen-6bb0d2908b4ca7908a8e655a5abcf7615a5f4c77.tar.gz Doxygen-6bb0d2908b4ca7908a8e655a5abcf7615a5f4c77.tar.bz2 |
Added javascript search engine data to the template context
Diffstat (limited to 'src/template.cpp')
-rw-r--r-- | src/template.cpp | 42 |
1 files changed, 32 insertions, 10 deletions
diff --git a/src/template.cpp b/src/template.cpp index 5102978..ce9493b 100644 --- a/src/template.cpp +++ b/src/template.cpp @@ -98,6 +98,34 @@ static QValueList<QCString> split(const QCString &str,const QCString &sep, //---------------------------------------------------------------------------- +/** Strips spaces surrounding `=` from string \a in, so + * `foo = 10 bar=5 baz= 'hello'` will become `foo=10 bar=5 baz='hello'` + */ +static void removeSpacesAroundEquals(QCString &in) +{ + const char *p=in.data(); + char *q = in.data(); + char c; + while ((c=*p++)) + { + if (c==' ') // found a space, see if there is a = as well + { + const char *t = p; + bool found=FALSE; + while (*t==' ' || *t=='=') { if (*t++=='=') found=TRUE; } + if (found) + { + c='='; + p=t; // move p to end of '\s*=\s*' sequence + } + } + *q++=c; + } + if (q<p) in.resize(q-in.data()+1); +} + +//---------------------------------------------------------------------------- + #if ENABLE_TRACING static QCString replace(const char *s,char csrc,char cdst) { @@ -793,7 +821,7 @@ class FilterAppend static TemplateVariant apply(const TemplateVariant &v,const TemplateVariant &arg) { if ((v.type()==TemplateVariant::String || v.type()==TemplateVariant::Integer) && - arg.type()==TemplateVariant::String) + (arg.type()==TemplateVariant::String || arg.type()==TemplateVariant::Integer)) { return TemplateVariant(v.toString() + arg.toString()); } @@ -1978,14 +2006,6 @@ class ExpressionParser TRACE(("{parseLiteral(%s)\n",m_curToken.id.data())); ExprAst *expr = new ExprAstLiteral(m_curToken.id); getNextToken(); - 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 expr; } @@ -3865,7 +3885,9 @@ class TemplateNodeWith : public TemplateNodeCreator<TemplateNodeWith> TRACE(("{TemplateNodeWith(%s)\n",data.data())); m_args.setAutoDelete(TRUE); ExpressionParser expParser(parser,line); - QValueList<QCString> args = split(data," "); + QCString filteredData = data; + removeSpacesAroundEquals(filteredData); + QValueList<QCString> args = split(filteredData," "); QValueListIterator<QCString> it = args.begin(); while (it!=args.end()) { |