Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

misc.but No paragraph should start with a 'But': checks starts of new lines which may not all indicate new paragraphs (rst/TeX) #1376

Open
sanjayankur31 opened this issue Jul 12, 2024 · 3 comments

Comments

@sanjayankur31
Copy link

sanjayankur31 commented Jul 12, 2024

The warning is meant to be shown when "But" is at the start of paragraphs. However, in its current implementation, it seems to check for "But" at the beginning of each new line in the body of the text. This is incorrect for formats that normalise white spaces and allow semantic line breaks. They can have "But" at the start of a new line within a paragraph (at the start of or within a sentence).

In rst/markdown/TeX, a new paragraph must be preceded by an empty line.

So:

This is a sentence.
But this sentence is not the beginning of a new paragraph.
The warning should not be shown here.

But, it should be shown here.

The warning should appear at the second "But", but not at the first.

@sanjayankur31 sanjayankur31 changed the title misc.but No paragraph should start with a 'But': checks starts of sentences too, not just paragraphs (rst/TeX) misc.but No paragraph should start with a 'But': checks starts of new lines which may not all indicate new paragraphs (rst/TeX) Jul 12, 2024
@Nytelife26
Copy link
Member

This is meant to be addressed in the code, by using a case-sensitive match. If you're getting false positives from it anyway, that indicates a problem with the ignore_case switch.

I'll try to verify this later, although the check has been updated in #1371, which may have inadvertently fixed this issue. I'll get back to you either way.

@sanjayankur31
Copy link
Author

Thanks for looking into this @Nytelife26 . Sorry, my issues description wasn't clear. I've updated it now.

A sentence
but continues in the next line

does not generate a warning. So this case is fine.

However, with a capital "But" at the start of a sentence, but not a new paragraph, it still does:

A sentence.
But at the start of new sentence not a new paragraph in rst/markdown/TeX.

In formats like rst/markdown/TeX, this isn't at the start of a new paragraph. A new paragraph needs to be preceded by an empty line in these formats:

A sentence or paragraph.

But at the start of a new paragraph, because there's an empty line before this sentence.

So, I think the check needs to be on the lines of: "But" (capital b) at the start of a sentence that is preceded by an empty line.

@Nytelife26
Copy link
Member

it was perfectly clear, looking back on it. i was tired when i read your issue and wrote the reply, so my apologies for that.

this should be relatively trivial to fix, and i'll add a test for it while i'm at it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants