Skip to content

Commit a255131

Browse files
committed
Fix capitalization hook.
1 parent 44b2e05 commit a255131

1 file changed

Lines changed: 7 additions & 5 deletions

File tree

scriptshifter/hooks/general/__init__.py

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,6 @@ def capitalize_post_assembly(ctx):
4545
return " ".join(dest_ls)
4646

4747

48-
4948
def normalize_spacing_post_assembly(ctx):
5049
"""
5150
Remove duplicate and unwanted whitespace around punctuation.
@@ -76,14 +75,17 @@ def normalize_spacing_post_assembly(ctx):
7675

7776
def _capitalize(src, which):
7877
"""
79-
Only capitalize first word and words preceded by space.
78+
capitalize first word only or all words.
8079
8180
NOTE: this function is only used for capitalizing hook-generated
8281
transliterations, which are not normally processed. Double cap rules are
8382
not applicable here.
8483
"""
8584
if which == "first":
86-
ctx.dest_ls[0] = ctx.dest_ls[0].upper()
85+
src[0] = src[0].capitalize()
86+
return src
87+
88+
if which == "all":
89+
return [tk[0].upper() + tk[1:] for tk in src]
8790

88-
elif which == "all":
89-
ctx.dest_ls = [tk[0].upper() + tk[1:] for tk in ctx.dest_ls]
91+
return src

0 commit comments

Comments
 (0)