@@ -99,6 +99,7 @@ class Validator(object):
99
99
'type' : 'object' ,
100
100
'oneOf' : [
101
101
{'$ref' : '#/definitions/header' },
102
+ {'$ref' : '#/definitions/category' },
102
103
{'$ref' : '#/definitions/common' },
103
104
],
104
105
},
@@ -126,13 +127,37 @@ class Validator(object):
126
127
},
127
128
},
128
129
},
130
+ 'category' : {
131
+ 'require' : ['type' , 'key' ],
132
+ 'additionalProperties' : False ,
133
+ 'properties' : {
134
+ 'type' : {
135
+ 'type' : 'string' ,
136
+ 'enum' : ['category' ],
137
+ },
138
+ 'key' : {
139
+ 'type' : 'array' ,
140
+ 'items' : {
141
+ 'type' : 'string' ,
142
+ 'pattern' : '^[^"<>]+$' ,
143
+ },
144
+ },
145
+ 'cpp_namespace' : {
146
+ 'type' : 'array' ,
147
+ 'items' : {
148
+ 'type' : 'string' ,
149
+ 'pattern' : '^[^:]+$' ,
150
+ },
151
+ },
152
+ },
153
+ },
129
154
'common' : {
130
155
'require' : ['type' , 'key' ],
131
156
'additionalProperties' : False ,
132
157
'properties' : {
133
158
'type' : {
134
159
'type' : 'string' ,
135
- 'enum' : ['class' , 'function' , 'mem_fun' , 'macro' , 'enum' , 'variable' , 'type-alias' , 'concept' , 'cpo' , 'article' ],
160
+ 'enum' : ['class' , 'function' , 'mem_fun' , 'macro' , 'enum' , 'variable' , 'type-alias' , 'concept' , 'named requirement' , ' cpo' , 'article' ],
136
161
},
137
162
'key' : {
138
163
'type' : 'array' ,
@@ -249,13 +274,15 @@ def get_meta(self, md):
249
274
@staticmethod
250
275
def identify_type (metas , names , nojump ):
251
276
# type 判別
252
- # metas['id-type']: class, class template, function, function template, enum, variable, type-alias, concept, macro, namespace
253
- # type: "header" / "class" / "function" / "mem_fun" / "macro" / "enum" / "variable"/ "type-alias" / "concept"/ "article"
277
+ # metas['id-type']: class, class template, function, function template, enum, variable, type-alias, concept, named requirement, macro, namespace
278
+ # type: "header" / "category" / " class" / "function" / "mem_fun" / "macro" / "enum" / "variable"/ "type-alias" / "concept" / "named requirement" / "article"
254
279
if nojump :
255
280
return 'meta'
256
281
elif 'id-type' not in metas :
257
282
if 'header' in metas :
258
283
return 'header'
284
+ elif 'category' in metas :
285
+ return 'category'
259
286
elif names [0 ] == 'article' :
260
287
# それ以外の article/ の下は article 扱いにする
261
288
return 'article'
@@ -280,7 +307,7 @@ def identify_type(metas, names, nojump):
280
307
return 'mem_fun'
281
308
else :
282
309
return 'function'
283
- elif id_type in {'enum' , 'variable' , 'type-alias' , 'concept' , 'macro' , 'namespace' , 'cpo' }:
310
+ elif id_type in {'enum' , 'variable' , 'type-alias' , 'concept' , 'named requirement' , ' macro' , 'namespace' , 'cpo' }:
284
311
return id_type
285
312
else :
286
313
raise RuntimeError (f'unexpected meta: { metas } ' )
@@ -327,6 +354,11 @@ def make_index(self, md, names, idgen, nojump):
327
354
'type' : 'header' ,
328
355
'key' : metas ['header' ][0 ].split ('/' ),
329
356
}))
357
+ if 'category' in metas :
358
+ related_to .append (idgen .get_indexid ({
359
+ 'type' : 'category' ,
360
+ 'key' : metas ['category' ][0 ].split ('/' ),
361
+ }))
330
362
331
363
if len (related_to ) != 0 :
332
364
index ['related_to' ] = related_to
0 commit comments