Sublime Forum

Title Case Capitalizes After Apostrophe . .

#1

The Dynamics Of The King’S Island Flood Relief Scheme

This is the sort of thing that happens under existing ST 4200.

I wonder if any tweak is possible to eliminate this erroneous capitalizing after an apostrophe . . .

0 Likes

#2

If you inspect Packages/Default/transform.py, you will see all the title_case command does is call Python’s title method on the string, so the bug is interestingly in Python 3.8

To work around it, open that file with the OverrideAudit plugin and change the relevant line (#38) to return s.title().replace("'S", "'s") and save it.

1 Like

#4

Use Override Audit, you can install it from Package Control, and then you’ll see entries in the Command Palette to kxplore the packages

0 Likes

#5

Installed OverrideAudit plugin.

Tools > OverrideAudit > Open Resource > Default > transform.py

Edited return s.title() --> return s.title().replace("'S “, " 's”) and saved.

Tested after restarting machine. Doesn’t work despite the code change.

I note that transform.py function is now referred to within OverrideAudit as transform.py[Override] but that is hardly making a difference.

0 Likes

#6

But your code looks for a space before the apostrophe, and there isn’t one in your text

1 Like

#7
class TitleCaseCommand(Transformer):
    @staticmethod
    def transformer(s):
        return s.title().replace("'S", "'s")

That is the code in the Python method.

And it doesn’t work.

0 Likes

#8

Weird because it works for me

0 Likes