#4383 - Tempcode ELSE functionality

Identifier #4383
Issue type Feature request or suggestion
Title Tempcode ELSE functionality
Status Open
Tags

Type: Performance (custom)

Handling member Deleted
Addon core
Description Currently 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.
Steps to reproduce

Funded? No
The system will post a comment when this issue is modified (e.g., status changes). To be notified of this, click "Enable comment notifications".

Rating

Unrated