added: two options to the config:

ezc_error_prefix (string)
        ezc_error_postfix (string)
        // prefix and postfix used when there is an error in Ezc patterns
        // default:
        // prefix:  "<!-- "
        // postfix: " -->"
added:  Ezc::Blocks to templates
added:  although patterns have pointers to functions and blocks cached
        the Ezc::Generator should use SetFunctions() and SetBlocks() method
        in order to correctly recognize variables (aliases)




git-svn-id: svn://ttmath.org/publicrep/winix/trunk@978 e52654a7-88a9-db11-a3e9-0013d4bc506e
This commit is contained in:
2014-10-19 21:20:09 +00:00
parent 5266a7e4e5
commit fb18b2238e
27 changed files with 1105 additions and 949 deletions

View File

@@ -207,6 +207,7 @@ void NotifyThread::SendMail()
Lock();
// 'patterns' object can use logger or other stuff so we use Lock() before
Ezc::Pattern * pat = patterns.Get(template_index, lang_id);
if( !pat )
@@ -221,13 +222,22 @@ void NotifyThread::SendMail()
generator.RecognizeSpecialChars(true);
generator.TrimWhite(true);
generator.SkipNewLine(true);
/*
* !! IMPROVE ME
* add blocks and variables
* hmm may they are not needed here?
*/
generator.SetFunctions(TemplatesNotifyFunctions::ezc_functions);
generator.SetPattern(*pat);
/*
* don't use cache
* 'pat' pattern is stored in 'patterns' object for all templates and by default
* all functions/blocks are cached, but we are in a second thread
* and cannot use such functions without locking
*
* IMPROVE ME
* blocks are parsed to the container from the main thread
* and we cannot just use it here (another thread)
* so may should we have our own 'patterns' object here?
*
*/
generator.CanUseCache(false);
generator.Generate(notify_stream);
SendMail(TemplatesNotifyFunctions::notify_user_msg.email, notify_stream.Str());