aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/deck.rs4
1 files changed, 3 insertions, 1 deletions
diff --git a/src/deck.rs b/src/deck.rs
index a414a02..70dfda1 100644
--- a/src/deck.rs
+++ b/src/deck.rs
@@ -39,7 +39,9 @@ pub fn read(deck: &str) -> Result<Vec<Entry>> {
message: "an entry should starts with “-”.".to_string(),
}));
} else {
- let translation = line[1..].trim().split(':').collect::<Vec<&str>>();
+ let without_minus = line.split('-').collect::<Vec<&str>>()[1].trim();
+ let without_comment = without_minus.split('#').collect::<Vec<&str>>()[0].trim();
+ let translation = without_comment.split(':').collect::<Vec<&str>>();
if translation.len() != 2 {
return Err(Error::from(ParseError {
line: index + 1,