summaryrefslogtreecommitdiff
path: root/tools/quickbook/test/templates-1_4.quickbook
blob: fc808554e89b2af57a9763b73ca89d572c022286 (plain)
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
[article Template 1.4
    [quickbook 1.4]
]

[/ 1.4 uses dynamic scoping ]

[template x static scoping]
[template foo1[] [x]]
[template foo2[x] [foo1]]
[foo2 dynamic scoping]

[/ In 1.4 template arguments are scoped at the point they are used]

[template y new]
[template foo3[a y] [a]]
[foo3 [y] old]

[/ 1.4 template arguments]

[template binary[x y] {[x]-[y]}]
[binary 1..2]     [/ {1-2} ]
[binary 1 2]      [/ {1-2} ]
[binary 1..2 3 4] [/ {1-2 3 4} ]
[binary 1 2..3 4] [/ {1 2-3 4} ]
[binary 1 2 3..4] [/ {1 2 3-4} ]
[binary [1..2]    [/ {(1-2} but with a square bracket ]
[binary 1.\.2..3] [/ {1..2-3} ]
[binary 1.\.2 3]  [/ {1..2-3} ]

[binary [binary 1 2..3] 4] [/ {[binary 1 2-3} 4] ]

[template ternary[x y z] {[x]-[y]-[z]}]
[ternary 1..2..3]  [/ {1-2-3} ]
[ternary 1 2 3]    [/ {1-2-3} ]
[ternary 1..2 3 4] [/ {1-2-3 4} ]
[ternary 1 2..3 4] [/ {1 2-3-4} ]
[ternary [1..2..3] [/ {(1-2-3} (but with a square bracket) ]