Skip to content

Commit

Permalink
use stringify()
Browse files Browse the repository at this point in the history
replace initial efforts with call to stringify() as suggested by Sergio
Corriea - simpler and faster … doh!
  • Loading branch information
Scott Koga-Browes authored and Scott Koga-Browes committed Dec 14, 2016
1 parent 46e517a commit 3fe8116
Showing 1 changed file with 1 addition and 7 deletions.
8 changes: 1 addition & 7 deletions abbrevs.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,13 +27,7 @@ def abbreplace(key, value, format, meta):
# add abbreviations from file metadata
for k, v in meta.items():#get keys, values for all metadata
if k.startswith('+'):# does the key start with a plus sign?
expan = ''# clear the string which the expansion will be stored in
for i in range(len(v['c'])):# check all elements in a metadata item
if v['c'][i]['t'] == 'Space': # if it's type 'space' then add a space to the result
expan = expan + " "
elif 'Str' in v['c'][i]['t']: # if it's a string, add the string
expan = expan + v['c'][i]['c']
abbrevlist[str(k.strip('+'))] = expan # add key and value to the abbrev dictionary
abbrevlist[str(k.strip('+'))] = stringify(v['c']) # add key and value to the abbrev dictionary

if key == 'Str' and value.startswith('+'):# is the string an abbrev? (starts with a plus?)
bare = value.strip('.,;:')# get the bare abbrev string
Expand Down

0 comments on commit 3fe8116

Please sign in to comment.