mirror of
https://github.com/odoo/documentation.git
synced 2025-12-12 07:29:27 +07:00
[FIX] tests: don't confuse separators for heading delimiters
RST separators (`-----`) look similar to H3 delimiters that use the same
`-` character, but separators' length should not be checked.
X-original-commit: a54a68823f
Part-of: odoo/documentation#12273
Signed-off-by: Antoine Vandevenne (anv) <anv@odoo.com>
This commit is contained in:
@@ -74,7 +74,8 @@ def check_min_one_main_heading(file, lines, options=None):
|
||||
def check_heading_delimiters_length(file, lines, options=None):
|
||||
""" Check that heading delimiters have the same length as their heading. """
|
||||
for lno, line in enumerate(lines):
|
||||
if HEADING_DELIMITER_RE.search(line): # The line is a heading delimiter.
|
||||
previous_line = lno >= 1 and lines[lno - 1]
|
||||
if HEADING_DELIMITER_RE.search(line) and previous_line != '\n': # Heading delimiter found.
|
||||
if MAIN_HEADING_RE.search(''.join(lines[lno:lno+3])): # Upper delimiter of h1.
|
||||
heading_lno = lno + 1
|
||||
else: # Lower delimiter of a heading of any level.
|
||||
@@ -87,7 +88,8 @@ def check_heading_delimiters_length(file, lines, options=None):
|
||||
def check_heading_spacing(file, lines, options=None):
|
||||
""" Check that headings are preceded and followed by at least one blank line. """
|
||||
for lno, line in enumerate(lines):
|
||||
if HEADING_DELIMITER_RE.search(line): # The line is a heading delimiter.
|
||||
previous_line = lno > 1 and lines[lno - 1]
|
||||
if HEADING_DELIMITER_RE.search(line) and previous_line != '\n': # Heading delimiter found.
|
||||
if MAIN_HEADING_RE.search(''.join(lines[lno:lno+3])): # Upper delimiter of h1.
|
||||
continue # We handle this heading via its lower delimiter.
|
||||
|
||||
|
||||
Reference in New Issue
Block a user