Andy Little wrote:
> "John Maddock" wrote
>
>> I hope you don't mind but I have some (completely unrelated) feature
>> requests:
>>
>> * Superscript and subscript.
>> * Unicode character insertion (insert a character by code value).
>> * Greek letters (really important to me this one).
>> * A few select Math symbols for not-equal less-than-equal etc.
>
> Some of these items are available by using escapes:
> Making the escapes into macros also seems to work (in QuickBook 1.1)
>
> [/ using the double underscores as recommended gets a bit ugly though!]
You know what? I am getting tired of those double underscores too.
See below.
> [def __squared__ '''<superscript>2</superscript>''']
> [def __alpha__ '''α''']
> [def __ge__ '''≥''']
> [def __angstrom__ '''Ô''']
>
> __alpha__ __ge__ x__squared__\n
>
> __angstrom__\n
>
> I guess that these can be combined with templates in the new version?
Yes! It was Joao who noted that with templates (actually parameterized
macros), we can extend quickbook without really having to code. In fact,
a lot of the markups now can be written as templates.
> [template pow(x,y ) x'''<superscript>y</superscript>''']
>
> invoked as:
>
> pow(__alpha__,2)
The problem with the old macros and the new template syntax is that
they tend to clash with plain text and code. That is the reason for
recommending the double underscores: to make the chance of clashing
lesser. As for the template syntax, it looks too much like a plain
function call. Maybe if we make the syntaxes more explicit for
macros and templates, we can get rid of those annoying double
underscores. Example:
[!alpha][!super(2)]
x[!super(2)]
(using the bang (!), this time as an explicit template/macro call.)
I wonder though if that's less annoying than the double underscores.
With the explicit use of [! ... ] for templates and macros, we can also
remove the parens for the template argument list:
[!alpha][!super 2]
x[!super 2]
Which brings us a lot closer to John's proposed syntax, without writing
any code :)
Macros are powerful beasts! We all know that they can even be
made turing complete with the addition of some branch controls
(e.g. if/else).
Thoughts?
Regards,
--
Joel de Guzman
http://www.boost-consulting.com
http://spirit.sf.net
_______________________________________________
Boost-docs mailing list
[email protected]
Unsubscribe and other administrative requests:
https://lists.sourceforge.net/lists/listinfo/boost-docs