]> code.citadel.org Git - citadel.git/commitdiff
* warn if we don't know an iterator
authorWilfried Göesgens <willi@citadel.org>
Thu, 11 Sep 2008 13:00:20 +0000 (13:00 +0000)
committerWilfried Göesgens <willi@citadel.org>
Thu, 11 Sep 2008 13:00:20 +0000 (13:00 +0000)
webcit/subst.c

index 38f1bae356a1631921c6cb999a617c58b1a23707..0aa6bb0709a997daf989e633d70e1e67af57f4e5 100644 (file)
@@ -1010,6 +1010,8 @@ void *load_template(StrBuf *filename, StrBuf *Key, HashList *PutThere)
                const char *pts, *pte;
                int InQuotes = 0;
                int InDoubleQuotes = 0;
+
+               /** Find one <? > */
                pos = (-1);
                for (; pch < pE; pch ++) {
                        if ((*pch=='<')&&(*(pch + 1)=='?'))
@@ -1019,6 +1021,8 @@ void *load_template(StrBuf *filename, StrBuf *Key, HashList *PutThere)
                if (pch >= pE)
                        continue;
                pts = pch;
+
+               /** Found one? parse it. */
                for (; pch < pE - 1; pch ++) {
                        if (*pch == '"')
                                InDoubleQuotes = ! InDoubleQuotes;
@@ -1237,8 +1241,21 @@ void tmpl_iterate_subtmpl(StrBuf *Target, int nArgs, WCTemplateToken *Tokens, vo
        if (!GetHash(Iterators, 
                     Tokens->Params[0]->Start,
                     Tokens->Params[0]->len,
-                    &vIt))
+                    &vIt)) {
+               lprintf(1, "unknown Iterator [%s] (in line %ld); "
+                       " [%s]\n", 
+                       Tokens->Params[0]->Start,
+                       Tokens->Line,
+                       ChrPtr(Tokens->FlatToken));
+               StrBufAppendPrintf(
+                       Target,
+                       "<pre>\nunknown Iterator [%s] (in line %ld); \n"
+                       " [%s]\n</pre>", 
+                       Tokens->Params[0]->Start,
+                       Tokens->Line,
+                       ChrPtr(Tokens->FlatToken));
                return;
+       }
 
        It = (HashIterator*) vIt;