Skip to content

Commit

Permalink
translator: print additional unknown-node feedback
Browse files Browse the repository at this point in the history
When an unknown node is detected by this extension, attempt to print
the document as well as the line number where the issue has occurred.
This should provide users a better understanding where the origin of an
unknown node occurs.

Signed-off-by: James Knight <james.d.knight@live.com>
  • Loading branch information
jdknight committed Jun 13, 2024
1 parent 6b290fb commit 79c100e
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion sphinxcontrib/confluencebuilder/translator.py
Original file line number Diff line number Diff line change
Expand Up @@ -165,7 +165,12 @@ def unknown_visit(self, node):
handler[node_name](self, node)
raise nodes.SkipNode

self.warn('unknown node: ' + node_name)
if node.source:
lpf = f'#{node.line}' if node.line else ''
self.warn(f'unknown node {node_name}: {node.source}{lpf}')
else:
self.warn(f'unknown node {node_name}: {self.docname}')

raise nodes.SkipNode

# ---------
Expand Down

0 comments on commit 79c100e

Please sign in to comment.