[quickbook] Conditional generation on a macro not being defined
Daniel James via Boost-docs <[email protected]> Wed, 19 Apr 2017 22:45:53 +0100
| Newsgroups | gmane.comp.lib.boost.documentation |
|---|---|
| Message-ID | <CAHOE3ydwxog+ursPv4UODQBqcVDLks4kVM8OkV3_NGqV-7Y9wQ@mail.gmail.com> |
Hi,
I'm writing some quickbook for the first time in a while, and feeling
the need for a new feature. In quickbook, you can conditionally
generate content if a macro is defined, for example:
[? __to_be__ To be or not to be]
Taken from:
http://www.boost.org/doc/libs/1_64_0/doc/html/quickbook/syntax/phrase.html#quickbook.syntax.phrase.cond
But there's no way to generate content if a macro isn't defined, which
seems like an omission, so I propose adding a way to do that, maybe:
[?!__to_be__ Not to be]
The content will only be generated if __to_be__ is not defined.
This does cause ambiguity if you have a macro that starts with '!'.
Which isn't something that I think anyone does, so maybe just disallow
in new versions of quickbook.
Or perhaps could disambiguate using whitespace between '?!', so this
is conditional on a macro called '!yuck!':
[? !yuck! Yuck!]
I initially felt that would be confusing, but on second thoughts it
actually looks okay?
Or maybe an alternative syntax to disambiguate it:
[?=!yuck! Yuck!]
But I don't like having an alternative syntax without a good reason.
An important use case is having a default value for a macro:
[?__something__ __something__][?!__something__ default]
Maybe there should be a shorthand for that?
An alternative would be to use a different symbol to '?', but that
feels like a waste of a symbol to me. And I'm not completely sure
which symbols are available.
Any opinions? Or objections?
Daniel