[Boost-docs] [quickbook] Conditional generation on a macro not being defined

Subject: [Boost-docs] [quickbook] Conditional generation on a macro not being defined
From: Daniel James (dnljms_at_[hidden])
Date: 2017-04-19 21:45:53


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:


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?


This archive was generated by hypermail 2.1.7 : 2017-11-11 08:50:41 UTC