summaryrefslogtreecommitdiff
path: root/tools/quickbook/test/templates-1_5.quickbook
blob: 038b8b3f0508bedbf8cac19b253529d9c05daef8 (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
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
[article Template 1.5
    [quickbook 1.5]
]

[/ 1.5 uses static scoping ]

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

[/ This should be '[a]' because [a] isn't matched. ]
[template test1[] [a]]
[template test2[a] [test1]]
[test2 1]

[/ In 1.5 template arguments are scoped at the point they are defined]

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

[/ From https://svn.boost.org/trac/boost/ticket/2034 ]

[template same[x] [x]]
[template echo[a b] [a] [b]]
[template echo_twice[x] [echo [same [x]]..[same [x]]]]
[echo_twice foo]

[/ 1.5 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..3] [/ {1..2-3} ]
[binary 1.\.2 3]  [/ {1..2-3} ]

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

[binary \[1 2\] 3] [/ {[1-2] 3} ]
[binary \[1..2\] 3] [/ {[1-2] 3} ]
[binary \[1 2] [/ {(1-2} ]

[template ternary[x y z] {[x]-[y]-[z]}]
[ternary 1..2..3]  [/ {1-2-3} ]
[ternary 1 2 3]    [/ {1-2-3} ]

[/ Block vs. phrase templates ]

[template phrase[] Some *text*]
[template block[]

A <emphasis>paragraph</emphasis>.
]

[phrase]
[block]
[`phrase]
[`block]

[/ Trailing newline shouldn't be included]

[template named_index[type title]
'''<index type="'''[type]'''"><title>'''[title]'''</title></index>'''
]

[named_index things Things]