• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1[article Templates
2    [quickbook 1.3]
3]
4
5[section Templates]
6
7[/-------------------------------- nullary arg ]
8
9[template foo0 nullary_arg]
10
11[foo0]
12
13[/-------------------------------- unary arg, phrase syle ]
14
15[template foo1[bar] foo [bar]]
16
17[foo1 baz]
18
19[/-------------------------------- unary arg, block syle ]
20
21[template foo2[bar]
22foo [bar]
23]
24
25[foo2 baz]
26
27[template foo3[bar]
28This is a complete paragraph. [bar] [bar] [bar] [bar] [bar]
29[bar] [bar] [bar] [bar].... blah blah blah......
30]
31
32[foo3 kalamazoo]
33
34[/-------------------------------- unary arg, using punctuation ]
35
36[template ![bar] '''<hey>'''[bar]'''</hey>''']
37
38[!baz]
39
40[/-------------------------------- recursive templates ]
41
42[template foo4[bar]
43[foo3 [bar]]
44]
45
46[foo3 madagascar]
47
48[template foo5[x] zoom [x]]
49[template foo6[x] [x] zoom]
50
51[foo6[foo5 peanut]]
52
53[template kinda_weird[x y] [x] [y]]
54
55[kinda_weird exactly..xanadu]
56
57
58[/-------------------------------- space delimitted args ]
59
60[template simple1[a b] [a][b]]
61
62[simple1 w x]
63
64[template simple2[a b c d] [a][b][c][d]]
65
66[simple2 w x y z][simple2 w x y z trail]
67
68[/-------------------------------- John's templates ]
69
70[template code[x]
71    int main()
72    {
73        std::cout << ``[x]`` << std::endl;
74    }
75]
76
77[code "Hello\, World"]
78
79[template alpha '''&alpha;''']
80[template pow[a b] [a]'''<superscript>'''[b]'''</superscript>''' ]
81[template super[text]'''<superscript>'''[text]'''</superscript>''' ]
82
83[pow x 2]
84
85[pow [alpha] 2]
86
87x[super 2]
88
89[/-------------------------------- Some more ]
90
91[template banana got a banana?]
92[template plantation[bananarama] [bananarama]]
93
94[plantation [banana]]
95
96[/-------------------------------- Not a bug (there was a syntax error here) ]
97
98[template join1[a b] [b][a]]
99[template join2[a b] [a][b]]
100[template test[x] [join1 [join2 0 [x]]...0]]
101[test 0]
102
103[/-------------------------------- Mismatched template ]
104
105[template foo 1]
106[fool]
107
108[template blah 10]
109
110[endsect]
111
112[section Empty Templates]
113
114[template empty1]
115[template empty2 ]
116[template empty3 [/comment]]
117[template empty4 [/comment]
118
119]
120[template empty5
121]
122[template empty6
123
124]
125[template empty7
126[/comment]
127]
128[template empty8
129
130[/comment]
131]
132[template empty_arg1[x]]
133[template empty_arg2[x y]]
134
135[empty1]
136[empty2]
137[empty3]
138[empty4]
139[empty5]
140[empty6]
141[empty7]
142[empty8]
143[empty_arg1 1]
144[empty_arg2 1 2]
145
146[endsect]
147
148[/----------------------------------- Nested templates ]
149
150[section Nested Templates]
151
152[template block[content]
153
154Start block template.
155
156[content]
157
158End block template.
159]
160
161[template phrase[content] Start phrase template. [content] End phrase template.]
162
163Pre [block [block Hello!]] Post
164
165Pre [block [phrase Hello!]] Post
166
167Pre [phrase [block Hello!]] Post
168
169Pre [phrase [phrase Hello!]] Post
170
171[endsect]
172
173[/----------------------------------- Block Markup ]
174
175[section Block Markup]
176
177[template list
178* a
179* b]
180
181[template horizontal
182----]
183
184[template codeblock
185    int main() {}]
186
187[template paragraphs
188Paragraphs 1
189
190Paragraphs 2
191]
192
193[list][horizontal][codeblock][paragraphs]
194
195* [list]
196* [horizontal]
197* [codeblock]
198* [paragraphs]
199
200[endsect]
201
202[/----------------------------------- Escaped templates ]
203
204[section Escaped templates]
205
206[template raw_markup <thingbob>Not real boostbook</thingbob>]
207[template | <thingbob>Also not real boostbook</thingbob>]
208[template escaped1 [|] [`|]]
209[template escaped2 [x] [`x]]
210
211[`raw_markup]
212[`|]
213[escaped1 <thingbob>More fake boostbook</thingbob>]
214[escaped2 <thingbob>Final fake boostbook</thingbob>]
215
216[endsect]
217