Skip to content

Commit 1ab7494

Browse files
committed
Add line number to one more warning
1 parent 886698e commit 1ab7494

File tree

2 files changed

+9
-2
lines changed

2 files changed

+9
-2
lines changed

src/sphinx_notion/__init__.py

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -666,9 +666,15 @@ def _(
666666
_LOGGER.warning(msg=table_multiple_header_rows_msg)
667667

668668
if table_structure.num_stub_columns > 1:
669+
first_body_row = table_structure.body_rows[0]
670+
first_body_row_entry = first_body_row.children[0]
671+
first_body_row_paragraph = first_body_row_entry.children[0]
669672
table_more_than_one_stub_column_msg = (
670673
f"Tables with more than 1 stub column are not supported. "
671-
f"Found {table_structure.num_stub_columns} stub columns."
674+
f"Found {table_structure.num_stub_columns} stub columns "
675+
f"on table with first body row on line "
676+
f"{first_body_row_paragraph.line} in "
677+
f"{first_body_row_paragraph.source}."
672678
)
673679
_LOGGER.warning(msg=table_more_than_one_stub_column_msg)
674680

tests/test_integration.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1999,7 +1999,8 @@ def test_list_table_stub_columns_two(
19991999

20002000
expected_warning = (
20012001
"Tables with more than 1 stub column are not supported. "
2002-
"Found 2 stub columns."
2002+
"Found 2 stub columns on table with first body row on line 8 in "
2003+
f"{tmp_path / 'src' / 'index.rst'}."
20032004
)
20042005

20052006
table = UnoTable(n_rows=3, n_cols=3, header_row=True, header_col=True)

0 commit comments

Comments
 (0)