We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 04774df commit e54b808Copy full SHA for e54b808
lib/parse/lex.js
@@ -19,13 +19,17 @@ function splitSections(nodes) {
19
20
// What is the type of this section
21
function sectionType(nodes, idx) {
22
- var codeNodes = _.filter(nodes, {
23
- type: 'code'
24
- }).length;
+ var codeType = { type: 'code' };
+
+ // Number of code nodes in section
25
+ var len = _.filter(nodes, codeType).length;
26
27
if(
- (codeNodes === 3 || codeNodes === 4) &&
28
- (idx % 2) === 1)
+ // Got 3 or 4 code blocks
29
+ (len === 3 || len === 4) &&
30
+ // Ensure all nodes are at the end
31
+ _.all(_.last(nodes, len), codeType)
32
+ )
33
{
34
return 'exercise';
35
}
0 commit comments