File tree Expand file tree Collapse file tree 1 file changed +9
-8
lines changed
Expand file tree Collapse file tree 1 file changed +9
-8
lines changed Original file line number Diff line number Diff line change @@ -189,14 +189,15 @@ def format_synonyms(term):
189189
190190def format_xrefs (term ):
191191 refs = []
192- for xref in term .xrefs :
193- # Check if xref is a string or dictionary
194- if isinstance (xref , dict ):
195- icon = ' <i class="fa fa-external-link"></i>' if xref .get ("site" , {}).get ("icon" ) == "link" else ''
196- refs .append (f'- <a href="{ xref ["link_base" ]} { xref ["accession" ]} " target="_blank">{ xref ["site" ]["label" ]} </a>{ icon } ' )
197- else :
198- # Handle string xrefs or log them for debugging
199- print (f"Unexpected xref format: { xref } " )
192+ if "xrefs" in term : # Check if xrefs exists in the dictionary
193+ for xref in term ["xrefs" ]: # Access xrefs using dictionary notation
194+ # Check if xref is a string or dictionary
195+ if isinstance (xref , dict ):
196+ icon = ' <i class="fa fa-external-link"></i>' if xref .get ("site" , {}).get ("icon" ) == "link" else ''
197+ refs .append (f'- <a href="{ xref ["link_base" ]} { xref ["accession" ]} " target="_blank">{ xref ["site" ]["label" ]} </a>{ icon } ' )
198+ else :
199+ # Handle string xrefs or log them for debugging
200+ print (f"Unexpected xref format: { xref } " )
200201 return '\n ' .join (refs ) if refs else 'None'
201202
202203def format_references (term ):
You can’t perform that action at this time.
0 commit comments