Search the Community
Showing results for tags 'template'.
Found 2 results
-
I've been experimenting with an integrated playground IDE plugin for the Sempare Template Engine ( https://github.com/sempare/sempare-delphi-template-engine or via GetIt). The template engine is available under Apache 2.0 and has been around for years, and has backward capability back to XE4. The playground plugin is similar to the standalone playground demo app that exists in the project. Anyways, I decided it was time to have a richer IDE experience. My initial development currently it supports: - highlighting (script tags, comments, numbers, strings) - toggling whitespace visibility - IDE Options Dialog allows you to customise options (overriding defaults which are IDE theme aware) - Supports prototyping templates against mock data (in json files) - Supports script tags <% %> or {{ }} - Real-time validation of templates and evaluation/preview - Preview as raw text or in a browser As I changed the license of the template engine to be Apache from GPL, this will be available initially to supporters of the project. More to follow... Any other ideas/improvement suggestions welcome. Here are some screenshots:
-
I'd like to advertise the Sempare Template Engine for Delphi. The Sempare Template Engine for Delphi allows for flexible text manipulation. It can be used for generating email, html, source code, xml, configuration, etc. It is available on github via https://github.com/sempare/sempare-delphi-template-engine It is also available via Delphinus (https://github.com/Memnarch/Delphinus) Simply add the 'src' directory to the search path to get started. Sample usage: program Example; uses Sempare.Template; type TInformation = record name: string; favourite_sport : string; end; begin var tpl := Template.parse('My name is <% name %>. My favourite sport is <% favourite_sport %>.'); var information : TInformation; information.name := 'conrad'; information.favourite_sport := 'ultimate'; writeln(Template.eval(tpl, information)); end. Features include: statements if, elif, else statements for and while statements include statement with statement function/method calls expressions simple expression evaluation (logical, numerical and string) variable definition functions and methods calls dereference records, classes, arrays, JSON objects, TDataSet descendants and dynamic arrays ternary operator safety max run-time protection customisation custom script token replacement add custom functions strip recurring spaces and new lines lazy template resolution parse time evaluation of expressions/statements allow use of custom encoding (UTF-8 with BOM, UTF-8 without BOM, ASCII, etc) extensible RTTI interface to easily dereference classes and interfaces (current customisations for ITemplateVariables, TDictionary, TJsonObject) There are numerous unit tests that can be reviewed as to how to use the various features. Happy for all to play with it. Released under GPL and Commercial License. Any feedback welcome.