Update of /cvsroot/boost/boost/tools/quickbook/doc
In directory sc8-pr-cvs3.sourceforge.net:/tmp/cvs-serv10039
Modified Files:
quickbook.qbk
Log Message:
template tweaks
Index: quickbook.qbk
===================================================================
RCS file: /cvsroot/boost/boost/tools/quickbook/doc/quickbook.qbk,v
retrieving revision 1.54
retrieving revision 1.55
diff -u -d -r1.54 -r1.55
--- quickbook.qbk 16 Nov 2006 05:19:51 -0000 1.54
+++ quickbook.qbk 16 Nov 2006 06:57:17 -0000 1.55
@@ -1202,43 +1202,43 @@
Nullary templates look and act like simple macros. Example:
[pre'''
-[template spirit[] [EMAIL PROTECTED]://spirit.sf.net Spirit]]
+[template alpha[]'''α''']
+[template beta[]'''β''']
''']
-[template spirit[] [EMAIL PROTECTED]://spirit.sf.net Spirit]]
+[template alpha[]'''α''']
+[template beta[]'''β''']
Expanding:
-[pre'''
-Please see [spirit]'s site.
-''']
+[pre'''Some squigles...[*[alpha][beta]]''']
We have:
-Please see [spirit]'s site.
+Some squiggles...[*[alpha][beta]]
The difference with macros are
* The explicit [link quickbook.syntax.block.templates.template_expansion
template expansion syntax]. This is an advantage because, now, we don't
have to use obscure naming conventions like double underscores (e.g.
- \_\_spirit\_\_) to avoid unwanted
+ \_\_alpha\_\_) to avoid unwanted
macro replacement.
* The template is expanded at the point where it is invoked. A macro is
expanded immediately at its point of declaration. This is subtle and
can cause a slight difference in behavior especially if you refer to
other macros and templates in the body.
-The empty brackets after the template identifier ([^spirit\[\]]) indicates
-no arguments. If the template body does not look like a template argument
-list (the example above does), we can elide the empty brackets. Example:
+The empty brackets after the template identifier ([^alpha\[\]]) indicates no
+arguments. If the template body does not look like a template argument list,
we
+can elide the empty brackets. Example:
[pre'''
[template aristotle_quote Aristotle: [*['Education is the best provision
for the journey to old age.]]]
''']
-[template aristotle_quote Aristotle: [*['Education is the best provision
+[template aristotle_quote\ Aristotle: [*['Education is the best provision
for the journey to old age.]]]
Expanding:
@@ -1250,6 +1250,30 @@
We have:
Here's a quote from [aristotle_quote].
+
+The disadvantage is that you can't avoid the space between the template
+identifier, `aristotle_quote`, and the template body "Aristotle...". This
space
+will be part of the template body. If that space is unwanted, use empty
+brackets or use the space escape: "`\ `". Example:
+
+[pre'''
+[template tag\ _tag]
+''']
+
+[template tag\ _tag]
+
+Then expanding:
+
+[pre'''
+`struct` x[tag];
+''']
+
+We have:
+
+`struct` x[tag];
+
+You have a couple of ways to do it. I personally prefer the explicit empty
+brackets, though.
[heading Simple Arguments]
-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys - and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
_______________________________________________
Boost-cvs mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/boost-cvs