Am 19.03.2017 um 00:08 schrieb Carl Sturtivant:
On Fri, 17 Mar 2017 20:59:28 +0100, Sönke Ludwig wrote:
The best you can probably do is to use a function or an include:
- void tableContent() tr th ... - if (condition) table(...) - tableContent(); - else table(...) - tableContent();
Or using
include table-content
with atable-content.dt
template.Thank you. Apologies: in the end I didn't use such a table for other reasons.
However, it occurs to me that in a way, what is needed is
endif
in abstract, something that is at the same level of indentation as theif
so it closes it, and yet renders to nothing. So maybe a comment will do!- if( condition) table(...) - else table(....) //- endif tr th .....
Haven't tried this, but if it works it might be a useful technique now and again with embedded control structures.
Unfortunately due to the way the Diet->D translation is done, this can't
be reasonably made to work within the parser (it would be possible to
write an AST transformation pass, but that would really be a rather
dirty solution).
Another possibility could be to introduce a way to conditionally exclude
certain attributes, for example by recognizing Nullable!T
values.
However, if that gets in, the parser should also be extended to handle
attribute lists that span multiple lines, as otherwise this would get
too messy too easily.