File: but.py

package info (click to toggle)
python3-proselint 0.14.0-2
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 1,220 kB
  • sloc: python: 7,173; sh: 6; makefile: 3
file content (25 lines) | stat: -rw-r--r-- 519 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
"""Don't start a paragraph with 'But'.

---
layout:
source: Justin Jungé
source_url:
title:
date:       2016-03-10 12:31:19
categories: writing
---

Paragraphs should not start with certain bad words.

"""
from proselint.tools import existence_check, memoize


@memoize
def check(text):
    """Do not start a paragraph with a 'But'."""
    err = "misc.but"
    msg = "No paragraph should start with a 'But'."
    regex = r"(^|([\n\r]+))(\s*)But"

    return existence_check(text, [regex], err, msg, ignore_case=False)