Skip to content

Commit

Permalink
👌 Add ability to localize figure caption (#14)
Browse files Browse the repository at this point in the history
Co-authored-by: Chris Sewell <[email protected]>
  • Loading branch information
j123b567 and chrisjsewell authored Jan 12, 2024
1 parent fb52892 commit e9e3d9a
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion src/sphinx_subfigure/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,10 @@ def run(self) -> list[nodes.Element]:
elif isinstance(child, nodes.paragraph):
if has_caption:
raise self.error("Invalid subfigure content (multiple captions)")
child.replace_self(nodes.caption(child.rawsource, *child.children))
caption = nodes.caption(child.rawsource, *child.children)
caption.source = child.source
caption.line = child.line
child.replace_self(caption)
has_caption = True
else:
raise self.error(
Expand Down

0 comments on commit e9e3d9a

Please sign in to comment.