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:
@@ -13,8 +13,9 @@ notify.o: ../../winix/templates/locale.h ../../winix/templates/localefilter.h
|
||||
notify.o: ../../ezc/src/ezc.h ../../ezc/src/generator.h ../../ezc/src/vars.h
|
||||
notify.o: ../../ezc/src/blocks.h ../../ezc/src/item.h ../../ezc/src/funinfo.h
|
||||
notify.o: ../../ezc/src/functions.h ../../pikotools/utf8/utf8.h
|
||||
notify.o: ../../ezc/src/pattern.h ../../ezc/src/patternparser.h
|
||||
notify.o: ../../winix/templates/misc.h ../../winix/templates/htmltextstream.h
|
||||
notify.o: ../../ezc/src/cache.h ../../ezc/src/pattern.h
|
||||
notify.o: ../../ezc/src/patternparser.h ../../winix/templates/misc.h
|
||||
notify.o: ../../winix/templates/htmltextstream.h
|
||||
notify.o: ../../winix/core/textstream.h notifythread.h
|
||||
notify.o: ../../winix/core/basethread.h ../../winix/core/synchro.h
|
||||
notify.o: templatesnotify.h ../../winix/core/config.h
|
||||
@@ -94,8 +95,9 @@ notifythread.o: ../../ezc/src/ezc.h ../../ezc/src/generator.h
|
||||
notifythread.o: ../../ezc/src/vars.h ../../ezc/src/blocks.h
|
||||
notifythread.o: ../../ezc/src/item.h ../../ezc/src/funinfo.h
|
||||
notifythread.o: ../../ezc/src/functions.h ../../pikotools/utf8/utf8.h
|
||||
notifythread.o: ../../ezc/src/pattern.h ../../ezc/src/patternparser.h
|
||||
notifythread.o: ../../winix/core/textstream.h ../../winix/templates/misc.h
|
||||
notifythread.o: ../../ezc/src/cache.h ../../ezc/src/pattern.h
|
||||
notifythread.o: ../../ezc/src/patternparser.h ../../winix/core/textstream.h
|
||||
notifythread.o: ../../winix/templates/misc.h
|
||||
notifythread.o: ../../winix/templates/localefilter.h
|
||||
notifythread.o: ../../winix/templates/locale.h
|
||||
notifythread.o: ../../winix/templates/htmltextstream.h
|
||||
@@ -133,8 +135,8 @@ templatesnotify.o: templatesnotify.h ../../ezc/src/ezc.h
|
||||
templatesnotify.o: ../../ezc/src/generator.h ../../ezc/src/vars.h
|
||||
templatesnotify.o: ../../ezc/src/blocks.h ../../ezc/src/item.h
|
||||
templatesnotify.o: ../../ezc/src/funinfo.h ../../ezc/src/functions.h
|
||||
templatesnotify.o: ../../pikotools/utf8/utf8.h ../../ezc/src/pattern.h
|
||||
templatesnotify.o: ../../ezc/src/patternparser.h
|
||||
templatesnotify.o: ../../pikotools/utf8/utf8.h ../../ezc/src/cache.h
|
||||
templatesnotify.o: ../../ezc/src/pattern.h ../../ezc/src/patternparser.h
|
||||
templatesnotify.o: ../../winix/core/textstream.h ../../winix/templates/misc.h
|
||||
templatesnotify.o: ../../winix/templates/localefilter.h
|
||||
templatesnotify.o: ../../winix/templates/locale.h
|
||||
|
||||
@@ -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());
|
||||
|
||||
@@ -46,6 +46,7 @@ Ezc::Functions<NotifyStream> ezc_functions;
|
||||
|
||||
|
||||
|
||||
|
||||
// you can use this pointer in template functions (will be always valid)
|
||||
NotifyUserMsg notify_user_msg;
|
||||
NotifyMsg notify_msg;
|
||||
@@ -120,6 +121,12 @@ void CreateFunctions()
|
||||
|
||||
ezc_functions.Insert("fil_qencode", fil_qencode);
|
||||
|
||||
/*
|
||||
* IMPROVE ME
|
||||
* now we are able to read from a Space struct and these functions can be removed
|
||||
* and we can use directly a Space struct
|
||||
* (copy those functions here from normal templates)
|
||||
*/
|
||||
ezc_functions.Insert("notify_add", notify_add);
|
||||
ezc_functions.Insert("notify_edit", notify_edit);
|
||||
ezc_functions.Insert("notify_delete", notify_delete);
|
||||
|
||||
Reference in New Issue
Block a user