forked from typedb/typedb-docs
-
Notifications
You must be signed in to change notification settings - Fork 0
/
autolink-keywords.js
237 lines (236 loc) · 9.02 KB
/
autolink-keywords.js
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
/**
* The content of codeKeywordsToLink is used to identify keywords in code blocks and turn them into a link
* that points the user to the relevant documentation on the highlighted keyword.
*
* Construction of links per configuration of each keyword object is as follows:
* (keyword.baseUrl || codeKeywordsToLink.commonBaseUrl.replace('{client}', keyword.language)) + anchor
*
* Properties of a keyword object:
* - baseUrl (optional): required only if the url is not pointed at one if the client pages
* - "titles": variants of the keyword. ex: ["undefine"] or ["getSchemaConcept", "get_schema_concept"]
* - syntaxedAs: the keyword will be recognised, only if it's syntax-highlighted as one of the given types
* allowed types are: function, graq-keyword, string, uncategorised
* - anchor: the id of the heading, prefixed by #. the corresponding heading is preceded by the comment (!!! synced with codeKeywordsToLink)
* - languages: the keyword, will be recognised, only if it's mentioned in a code block of an given language
*/
codeKeywordsToLink = {
"commonBaseUrl": "/docs/client-api/{client}",
"keywords": [
// order matters for functionality. keywords that need to turn into a link first. example: undefine before define
{
"titles": ["undefine"],
"baseUrl": "../schema/concepts",
"syntaxedAs": ["graql-keyword", "string"],
"anchor": "#undefine",
"languages": ["graql", "java", "javascript", "python"]
},
{
"titles": ["getAttributesByValue", "get_attributes_by_value"],
"syntaxedAs": ["function"],
"anchor": "#retrieve-an-attribute-by-value",
"languages": [ "java", "javascript", "python"]
},
{
"titles": ["getConcept", "get_concept"],
"syntaxedAs": ["function"],
"anchor": "#retrieve-a-concept-by-id",
"languages": ["java", "javascript", "python"]
},
{
"titles": ["getSchemaConcept", "get_schema_concept"],
"syntaxedAs": ["function"],
"anchor": "#retrieve-a-schema-concept-by-label",
"languages": ["java", "javascript", "python"]
},
{
"titles": ["queryPattern", "query_pattern", "getPattern"],
"syntaxedAs": ["function"],
"anchor": "#query-pattern-that-leads-to-the-conceptmap",
"languages": ["java", "javascript", "python"]
},
// alphabetic order only required for readability
{
"titles": ["count", "sum", "min", "max", "mean", "median", "std"],
"baseUrl": "../query/aggregate-query",
"syntaxedAs": ["function", "graql-keyword", "string"],
"anchor": "",
"languages": ["graql", "java", "javascript", "python"]
},
{
"titles": ["answerIterator", "answer_iterator", "Iterator", "iterator"],
"syntaxedAs": ["uncategorised"],
"anchor": "#iterator",
"languages": ["javascript", "python"]
},
{
"titles": ["answers", "getAnswers"],
"syntaxedAs": ["function"],
"anchor": "#retrieve-source-facts-of-inference",
"languages": ["java", "javascript", "python"]
},
{
"titles": ["collectConcepts"],
"syntaxedAs": ["function"],
"anchor": "#consume-the-iterator-eagerly",
"languages": ["javascript"]
},
{
"titles": ["commit"],
"syntaxedAs": ["function"],
"anchor": "#commit-a-write-transaction",
"languages": ["java", "javascript", "python"]
},
{
"titles": ["compute"],
"baseUrl": "../query/compute-query",
"syntaxedAs": ["function", "graql-keyword", "string"],
"anchor": "#compute-statistics",
"languages": ["graql", "java", "javascript", "python"]
},
{
"titles": ["ConceptMap", "concept_map", "conceptMap"],
"syntaxedAs": ["uncategorised"],
"anchor": "#conceptmap",
"languages": ["java", "javascript", "python"]
},
{
"titles": ["define"],
"baseUrl": "../schema/concepts",
"syntaxedAs": ["function", "graql-keyword", "string"],
"anchor": "#define",
"languages": ["graql", "java", "javascript", "python"]
},
{
"titles": ["delete"],
"baseUrl": "../query/delete-query",
"syntaxedAs": ["function", "graql-keyword", "string"],
"anchor": "",
"languages": ["graql", "java", "javascript", "python"]
},
{
"titles": ["explanation"],
"syntaxedAs": ["function"],
"anchor": "#explanation",
"languages": ["java", "javascript", "python"]
},
{
"titles": ["execute"],
"syntaxedAs": ["function"],
"anchor": "#eagerly-execute-a-graql-query",
"languages": ["java"]
},
{
"titles": ["get"],
"baseUrl": "../query/get-query",
"syntaxedAs": ["function"],
"anchor": "",
"languages": ["java"]
},
{
"titles": ["get"],
"baseUrl": "../query/get-query",
"syntaxedAs": ["function", "graql-keyword", "string"],
"anchor": "",
"languages": ["graql", "java", "javascript", "python"]
},
{
"titles": ["Graql"],
"syntaxedAs": ["uncategorised"],
"anchor": "#graql",
"languages": ["java"]
},
{
"titles": ["insert"],
"baseUrl": "../query/insert-query",
"syntaxedAs": ["function", "graql-keyword", "string"],
"anchor": "",
"languages": ["graql", "java", "javascript", "python"]
},
{
"titles": ["isOpen", "is_open"],
"syntaxedAs": ["function"],
"anchor": "#checks-if-the-transaction-is-open",
"languages": ["java", "javascript", "python"]
},
{
"titles": ["match"],
"baseUrl": "../query/match-clause",
"syntaxedAs": ["function", "graql-keyword", "string"],
"anchor": "",
"languages": ["graql", "java", "javascript", "python"]
},
{
"titles": ["measurement"],
"syntaxedAs": ["function"],
"anchor": "#retrieve-the-numeric-value-of-a-centrality-computation",
"languages": ["java", "javascript", "python"]
},
{
"titles": ["owner"],
"syntaxedAs": ["function"],
"anchor": "#retrieve-the-concept-that-is-the-group-owner",
"languages": ["java", "javascript", "python"]
},
{
"titles": ["putAttributeType", "put_attribute_type"],
"syntaxedAs": ["function"],
"anchor": "#create-or-retrieve-an-attributetype",
"languages": ["java", "javascript", "python"]
},
{
"titles": ["putEntityType", "put_entity_type"],
"syntaxedAs": ["function"],
"anchor": "#create-or-retrieve-an-entitytype",
"languages": ["javascript", "python"]
},
{
"titles": ["putRelationType", "put_relation_type"],
"syntaxedAs": ["function"],
"anchor": "#create-or-retrieve-a-relationtype",
"languages": ["javascript", "python"]
},
{
"titles": ["putRole", "put_role"],
"syntaxedAs": ["function"],
"anchor": "#create-or-retrieve-a-role",
"languages": ["javascript", "python"]
},
{
"titles": ["putRule", "put_rule"],
"syntaxedAs": ["function"],
"anchor": "#create-or-retrieve-a-rule",
"languages": ["javascript", "python"]
},
{
"titles": ["query"],
"syntaxedAs": ["function"],
"anchor": "#lazily-execute-a-graql-query",
"languages": ["javascript", "python"]
},
{
"titles": ["rule"],
"baseUrl": "../schema/rules",
"syntaxedAs": ["graql-keyword", "string"],
"anchor": "",
"languages": ["graql", "javascript", "python"],
},
{
"titles": ["session"],
"syntaxedAs": ["function"],
"anchor": "#create-a-sessionkeyspace",
"languages": ["java", "javascript", "python"]
},
{
"titles": ["transaction().read()"],
"syntaxedAs": ["function"],
"anchor": "#open-a-read-transaction",
"languages": ["java", "javascript", "python"]
},
{
"titles": ["transaction().write()"],
"syntaxedAs": ["function"],
"anchor": "#open-a-write-transaction",
"languages": ["java", "javascript", "python"]
}
]
}