File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -473,8 +473,22 @@ def __parse_script(cls, script_data):
473473 elif script_elem .tag == 'table' :
474474 tdict = {}
475475 for telem in script_elem :
476- tdict [telem .get ('key' )] = telem .text
477- _elt_dict [script_elem .get ('key' )] = tdict
476+ # Handle duplicate element keys
477+ tkey = telem .get ('key' )
478+ if tkey in tdict :
479+ if not isinstance (tdict [tkey ], list ):
480+ tdict [tkey ] = [tdict [tkey ], ]
481+ tdict [tkey ].append (telem .text )
482+ else :
483+ tdict [tkey ] = telem .text
484+ # Handle duplicate table keys
485+ skey = script_elem .get ('key' )
486+ if skey in _elt_dict :
487+ if not isinstance (_elt_dict [skey ], list ):
488+ _elt_dict [skey ] = [_elt_dict [skey ], ]
489+ _elt_dict [skey ].append (tdict )
490+ else :
491+ _elt_dict [skey ] = tdict
478492 _script_dict ['elements' ] = _elt_dict
479493 return _script_dict
480494
You can’t perform that action at this time.
0 commit comments