Skip to content

Commit 22edc24

Browse files
committed
Ensure bullet lists are preceded by a blank line (a common mistake that would be seen as a paragraph otherwise)
1 parent 42aaab2 commit 22edc24

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

mlx/robot2rst/style_checker.py

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44

55
import logging
66
import itertools
7+
import re
78

89
from docstrfmt.docstrfmt import Manager, IgnoreMessagesReporter, pairwise
910
from docstrfmt.main import Reporter
@@ -136,7 +137,11 @@ def visit_Documentation(self, node):
136137

137138
manager = StyleManager(current_file=self.robot_file)
138139

139-
doc_node = manager.parse_string(doc_string, line_offset=node.lineno-1) # , file=self.robot_file
140+
# Ensure bullet lists are preceded by a blank line
141+
text = re.sub(r'([^\n])\n([-*+]) ', r'\1\n\n\2 ', doc_string)
142+
143+
doc_node = manager.parse_string(text, line_offset=node.lineno-1)
144+
doc_node.settings.tab_width = 4
140145
formatted_doc = manager.format_node(self.line_length, doc_node).rstrip()
141146
if manager.error_count > 0:
142147
self.issues_found = True

0 commit comments

Comments
 (0)