View Issue Details

IDProjectCategoryView StatusLast Update
0004383Composrcorepublic2020-09-26 16:07
ReporterChris GrahamAssigned To 
SeverityFeature-request 
Status non-assignedResolutionopen 
Product Version 
Fixed in Version 
Summary0004383: Tempcode ELSE functionality
DescriptionCurrently every Tempcode directive is self-contained.
This is nice and simple, and reflects that Tempcode is implemented as a clean markup language, not a regular programming language.

However, it does mean that:
1) There's a small performance loss calculating negated conditions
2) It's a bit more code
3) The Tempcode parse tree is bigger than needed (Tempcode parse tree size is a perf headache for us sometimes)
4) There'll be extra white-space in the outputted HTML

For an IF directive, allow ELSEIF and ELSE directives to follow directly (with tolerance for white-space, which would be ignored)...

{+START,IF,...}...{+END}
{+START,ELSEIF,...}...{+END}
{+START,ELSE}...{+END}

For an IF_EMPTY or IF_NON_EMPTY directive, allow ELSE directives to follow directly (with tolerance for white-space, which would be ignored)...

{+START,IF_EMPTY,...}...{+END}
{+START,ELSE}...{+END}

For an IF_PASSED or IF_NON_PASSED directive, allow ELSE directives to follow directly (with tolerance for white-space, which would be ignored)...

{+START,IF_PASSED,...}...{+END}
{+START,ELSE}...{+END}

The Tempcode parser would need to be made smart enough to recognise these situations with look-ahead parsing.

Alter all the default templates to make use of the new syntax.
TagsType: Performance
Time estimation (hours)18
Sponsorship open

Activities

Chris Graham

2020-09-26 16:06

administrator   ~0006710

Or we could consider something like...

{+START,IF,...}
    ...
    {+START,ELSEIF,...}
        ....
        {+START,ELSE}
            ...
        {+END}
    {+END}
{+END}

Or we could consider something like...

{+START,IF,...}
    ...
{+ELSEIF,...}
    ...
{+ELSE}
    ...
{+END}

I might actually like the last syntax here. It's simpler, and also easier to parse.

Issue History

Date Modified Username Field Change
2020-09-26 16:00 Chris Graham New Issue
2020-09-26 16:00 Chris Graham Tag Attached: Type: Performance
2020-09-26 16:06 Chris Graham Note Added: 0006710
2020-09-26 16:07 Chris Graham Description Updated View Revisions