Skip to content

Commit e9e3d9a

Browse files
👌 Add ability to localize figure caption (#14)
Co-authored-by: Chris Sewell <chrisj_sewell@hotmail.com>
1 parent fb52892 commit e9e3d9a

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

src/sphinx_subfigure/main.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,10 @@ def run(self) -> list[nodes.Element]:
7979
elif isinstance(child, nodes.paragraph):
8080
if has_caption:
8181
raise self.error("Invalid subfigure content (multiple captions)")
82-
child.replace_self(nodes.caption(child.rawsource, *child.children))
82+
caption = nodes.caption(child.rawsource, *child.children)
83+
caption.source = child.source
84+
caption.line = child.line
85+
child.replace_self(caption)
8386
has_caption = True
8487
else:
8588
raise self.error(

0 commit comments

Comments
 (0)