David Abrahams wrote:
Jo�o Abecasis <[EMAIL PROTECTED]> writes:
John Maddock wrote:
Quick question: how do I "turn off" syntax highlighting, and "turn
on" my own syntax for a short code snippet, contained within a
larger code chunk, for example I have:
template <class T>
struct is_void : public true-or-false-type {};
And I would like the "true-or-false-type" bit to be in italic, and
otherwise not highlighted. However the usual mark-up with /text/ or
['text] fails to work. This is quite a common requirement for
things that are "unspecified", "implementation defined", or
named-concepts etc, can it be done?
Thomas Guest was working on dynamically loadable syntax highlighters.
His work provides the ability to write customized syntax highlighters
and would help you here.
I don't believe that is the appropriate approach for John's problem.
He needs a convenient way to insert the <replaceable> </replaceable>
tag in the generated XML. This is formatted as italic by BoostBook
and represents the right semantics to boot.
Replaceable text in code is an important idiom that we used often in
"C++ Template Metaprogramming," and has crucial interactions with the
literate programming/testing system we used to test the examples: you
need to replace the <replaceable> text with something concrete in
order to make the tests work. Of course, ReST doesn't have
<replaceable>, so we just used italics and interpreted all italics in
literal blocks as <replaceable>. ReST has a parsed-literal directive
within which markup is significant, so it was pretty easy:
.. parsed-literal::
template <class T>
struct is_void : public *true-or-false-type* {};
QuickBook needs something similar.
Quickbook's syntax is modal and switches to and from plain
quickbook syntax to c++/python/etc. Unlike Quickbook, ReST
does not have highlighting and the code above will be
ambiguous in Quickbook in c++ source code mode.
Perhaps what we need is a way to escape to qbk from within
code snippets. In qbk mode, we use the tick `some code` to
switch temprarily from qbk to source code mode. I think it
should be easy to do the same the other way around. To avoid
clashing with the syntax of the language, the escape mark
should be part of the highlighting configuration. For c++,
we can reuse the tick. Example:
struct is_void : public `*true-or-false-type*` {};
Thoughts?
Cheers,
--
Joel de Guzman
http://www.boost-consulting.com
http://spirit.sf.net
-------------------------------------------------------
SF email is sponsored by - The IT Product Guide
Read honest & candid reviews on hundreds of IT Products from real users.
Discover which products truly live up to the hype. Start reading now.
http://ads.osdn.com/?ad_id=6595&alloc_id=14396&op=click
_______________________________________________
Boost-docs mailing list
[email protected]
Unsubscribe and other administrative requests:
https://lists.sourceforge.net/lists/listinfo/boost-docs