@@ -712,7 +712,7 @@ def compact(self, input_, ctx, options):
712
712
options .setdefault ('activeCtx' , False )
713
713
options .setdefault ('documentLoader' , _default_document_loader )
714
714
options .setdefault ('link' , False )
715
- if options ['link' ]:
715
+ if isinstance ( options ['link' ], dict ) :
716
716
# force skip expansion when linking, "link" is not part of the
717
717
# public API, it should only be called from framing
718
718
options ['skipExpansion' ] = True
@@ -1752,7 +1752,7 @@ def _compact(self, active_ctx, active_property, element, options):
1752
1752
if _is_value (element ) or _is_subject_reference (element ):
1753
1753
rval = self ._compact_value (
1754
1754
active_ctx , active_property , element )
1755
- if options ['link' ] and _is_subject_reference (element ):
1755
+ if isinstance ( options ['link' ], dict ) and _is_subject_reference (element ):
1756
1756
# store linked element
1757
1757
options ['link' ].setdefault (element ['@id' ], []).append (
1758
1758
{'expanded' : element , 'compacted' : rval })
@@ -1763,7 +1763,7 @@ def _compact(self, active_ctx, active_property, element, options):
1763
1763
1764
1764
rval = {}
1765
1765
1766
- if options ['link' ] and '@id' in element :
1766
+ if isinstance ( options ['link' ], dict ) and '@id' in element :
1767
1767
# store linked element
1768
1768
options ['link' ].setdefault (element ['@id' ], []).append (
1769
1769
{'expanded' : element , 'compacted' : rval })
0 commit comments