2828
2929from scriptshifter .exceptions import BREAK
3030from scriptshifter .hooks .korean import KCONF
31- from scriptshifter .tools import capitalize
31+ from scriptshifter .hooks . general import capitalize_post_assembly
3232
3333
3434PWD = path .dirname (path .realpath (__file__ ))
@@ -62,6 +62,12 @@ def s2r_nonames_post_config(ctx):
6262 ctx .dest , ctx .warnings = _romanize_nonames (
6363 ctx .src , ctx .options )
6464
65+ if ctx .dest :
66+ # FKR042: Capitalize all first letters
67+ # FKR043: Capitalize the first letter
68+ logger .debug (f"Before capitalization: { ctx .dest } " )
69+ ctx .dest = capitalize_post_assembly (ctx )
70+
6571 return BREAK
6672
6773
@@ -74,6 +80,12 @@ def s2r_names_post_config(ctx):
7480 """
7581 ctx .dest , ctx .warnings = _romanize_names (ctx .src , ctx .options )
7682
83+ if ctx .dest :
84+ # FKR042: Capitalize all first letters
85+ # FKR043: Capitalize the first letter
86+ logger .debug (f"Before capitalization: { ctx .dest } " )
87+ ctx .dest = capitalize_post_assembly (ctx )
88+
7789 return BREAK
7890
7991
@@ -105,19 +117,9 @@ def _romanize_nonames(src, options):
105117
106118 rom = _romanize_oclc_auto (kor )
107119
108- logger .debug (f"Before capitalization: { rom } " )
109- # FKR042: Capitalize all first letters
110- if options ["capitalize" ] == "all" :
111- rom = capitalize (rom )
112- # FKR043: Capitalize the first letter
113- elif options ["capitalize" ] == "first" :
114- rom = rom [0 ].upper () + rom [1 :]
115-
116120 # FKR044: Ambiguities
117121 ambi = re .sub ("[,.\" ;: ]+" , " " , rom )
118122
119- # TODO Decide what to do with these. There is no facility for outputting
120- # warnings or notes to the user yet.
121123 warnings = []
122124 _fkr_log (45 )
123125 for exp , warn in KCONF ["fkr045" ].items ():
@@ -308,10 +310,11 @@ def _kor_corp_name_rom(src):
308310 src = src [:- 4 ]
309311 yu = "R"
310312
311- rom_tok = []
312- for tok in src .split (" " ):
313- rom_tok .append (_romanize_oclc_auto (tok ))
314- rom = capitalize (" " .join (rom_tok ))
313+ rom_tok = [
314+ _romanize_oclc_auto (tok )
315+ for tok in src .split (" " )
316+ ]
317+ rom = " " .join (rom_tok )
315318
316319 if chu == "L" :
317320 rom = "(Chu) " + rom
0 commit comments