diff --git a/rslib/src/cloze.rs b/rslib/src/cloze.rs index 5aab2e83f..1fb97ed85 100644 --- a/rslib/src/cloze.rs +++ b/rslib/src/cloze.rs @@ -158,11 +158,15 @@ fn parse_text_with_clozes(text: &str) -> Vec> { let mut output = vec![]; for token in tokenize(text) { match token { - Token::OpenCloze(ordinal) => open_clozes.push(ExtractedCloze { - ordinal, - nodes: Vec::with_capacity(1), // common case - hint: None, - }), + Token::OpenCloze(ordinal) => { + if open_clozes.len() < 3 { + open_clozes.push(ExtractedCloze { + ordinal, + nodes: Vec::with_capacity(1), // common case + hint: None, + }) + } + } Token::Text(mut text) => { if let Some(cloze) = open_clozes.last_mut() { // extract hint if found