@@ -670,7 +670,7 @@ def compact(self, input_, ctx, options):
670
670
options .setdefault ('activeCtx' , False )
671
671
options .setdefault ('documentLoader' , _default_document_loader )
672
672
options .setdefault ('link' , False )
673
- if options ['link' ]:
673
+ if isinstance ( options ['link' ], dict ) :
674
674
# force skip expansion when linking, "link" is not part of the
675
675
# public API, it should only be called from framing
676
676
options ['skipExpansion' ] = True
@@ -1710,7 +1710,7 @@ def _compact(self, active_ctx, active_property, element, options):
1710
1710
if _is_value (element ) or _is_subject_reference (element ):
1711
1711
rval = self ._compact_value (
1712
1712
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 ):
1714
1714
# store linked element
1715
1715
options ['link' ].setdefault (element ['@id' ], []).append (
1716
1716
{'expanded' : element , 'compacted' : rval })
@@ -1721,7 +1721,7 @@ def _compact(self, active_ctx, active_property, element, options):
1721
1721
1722
1722
rval = {}
1723
1723
1724
- if options ['link' ] and '@id' in element :
1724
+ if isinstance ( options ['link' ], dict ) and '@id' in element :
1725
1725
# store linked element
1726
1726
options ['link' ].setdefault (element ['@id' ], []).append (
1727
1727
{'expanded' : element , 'compacted' : rval })
0 commit comments