1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
1050
1051
1052
1053
1054
1055
1056
1057
1058
1059
1060
1061
1062
1063
1064
1065
1066
1067
1068
1069
1070
1071
1072
1073
1074
1075
1076
1077
1078
1079
1080
1081
1082
1083
1084
1085
1086
1087
1088
1089
1090
1091
1092
1093
1094
1095
1096
1097
1098
1099
1100
1101
1102
1103
1104
1105
1106
1107
1108
1109
1110
1111
1112
1113
1114
1115
1116
1117
1118
1119
1120
1121
1122
1123
1124
1125
1126
1127
1128
1129
1130
1131
1132
1133
1134
1135
1136
1137
1138
1139
1140
1141
1142
1143
1144
1145
1146
1147
1148
1149
1150
1151
1152
1153
1154
1155
1156
1157
1158
1159
1160
1161
1162
1163
1164
1165
1166
1167
1168
1169
1170
1171
1172
1173
1174
1175
1176
1177
1178
1179
1180
1181
1182
1183
1184
1185
1186
1187
1188
1189
1190
1191
1192
1193
1194
1195
1196
1197
1198
1199
1200
1201
1202
1203
1204
1205
1206
1207
1208
1209
1210
1211
1212
1213
1214
1215
1216
1217
1218
1219
1220
1221
1222
1223
1224
1225
1226
1227
1228
1229
1230
1231
1232
1233
1234
1235
1236
1237
1238
1239
1240
1241
1242
1243
1244
1245
1246
1247
1248
1249
1250
1251
1252
1253
1254
1255
1256
1257
1258
1259
1260
1261
1262
1263
1264
1265
1266
1267
1268
1269
1270
1271
1272
1273
1274
1275
1276
1277
1278
1279
1280
1281
1282
1283
1284
1285
1286
1287
1288
1289
1290
1291
1292
1293
1294
1295
1296
1297
1298
1299
1300
1301
1302
1303
1304
1305
1306
1307
1308
1309
1310
1311
1312
1313
1314
1315
1316
1317
1318
1319
1320
1321
1322
1323
1324
1325
1326
1327
1328
1329
1330
1331
1332
1333
1334
1335
1336
1337
1338
1339
1340
1341
1342
1343
1344
1345
1346
1347
1348
1349
1350
1351
1352
1353
1354
1355
1356
1357
1358
1359
1360
1361
1362
1363
1364
1365
1366
1367
1368
1369
1370
1371
1372
1373
1374
1375
1376
1377
1378
1379
1380
1381
1382
1383
1384
1385
1386
1387
1388
1389
1390
1391
1392
1393
1394
1395
1396
1397
1398
1399
1400
1401
1402
1403
1404
1405
1406
1407
1408
1409
1410
1411
1412
1413
1414
1415
1416
1417
1418
1419
1420
1421
1422
1423
1424
1425
1426
1427
1428
1429
1430
1431
1432
1433
1434
1435
1436
1437
1438
1439
1440
1441
1442
1443
1444
1445
1446
1447
1448
1449
1450
1451
1452
1453
1454
1455
1456
1457
1458
1459
1460
1461
1462
1463
1464
1465
1466
1467
1468
1469
1470
1471
1472
1473
1474
1475
1476
1477
1478
1479
1480
1481
1482
1483
1484
1485
1486
1487
1488
1489
1490
1491
1492
1493
1494
1495
1496
1497
1498
1499
1500
1501
1502
1503
1504
1505
1506
1507
1508
1509
1510
1511
1512
1513
1514
1515
1516
1517
1518
1519
1520
1521
1522
1523
1524
1525
1526
1527
1528
1529
1530
1531
1532
1533
1534
1535
1536
1537
1538
1539
1540
1541
1542
1543
1544
1545
1546
1547
1548
1549
1550
1551
1552
1553
1554
1555
1556
1557
1558
1559
1560
1561
1562
1563
1564
1565
1566
1567
1568
1569
1570
1571
1572
1573
1574
1575
1576
1577
1578
1579
1580
1581
1582
1583
1584
1585
1586
1587
1588
1589
1590
1591
1592
1593
1594
1595
1596
1597
1598
1599
1600
1601
1602
1603
1604
1605
1606
1607
1608
1609
1610
1611
1612
1613
1614
1615
1616
1617
1618
1619
1620
1621
1622
1623
1624
1625
1626
1627
1628
1629
1630
1631
1632
1633
1634
1635
1636
1637
1638
1639
1640
1641
1642
1643
1644
1645
1646
1647
1648
1649
1650
1651
1652
1653
1654
1655
1656
1657
1658
1659
1660
1661
1662
1663
1664
1665
1666
1667
1668
1669
1670
1671
1672
1673
1674
1675
1676
1677
1678
1679
1680
1681
1682
1683
1684
1685
1686
1687
1688
1689
1690
1691
1692
1693
1694
1695
1696
1697
1698
1699
1700
1701
1702
1703
1704
1705
1706
1707
1708
1709
1710
1711
1712
1713
1714
1715
1716
1717
1718
1719
1720
1721
1722
1723
1724
1725
1726
1727
1728
1729
1730
1731
1732
1733
1734
1735
1736
1737
1738
1739
1740
1741
1742
1743
1744
1745
1746
1747
1748
1749
1750
1751
1752
1753
1754
1755
1756
1757
1758
1759
1760
1761
1762
1763
1764
1765
1766
1767
1768
1769
1770
1771
1772
1773
1774
1775
1776
1777
1778
1779
1780
1781
1782
1783
1784
1785
1786
1787
1788
1789
1790
1791
1792
1793
1794
1795
1796
1797
1798
1799
1800
1801
1802
1803
1804
1805
1806
1807
1808
1809
1810
1811
1812
1813
1814
1815
1816
1817
1818
1819
1820
1821
1822
1823
1824
1825
1826
1827
1828
1829
1830
1831
1832
1833
1834
1835
1836
1837
1838
1839
1840
1841
1842
1843
1844
1845
1846
1847
1848
1849
1850
1851
1852
1853
1854
1855
1856
1857
1858
1859
1860
1861
1862
1863
1864
1865
1866
1867
1868
1869
1870
1871
1872
1873
1874
1875
1876
1877
1878
1879
1880
1881
1882
1883
1884
1885
1886
1887
1888
1889
1890
1891
1892
1893
1894
1895
1896
1897
1898
1899
1900
1901
1902
1903
1904
1905
1906
1907
1908
1909
1910
1911
1912
1913
1914
1915
1916
1917
1918
1919
1920
1921
1922
1923
1924
1925
1926
1927
1928
1929
1930
1931
1932
1933
1934
1935
1936
1937
1938
1939
1940
1941
1942
1943
1944
1945
1946
1947
1948
1949
1950
1951
1952
1953
1954
1955
1956
1957
1958
1959
1960
1961
1962
1963
1964
1965
1966
1967
1968
1969
1970
1971
1972
1973
1974
1975
1976
1977
1978
1979
|
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=US-ASCII">
<title>Block Level Elements</title>
<link rel="stylesheet" href="../../../../doc/src/boostbook.css" type="text/css">
<meta name="generator" content="DocBook XSL Stylesheets V1.79.1">
<link rel="home" href="../../index.html" title="The Boost C++ Libraries BoostBook Documentation Subset">
<link rel="up" href="../../quickbook.html" title="Chapter 51. Quickbook 1.6">
<link rel="prev" href="phrase.html" title="Phrase Level Elements">
<link rel="next" href="../versions.html" title="Language Versions">
</head>
<body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF">
<table cellpadding="2" width="100%"><tr>
<td valign="top"><img alt="Boost C++ Libraries" width="277" height="86" src="../../../../boost.png"></td>
<td align="center"><a href="../../../../index.html">Home</a></td>
<td align="center"><a href="../../../../libs/libraries.htm">Libraries</a></td>
<td align="center"><a href="http://www.boost.org/users/people.html">People</a></td>
<td align="center"><a href="http://www.boost.org/users/faq.html">FAQ</a></td>
<td align="center"><a href="../../../../more/index.htm">More</a></td>
</tr></table>
<hr>
<div class="spirit-nav">
<a accesskey="p" href="phrase.html"><img src="../../../../doc/src/images/prev.png" alt="Prev"></a><a accesskey="u" href="../../quickbook.html"><img src="../../../../doc/src/images/up.png" alt="Up"></a><a accesskey="h" href="../../index.html"><img src="../../../../doc/src/images/home.png" alt="Home"></a><a accesskey="n" href="../versions.html"><img src="../../../../doc/src/images/next.png" alt="Next"></a>
</div>
<div class="section">
<div class="titlepage"><div><div><h2 class="title" style="clear: both">
<a name="quickbook.syntax.block"></a>Block Level Elements</h2></div></div></div>
<div class="toc"><dl class="toc">
<dt><span class="section"><a href="block.html#quickbook.syntax.block.xinclude">xinclude</a></span></dt>
<dt><span class="section"><a href="block.html#quickbook.syntax.block.paragraphs">Paragraphs</a></span></dt>
<dt><span class="section"><a href="block.html#quickbook.syntax.block.lists">Lists</a></span></dt>
<dt><span class="section"><a href="block.html#quickbook.syntax.block.code">Code</a></span></dt>
<dt><span class="section"><a href="block.html#quickbook.syntax.block.escape_back">Escaping
Back To QuickBook</a></span></dt>
<dt><span class="section"><a href="block.html#quickbook.syntax.block.preformatted">Preformatted</a></span></dt>
<dt><span class="section"><a href="block.html#quickbook.syntax.block.blockquote">Blockquote</a></span></dt>
<dt><span class="section"><a href="block.html#quickbook.syntax.block.admonitions">Admonitions</a></span></dt>
<dt><span class="section"><a href="block.html#quickbook.syntax.block.headings">Headings</a></span></dt>
<dt><span class="section"><a href="block.html#quickbook.syntax.block.generic_heading">Generic
Heading</a></span></dt>
<dt><span class="section"><a href="block.html#quickbook.syntax.block.macros">Macros</a></span></dt>
<dt><span class="section"><a href="block.html#quickbook.syntax.block.predefined_macros">Predefined
Macros</a></span></dt>
<dt><span class="section"><a href="block.html#quickbook.syntax.block.templates">Templates</a></span></dt>
<dt><span class="section"><a href="block.html#quickbook.syntax.block.blurbs">Blurbs</a></span></dt>
<dt><span class="section"><a href="block.html#quickbook.syntax.block.tables">Tables</a></span></dt>
<dt><span class="section"><a href="block.html#quickbook.syntax.block.variable_lists">Variable
Lists</a></span></dt>
<dt><span class="section"><a href="block.html#quickbook.syntax.block.include">Include</a></span></dt>
<dt><span class="section"><a href="block.html#quickbook.syntax.block.import">Import</a></span></dt>
<dt><span class="section"><a href="block.html#quickbook.syntax.block.block">Plain
blocks</a></span></dt>
</dl></div>
<div class="section">
<div class="titlepage"><div><div><h3 class="title">
<a name="quickbook.syntax.block.xinclude"></a><a name="quickbook.ref.xinclude"></a><a class="link" href="block.html#quickbook.syntax.block.xinclude" title="xinclude">xinclude</a>
</h3></div></div></div>
<p>
You can include another XML file with:
</p>
<pre class="programlisting">[xinclude file.xml]
</pre>
<p>
This is useful when file.xml has been generated by Doxygen and contains your
reference section.
</p>
<p>
<code class="literal">xinclude</code> paths are normally used unchanged in the generated
documentation, which will not work if you wish them to be relative to the
current quickbook file. Quickbook can add a <code class="literal">xml:base</code> attribute
to the boostbook documentation to specify where <code class="literal">xinclude</code>
files should be found. For example, if you wish them to be relative to the
current quickbook file:
</p>
<pre class="programlisting">[article Article with xincludes
[quickbook 1.6]
[xmlbase .]
]
[xinclude file.xml]
</pre>
<p>
Now the xinclude should work if <code class="literal">file.xml</code> is in the same
directory as the quickbook file. Although it might not work if you distribute
the generated files (as their relative directories can change).
</p>
<p>
Say the article is generated in a sub-directory, by running something like:
</p>
<pre class="programlisting">quickbook article.qbk --output-file=output/article.xml
</pre>
<p>
This will generate a boostbook root tag:
</p>
<pre class="programlisting"><article id="article_with_xincludes"
last-revision="$Date: 2013/08/20 08:26:48 $"
xml:base=".."
xmlns:xi="http://www.w3.org/2001/XInclude">
</pre>
<p>
Because <code class="literal">xml:base</code> is set to <code class="literal">..</code>, the
xml processor will know to look in the parent directory to find <code class="literal">file.xml</code>,
which it comes across the <code class="literal">xi:include</code> tag.
</p>
</div>
<div class="section">
<div class="titlepage"><div><div><h3 class="title">
<a name="quickbook.syntax.block.paragraphs"></a><a name="quickbook.ref.paragraphs"></a><a class="link" href="block.html#quickbook.syntax.block.paragraphs" title="Paragraphs">Paragraphs</a>
</h3></div></div></div>
<p>
Paragraphs start left-flushed and are terminated by two or more newlines.
No markup is needed for paragraphs. QuickBook automatically detects paragraphs
from the context. Block markups [section, endsect, h1, h2, h3, h4, h5, h6,
blurb, (block-quote) ':', pre, def, table and include ] may also terminate
a paragraph. This is a new paragraph...
</p>
</div>
<div class="section">
<div class="titlepage"><div><div><h3 class="title">
<a name="quickbook.syntax.block.lists"></a><a name="quickbook.ref.lists"></a><a class="link" href="block.html#quickbook.syntax.block.lists" title="Lists">Lists</a>
</h3></div></div></div>
<div class="toc"><dl class="toc">
<dt><span class="section"><a href="block.html#quickbook.syntax.block.lists.ordered_lists">Ordered
lists</a></span></dt>
<dt><span class="section"><a href="block.html#quickbook.syntax.block.lists.list_hierarchies">List
Hierarchies</a></span></dt>
<dt><span class="section"><a href="block.html#quickbook.syntax.block.lists.long_list_lines">Long
List Lines</a></span></dt>
<dt><span class="section"><a href="block.html#quickbook.syntax.block.lists.unordered_lists">Unordered
lists</a></span></dt>
<dt><span class="section"><a href="block.html#quickbook.syntax.block.lists.mixed_lists">Mixed
lists</a></span></dt>
<dt><span class="section"><a href="block.html#quickbook.syntax.block.lists.list_tags">Explicit
list tags</a></span></dt>
</dl></div>
<div class="section">
<div class="titlepage"><div><div><h4 class="title">
<a name="quickbook.syntax.block.lists.ordered_lists"></a><a name="quickbook.ref.ordered_lists"></a><a class="link" href="block.html#quickbook.syntax.block.lists.ordered_lists" title="Ordered lists">Ordered
lists</a>
</h4></div></div></div>
<pre class="programlisting"># One
# Two
# Three
</pre>
<p>
will generate:
</p>
<div class="orderedlist"><ol class="orderedlist" type="1">
<li class="listitem">
One
</li>
<li class="listitem">
Two
</li>
<li class="listitem">
Three
</li>
</ol></div>
</div>
<div class="section">
<div class="titlepage"><div><div><h4 class="title">
<a name="quickbook.syntax.block.lists.list_hierarchies"></a><a name="quickbook.ref.list_hierarchies"></a><a class="link" href="block.html#quickbook.syntax.block.lists.list_hierarchies" title="List Hierarchies">List
Hierarchies</a>
</h4></div></div></div>
<p>
List hierarchies are supported. Example:
</p>
<pre class="programlisting"># One
# Two
# Three
# Three.a
# Three.b
# Three.c
# Four
# Four.a
# Four.a.i
# Four.a.ii
# Five
</pre>
<p>
will generate:
</p>
<div class="orderedlist"><ol class="orderedlist" type="1">
<li class="listitem">
One
</li>
<li class="listitem">
Two
</li>
<li class="listitem">
Three
<div class="orderedlist"><ol class="orderedlist" type="a">
<li class="listitem">
Three.a
</li>
<li class="listitem">
Three.b
</li>
<li class="listitem">
Three.c
</li>
</ol></div>
</li>
<li class="listitem">
Fourth
<div class="orderedlist"><ol class="orderedlist" type="a"><li class="listitem">
Four.a
<div class="orderedlist"><ol class="orderedlist" type="i">
<li class="listitem">
Four.a.i
</li>
<li class="listitem">
Four.a.ii
</li>
</ol></div>
</li></ol></div>
</li>
<li class="listitem">
Five
</li>
</ol></div>
</div>
<div class="section">
<div class="titlepage"><div><div><h4 class="title">
<a name="quickbook.syntax.block.lists.long_list_lines"></a><a name="quickbook.ref.long_list_lines"></a><a class="link" href="block.html#quickbook.syntax.block.lists.long_list_lines" title="Long List Lines">Long
List Lines</a>
</h4></div></div></div>
<p>
Long lines will be wrapped appropriately. Example:
</p>
<pre class="programlisting"># A short item.
# A very long item. A very long item. A very long item.
A very long item. A very long item. A very long item.
A very long item. A very long item. A very long item.
A very long item. A very long item. A very long item.
A very long item. A very long item. A very long item.
# A short item.
</pre>
<div class="orderedlist"><ol class="orderedlist" type="1">
<li class="listitem">
A short item.
</li>
<li class="listitem">
A very long item. A very long item. A very long item. A very long item.
A very long item. A very long item. A very long item. A very long item.
A very long item. A very long item. A very long item. A very long item.
A very long item. A very long item. A very long item.
</li>
<li class="listitem">
A short item.
</li>
</ol></div>
</div>
<div class="section">
<div class="titlepage"><div><div><h4 class="title">
<a name="quickbook.syntax.block.lists.unordered_lists"></a><a name="quickbook.ref.unordered_lists"></a><a class="link" href="block.html#quickbook.syntax.block.lists.unordered_lists" title="Unordered lists">Unordered
lists</a>
</h4></div></div></div>
<pre class="programlisting">* First
* Second
* Third
</pre>
<p>
will generate:
</p>
<div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; ">
<li class="listitem">
First
</li>
<li class="listitem">
Second
</li>
<li class="listitem">
Third
</li>
</ul></div>
</div>
<div class="section">
<div class="titlepage"><div><div><h4 class="title">
<a name="quickbook.syntax.block.lists.mixed_lists"></a><a name="quickbook.ref.mixed_lists"></a><a class="link" href="block.html#quickbook.syntax.block.lists.mixed_lists" title="Mixed lists">Mixed
lists</a>
</h4></div></div></div>
<p>
Mixed lists (ordered and unordered) are supported. Example:
</p>
<pre class="programlisting"># One
# Two
# Three
* Three.a
* Three.b
* Three.c
# Four
</pre>
<p>
will generate:
</p>
<div class="orderedlist"><ol class="orderedlist" type="1">
<li class="listitem">
One
</li>
<li class="listitem">
Two
</li>
<li class="listitem">
Three
<div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; ">
<li class="listitem">
Three.a
</li>
<li class="listitem">
Three.b
</li>
<li class="listitem">
Three.c
</li>
</ul></div>
</li>
<li class="listitem">
Four
</li>
</ol></div>
<p>
And...
</p>
<pre class="programlisting"># 1
* 1.a
# 1.a.1
# 1.a.2
* 1.b
# 2
* 2.a
* 2.b
# 2.b.1
# 2.b.2
* 2.b.2.a
* 2.b.2.b
</pre>
<p>
will generate:
</p>
<div class="orderedlist"><ol class="orderedlist" type="1">
<li class="listitem">
1
<div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; ">
<li class="listitem">
1.a
<div class="orderedlist"><ol class="orderedlist" type="a">
<li class="listitem">
1.a.1
</li>
<li class="listitem">
1.a.2
</li>
</ol></div>
</li>
<li class="listitem">
1.b
</li>
</ul></div>
</li>
<li class="listitem">
2
<div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; ">
<li class="listitem">
2.a
</li>
<li class="listitem">
2.b
<div class="orderedlist"><ol class="orderedlist" type="a">
<li class="listitem">
2.b.1
</li>
<li class="listitem">
2.b.2
<div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: circle; ">
<li class="listitem">
2.b.2.a
</li>
<li class="listitem">
2.b.2.b
</li>
</ul></div>
</li>
</ol></div>
</li>
</ul></div>
</li>
</ol></div>
</div>
<div class="section">
<div class="titlepage"><div><div><h4 class="title">
<a name="quickbook.syntax.block.lists.list_tags"></a><a name="quickbook.ref.list_tags"></a><a class="link" href="block.html#quickbook.syntax.block.lists.list_tags" title="Explicit list tags">Explicit
list tags</a>
</h4></div></div></div>
<p>
Sometimes the wiki-style list markup can be tricky to use, especially if
you wish to include more complicated markup with the list. So in quickbook
1.6, an alternative way to mark up lists introduced:
</p>
<pre class="programlisting">[ordered_list [item1][item2]]
</pre>
<p>
is equivalent to:
</p>
<pre class="programlisting"># item1
# item2
</pre>
<p>
And:
</p>
<pre class="programlisting">[itemized_list [item1][item2]]
</pre>
<p>
is equivalent to:
</p>
<pre class="programlisting">* item1
* item2
</pre>
</div>
</div>
<div class="section">
<div class="titlepage"><div><div><h3 class="title">
<a name="quickbook.syntax.block.code"></a><a name="quickbook.ref.code"></a><a class="link" href="block.html#quickbook.syntax.block.code" title="Code">Code</a>
</h3></div></div></div>
<p>
Preformatted code starts with a space or a tab. The code will be syntax highlighted
according to the current <a class="link" href="phrase.html#quickbook.ref.source_mode">Source
Mode</a>:
</p>
<pre class="programlisting"><span class="preprocessor">#include</span> <span class="special"><</span><span class="identifier">iostream</span><span class="special">></span>
<span class="keyword">int</span> <span class="identifier">main</span><span class="special">()</span>
<span class="special">{</span>
<span class="comment">// Sample code</span>
<span class="identifier">std</span><span class="special">::</span><span class="identifier">cout</span> <span class="special"><<</span> <span class="string">"Hello, World\n"</span><span class="special">;</span>
<span class="keyword">return</span> <span class="number">0</span><span class="special">;</span>
<span class="special">}</span>
</pre>
<pre class="programlisting"><span class="keyword">import</span> <span class="identifier">cgi</span>
<span class="keyword">def</span> <span class="identifier">cookForHtml</span><span class="special">(</span><span class="identifier">text</span><span class="special">):</span>
<span class="string">'''"Cooks" the input text for HTML.'''</span>
<span class="keyword">return</span> <span class="identifier">cgi</span><span class="special">.</span><span class="identifier">escape</span><span class="special">(</span><span class="identifier">text</span><span class="special">)</span>
</pre>
<p>
Macros that are already defined are expanded in source code. Example:
</p>
<pre class="programlisting">[def __array__ [@http://www.boost.org/doc/html/array/reference.html array]]
[def __boost__ [@http://www.boost.org/libs/libraries.htm boost]]
using __boost__::__array__;
</pre>
<p>
Generates:
</p>
<pre class="programlisting">using <a href="http://www.boost.org/libs/libraries.htm" target="_top">boost</a>::<a href="http://www.boost.org/doc/html/array/reference.html" target="_top">array</a>;
</pre>
</div>
<div class="section">
<div class="titlepage"><div><div><h3 class="title">
<a name="quickbook.syntax.block.escape_back"></a><a name="quickbook.ref.escape_back"></a><a class="link" href="block.html#quickbook.syntax.block.escape_back" title="Escaping Back To QuickBook">Escaping
Back To QuickBook</a>
</h3></div></div></div>
<p>
Inside code, code blocks and inline code, QuickBook does not allow any markup
to avoid conflicts with the target syntax (e.g. c++). In case you need to
switch back to QuickBook markup inside code, you can do so using a language
specific <span class="emphasis"><em>escape-back</em></span> delimiter. In C++ and Python, the
delimiter is the double tick (back-quote): "``" and "``".
Example:
</p>
<pre class="programlisting">void <a href="http://en.wikipedia.org/wiki/Foo#Foo.2C_Bar_and_Baz" target="_top">foo</a>()
{
}
</pre>
<p>
Will generate:
</p>
<pre class="programlisting">void <a href="http://en.wikipedia.org/wiki/Foo#Foo.2C_Bar_and_Baz" target="_top">foo</a>()
{
}
</pre>
<p>
When escaping from code to QuickBook, only phrase level markups are allowed.
Block level markups like lists, tables etc. are not allowed.
</p>
</div>
<div class="section">
<div class="titlepage"><div><div><h3 class="title">
<a name="quickbook.syntax.block.preformatted"></a><a name="quickbook.ref.preformatted"></a><a class="link" href="block.html#quickbook.syntax.block.preformatted" title="Preformatted">Preformatted</a>
</h3></div></div></div>
<p>
Sometimes, you don't want some preformatted text to be parsed as source code.
In such cases, use the <code class="literal">[pre ... ]</code> markup block.
</p>
<pre class="programlisting">[pre
Some *preformatted* text Some *preformatted* text
Some *preformatted* text Some *preformatted* text
Some *preformatted* text Some *preformatted* text
]
</pre>
<p>
Spaces, tabs and newlines are rendered as-is. Unlike all quickbook block
level markup, pre (and Code) are the only ones that allow multiple newlines.
The markup above will generate:
</p>
<pre class="programlisting">
Some <span class="bold"><strong>preformatted</strong></span> text Some <span class="bold"><strong>preformatted</strong></span> text
Some <span class="bold"><strong>preformatted</strong></span> text Some <span class="bold"><strong>preformatted</strong></span> text
Some <span class="bold"><strong>preformatted</strong></span> text Some <span class="bold"><strong>preformatted</strong></span> text
</pre>
<p>
Notice that unlike Code, phrase markup such as font style is still permitted
inside <code class="literal">pre</code> blocks.
</p>
</div>
<div class="section">
<div class="titlepage"><div><div><h3 class="title">
<a name="quickbook.syntax.block.blockquote"></a><a name="quickbook.ref.blockquote"></a><a class="link" href="block.html#quickbook.syntax.block.blockquote" title="Blockquote">Blockquote</a>
</h3></div></div></div>
<pre class="programlisting">[:sometext...]
</pre>
<div class="blockquote"><blockquote class="blockquote"><p>
Indents the paragraph. This applies to one paragraph only.
</p></blockquote></div>
</div>
<div class="section">
<div class="titlepage"><div><div><h3 class="title">
<a name="quickbook.syntax.block.admonitions"></a><a name="quickbook.ref.admonitions"></a><a class="link" href="block.html#quickbook.syntax.block.admonitions" title="Admonitions">Admonitions</a>
</h3></div></div></div>
<pre class="programlisting">[note This is a note]
[tip This is a tip]
[important This is important]
[caution This is a caution]
[warning This is a warning]
</pre>
<p>
generates <a href="http://www.docbook.org/" target="_top">DocBook</a> admonitions:
</p>
<div class="note"><table border="0" summary="Note">
<tr>
<td rowspan="2" align="center" valign="top" width="25"><img alt="[Note]" src="../../../../doc/src/images/note.png"></td>
<th align="left">Note</th>
</tr>
<tr><td align="left" valign="top"><p>
This is a note
</p></td></tr>
</table></div>
<div class="tip"><table border="0" summary="Tip">
<tr>
<td rowspan="2" align="center" valign="top" width="25"><img alt="[Tip]" src="../../../../doc/src/images/tip.png"></td>
<th align="left">Tip</th>
</tr>
<tr><td align="left" valign="top"><p>
This is a tip
</p></td></tr>
</table></div>
<div class="important"><table border="0" summary="Important">
<tr>
<td rowspan="2" align="center" valign="top" width="25"><img alt="[Important]" src="../../../../doc/src/images/important.png"></td>
<th align="left">Important</th>
</tr>
<tr><td align="left" valign="top"><p>
This is important
</p></td></tr>
</table></div>
<div class="caution"><table border="0" summary="Caution">
<tr>
<td rowspan="2" align="center" valign="top" width="25"><img alt="[Caution]" src="../../../../doc/src/images/caution.png"></td>
<th align="left">Caution</th>
</tr>
<tr><td align="left" valign="top"><p>
This is a caution
</p></td></tr>
</table></div>
<div class="warning"><table border="0" summary="Warning">
<tr>
<td rowspan="2" align="center" valign="top" width="25"><img alt="[Warning]" src="../../../../doc/src/images/warning.png"></td>
<th align="left">Warning</th>
</tr>
<tr><td align="left" valign="top"><p>
This is a warning
</p></td></tr>
</table></div>
<p>
These are the only admonitions supported by <a href="http://www.docbook.org/" target="_top">DocBook</a>.
So, for example <code class="literal">[information This is some information]</code>
is unlikely to produce the desired effect.
</p>
</div>
<div class="section">
<div class="titlepage"><div><div><h3 class="title">
<a name="quickbook.syntax.block.headings"></a><a name="quickbook.ref.headings"></a><a class="link" href="block.html#quickbook.syntax.block.headings" title="Headings">Headings</a>
</h3></div></div></div>
<pre class="programlisting">[h1 Heading 1]
[h2 Heading 2]
[h3 Heading 3]
[h4 Heading 4]
[h5 Heading 5]
[h6 Heading 6]
</pre>
<h2>
<a name="quickbook.syntax.block.headings.h0"></a>
<span class="phrase"><a name="quickbook.syntax.block.headings.heading_1"></a></span><a class="link" href="block.html#quickbook.syntax.block.headings.heading_1">Heading
1</a>
</h2>
<h3>
<a name="quickbook.syntax.block.headings.h1"></a>
<span class="phrase"><a name="quickbook.syntax.block.headings.heading_2"></a></span><a class="link" href="block.html#quickbook.syntax.block.headings.heading_2">Heading
2</a>
</h3>
<h4>
<a name="quickbook.syntax.block.headings.h2"></a>
<span class="phrase"><a name="quickbook.syntax.block.headings.heading_3"></a></span><a class="link" href="block.html#quickbook.syntax.block.headings.heading_3">Heading
3</a>
</h4>
<h5>
<a name="quickbook.syntax.block.headings.h3"></a>
<span class="phrase"><a name="quickbook.syntax.block.headings.heading_4"></a></span><a class="link" href="block.html#quickbook.syntax.block.headings.heading_4">Heading
4</a>
</h5>
<h6>
<a name="quickbook.syntax.block.headings.h4"></a>
<span class="phrase"><a name="quickbook.syntax.block.headings.heading_5"></a></span><a class="link" href="block.html#quickbook.syntax.block.headings.heading_5">Heading
5</a>
</h6>
<h4>
<a name="quickbook.syntax.block.headings.h5"></a>
<span class="phrase"><a name="quickbook.syntax.block.headings.heading_6"></a></span><a class="link" href="block.html#quickbook.syntax.block.headings.heading_6">Heading
6</a>
</h4>
<p>
You can specify an id for a heading:
</p>
<pre class="programlisting">[h1:heading_id A heading to link to]
</pre>
<p>
To link to it, you'll need to include the enclosing section's id:
</p>
<pre class="programlisting">[link document_id.section_id.heading_id The link text]
</pre>
<p>
Although you can preceed a heading by an <a class="link" href="phrase.html#quickbook.ref.anchors">anchor</a>
if you wish to use a location independent link.
</p>
<p>
If a heading doesn't have an id, one will be automatically generated with
a normalized name with <code class="literal">name="document_id.section_id.normalized_header_text"</code>
(i.e. valid characters are <code class="literal">a-z</code>, <code class="literal">A-Z</code>,
<code class="literal">0-9</code> and <code class="literal">_</code>. All non-valid characters
are converted to underscore and all upper-case are converted to lower-case.
For example: Heading 1 in section Section 2 will be normalized to <code class="literal">section_2.heading_1</code>).
You can use:
</p>
<pre class="programlisting">[link document_id.section_id.normalized_header_text The link text]
</pre>
<p>
to link to them. See <a class="link" href="phrase.html#quickbook.ref.anchor_links">Anchor links</a>
and <a class="link" href="structure.html#quickbook.ref.section">Section</a> for more info.
</p>
<div class="note"><table border="0" summary="Note">
<tr>
<td rowspan="2" align="center" valign="top" width="25"><img alt="[Note]" src="../../../../doc/src/images/note.png"></td>
<th align="left">Note</th>
</tr>
<tr><td align="left" valign="top"><p>
Specifying heading ids is a quickbook 1.6 feature, earlier versions don't
support them.
</p></td></tr>
</table></div>
</div>
<div class="section">
<div class="titlepage"><div><div><h3 class="title">
<a name="quickbook.syntax.block.generic_heading"></a><a name="quickbook.ref.generic_heading"></a><a class="link" href="block.html#quickbook.syntax.block.generic_heading" title="Generic Heading">Generic
Heading</a>
</h3></div></div></div>
<p>
In cases when you don't want to care about the heading level (1 to 6), you
can use the <span class="emphasis"><em>Generic Heading</em></span>:
</p>
<pre class="programlisting">[heading Heading]
</pre>
<p>
The <span class="emphasis"><em>Generic Heading</em></span> assumes the level, plus one, of
the innermost section where it is placed. For example, if it is placed in
the outermost section, then, it assumes <span class="emphasis"><em>h2</em></span>.
</p>
<p>
Headings are often used as an alternative to sections. It is used particularly
if you do not want to start a new section. In many cases, however, headings
in a particular section is just flat. Example:
</p>
<pre class="programlisting">[section A]
[h2 X]
[h2:link_id Y]
[h2 Z]
[endsect]
</pre>
<p>
Here we use h2 assuming that section A is the outermost level. If it is placed
in an inner level, you'll have to use h3, h4, etc. depending on where the
section is. In general, it is the section level plus one. It is rather tedious,
however, to scan the section level everytime. If you rewrite the example
above as shown below, this will be automatic:
</p>
<pre class="programlisting">[section A]
[heading X]
[heading Y]
[heading Z]
[endsect]
</pre>
<p>
They work well regardless where you place them. You can rearrange sections
at will without any extra work to ensure correct heading levels. In fact,
with <span class="emphasis"><em>section</em></span> and <span class="emphasis"><em>heading</em></span>, you have
all you need. <span class="emphasis"><em>h1</em></span>..<span class="emphasis"><em>h6</em></span> becomes redundant.
<span class="emphasis"><em>h1</em></span>..<span class="emphasis"><em>h6</em></span> might be deprecated in the
future.
</p>
</div>
<div class="section">
<div class="titlepage"><div><div><h3 class="title">
<a name="quickbook.syntax.block.macros"></a><a name="quickbook.ref.macros"></a><a class="link" href="block.html#quickbook.syntax.block.macros" title="Macros">Macros</a>
</h3></div></div></div>
<pre class="programlisting">[def macro_identifier some text]
</pre>
<p>
When a macro is defined, the identifier replaces the text anywhere in the
file, in paragraphs, in markups, etc. macro_identifier is a string of non-
white space characters except ']'. A macro may not follow an alphabetic character
or the underscore. The replacement text can be any phrase (even marked up).
Example:
</p>
<pre class="programlisting">[def sf_logo [$http://sourceforge.net/sflogo.php?group_id=28447&amp;type=1]]
sf_logo
</pre>
<p>
Now everywhere the sf_logo is placed, the picture will be inlined.
</p>
<p>
<span class="inlinemediaobject"><img src="http://sourceforge.net/sflogo.php?group_id=28447&type=1"></span>
</p>
<div class="tip"><table border="0" summary="Tip">
<tr>
<td rowspan="2" align="center" valign="top" width="25"><img alt="[Tip]" src="../../../../doc/src/images/tip.png"></td>
<th align="left">Tip</th>
</tr>
<tr><td align="left" valign="top"><p>
It's a good idea to use macro identifiers that are distinguishable. For
instance, in this document, macro identifiers have two leading and trailing
underscores (e.g. <code class="literal">__spirit__</code>). The reason is to avoid
unwanted macro replacement.
</p></td></tr>
</table></div>
<p>
Links (URLS) and images are good candidates for macros. <span class="bold"><strong>1</strong></span>)
They tend to change a lot. It is a good idea to place all links and images
in one place near the top to make it easy to make changes. <span class="bold"><strong>2</strong></span>)
The syntax is not pretty. It's easier to read and write, e.g. <code class="literal">__spirit__</code>
than <code class="computeroutput">[@http://spirit.sourceforge.net Spirit]</code>.
</p>
<p>
Some more examples:
</p>
<pre class="programlisting">[def :-) [$theme/smiley.png]]
[def __spirit__ [@http://spirit.sourceforge.net Spirit]]
</pre>
<p>
(See <a class="link" href="phrase.html#quickbook.ref.images">Images</a> and <a class="link" href="phrase.html#quickbook.ref.links">Links</a>)
</p>
<p>
Invoking these macros:
</p>
<pre class="programlisting">Hi __spirit__ :-)
</pre>
<p>
will generate this:
</p>
<p>
Hi <a href="http://spirit.sourceforge.net" target="_top">Spirit</a> <span class="inlinemediaobject"><img src="../../../src/images/smiley.png"></span>
</p>
</div>
<div class="section">
<div class="titlepage"><div><div><h3 class="title">
<a name="quickbook.syntax.block.predefined_macros"></a><a name="quickbook.ref.predefined_macros"></a><a class="link" href="block.html#quickbook.syntax.block.predefined_macros" title="Predefined Macros">Predefined
Macros</a>
</h3></div></div></div>
<p>
Quickbook has some predefined macros that you can already use.
</p>
<div class="table">
<a name="quickbook.syntax.block.predefined_macros.predefined_macros"></a><p class="title"><b>Table 51.3. Predefined Macros</b></p>
<div class="table-contents"><table class="table" summary="Predefined Macros">
<colgroup>
<col>
<col>
<col>
</colgroup>
<thead><tr>
<th>
<p>
Macro
</p>
</th>
<th>
<p>
Meaning
</p>
</th>
<th>
<p>
Example
</p>
</th>
</tr></thead>
<tbody>
<tr>
<td>
<p>
<code class="literal">__DATE__</code>
</p>
</td>
<td>
<p>
Today's date
</p>
</td>
<td>
<p>
2017-Aug-19
</p>
</td>
</tr>
<tr>
<td>
<p>
<code class="literal">__TIME__</code>
</p>
</td>
<td>
<p>
The current time
</p>
</td>
<td>
<p>
04:59:36 PM
</p>
</td>
</tr>
<tr>
<td>
<p>
<code class="literal">__FILENAME__</code>
</p>
</td>
<td>
<p>
Quickbook source filename
</p>
</td>
<td>
<p>
block.qbk
</p>
</td>
</tr>
</tbody>
</table></div>
</div>
<br class="table-break">
</div>
<div class="section">
<div class="titlepage"><div><div><h3 class="title">
<a name="quickbook.syntax.block.templates"></a><a name="quickbook.ref.templates"></a><a class="link" href="block.html#quickbook.syntax.block.templates" title="Templates">Templates</a>
</h3></div></div></div>
<p>
Templates provide a more versatile text substitution mechanism. Templates
come in handy when you need to create parameterizable, multi-line, boilerplate
text that you specify once and expand many times. Templates accept one or
more arguments. These arguments act like place-holders for text replacement.
Unlike simple macros, which are limited to phrase level markup, templates
can contain block level markup (e.g. paragraphs, code blocks and tables).
</p>
<p>
Example template:
</p>
<pre class="programlisting">[template person[name age what]
Hi, my name is [name]. I am [age] years old. I am a [what].
]
</pre>
<a name="quickbook.ref.template_identifier"></a><h4>
<a name="quickbook.syntax.block.templates.h0"></a>
<span class="phrase"><a name="quickbook.syntax.block.templates.template_identifier"></a></span><a class="link" href="block.html#quickbook.syntax.block.templates.template_identifier">Template Identifier</a>
</h4>
<p>
Template identifiers can either consist of:
</p>
<div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; ">
<li class="listitem">
An initial alphabetic character or the underscore, followed by zero or
more alphanumeric characters or the underscore. This is similar to your
typical C/C++ identifier.
</li>
<li class="listitem">
A single character punctuation (a non-alphanumeric printable character)
</li>
</ul></div>
<h4>
<a name="quickbook.syntax.block.templates.h1"></a>
<span class="phrase"><a name="quickbook.syntax.block.templates.formal_template_arguments"></a></span><a class="link" href="block.html#quickbook.syntax.block.templates.formal_template_arguments">Formal
Template Arguments</a>
</h4>
<p>
Template formal arguments are identifiers consisting of an initial alphabetic
character or the underscore, followed by zero or more alphanumeric characters
or the underscore. This is similar to your typical C/C++ identifier.
</p>
<p>
A template formal argument temporarily hides a template of the same name
at the point where the <a class="link" href="phrase.html#quickbook.ref.template_expansion">template
is expanded</a>. Note that the body of the <code class="literal">person</code> template
above refers to <code class="literal">name</code> <code class="literal">age</code> and <code class="literal">what</code>
as <code class="literal">[name]</code> <code class="literal">[age]</code> and <code class="literal">[what]</code>.
<code class="literal">name</code> <code class="literal">age</code> and <code class="literal">what</code>
are actually templates that exist in the duration of the template call.
</p>
<h4>
<a name="quickbook.syntax.block.templates.h2"></a>
<span class="phrase"><a name="quickbook.syntax.block.templates.template_body"></a></span><a class="link" href="block.html#quickbook.syntax.block.templates.template_body">Template
Body</a>
</h4>
<p>
The template body can be just about any QuickBook block or phrase. There
are actually two forms. Templates may be phrase or block level. Phrase templates
are of the form:
</p>
<pre class="programlisting">[template sample[arg1 arg2...argN] replacement text... ]
</pre>
<p>
Block templates are of the form:
</p>
<pre class="programlisting">[template sample[arg1 arg2...argN]
replacement text...
]
</pre>
<p>
The basic rule is as follows: if a newline immediately follows the argument
list, then it is a block template, otherwise, it is a phrase template. Phrase
templates are typically expanded as part of phrases. Like macros, block level
elements are not allowed in phrase templates.
</p>
<h4>
<a name="quickbook.syntax.block.templates.h3"></a>
<span class="phrase"><a name="quickbook.syntax.block.templates.template_expansion"></a></span><a class="link" href="block.html#quickbook.syntax.block.templates.template_expansion">Template
Expansion</a>
</h4>
<p>
You expand a template this way:
</p>
<pre class="programlisting">[template_identifier arg1..arg2..arg3]
</pre>
<p>
At template expansion, you supply the actual arguments. The template will
be expanded with your supplied arguments. Example:
</p>
<pre class="programlisting">[person James Bond..39..Spy]
[person Santa Clause..87..Big Red Fatso]
</pre>
<p>
Which will expand to:
</p>
<p>
Hi, my name is James Bond. I am 39 years old. I am a Spy.
</p>
<p>
Hi, my name is Santa Clause. I am 87 years old. I am a Big Red Fatso.
</p>
<div class="caution"><table border="0" summary="Caution">
<tr>
<td rowspan="2" align="center" valign="top" width="25"><img alt="[Caution]" src="../../../../doc/src/images/caution.png"></td>
<th align="left">Caution</th>
</tr>
<tr><td align="left" valign="top"><p>
A word of caution: Templates are recursive. A template can call another
template or even itself, directly or indirectly. There are no control structures
in QuickBook (yet) so this will always mean infinite recursion. QuickBook
can detect this situation and report an error if recursion exceeds a certain
limit.
</p></td></tr>
</table></div>
<p>
Each actual argument can be a word, a text fragment or just about any <a class="link" href="phrase.html" title="Phrase Level Elements">QuickBook phrase</a>. Arguments are
separated by the double dot <code class="literal">".."</code> and terminated
by the close parenthesis.
</p>
<p>
Note that templates and template parameters can't be expanded everywhere,
only where text is interpreted as a phrase. So they can't be expanded in
places such as table titles and link's urls. If you want to use a template
to generate a link based of the template parameter, you can't use a normal
link and will need to use escaped docbook instead. Example:
</p>
<pre class="programlisting">[template boost_ticket[key] '''<ulink url="https://svn.boost.org/trac/boost/ticket/'''[key]'''">#'''[key]'''</ulink>''']
[boost_ticket 2035]
</pre>
<p>
will expand to:
</p>
<p>
<a href="https://svn.boost.org/trac/boost/ticket/2035" target="_top">#2035</a>
</p>
<div class="caution"><table border="0" summary="Caution">
<tr>
<td rowspan="2" align="center" valign="top" width="25"><img alt="[Caution]" src="../../../../doc/src/images/caution.png"></td>
<th align="left">Caution</th>
</tr>
<tr><td align="left" valign="top"><p>
Since quickbook doesn't understand the context where the parameter is being
used, it will interpret it as quickbook markup, so when writing a template
like this, you'll need to escape any meaningful punctuation.
</p></td></tr>
</table></div>
<h4>
<a name="quickbook.syntax.block.templates.h4"></a>
<span class="phrase"><a name="quickbook.syntax.block.templates.nullary_templates"></a></span><a class="link" href="block.html#quickbook.syntax.block.templates.nullary_templates">Nullary
Templates</a>
</h4>
<p>
Nullary templates look and act like simple macros. Example:
</p>
<pre class="programlisting">[template alpha[]&apos;&apos;&apos;&amp;#945;&apos;&apos;&apos;]
[template beta[]&apos;&apos;&apos;&amp;#946;&apos;&apos;&apos;]
</pre>
<p>
Expanding:
</p>
<pre class="programlisting">Some squigles...[*[alpha][beta]]</pre>
<p>
We have:
</p>
<p>
Some squiggles...<span class="bold"><strong>αβ</strong></span>
</p>
<p>
The difference with macros are
</p>
<div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; ">
<li class="listitem">
The explicit <a class="link" href="phrase.html#quickbook.ref.template_expansion">template
expansion syntax</a>. This is an advantage because, now, we don't
have to use obscure naming conventions like double underscores (e.g.
__alpha__) to avoid unwanted macro replacement.
</li>
<li class="listitem">
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.
</li>
</ul></div>
<p>
The empty brackets after the template identifier (<code class="literal">alpha[]</code>)
indicates no arguments. If the template body does not look like a template
argument list, we can elide the empty brackets. Example:
</p>
<pre class="programlisting">[template aristotle_quote Aristotle: [*['Education is the best provision
for the journey to old age.]]]
</pre>
<p>
Expanding:
</p>
<pre class="programlisting">Here's a quote from [aristotle_quote].
</pre>
<p>
We have:
</p>
<p>
Here's a quote from Aristotle: <span class="bold"><strong><span class="emphasis"><em>Education
is the best provision for the journey to old age.</em></span></strong></span>.
</p>
<p>
The disadvantage is that you can't avoid the space between the template identifier,
<code class="computeroutput">aristotle_quote</code>, 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: "<code class="computeroutput">\ </code>".
Example:
</p>
<pre class="programlisting">[template tag\ _tag]
</pre>
<p>
Then expanding:
</p>
<pre class="programlisting">`struct` x[tag];
</pre>
<p>
We have:
</p>
<p>
<code class="computeroutput">struct</code> x_tag;
</p>
<p>
You have a couple of ways to do it. I personally prefer the explicit empty
brackets, though.
</p>
<h4>
<a name="quickbook.syntax.block.templates.h5"></a>
<span class="phrase"><a name="quickbook.syntax.block.templates.simple_arguments"></a></span><a class="link" href="block.html#quickbook.syntax.block.templates.simple_arguments">Simple
Arguments</a>
</h4>
<p>
As mentioned, arguments are separated by the double dot <code class="literal">".."</code>.
Alternatively, if the double dot isn't used and more than one argument is
expected, QuickBook uses whitespace to separate the arguments, following
this logic:
</p>
<div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; ">
<li class="listitem">
Break the last argument into two, at the first space found (<code class="literal">'',
'\n', \t' or '\r'</code>).
</li>
<li class="listitem">
Repeat until there are enough arguments or if there are no more spaces
found (in which case, an error is reported).
</li>
</ul></div>
<p>
For example:
</p>
<pre class="programlisting">[template simple[a b c d] [a][b][c][d]]
[simple w x y z]
</pre>
<p>
will produce:
</p>
<p>
wxyz
</p>
<p>
"w x y z" is initially treated as a single argument because we
didn't supply any <code class="literal">".."</code> separators. However,
since <code class="literal">simple</code> expects 4 arguments, "w x y z"
is broken down iteratively (applying the logic above) until we have "w",
"x", "y" and "z".
</p>
<p>
QuickBook only tries to get the arguments it needs. For example:
</p>
<pre class="programlisting">[simple w x y z trail]
</pre>
<p>
will produce:
</p>
<p>
wxyz trail
</p>
<p>
The arguments being: "w", "x", "y" and "z
trail".
</p>
<div class="caution"><table border="0" summary="Caution">
<tr>
<td rowspan="2" align="center" valign="top" width="25"><img alt="[Caution]" src="../../../../doc/src/images/caution.png"></td>
<th align="left">Caution</th>
</tr>
<tr><td align="left" valign="top"><p>
The behavior described here is for QuickBook 1.5. In older versions you
could use both the double dot and whitespace as separators in the same
template call. If your document is marked up as an older version, it will
use the old behavior, which is described in the <a href="http://www.boost.org/doc/libs/1_40_0/doc/html/quickbook/syntax.html#quickbook.syntax.block.templates.simple_arguments" target="_top">QuickBook
1.4 documentation</a>.
</p></td></tr>
</table></div>
<h4>
<a name="quickbook.syntax.block.templates.h6"></a>
<span class="phrase"><a name="quickbook.syntax.block.templates.punctuation_templates"></a></span><a class="link" href="block.html#quickbook.syntax.block.templates.punctuation_templates">Punctuation
Templates</a>
</h4>
<p>
With templates, one of our objectives is to allow us to rewrite QuickBook
in QuickBook (as a qbk library). For that to happen, we need to accommodate
single character punctuation templates which are fairly common in QuickBook.
You might have noticed that single character punctuations are allowed as
<a class="link" href="block.html#quickbook.ref.template_identifier">template identifiers</a>.
Example:
</p>
<pre class="programlisting">[template ![bar] <hey>[bar]</hey>]
</pre>
<p>
Now, expanding this:
</p>
<pre class="programlisting">[!baz]
</pre>
<p>
We will have:
</p>
<pre class="programlisting"><hey>baz</hey>
</pre>
</div>
<div class="section">
<div class="titlepage"><div><div><h3 class="title">
<a name="quickbook.syntax.block.blurbs"></a><a name="quickbook.ref.blurbs"></a><a class="link" href="block.html#quickbook.syntax.block.blurbs" title="Blurbs">Blurbs</a>
</h3></div></div></div>
<pre class="programlisting">[blurb :-) [*An eye catching advertisement or note...]
<a href="http://spirit.sourceforge.net" target="_top">Spirit</a> is an object-oriented recursive-descent parser generator framework
implemented using template meta-programming techniques. Expression templates
allow us to approximate the syntax of Extended Backus-Normal Form (EBNF)
completely in C++.
]
</pre>
<p>
will generate this:
</p>
<div class="sidebar">
<div class="titlepage"><div><div><p class="title"><b></b></p></div></div></div>
<p>
<span class="inlinemediaobject"><img src="../../../src/images/smiley.png"></span>
<span class="bold"><strong>An eye catching advertisement or note...</strong></span>
</p>
<p>
<a href="http://spirit.sourceforge.net" target="_top">Spirit</a> is an object-oriented
recursive-descent parser generator framework implemented using template meta-programming
techniques. Expression templates allow us to approximate the syntax of Extended
Backus-Normal Form (EBNF) completely in C++.
</p>
</div>
<div class="note"><table border="0" summary="Note">
<tr>
<td rowspan="2" align="center" valign="top" width="25"><img alt="[Note]" src="../../../../doc/src/images/note.png"></td>
<th align="left">Note</th>
</tr>
<tr><td align="left" valign="top"><p>
Prefer <a class="link" href="block.html#quickbook.ref.admonitions">admonitions</a> wherever
appropriate.
</p></td></tr>
</table></div>
</div>
<div class="section">
<div class="titlepage"><div><div><h3 class="title">
<a name="quickbook.syntax.block.tables"></a><a name="quickbook.ref.tables"></a><a class="link" href="block.html#quickbook.syntax.block.tables" title="Tables">Tables</a>
</h3></div></div></div>
<pre class="programlisting">[table:id A Simple Table
[[Heading 1] [Heading 2] [Heading 3]]
[[R0-C0] [R0-C1] [R0-C2]]
[[R1-C0] [R1-C1] [R1-C2]]
[[R2-C0] [R2-C1] [R2-C2]]
]
</pre>
<p>
will generate:
</p>
<div class="table">
<a name="quickbook.syntax.block.tables.id"></a><p class="title"><b>Table 51.4. A Simple Table</b></p>
<div class="table-contents"><table class="table" summary="A Simple Table">
<colgroup>
<col>
<col>
<col>
</colgroup>
<thead><tr>
<th>
<p>
Heading 1
</p>
</th>
<th>
<p>
Heading 2
</p>
</th>
<th>
<p>
Heading 3
</p>
</th>
</tr></thead>
<tbody>
<tr>
<td>
<p>
R0-C0
</p>
</td>
<td>
<p>
R0-C1
</p>
</td>
<td>
<p>
R0-C2
</p>
</td>
</tr>
<tr>
<td>
<p>
R1-C0
</p>
</td>
<td>
<p>
R1-C1
</p>
</td>
<td>
<p>
R1-C2
</p>
</td>
</tr>
<tr>
<td>
<p>
R2-C0
</p>
</td>
<td>
<p>
R2-C1
</p>
</td>
<td>
<p>
R2-C2
</p>
</td>
</tr>
</tbody>
</table></div>
</div>
<br class="table-break"><p>
The table title is optional. The first row of the table is automatically
treated as the table header; that is, it is wrapped in <code class="literal"><thead>...</thead></code>
XML tags. Note that unlike the original QuickDoc, the columns are nested
in [cells... ].
</p>
<p>
Giving tables an id is a new feature for quickbook 1.5 onwards. As with sections,
the id is optional. If the table has a title but no id, an id will be generated
from the title. The table above can be linked to using:
</p>
<pre class="programlisting">[link quickbook.syntax.block.tables.id link to table]
</pre>
<p>
which will generate:
</p>
<p>
<a class="link" href="block.html#quickbook.syntax.block.tables.id" title="Table 51.4. A Simple Table">link to table</a>
</p>
<p>
The syntax is free-format and allows big cells to be formatted nicely. Example:
</p>
<pre class="programlisting">[table Table with fat cells
[[Heading 1] [Heading 2]]
[
[Row 0, Col 0: a small cell]
[
Row 0, Col 1: a big fat cell with paragraphs
Boost provides free peer-reviewed portable C++ source libraries.
We emphasize libraries that work well with the C++ Standard Library.
Boost libraries are intended to be widely useful, and usable across
a broad spectrum of applications. The Boost license encourages both
commercial and non-commercial use.
]
]
[
[Row 1, Col 0: a small cell]
[Row 1, Col 1: a small cell]
]
]
</pre>
<p>
and thus:
</p>
<div class="table">
<a name="quickbook.syntax.block.tables.table_with_fat_cells"></a><p class="title"><b>Table 51.5. Table with fat cells</b></p>
<div class="table-contents"><table class="table" summary="Table with fat cells">
<colgroup>
<col>
<col>
</colgroup>
<thead><tr>
<th>
<p>
Heading 1
</p>
</th>
<th>
<p>
Heading 2
</p>
</th>
</tr></thead>
<tbody>
<tr>
<td>
<p>
Row 0, Col 0: a small cell
</p>
</td>
<td>
<p>
Row 0, Col 1: a big fat cell with paragraphs
</p>
<p>
Boost provides free peer-reviewed portable C++ source libraries.
We emphasize libraries that work well with the C++ Standard Library.
Boost libraries are intended to be widely useful, and usable across
a broad spectrum of applications. The Boost license encourages
both commercial and non-commercial use.
</p>
</td>
</tr>
<tr>
<td>
<p>
Row 1, Col 0: a small cell
</p>
</td>
<td>
<p>
Row 1, Col 1: a small cell
</p>
</td>
</tr>
</tbody>
</table></div>
</div>
<br class="table-break"><p>
Here's how to have preformatted blocks of code in a table cell:
</p>
<pre class="programlisting">[table Table with code
[[Comment] [Code]]
[
[My first program]
[``
#include <iostream>
int main()
{
std::cout << "Hello, World!" << std::endl;
return 0;
}
``]
]
]
</pre>
<div class="table">
<a name="quickbook.syntax.block.tables.table_with_code"></a><p class="title"><b>Table 51.6. Table with code</b></p>
<div class="table-contents"><table class="table" summary="Table with code">
<colgroup>
<col>
<col>
</colgroup>
<thead><tr>
<th>
<p>
Comment
</p>
</th>
<th>
<p>
Code
</p>
</th>
</tr></thead>
<tbody><tr>
<td>
<p>
My first program
</p>
</td>
<td>
<pre class="programlisting">#include <iostream>
int main()
{
std::cout << "Hello, World!" << std::endl;
return 0;
}
</pre>
</td>
</tr></tbody>
</table></div>
</div>
<br class="table-break">
</div>
<div class="section">
<div class="titlepage"><div><div><h3 class="title">
<a name="quickbook.syntax.block.variable_lists"></a><a name="quickbook.ref.variable_lists"></a><a class="link" href="block.html#quickbook.syntax.block.variable_lists" title="Variable Lists">Variable
Lists</a>
</h3></div></div></div>
<pre class="programlisting">[variablelist A Variable List
[[term 1] [The definition of term 1]]
[[term 2] [The definition of term 2]]
[[term 3] [
The definition of term 3.
Definitions may contain paragraphs.
]]
]
</pre>
<p>
will generate:
</p>
<div class="variablelist">
<p class="title"><b>A Variable List</b></p>
<dl class="variablelist">
<dt><span class="term">term 1</span></dt>
<dd><p>
The definition of term 1
</p></dd>
<dt><span class="term">term 2</span></dt>
<dd><p>
The definition of term 2
</p></dd>
<dt><span class="term">term 3</span></dt>
<dd>
<p>
The definition of term 3.
</p>
<p>
Definitions may contain paragraphs.
</p>
</dd>
</dl>
</div>
<p>
The rules for variable lists are the same as for tables, except that only
2 "columns" are allowed. The first column contains the terms, and
the second column contains the definitions. Those familiar with HTML will
recognize this as a "definition list".
</p>
</div>
<div class="section">
<div class="titlepage"><div><div><h3 class="title">
<a name="quickbook.syntax.block.include"></a><a name="quickbook.ref.include"></a><a class="link" href="block.html#quickbook.syntax.block.include" title="Include">Include</a>
</h3></div></div></div>
<p>
You can include one QuickBook file from another. The syntax is simply:
</p>
<pre class="programlisting">[include someother.qbk]
</pre>
<p>
In quickbook 1.6 and later, if the included file has a <a class="link" href="structure.html#quickbook.ref.docinfo">docinfo
block</a> then it will create a nested document. This will be processed
as a standalone document, although any macros or templates from the enclosing
file will still be defined.
</p>
<p>
Otherwise the included file will be processed as if it had been cut and pasted
into the current document, with the following exceptions:
</p>
<div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; ">
<li class="listitem">
The __FILENAME__ predefined macro will reflect the name of the file currently being
processed.
</li>
<li class="listitem">
Any macros or templates defined in the included file are scoped to that
file, i.e. they are not added to the enclosing file.
</li>
</ul></div>
<div class="note"><table border="0" summary="Note">
<tr>
<td rowspan="2" align="center" valign="top" width="25"><img alt="[Note]" src="../../../../doc/src/images/note.png"></td>
<th align="left">Note</th>
</tr>
<tr><td align="left" valign="top"><p>
In quickbook 1.5 and earlier templates weren't scoped in included files.
If you want to use templates or macros from a file in quickbook 1.6, use
<a class="link" href="block.html#quickbook.ref.import">import</a> instead.
</p></td></tr>
</table></div>
<p>
The <code class="literal">[include]</code> directive lets you specify a document id
to use for the included file. You can specify the id like this:
</p>
<pre class="programlisting">[include:someid someother.qbk]
</pre>
<p>
All auto-generated anchors will use the document id as a unique prefix. So
for instance, if there is a top section in someother.qbk named "Intro",
the named anchor for that section will be "someid.intro", and you
can link to it with <code class="literal">[link someid.intro The Intro]</code>.
</p>
<p>
If the included file has a docinfo block, an id specified in an <code class="literal">[include]</code>
directive will overwrite it.
</p>
<p>
You can also include C, C++ and python source files. This will include any
quickbook blocks in the file that aren't inside of named code snippets. See
the <a class="link" href="block.html#quickbook.ref.import">Import section</a> for syntax
details. For example, say you included this file:
</p>
<pre class="programlisting">/**
* Hello world example
*/
// In this comment, the backtick indicates that this is a
// quickbook source block that will be included.
/*`
First include the appropriate header: [hello_includes]
Then write your main function: [hello_main]
*/
// This defines a code snippet, the syntax is
// described in the import section. It's available
// in the whole of this source file, not just after
// its definition.
//[hello_includes
#include <iostream>
//]
//[hello_main
int main() {
std::cout << "Hello, trivial example" << std::endl;
}
//]
</pre>
<p>
It will generate:
</p>
<pre class="programlisting">First include the appropriate header:
#include <iostream>
Then write your main function:
int main() {
std::cout << "Hello, trivial example" << std::endl;
}
</pre>
</div>
<div class="section">
<div class="titlepage"><div><div><h3 class="title">
<a name="quickbook.syntax.block.import"></a><a name="quickbook.ref.import"></a><a class="link" href="block.html#quickbook.syntax.block.import" title="Import">Import</a>
</h3></div></div></div>
<p>
In quickbook 1.6 and later if you wish to use a template, macro or code snippet
from a file, you need to import it. This will not include any of the content
from that file, but will pull templates, macros and code snippets into the
current file's scope.
</p>
<p>
With quickbook files, this allows you to create template and macro libraries.
For python (indicated by the <code class="computeroutput">.py</code> extension), C or C++ files
this allows you to include code snippets from source files, so that your
code examples can be kept up to date and fully tested.
</p>
<h4>
<a name="quickbook.syntax.block.import.h0"></a>
<span class="phrase"><a name="quickbook.syntax.block.import.example"></a></span><a class="link" href="block.html#quickbook.syntax.block.import.example">Example</a>
</h4>
<p>
You can effortlessly import code snippets from source code into your QuickBook.
The following illustrates how this is done:
</p>
<pre class="programlisting">[import ../test/stub.cpp]
[foo]
[bar]
</pre>
<p>
The first line:
</p>
<pre class="programlisting">[import ../test/stub.cpp]
</pre>
<p>
collects specially marked-up code snippets from <a href="../../../../tools/quickbook/test/stub.cpp" target="_top">stub.cpp</a>
and places them in your QuickBook file as virtual templates. Each of the
specially marked-up code snippets has a name (e.g. <code class="computeroutput">foo</code> and
<code class="computeroutput">bar</code> in the example above). This shall be the template identifier
for that particular code snippet. The second and third line above does the
actual template expansion:
</p>
<pre class="programlisting">[foo]
[bar]
</pre>
<p>
And the result is:
</p>
<p>
This is the <span class="bold"><strong><span class="emphasis"><em>foo</em></span></strong></span> function.
</p>
<p>
This description can have paragraphs...
</p>
<div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; ">
<li class="listitem">
lists
</li>
<li class="listitem">
etc.
</li>
</ul></div>
<p>
And any quickbook block markup.
</p>
<pre class="programlisting"><span class="identifier">std</span><span class="special">::</span><span class="identifier">string</span> <span class="identifier">foo</span><span class="special">()</span>
<span class="special">{</span>
<span class="comment">// return 'em, foo man!</span>
<span class="keyword">return</span> <span class="string">"foo"</span><span class="special">;</span>
<span class="special">}</span>
</pre>
<p>
This is the <span class="bold"><strong><span class="emphasis"><em>bar</em></span></strong></span> function
</p>
<pre class="programlisting"><span class="identifier">std</span><span class="special">::</span><span class="identifier">string</span> <span class="identifier">bar</span><span class="special">()</span>
<span class="special">{</span>
<span class="comment">// return 'em, bar man!</span>
<span class="keyword">return</span> <span class="string">"bar"</span><span class="special">;</span>
<span class="special">}</span>
</pre>
<p>
Some trailing text here
</p>
<h4>
<a name="quickbook.syntax.block.import.h1"></a>
<span class="phrase"><a name="quickbook.syntax.block.import.code_snippet_markup"></a></span><a class="link" href="block.html#quickbook.syntax.block.import.code_snippet_markup">Code
Snippet Markup</a>
</h4>
<p>
Note how the code snippets in <a href="../../../../tools/quickbook/test/stub.cpp" target="_top">stub.cpp</a>
get marked up. We use distinguishable comments following the form:
</p>
<pre class="programlisting">//[id
some code here
//]
</pre>
<p>
The first comment line above initiates a named code-snippet. This prefix
will not be visible in quickbook. The entire code-snippet in between <code class="computeroutput">//[id</code>
and <code class="computeroutput">//]</code> will be inserted as a template in quickbook with name
<span class="emphasis"><em><span class="emphasis"><em>id</em></span></em></span>. The comment <code class="computeroutput">//]</code>
ends a code-snippet This too will not be visible in quickbook.
</p>
<h4>
<a name="quickbook.syntax.block.import.h2"></a>
<span class="phrase"><a name="quickbook.syntax.block.import.special_comments"></a></span><a class="link" href="block.html#quickbook.syntax.block.import.special_comments">Special
Comments</a>
</h4>
<p>
Special comments of the form:
</p>
<pre class="programlisting">//` some [*quickbook] markup here
</pre>
<p>
and:
</p>
<pre class="programlisting">/*` some [*quickbook] markup here */
</pre>
<p>
will be parsed by QuickBook. This can contain quickbook <span class="emphasis"><em>blocks</em></span>
(e.g. sections, paragraphs, tables, etc). In the first case, the initial
slash-slash, tick and white-space shall be ignored. In the second, the initial
slash-star-tick and the final star-slash shall be ignored.
</p>
<p>
Special comments of the form:
</p>
<pre class="programlisting">/*<- this C++ comment will be ignored ->*/
</pre>
<p>
or
</p>
<pre class="programlisting">/*<-*/ "this c++ code will be ignored" /*->*/
</pre>
<p>
or
</p>
<pre class="programlisting">//<-
private:
int some_member;
//->
</pre>
<p>
can be used to inhibit code from passing through to quickbook. All text between
the delimeters will simply be ignored.
</p>
<p>
Comments of this form:
</p>
<pre class="programlisting">//=int main() {}
</pre>
<p>
or
</p>
<pre class="programlisting">/*=foo()*/
</pre>
<p>
will be displayed as code that isn't in comments. This allows you to include
some code in the snippet but not actually use it when compiling your example.
</p>
<h4>
<a name="quickbook.syntax.block.import.h3"></a>
<span class="phrase"><a name="quickbook.syntax.block.import.callouts"></a></span><a class="link" href="block.html#quickbook.syntax.block.import.callouts">Callouts</a>
</h4>
<p>
Special comments of the form:
</p>
<pre class="programlisting">/*< some [*quickbook] markup here >*/
</pre>
<p>
will be regarded as callouts. These will be collected, numbered and rendered
as a "callout bug" (a small icon with a number). After the whole
snippet is parsed, the callout list is generated. See <a href="http://www.docbook.org/tdg/en/html/callout.html" target="_top">Callouts</a>
for details. Example:
</p>
<pre class="programlisting"><span class="identifier">std</span><span class="special">::</span><span class="identifier">string</span> <span class="identifier">foo_bar</span><span class="special">()</span> <a class="co" name="quickbook.syntax.block.import.c0" href="block.html#quickbook.syntax.block.import.c1"><img src="../../../../doc/src/images/callouts/1.png" alt="1" border="0"></a>
<span class="special">{</span>
<span class="keyword">return</span> <span class="string">"foo-bar"</span><span class="special">;</span> <a class="co" name="quickbook.syntax.block.import.c2" href="block.html#quickbook.syntax.block.import.c3"><img src="../../../../doc/src/images/callouts/2.png" alt="2" border="0"></a>
<span class="special">}</span>
</pre>
<div class="calloutlist"><table border="0" summary="Callout list">
<tr>
<td width="5%" valign="top" align="left"><p><a name="quickbook.syntax.block.import.c1"></a><a href="#quickbook.syntax.block.import.c0"><img src="../../../../doc/src/images/callouts/1.png" alt="1" border="0"></a> </p></td>
<td valign="top" align="left"><p>
The <span class="emphasis"><em>Mythical</em></span> FooBar. See <a href="http://en.wikipedia.org/wiki/Foobar" target="_top">Foobar
for details</a>
</p></td>
</tr>
<tr>
<td width="5%" valign="top" align="left"><p><a name="quickbook.syntax.block.import.c3"></a><a href="#quickbook.syntax.block.import.c2"><img src="../../../../doc/src/images/callouts/2.png" alt="2" border="0"></a> </p></td>
<td valign="top" align="left"><p>
return 'em, foo-bar man!
</p></td>
</tr>
</table></div>
<p>
This is the actual code:
</p>
<pre class="programlisting">//[ foo_bar
std::string foo_bar() /*< The /Mythical/ FooBar.
See [@http://en.wikipedia.org/wiki/Foobar Foobar for details] >*/
{
return "foo-bar"; /*< return 'em, foo-bar man! >*/
}
//]
</pre>
<p>
The callouts bugs are placed exactly where the special callout comment is
situated. It can be anywhere in the code. The bugs can be rather obtrusive,
however. They get in the way of the clarity of the code. Another special
callout comment style is available:
</p>
<pre class="programlisting">/*<< some [*quickbook] markup here >>*/
</pre>
<p>
This is the line-oriented version of the callout. With this, the "bug"
is placed at the very left of the code block, away from the actual code.
By placing it at the far left, the code is rendered un-obscured. Example:
</p>
<pre class="programlisting"><span class="keyword">class</span> <span class="identifier">x</span>
<span class="special">{</span>
<span class="keyword">public</span><span class="special">:</span>
<a class="co" name="quickbook.syntax.block.import.c4" href="block.html#quickbook.syntax.block.import.c5"><img src="../../../../doc/src/images/callouts/1.png" alt="1" border="0"></a><span class="identifier">x</span><span class="special">()</span> <span class="special">:</span> <span class="identifier">n</span><span class="special">(</span><span class="number">0</span><span class="special">)</span>
<span class="special">{</span>
<span class="special">}</span>
<a class="co" name="quickbook.syntax.block.import.c6" href="block.html#quickbook.syntax.block.import.c7"><img src="../../../../doc/src/images/callouts/2.png" alt="2" border="0"></a><span class="special">~</span><span class="identifier">x</span><span class="special">()</span>
<span class="special">{</span>
<span class="special">}</span>
<a class="co" name="quickbook.syntax.block.import.c8" href="block.html#quickbook.syntax.block.import.c9"><img src="../../../../doc/src/images/callouts/3.png" alt="3" border="0"></a><span class="keyword">int</span> <span class="identifier">get</span><span class="special">()</span> <span class="keyword">const</span>
<span class="special">{</span>
<span class="keyword">return</span> <span class="identifier">n</span><span class="special">;</span>
<span class="special">}</span>
<a class="co" name="quickbook.syntax.block.import.c10" href="block.html#quickbook.syntax.block.import.c11"><img src="../../../../doc/src/images/callouts/4.png" alt="4" border="0"></a><span class="keyword">void</span> <span class="identifier">set</span><span class="special">(</span><span class="keyword">int</span> <span class="identifier">n_</span><span class="special">)</span>
<span class="special">{</span>
<span class="identifier">n</span> <span class="special">=</span> <span class="identifier">n_</span><span class="special">;</span>
<span class="special">}</span>
<span class="special">};</span>
</pre>
<div class="calloutlist"><table border="0" summary="Callout list">
<tr>
<td width="5%" valign="top" align="left"><p><a name="quickbook.syntax.block.import.c5"></a><a href="#quickbook.syntax.block.import.c4"><img src="../../../../doc/src/images/callouts/1.png" alt="1" border="0"></a> </p></td>
<td valign="top" align="left"><p>
Constructor
</p></td>
</tr>
<tr>
<td width="5%" valign="top" align="left"><p><a name="quickbook.syntax.block.import.c7"></a><a href="#quickbook.syntax.block.import.c6"><img src="../../../../doc/src/images/callouts/2.png" alt="2" border="0"></a> </p></td>
<td valign="top" align="left"><p>
Destructor
</p></td>
</tr>
<tr>
<td width="5%" valign="top" align="left"><p><a name="quickbook.syntax.block.import.c9"></a><a href="#quickbook.syntax.block.import.c8"><img src="../../../../doc/src/images/callouts/3.png" alt="3" border="0"></a> </p></td>
<td valign="top" align="left"><p>
Get the <code class="computeroutput">n</code> member variable
</p></td>
</tr>
<tr>
<td width="5%" valign="top" align="left"><p><a name="quickbook.syntax.block.import.c11"></a><a href="#quickbook.syntax.block.import.c10"><img src="../../../../doc/src/images/callouts/4.png" alt="4" border="0"></a> </p></td>
<td valign="top" align="left"><p>
Set the <code class="computeroutput">n</code> member variable
</p></td>
</tr>
</table></div>
<p>
See the actual code here: <a href="../../../../tools/quickbook/test/stub.cpp" target="_top">tools/quickbook/test/stub.cpp</a>
</p>
</div>
<div class="section">
<div class="titlepage"><div><div><h3 class="title">
<a name="quickbook.syntax.block.block"></a><a name="quickbook.ref.block"></a><a class="link" href="block.html#quickbook.syntax.block.block" title="Plain blocks">Plain
blocks</a>
</h3></div></div></div>
<p>
<code class="computeroutput">block</code> is a plain block element, that doesn't wrap its contents
in any docbook or boostbook tags. This can be useful when using escaped docbook
block tags, such as:
</p>
<pre class="programlisting">[template chapter[title]
[block'''<chapter><title>'''[title]'''</title>''']
]
[template chapterend
[block'''</chapter>''']
]
[chapter An example chapter]
Content
[chapterend]
</pre>
<p>
Without the <code class="computeroutput">block</code> element, the <code class="computeroutput">chapter</code> and <code class="computeroutput">chapterend</code>
templates would be wrapped in paragraph tags.
</p>
<div class="note"><table border="0" summary="Note">
<tr>
<td rowspan="2" align="center" valign="top" width="25"><img alt="[Note]" src="../../../../doc/src/images/note.png"></td>
<th align="left">Note</th>
</tr>
<tr><td align="left" valign="top"><p>
In this example, the template body has to start with a newline so that
the template will be interpreted in block mode.
</p></td></tr>
</table></div>
</div>
</div>
<table xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" width="100%"><tr>
<td align="left"></td>
<td align="right"><div class="copyright-footer">Copyright © 2002, 2004, 2006 Joel de Guzman,
Eric Niebler<br>Copyright © 2010, 2011 Daniel James<p>
Distributed under the Boost Software License, Version 1.0. (See accompanying
file LICENSE_1_0.txt or copy at <a href="http://www.boost.org/LICENSE_1_0.txt" target="_top">http://www.boost.org/LICENSE_1_0.txt</a>)
</p>
</div></td>
</tr></table>
<hr>
<div class="spirit-nav">
<a accesskey="p" href="phrase.html"><img src="../../../../doc/src/images/prev.png" alt="Prev"></a><a accesskey="u" href="../../quickbook.html"><img src="../../../../doc/src/images/up.png" alt="Up"></a><a accesskey="h" href="../../index.html"><img src="../../../../doc/src/images/home.png" alt="Home"></a><a accesskey="n" href="../versions.html"><img src="../../../../doc/src/images/next.png" alt="Next"></a>
</div>
</body>
</html>
|