File tree Expand file tree Collapse file tree 1 file changed +23
-0
lines changed Expand file tree Collapse file tree 1 file changed +23
-0
lines changed Original file line number Diff line number Diff line change @@ -256,6 +256,24 @@ def parse_attr_sets(entries: List[Dict[str, Any]]) -> str:
256
256
return "\n " .join (lines )
257
257
258
258
259
+ def parse_sub_messages (entries : List [Dict [str , Any ]]) -> str :
260
+ """Parse sub-message definitions"""
261
+ lines = []
262
+
263
+ for entry in entries :
264
+ lines .append (rst_section (entry ["name" ]))
265
+ for fmt in entry ["formats" ]:
266
+ value = fmt ["value" ]
267
+
268
+ lines .append (rst_bullet (bold (value )))
269
+ for attr in ['fixed-header' , 'attribute-set' ]:
270
+ if attr in fmt :
271
+ lines .append (rst_fields (attr , fmt [attr ], 2 ))
272
+ lines .append ("\n " )
273
+
274
+ return "\n " .join (lines )
275
+
276
+
259
277
def parse_yaml (obj : Dict [str , Any ]) -> str :
260
278
"""Format the whole YAML into a RST string"""
261
279
lines = []
@@ -292,6 +310,11 @@ def parse_yaml(obj: Dict[str, Any]) -> str:
292
310
lines .append (rst_subtitle ("Attribute sets" ))
293
311
lines .append (parse_attr_sets (obj ["attribute-sets" ]))
294
312
313
+ # Sub-messages
314
+ if "sub-messages" in obj :
315
+ lines .append (rst_subtitle ("Sub-messages" ))
316
+ lines .append (parse_sub_messages (obj ["sub-messages" ]))
317
+
295
318
return "\n " .join (lines )
296
319
297
320
You can’t perform that action at this time.
0 commit comments