@@ -213,17 +213,27 @@ def __init__(self, toc, j, renderlist, redirects):
213
213
("docAfter" not in f ))):
214
214
self .render_type (f , 1 )
215
215
216
- def typefmt (self , tp , redirects , nbsp = False ):
216
+ def typefmt (self , tp , redirects , nbsp = False , jsonldPredicate = None ):
217
217
# type: (Any, Dict[str, str], bool) -> Union[str, unicode]
218
218
global primitiveType
219
219
if isinstance (tp , list ):
220
220
if nbsp and len (tp ) <= 3 :
221
- return " | " .join ([self .typefmt (n , redirects ) for n in tp ])
221
+ return " | " .join ([self .typefmt (n , redirects , jsonldPredicate = jsonldPredicate ) for n in tp ])
222
222
else :
223
223
return " | " .join ([self .typefmt (n , redirects ) for n in tp ])
224
224
if isinstance (tp , dict ):
225
225
if tp ["type" ] == "https://w3id.org/cwl/salad#array" :
226
- return "array<%s>" % (self .typefmt (tp ["items" ], redirects , nbsp = True ))
226
+ ar = "array<%s>" % (self .typefmt (tp ["items" ], redirects , nbsp = True ))
227
+ if jsonldPredicate and "mapSubject" in jsonldPredicate :
228
+ if "mapPredicate" in jsonldPredicate :
229
+ ar += " | map<%s.%s, %s.%s>" % (self .typefmt (tp ["items" ], redirects ),
230
+ jsonldPredicate ["mapSubject" ],
231
+ self .typefmt (tp ["items" ], redirects ),
232
+ jsonldPredicate ["mapPredicate" ])
233
+ ar += " | map<%s.%s, %s>" % (self .typefmt (tp ["items" ], redirects ),
234
+ jsonldPredicate ["mapSubject" ],
235
+ self .typefmt (tp ["items" ], redirects ))
236
+ return ar
227
237
if tp ["type" ] in ("https://w3id.org/cwl/salad#record" , "https://w3id.org/cwl/salad#enum" ):
228
238
frg = schema .avro_name (tp ["name" ])
229
239
if tp ["name" ] in redirects :
@@ -345,7 +355,8 @@ def extendsfrom(item, ex):
345
355
rfrg = schema .avro_name (i ["name" ])
346
356
tr = "<td><code>%s</code></td><td>%s</td><td>%s</td>" \
347
357
"<td>%s</td>" % (
348
- rfrg , self .typefmt (tp , self .redirects ),
358
+ rfrg , self .typefmt (tp , self .redirects ,
359
+ jsonldPredicate = i .get ("jsonldPredicate" )),
349
360
"Optional" if opt else "Required" ,
350
361
mistune .markdown (desc ))
351
362
if opt :
0 commit comments