Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion src/licensedcode/match.py
Original file line number Diff line number Diff line change
Expand Up @@ -768,9 +768,11 @@ def to_dict(
Return a "result" scan data built from a LicenseMatch object.
"""
matched_text = None
matched_text_diagnostics = None

if include_text:
if license_text_diagnostics:
matched_text = self.matched_text(whole_lines=False, highlight=True)
matched_text_diagnostics = self.matched_text(whole_lines=False, highlight=True)
else:
if whole_lines:
matched_text = self.matched_text(whole_lines=True, highlight=False)
Expand All @@ -795,6 +797,8 @@ def to_dict(

if include_text:
result['matched_text'] = matched_text
if license_text_diagnostics:
result['matched_text_diagnostics'] = matched_text_diagnostics
return result

def get_highlighted_text(self, trace=TRACE_HIGHLIGHTED_TEXT):
Expand Down