[MGNLDEMO-22] Freemarker Scripts: Should be simplified and best practices should be used Created: 06/May/15 Updated: 01/Jul/15 Resolved: 09/Jun/15 |
|
| Status: | Closed |
| Project: | Magnolia Demo Projects |
| Component/s: | magnolia-travels |
| Affects Version/s: | 0.5 |
| Fix Version/s: | None |
| Type: | Improvement | Priority: | Major |
| Reporter: | Christian Ringele | Assignee: | Espen Jervidalo |
| Resolution: | Obsolete | Votes: | 0 |
| Labels: | None | ||
| Remaining Estimate: | Not Specified | ||
| Time Spent: | Not Specified | ||
| Original Estimate: | Not Specified | ||
| Issue Links: |
|
||||||||
| Template: |
|
||||||||
| Acceptance criteria: |
Empty
|
||||||||
| Task DoD: |
[ ]*
Doc/release notes changes? Comment present?
[ ]*
Downstream builds green?
[ ]*
Solution information and context easily available?
[ ]*
Tests
[ ]*
FixVersion filled and not yet released
[ ] 
Architecture Decision Record (ADR)
|
||||||||
| Date of First Response: | |||||||||
| Description |
|
I see in many scripts parts which are either too complicated or do not use scripting best practices. One example (textImage.ftl): [#assign headingLevel = "h2"] [#if content.headingLevel?has_content] [#assign headingLevel = content.headingLevel] [/#if] [#if content.headline?has_content] <${headingLevel}>${content.headline!}</${headingLevel}> [/#if] Replacing with (using properly "!"): [#assign headingLevel = content.headingLevel!"h2"] [#if content.headline?has_content] <${headingLevel}>${content.headline}</${headingLevel}> [/#if] Better would be even delegating to the parameters def the default heading level. [#assign headingLevel = content.headingLevel!def.parameters.defaultHeadingLevel!"h2"] [#if content.headline?has_content] <${headingLevel}>${content.headline}</${headingLevel}> [/#if] |
| Comments |
| Comment by Espen Jervidalo [ 09/Jun/15 ] |
|
This has been fixed in linked ticket. |