mirror of
https://github.com/Abdess/retroarch_system.git
synced 2026-10-16 16:33:27 -05:00
fix: catch indented hashes in wiki sources
This commit is contained in:
1 parent
4dc6af5a89
commit
99b049fa96
1 file changed
+16
-1
@@ -64,14 +64,29 @@ class WikiSourceHeadings(unittest.TestCase):
|
||||
for number, line in enumerate(
|
||||
page.read_text(encoding="utf-8").splitlines(), start=1
|
||||
):
|
||||
if line.lstrip().startswith("```"):
|
||||
if line.lstrip().startswith(("```", "~~~")):
|
||||
fenced = not fenced
|
||||
elif not fenced and line.startswith("#") and not line.startswith(
|
||||
("# ", "## ", "### ", "#### ", "##### ", "###### ")
|
||||
):
|
||||
offenders.append(f"{page.name}:{number}")
|
||||
elif not fenced and line[:1].isspace() and line.lstrip().startswith("#"):
|
||||
# Inside a list item or an admonition an indented hash is
|
||||
# a heading too; code that needs one goes in a fence.
|
||||
offenders.append(f"{page.name}:{number}")
|
||||
self.assertEqual(offenders, [])
|
||||
|
||||
def test_an_indented_hash_renders_as_a_heading(self):
|
||||
"""What the check above guards: a wrapped `#79)` inside a list item."""
|
||||
try:
|
||||
import markdown
|
||||
except ImportError:
|
||||
self.skipTest("rendering needs markdown")
|
||||
html = markdown.markdown(
|
||||
"1. First paragraph.\n\n Second paragraph (see issue\n #79). More."
|
||||
)
|
||||
self.assertIn("<h1", html)
|
||||
|
||||
|
||||
class PlatformDetails(unittest.TestCase):
|
||||
def test_lists_and_flags_read_as_prose(self):
|
||||
|
||||
Reference in new issue
Block a user