mirror of
https://github.com/alvierahman90/otfmacros.git
synced 2024-12-15 12:01:59 +00:00
Add check before trying to second character of token
This commit is contained in:
parent
75587f7b3a
commit
f46662bc16
@ -11,8 +11,6 @@ def get_args():
|
||||
parser = argparse.ArgumentParser()
|
||||
parser.add_argument("-m", "--macros", default=["macros"], action="append",
|
||||
help="Extra files where macros are stored")
|
||||
parser.add_argument("-s", "--silent", default=False, action="store_true",
|
||||
help="Do not print processed file")
|
||||
parser.add_argument("input", help="The file to be processed")
|
||||
parser.add_argument("output", help="The location of the output")
|
||||
return parser.parse_args()
|
||||
@ -58,7 +56,6 @@ def pluralize(word, macro=None):
|
||||
|
||||
|
||||
def upper_check(token, word):
|
||||
lowercase = False
|
||||
all_caps = True
|
||||
|
||||
for letter in token:
|
||||
@ -69,6 +66,7 @@ def upper_check(token, word):
|
||||
if all_caps:
|
||||
return word.upper()
|
||||
|
||||
if len(token) > 1:
|
||||
if token[1].isupper():
|
||||
return word[:1].upper() + word[1:]
|
||||
|
||||
@ -166,9 +164,6 @@ def main(args):
|
||||
with open(args.output, 'w+') as file:
|
||||
file.write(output)
|
||||
|
||||
if not args.silent:
|
||||
print(output)
|
||||
|
||||
return 0
|
||||
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user