changelog.md
September 22, 2022 ยท View on GitHub
ChangeLog
1.6.0
- define local variables that are literally accessible to literal code and vice-versa
- variable parsing became better, can use any valid expression in variable bracket
- update tests
1.5.0
- support including literal php/js/py code (properly indented), see examples and manual
- stop compatibility mode support
- drop localization support (user should include her own solution as plugins)
- major refactor, some utility methods renamed (eg url -> urlencode) or removed (eg data, ucfirst/lcfirst, camelcase/snakecase, addslashes/stripslashes)
- update tests
1.4.0
- support
php-like object accesss notation (arrow notation->) to support not only strictly arrays as template data but arbitrary objects as well. Support arbitrary chained prop/method access (works same for all js/php/python engines) - add
gettemplate directive to access arbitrary (nested) variable properties based on arbitrary expressions (arbitrary expressions not supported by literal object access notation above, see manual) and also access dynamic properties that usegettermethods - add new template functions
keys(php-likearray_keys),values(php-likearray_values),buildquery(php-likehttp_build_query),parsequery(php-likeparse_str) - update tests and live examples along with contemplate grammar
1.3.0
- PHP/JS/PY: support custom template finder per context or even an array of possible template dirs in order to find templates dynamicaly not already added/defined (js engine supports both sync and async operations plus promise-based) (see manual for details)
- PHP/JS/PY: add template function
vsprintfsimilar tosprintfbut accepts an array of arguments instead of them being passed individualy as separate arguments during function call (can be useful when needing to format string based on arguments from data or parameters) PY: try to implementsprintf/vsprintffunctionality as close as possible to originalphp/jssprintf/vsprintf(uses old-style string formating with a couple of hacks, maybe in future use new-style.formatmethod) - JS: fix and complete async template loading, parsing and rendering (fix a small issue with async parsing not updating regex) and also do static analysis (during compilation) on dynamic templates used inside calling template (ie using
tpl/templatefunctions) and pre-load them async (if in async opreation) in order to be rendered without blocking. If sync operations, everything functions as before PHP: handle dynamic function creation (eg for inline templates) forPHP < 7.2.0andPHP >= 7.2.0wherecreate_functionis deprecated
1.2.5
- JS: enable asynchronous template loading, parsing and writing so that performance can be even greater in
Node.jswheresyncmethods may block.Contemplate.tpl,Contemplate.getTemplateContents,Contemplate.parseTplall accept acallback(nodeback) as last argument with signaturefunction(err, result)which if given all processing becomes asynchronous. Also ifPromisesare supported "promisified" versions of the above methods exist i.eContemplate.tplPromise,Contemplate.getTemplateContentsPromise,Contemplate.parseTplPromiseall return aPromisewhich resolves and rejects accordingly. - PHP/PY: update versions
1.2.0
- PHP/JS/PY: enable templates subfolders and paths. Meaning a template id can have relative path in its name and same relative path will be created and mirrored in template cacheDir and served as such. This accomodates templates used for different purposes having same basename but differing in relative path and also reflects structure and organisation of original templates. This resolves the issue and also allows more flexibility in handling many different templates and template folder structures. If path does not exist in cache folder it will be created automaticaly.
- add new template function
queryvarto add/removeurl queryvariables from givenurl(needed sometimes in templates) - add new template function
striptagsto striphtml tagsfrom string - add custom
pluralFormcallable (per context) for current locale. It specifies whether asingularorpluralstring is to be used based on numeric value given (eg a-la wordpress) (see manual how to set or clear) locale/xlocalemethods slightly changed signature and can accept an optionalarray/listof arguments which will be used to format the string to be localised a-lasprintffunctionality (done automaticaly) (NOTE: limitedsprintfsupport for python implementation)- JS/PY:
emptyfunction behaves now exactly like PHP's function, ie it returnstruealso for string with value"0"
1.1.10
- PHP: require exclusive lock when writing a compiled and cached template to disk
- PY: make sure module is reloaded in case it is out of date when loading a template (as module) from disk. Seems to fix the failure to load/import template module if created just before loading
- JS: update version
1.1.9
- PHP: use
class_exists($class, false), JS/PY: update version numbers
1.1.8
create_functionis deprecated in PHP 7.2+, so eliminate use ofcreate_functionand use with@operator to avoid php notices. It is not used but left there for compatibility. Maybe removed completely in another update
1.1.7
- minor changes for better code alignment/indentation
- minor changes in rendering
1.1.6
- minor changes for faster basic templates
- new function
join / jto (flatly) string-concatenate arbitrary array (of arrays) with given separator
1.1.5
- new function
in_arrayto test if array contains a value (similar to php) - new functions
json_encode,json_decode(similar to php)
1.1.4
- lazier init for faster performance
- new function
is_arrayto test both if isarray(strict) or isobject - new directive
local_setto set/update a local variable - some further optimisation changes
1.1.3
- add
continueandbreakloop constructs/directives - minor changes
1.1.2
iifis a templatedirectiveinstead of afunction, so it functions exactly asinlined ternary-ifstatementemptyis a templatedirectiveinstead of afunction, so it functions exactly as php'semptydirective- inline, at compile-time, more template functions (e.g
concat) for faster execution - inlined plugins can receive passed arguments (via
$array parameter) both as (comma-separated) string ($0), plus each separate argument ($1..$n) - lazy init and rendering for inline templates and plugins for even faster execution
- remove
pluralfunctions and add linguisticaly contexual localisationxlocale,nxlocalefunctions ccfunction alias ofconcat- fix php-like
date()function in python implementation (wrong day of week forSunday)
1.1.1
- plugins (non-inlined) with empty arguments invalid output code generation, fixed
- localisation settings accept a callback function as well for custom dynamic localisation (with optional extra arguments)
- new localisation function
nlocalefor singular/plural dynamic localisation based on numeric parameter (1st argument)
1.1.0
- inline
iffunctioniif() - php-like
empty()function - fix
date()function in python implementation (wrong month,day of week) - fix
not,or,andoperator replacements in python implementation - minor changes
1.0.0
- enable multiple dynamic contexts (see examples), different parts of an application can use the engine in a modular way, with their contextual template settings (including templates, caching, directories, locales, plugins, etc..) independantly
- template
directives,functionsandpluginsno longer use the%prefix i.e%for,%if, .. butfor,if, .. if compatibility to older format is needed useContemplate.setCompatibilityMode( true ) elifalias ofelseif,fialias ofendif- optimisations, typo fixes
0.9.2
- update/optimise
date,localized_datemethods - remove
%html(htmlentities) method (not needed, can be added as plugin if needed, less code size) ContemplateInlineTplminor changes
0.9.1
- make
%super(block)a construct (cannot be overriden via a plugin) - add
%getblock(block)construct to return block content directly via function, can be useful when block content is needed as a parameter %blockconstruct can be defined without being echoed (like a container) using%block(blockID, false)- can override 'cacheDir' option in
Contemplate.tplcall via options (experimental)
0.9.0.1
- add
hasTpl(tpl),hasPlugin(name)Contemplate methods
0.9
- make
%htmltable,%htmlselectexternal plugins (reduce main engine code size etc) - add
%supertemplate function to reference a super block directly if needed in OO manner - defined plugins no longer take a
plg_prefix, the plugin name is exactly same as the given name defined (this way even built-in functions can be overriden in some cases)
0.8.4
- inlined plugins replace code accept the plugin arguments as well
- fix subsequent plugin calls in templates, are not parsed/rendered correctly (php)
0.8.3
- refined BlockTag parsing (accurately parse blockTag, regardless of strings)
- test examples provide a Contemplate tutorial, API reference as well
0.8.2.1
- Contemplate.js remove
Function.binddependency - tag new version
0.8.2
InlineTemplate.multisplit_remethod, split inlineTpl using regexps- Contemplate.php fix
undefined __currentblockerror - minor changes
0.8.1
- even faster rendering optimisations (esp. for javascript, reduce rendering function calls by one)
- minor changes
0.8
- new template function
%echo(similar to php function that echoes strings to the output) %tpl(alias of%template,%templateto be deprecated?)%tpl,%template,%include,%extends,%blockconstructs/functions accept literal strings as (1st) argument (see examples)- minor edits
- various optimisations, faster, more refined compilation and rendering
0.7.1
- handle loop variables as local (block-scoped) variables (not added or accessed to/from passed data)
- various optimisations
- (re-uploaded) fix inline templates rendering issue
0.7
- inline templates both in Contemplate templates (e.g as parameters to other functions) or in code
%inlinetemplate function, creates/renders inline templates- templates classes extend
Contemplate.Tpltemplate class (Contemplate.InlineTplalso?) - minor updates
0.6.12
- python-style for-loops contructs (see manual and examples)
0.6.11
- remove
Contemplate.addInlinemethod,Contemplate.addhandles both references and literal/inline templates - minor changes/updates
0.6.10
- optimise custom html esc method (Contemplate.js)
0.6.9
- enable plugin code inlining inside the compiled template
- add a custom simpler/faster html escape function
%e - minimise plugin naming convention (
%plugin_pluginName,%plg_pluginName) - add html entinties escape mode as parameter (default=
"ENT_COMPAT") - optimise
htmlentities,countetc. methods from phpjs (Contemplate.js)
0.6.8
- option to create a template instance from pre-parsed template code returned from
Contemplate.parseTplmethod - minor changes
0.6.7
- make parse method public as
Contemplate.parseTpl( tpl, options )
0.6.6
- remove render data initialisation/copy/isolation code from inside tpl.render methods (makes rendering a lot faster), user can copy data (once) using
Contemplate.datamethod if needed as needed - minor edits/optimizations (e.g in loops)
0.6.5
- enable associative and non-associative
forloops (see examples) i.efor(o as k=>v)for(o as v) - minor edits/optimizations
0.6.4
- make faster and more precise (internal) template parsing/rendering
- make faster and more precise blocks and nested block parsing
- Contemplate for Node.js is not global anymore
- refactor/optimize
0.6.3
- add more options (e.g
'autoUpdate') per single template - fix some typos
0.6.2
- parse nested blocks
escapeparse option (true by default), options syntax change (see manual)
0.6.1
- enable template separators to be defined inside a template or passed as paramaters
0.6
- define template separators in the 1st line of a template (each tpl can define its own separators)
- micro edits/changes
0.5.3, 0.5.4
- add
%issetdirective - change
%has_keytemplate function to%haskey - template directives parsing edits (accomodate nested directives in arguments)
0.5.2
- enable literal data to be used as a loop object (see examples)
- php data func (deep object) fixed
0.5.1
- add
%addslashes,%stripslashestpl functions - updates / edits
0.5
- add support for custom (user-defined) plugins as template functions with addPlugin(name, handler) method
- add support for setting/unsetting custom variables inside template (on-the-fly) with
%set(var, val),%unset(var)directives - refine/optimize template parsing for strings and variables
- support literal data notation with template functions and plugins also
- updates / edits
0.4.10
- add custom codePrefix in cached templates
0.4.9
- add
%uuidfunction (generate universal unique id)
0.4.8
- change
%pluralisesignature, unifyContemplate.add,Contemplate.addInlinemethods, edits, optimizations
0.4.7
- add
%pluralisefunction,clearLocaleStrings,setPlurals,clearPluralsmethods
0.4.6
- add
%lowercase,%uppercase,%camelcase,%snakecasetemplate functions (see manual)
0.4.5
- add
%has_keytemplate function (see manual)
0.4.4
- escape single quotes and parse template variables accurately
0.4.3
- Contemplate Engine for Python 2.x and 3.x
- minor edits, generate formatted and anotated cached template code (better for debug)
- tidy up repo
- project stopped
0.4.2
- add clear (memory) method
clearCache() - allow inline templates with
addInline()method (see examples) - allow
for()directive to handle an expression in place of an object ( so%for($data["subdata"] as $key=>$val)or other expressions WILL work) - allow to refresh the (memory) cache for a specific template (ie.
Contemplate.tpl(tpl_id, data, refresh))refresh = truewill refresh the (memory) cache (defaultfalse)
0.4.1
- parse template tags a little more accurately
- minor edits/optimizations
0.4
- add template inheritance and block definitions
- allow client-js template engine to load templates via ajax
- add basic html/url escaping (
htmlentities,urlencode) - minor edits/optimizations
0.3.3
- make Contemplate.js work with Nodejs , add nodejs server example (test.js)
- add
%countfunction (number of items in an array/object)
0.3.2
- make
%htmltable%htmlselectconstructs instead of functions (so literal data can be used also) - add
%ltrim,%rtrimfunctions - minor fixes, edits
0.3.1
- add
%q%dqfunctions (quote, double quote) - add
%htmltable%htmlselectfunctions (render a html table with options, render a html select with options) - minor fixes, edits
0.3
- add
%templatedirective - add template functions to manipulate dates and localized dates
- add some javascript methods from phpjs project, (
trim,sprintf,time,date), these are available as template functions (eg%sprintf,%trim, etc..) - make the Contemplate.js class compatible with both browser, node.js and requirejs configurations
0.2
- add
%includedirective - make template separators configurable (defaults are
<%and%>) - add filesystem caching, refactor, optimize
0.1
- add localization options and template functions
- initial release