changeset 1119:af57fbe9435a

formatter: Fix the regex used to find page segments. It was incorrectly matching a Markdown horizontal rule followed by a title if the title had exactly 3 dashes underneath it.
author Ludovic Chabant <ludovic@chabant.com>
date Tue, 27 Feb 2018 15:43:50 -0800
parents 1dcebff866f1
children 181a7a34d8f0
files piecrust/page.py
diffstat 1 files changed, 1 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/piecrust/page.py	Sun Feb 25 23:19:38 2018 -0800
+++ b/piecrust/page.py	Tue Feb 27 15:43:50 2018 -0800
@@ -301,8 +301,7 @@
 
 
 segment_pattern = re.compile(
-    r"""^\-\-\-\s*(?P<name>\w+)(\:(?P<fmt>\w+))?\s*\-\-\-\s*$""",
-    re.M)
+    r"^\-\-\-[ \t]*(?P<name>\w+)(\:(?P<fmt>\w+))?[ \t]*\-\-\-[ \t]*$", re.M)
 
 
 def _count_lines(txt, start=0, end=-1):