diff options
Diffstat (limited to 'lib/parse/lex.js')
-rw-r--r-- | lib/parse/lex.js | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/lib/parse/lex.js b/lib/parse/lex.js index cec6047..b77b844 100644 --- a/lib/parse/lex.js +++ b/lib/parse/lex.js @@ -34,6 +34,22 @@ function sectionType(nodes, idx) { return 'exercise'; } + if (nodes.length > 2) { + var nonBlockquoteNodes = nodes.slice(nodes[0].type === 'paragraph' ? 1 : 0); + nonBlockquoteNodes.splice(_.findIndex(nonBlockquoteNodes, { type: 'blockquote_start' }), + _.findIndex(nonBlockquoteNodes, { type: 'blockquote_end' })); + + if (nonBlockquoteNodes.length === 2) { + if (_.every(nonBlockquoteNodes, { type: 'table' })) { + if (_.every(nonBlockquoteNodes[0].cells, function(row) { + return _.every(row.slice(1), function(cell) { return cell === "( )"; }); + })) { + return 'quiz'; + } + } + } + } + return 'normal'; } |