Skip to content

Commit

Permalink
Formatting
Browse files Browse the repository at this point in the history
  • Loading branch information
TDKorn committed Aug 18, 2024
1 parent 759564a commit f127126
Showing 1 changed file with 2 additions and 4 deletions.
6 changes: 2 additions & 4 deletions sphinx_inlinecode/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -124,13 +124,11 @@ def add_code_blocks(file: Path, objects: Dict[str, Any], highlighter: "PythonLex
else:
target = get_target(viewcode_label.parent)

# this can happen if documentation is not structured perfectly
# skipping keys which don't exist allow the documentation to be built even if the structure isn't perfect
if target not in objects:
if not (obj := objects.get(target)):
continue

# Highlight and insert the source code block after the object signature
code_block = get_code_block(target, objects[target], highlighter)
code_block = get_code_block(target, obj, highlighter)
doc_entry.append(code_block)

if viewcode_label: # Remove the viewcode link, if it exists
Expand Down

0 comments on commit f127126

Please sign in to comment.