Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 10 additions & 4 deletions sphinxlint/checkers.py
Original file line number Diff line number Diff line change
Expand Up @@ -197,10 +197,16 @@ def check_missing_space_after_role(file, lines, options=None):
Bad: :exc:`Exception`s.
Good: :exc:`Exceptions`\ s
"""
for lno, line in enumerate(lines, start=1):
line = clean_paragraph(line)
for role in _SUSPICIOUS_ROLE.finditer(line):
yield lno, f"role missing (escaped) space after role: {role.group(0)!r}"
for paragraph_lno, paragraph in paragraphs(lines):
if paragraph.count("|") > 4:
continue # we don't handle tables yet.
paragraph = clean_paragraph(paragraph)
for role in _SUSPICIOUS_ROLE.finditer(paragraph):
error_offset = paragraph[: role.start()].count("\n")
yield (
paragraph_lno + error_offset,
f"role missing (escaped) space after role: {role.group(0)!r}",
)


@checker(".rst", ".po")
Expand Down
11 changes: 11 additions & 0 deletions tests/fixtures/xpass/multiline-role-in-table.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
Math in Table
=============

+-----------+---------------+---------------+
| Shape | Area | Perimeter |
+===========+===============+===============+
| Circle | :math:`\pi | :math:`2 \pi |
| | r^2` | r` |
+-----------+---------------+---------------+
| Square | :math:`w^2` | :math:`4w` |
+-----------+---------------+---------------+