From 0d87299040d448e8ab59ff233b0cfbe0157970cb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gon=C3=A7alo=20Silva?= Date: Sat, 8 Jun 2019 03:04:24 +0100 Subject: [PATCH] Fix paragraph counting Markdown requires at least 2 newlines to form a paragraph. --- uberwriter/stats_counter.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/uberwriter/stats_counter.py b/uberwriter/stats_counter.py index ec54095..b37ec65 100644 --- a/uberwriter/stats_counter.py +++ b/uberwriter/stats_counter.py @@ -23,8 +23,8 @@ class StatsCounter: # exclamation mark, paragraph, and variants. SENTENCES = re.compile(r"[^\n][.。।෴۔።?՞;⸮؟?፧꘏⳺⳻⁇﹖⁈⁉‽!﹗!՜߹႟᥄\n]+") - # Regexp that matches paragraphs, ie. anything separated by newlines. - PARAGRAPHS = re.compile(r".+\n?") + # Regexp that matches paragraphs, ie. anything separated by at least 2 newlines. + PARAGRAPHS = re.compile(r"[^\n]+(\n{2,}|$)") # List of regexp whose matches should be replaced by their "text" group. Order is important. MARKUP_REGEXP_REPLACE = (