Skip to content

Commit

Permalink
remove cloze candidates that are only whitespace
Browse files Browse the repository at this point in the history
  • Loading branch information
tarix committed Jan 29, 2012
1 parent 2249739 commit ea24b52
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions mcd/cloze.py
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,8 @@ def createNote(self):
# Kanji/Hanzi
elif self.mode == 'kanji':
listClozes = listKanjiHanzi(self.clozes)
# remove any empty (whitespace only) entries
listClozes = [ clz for clz in listClozes if clz.strip() ]
# TODO: remove duplicates
# grab part of the card for the status update
excerpt = self.text[:10]
Expand All @@ -59,9 +61,6 @@ def createNote(self):
added = 0
num_cloze = 0
for clz in listClozes:
# skip empty clozes (for example double spaces)
if (clz.strip() == ''):
continue
num_cloze = num_cloze + 1
# process this cloze
self.text = clozeManual( self.text, clz, num_cloze )
Expand Down

0 comments on commit ea24b52

Please sign in to comment.