sempare / sempare-delphi-template-engine

Sempare Template (scripting) Engine for Delphi allows for flexible dynamic text generation. It can be used for generating email, html, reports, source code, xml, configuration, etc.
Apache License 2.0
144 stars 18 forks source link

Extends support #116

Closed darnocian closed 1 year ago

darnocian commented 1 year ago

Initial development of 'extends' support. #72

This needs more testing, but looks promising. Need to resolve AV. Currently calls to Free on the Resolver and Replacer are commented out, resulting in a leak.

darnocian commented 1 year ago

TODO: extends must behave like include. extends(template, expr).... expr is parsed, but must still be processed. TODO: extends/body is currently handled at parse time. this restricts the functionality to require body name or template names to be fixed strings rather than dynamic expressions. there is more flexibility in it being dynamic. NOTE: have chosen not to implement 'super'/'inherited' as it may complicate things, and not sure at present how useful it would be. TODO: add more tests with nested templates / body NOTE: the other issue is that inline templates are only resolved at eval time. as a result, these cannot be referenced at parse time. this is another reason for making the extends/block resolution dynamic.