-
Notifications
You must be signed in to change notification settings - Fork 52
Expand file tree
/
Copy pathjson.php
More file actions
94 lines (86 loc) · 1.79 KB
/
Copy pathjson.php
File metadata and controls
94 lines (86 loc) · 1.79 KB
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
<# Add a comma if item is not the first one. #>
<@ snippet comma @>
<@~ if @{ :i } > 1 ~@>
,
<@~ end ~@>
<@ end @>
<# Generate JSON for a pagelist #>
<@ snippet pages ~@>
[
<@~ foreach in pagelist ~@>
<@ comma @>{"url":"@{ :origUrl }","title":"@{ title }","date":"@{ date }"}
<@~ end ~@>
]
<@~ end @>
<# Generate JSON for tags. #>
<@ snippet tags ~@>
[
<@~ foreach in tags ~@>
<@ comma @>"@{ :tag }"
<@~ end ~@>
]
<@~ end @>
<# Generate JSON for the file list. #>
<@ snippet files ~@>
[
<@~ foreach in '*.jpg, *.png, *.gif' ~@>
<@ comma @>{"url":"@{ :file }","caption":"@{ :caption }"}
<@~ end ~@>
]
<@~ end @>
<# Generate JSON for the children of the current page. #>
<@ snippet children @>
<@~ newPagelist {
excludeHidden: false,
type: "children"
} ~@>
<@ pages ~@>
<@ end @>
<# Generate JSON for the siblings of the current page. #>
<@ snippet siblings @>
<@~ newPagelist {
excludeHidden: false,
excludeCurrent: true,
type: "siblings"
} ~@>
<@ pages ~@>
<@ end @>
<# Generate JSON for related pages. #>
<@ snippet related @>
<@~ newPagelist {
excludeHidden: false,
type: "related"
} ~@>
<@ pages ~@>
<@ end @>
<# Generate JSON for the search results list. #>
<@ snippet results @>
<@~ newPagelist {
excludeHidden: false,
search: @{ ?search },
filter: @{ ?filter }
} ~@>
<@ pages ~@>
<@ end @>
<# The actual JSON content. #>
<@ if @{ ?search } or @{ ?filter } @>
[
<@ results @>
]
<@ else @>
{
"title": "@{ title }",
"date": "@{ date }",
"text": "@{ text | markdown }",
"teaser": "@{ textTeaser | markdown }",
"hidden": "@{ hidden }",
"parent": "@{ :parent }",
"path": "@{ :path }",
"mtime": "@{ :mtime }",
"tags": <@ tags @>,
"children": <@ children @>,
"siblings": <@ siblings @>,
"related": <@ related @>,
"files": <@ files @>
}
<@ end @>