@@ -670,7 +670,7 @@ def compact(self, input_, ctx, options):
670670 options .setdefault ('activeCtx' , False )
671671 options .setdefault ('documentLoader' , _default_document_loader )
672672 options .setdefault ('link' , False )
673- if options ['link' ]:
673+ if isinstance ( options ['link' ], dict ) :
674674 # force skip expansion when linking, "link" is not part of the
675675 # public API, it should only be called from framing
676676 options ['skipExpansion' ] = True
@@ -1710,7 +1710,7 @@ def _compact(self, active_ctx, active_property, element, options):
17101710 if _is_value (element ) or _is_subject_reference (element ):
17111711 rval = self ._compact_value (
17121712 active_ctx , active_property , element )
1713- if options ['link' ] and _is_subject_reference (element ):
1713+ if isinstance ( options ['link' ], dict ) and _is_subject_reference (element ):
17141714 # store linked element
17151715 options ['link' ].setdefault (element ['@id' ], []).append (
17161716 {'expanded' : element , 'compacted' : rval })
@@ -1721,7 +1721,7 @@ def _compact(self, active_ctx, active_property, element, options):
17211721
17221722 rval = {}
17231723
1724- if options ['link' ] and '@id' in element :
1724+ if isinstance ( options ['link' ], dict ) and '@id' in element :
17251725 # store linked element
17261726 options ['link' ].setdefault (element ['@id' ], []).append (
17271727 {'expanded' : element , 'compacted' : rval })
0 commit comments