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

Fixes the the majority of "The the" in chat messages (Part 1) #5087

Merged
merged 3 commits into from
Dec 4, 2023

Conversation

SabreML
Copy link
Member

@SabreML SabreML commented Dec 1, 2023

(Part 1/3 because there's about 100 files in total and it's easier to review if they're split up.)
Part 1: <You are here!>
Part 2: #5121
Part 3: #5139

About the pull request

Fixes instances of "The the item" and "A the item" in chat messages so that they display as "The item" and "A item" instead.

These were caused by DM's built-in Text Macros system either being used incorrectly, or used unintentionally.

DM outputs for various inputs:
/obj/improper_noun
	name = "test object"

var/obj/improper_noun/T = new()
"The [T] is formatted"          // Outputs as "The the test object is formatted"
"The [T.name] is formatted"     // Outputs as "The test object is formatted"
"\The [T] is formatted"         // Outputs as "The test object is formatted"
"\The [T.name] is formatted"    // Outputs as "The test object is formatted"
"A [T] is formatted"            // Outputs as "A the test object is formatted"
"A [T.name] is formatted"       // Outputs as "A test object is formatted"
"\A [T] is formatted"           // Outputs as "A test object is formatted"
"\A [T.name] is formatted"      // Outputs as "A test object is formatted"

/obj/proper_noun
	name = "Test Object"

var/obj/proper_noun/T = new()
"The [T] is formatted"          // Outputs as "The Test Object is formatted"
"The [T.name] is formatted"     // Outputs as "The Test Object is formatted"
"\The [T] is formatted"         // Outputs as "Test Object is formatted"
"\The [T.name] is formatted"    // Outputs as "Test Object is formatted"
"A [T] is formatted"            // Outputs as "A Test Object is formatted"
"A [T.name] is formatted"       // Outputs as "A Test Object is formatted"
"\A [T] is formatted"           // Outputs as "Test Object is formatted"
"\A [T.name] is formatted"      // Outputs as "Test Object is formatted"

(Code validation here in Coderbus)


I've tried to avoid touching anything that already works properly in-game in order to keep the PR size down, even if the manner in which it's working isn't the "correct" way (things like improper nouns being capitalised and vice versa).
I did edit the names of some items in chem_grenade.dm though, since they needed to be changed for the /obj/item/explosive/proc/toggle_blast_dampener() proc to display its message properly.


RegEx used:
^(?!.*(?:\/{2,}|\/\*|\* )).*?[^\\](?:the|a) \[.+\] (https://regexr.com/7o5vd)
(For search only. All replacements were done manually and I skipped a lot of false positives.)

Bad regex explanation:
^             == Beginning of the line.

(?!           == Negative lookahead START (If this group matches anything further in the line, discard this result.)
  .*          == 0 or more characters. (e.g. indentation)

  (?:         == Non-capturing group START (Capturing vs non-capturing actually makes no difference here since nothing's being replaced)
    \/{2,}    == 2 or more forward slash '/' characters ('//' or '///' at the start of the line is a comment)
    |         == OR
    \/\*      == One forward slash and an asterisk. (Block comment start)
    |         == OR
    \*        == A single asterisk followed by a space. (Middle of a block comment)
  )           == Non-capturing group END

)             == Negative lookahead END

.*?           == 0 or more characters with a 'lazy' quantifier so that it matches as few as possible.

[^\\]         == Negated character set containing a backslash. (Match any character that is not a '\'. (This filters out "\the [item]" results))

(?:           == Non-capturing group START
  the|a       == Match 'the' or 'a'. (As in "the [item]"/ "a [item]")
)             == Non-capturing group END

 \[.+\]       == Match opening and closing square brackets with 1 or more characters inside them.

Explain why it's good for the game

"Typo" fixes.

Testing Photographs and Procedure

Screenshots

(I took these screenshots before I split the PR into smaller parts and I'm posting it pretty late at night, so some of these examples might not actually be included in this PR.)
(I can take new ones later if that's requested later.)

Before:
sandwich before

pizza before

cigarette before

barricade before

magazine box before

After:
sandwich after

pizza after

cigarette after

barricade after

magazine box after

Changelog

🆑
spellcheck: Fixed instances of "The the" and "A the" in chat messages so that they're just "The" instead. (Part 1)
/:cl:

Required for the `toggle_blast_dampener()` text to display properly.
@github-actions github-actions bot added the Grammar and Formatting Fixes the codebase's tpyos and grammatical's errors label Dec 1, 2023
@Drulikar
Copy link
Contributor

Drulikar commented Dec 1, 2023

This change is generally only applicable to atom insertions (as in "some text [atom_insert] some text"). When they are either capitalized or are forced proper with \proper they won't generate a the .

You'd be better off instead changing all instances of the to \the or The to \The along with a, an, etc. See https://www.byond.com/docs/ref/#/DM/text/macros but note that the \the macros are also probably going to need to be followed by an atom insertion to behave properly.

@Drulikar
Copy link
Contributor

Drulikar commented Dec 1, 2023

Since I see you were already using \a in some cases, you probably already know about that behavior though. So as long as all the changes work out; its fine.

Copy link
Member

@fira fira left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good overall

code/game/objects/items/lightstick.dm Outdated Show resolved Hide resolved
Plus a bit extra in `/obj/item/lightstick/attack_hand()` because it's right there.
@Drulikar Drulikar added this pull request to the merge queue Dec 4, 2023
Merged via the queue into cmss13-devs:master with commit 5998e00 Dec 4, 2023
26 checks passed
cm13-github added a commit that referenced this pull request Dec 4, 2023
github-merge-queue bot pushed a commit that referenced this pull request Dec 6, 2023
# About the pull request
Fixes instances of `"The the item"` and `"A the item"` in chat messages
so that they display as `"The item"` and `"A item"` instead.

See #5087 for more details.

# Explain why it's good for the game

Better english I guess.

# Testing Photographs and Procedure
<details>
<summary>Screenshots</summary>

**Before:**

![old](https://github.com/cmss13-devs/cmss13/assets/57483089/649bf896-e712-4f8c-9e7f-d64403a1e45a)

![pizza
before](https://github.com/cmss13-devs/cmss13/assets/57483089/d00a158f-fcab-4aec-b044-f5d591b12aad)

![cigarette
before](https://github.com/cmss13-devs/cmss13/assets/57483089/463a0b36-1ee9-4b3b-bf63-36326edd04c3)

![barricade
before](https://github.com/cmss13-devs/cmss13/assets/57483089/92bffce0-c2f4-47c9-8358-b9c36474c787)

**After:**

![new](https://github.com/cmss13-devs/cmss13/assets/57483089/991a230c-2e5a-4dac-8d32-4af91b957715)

![pizza
after](https://github.com/cmss13-devs/cmss13/assets/57483089/9bfb1388-d712-4386-beca-0c924e4f1adf)

![cigarette
after](https://github.com/cmss13-devs/cmss13/assets/57483089/fd707f3e-583e-49da-97c9-9972f9013de3)

![barricade
after](https://github.com/cmss13-devs/cmss13/assets/57483089/65d8d0c3-921a-41c2-a640-27f184db01d8)

</details>


# Changelog
:cl:
spellcheck: Fixed instances of "The the" and "A the" in chat messages so
that they're just "The" instead. (Part 2)
/:cl:
github-merge-queue bot pushed a commit that referenced this pull request Dec 7, 2023
# About the pull request

Part 1: #5087
Part 2: #5121
Part 3: \<You are here!\>

Third and final part of the 'The the' trilogy!
Please see the first PR (#5087) for more details.

# Explain why it's good for the game


![image](https://github.com/cmss13-devs/cmss13/assets/57483089/04c7cace-6360-4eb3-a910-cda7c2a9ee9e)


# Changelog
:cl:
spellcheck: Fixed instances of "The the" and "A the" in chat messages so
that they're just "The" instead. (Part 3)
/:cl:
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Grammar and Formatting Fixes the codebase's tpyos and grammatical's errors
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants