-
Notifications
You must be signed in to change notification settings - Fork 25.6k
Description
Templates exist to resolve placeholders in pieces of text and can only be used in indexed scripts and ingest. While scripts are used in many other places and exist to flexible execute custom logic related to the context it is running in.
Templates are integrated into the script infrastructure (mustache implements ScriptEngineService interface, Template extends from Script and all places that use templates are hardcoded to use mustache language). I think it makes sense to strip templates from the script infrastructure and let it be its own thing. For example Template should be not extend from Script, template implementations would implement TemplateEngineService and all of the template features would be accessible from a TemplateService.
The following is a list of tasks to work towards a separated TemplateService:
- Add
ScriptService#compileTemplateand cut some script compilations to that method (Templates: Add compileTemplate method to ScriptService for template consumers #24280) - Cut all script compilation to
ScriptService#compileTemplate(Templates: Add compileTemplate method to ScriptService for template consumers #24280) - Create a
Templateclass similar to theScriptclass that we can use to parse templates and use that withScriptService#compileTemplate - Make a replacement for
ScriptEngineServicefor templates, us it inScriptService#compileTemplate, and make mustache implement that instead. - Remove template specific stuff from
ScriptandScriptEngineService(I'm starting to get fuzzy on exactly what this is so we'll have to clarify later)