Details
-
Improvement
-
Resolution: Won't Fix
-
Major
-
None
-
1.6
-
None
-
Unknown
-
N/A
-
N/A
-
Description
A best practice when using a custom template is to do search/replace of content so that when the default template is upgraded you can still benefit from it and only modify what you need.
In order to make this simpler, I'm introducing new methods in ModifiableTemplate:
- public void replaceLines(String match, String replacement)
- public void replaceLines(String match, String replacement, boolean useRegex)
- public void replaceLine(String match, String replacement)
- public void replaceLine(String match, String replacement, boolean useRegex)
Example usage in a custom Preamble template:
## This is testing an override showing how to replace some default content with some other content ## Step 1: Get the default template #set ($template = $latex.processor.getTemplate('default/Preamble')) ## Step 2: Replace the content #set ($discard = $template.replaceLine('\usepackage{amsmath}', '\usepackage{amsmath, amsthm, amssymb, amsfonts}')) ## Step 3: Render the modified template $latex.processor.render($template)##