summaryrefslogtreecommitdiffstats
path: root/flashcards
diff options
context:
space:
mode:
authorEduardo Pedroni <e.pedroni91@gmail.com>2017-02-23 10:16:59 +0100
committerEduardo Pedroni <e.pedroni91@gmail.com>2017-02-23 10:16:59 +0100
commita490027e0c4c8cf70774382b586e3e66d7e7b274 (patch)
tree5fd41fa999f7e044c1065e65331d3c320bec9b64 /flashcards
parent9d45ae4034d1ef7999a598f6a5b2433632e92ed6 (diff)
Fixed bug where last card was not loaded, multiple line breaks between cards are no longer printed
Diffstat (limited to 'flashcards')
-rwxr-xr-xflashcards4
1 files changed, 3 insertions, 1 deletions
diff --git a/flashcards b/flashcards
index 1cbcfc6..0b57dbe 100755
--- a/flashcards
+++ b/flashcards
@@ -38,11 +38,13 @@ def extractCards(f):
match = re.match(cardRegex, l)
if match:
if front != "":
- cards.append([front, back])
+ cards.append([front.strip(), back.strip()])
back = ""
front = match.string[prefixLength:]
else:
back += l
+ # do the last front-back pair before returning
+ cards.append([front.strip(), back.strip()])
return cards
# Loops serving cards to the user until the program is exited