Thomas Dalton wrote:
A [Foo] Bar = A Foo Bar, A Bar A [Foo|Moo] Bar = A Foo Bar, A Moo Bar A [Foo|Moo|] Bar = A Foo Bar, A Moo Bar, A Bar A [[Foo|Moo]] Bar = same as previous, but discouraged.
That's the wrong way round. [Foo|Moo|] is, without any need to define new syntax: "Foo" or "Moo" or "" (the empty string, ie. nothing). Personally, I would put the extra pipe at the beginning, but either would work without any extra programming.
So:
A [Foo] Bar = A Foo Bar A [|Foo] Bar = A Bar, A Foo Bar (the initial | could be consider implicit if only one option is given - there is no reason to put the word in brackets unless you intend it to be optional. Depends if the addition convenience is worth the additional confusion.) A [Foo|Moo] Bar = A Foo Bar, A Moo Bar A [|Foo|Moo] Bar = A Bar, A Foo Bar, A Moo Bar
What this proposal seems to ignore is the normal use of square brackets in texts. In a quotation like, "He [Bob] was found on the beach" the square brackets are used to add in the name to clarify the pronoun, even though it is not part of the actual quotation. The actual name would have occurred earlier in a part of the source text that is not useful to the quote. The proposal, when parsed, seems as though it would remove the brackets.
Ec