5
5
import '../ast.dart' ;
6
6
import '../block_parser.dart' ;
7
7
import '../charcode.dart' ;
8
+ import '../line.dart' ;
8
9
import '../patterns.dart' ;
9
10
import '../util.dart' ;
10
11
import 'block_syntax.dart' ;
@@ -19,32 +20,32 @@ class BlockquoteSyntax extends BlockSyntax {
19
20
const BlockquoteSyntax ();
20
21
21
22
@override
22
- List <String > parseChildLines (BlockParser parser) {
23
+ List <Line > parseChildLines (BlockParser parser) {
23
24
// Grab all of the lines that form the blockquote, stripping off the ">".
24
- final childLines = < String > [];
25
+ final childLines = < Line > [];
25
26
26
27
while (! parser.isDone) {
27
28
final currentLine = parser.current;
28
- final match = pattern.firstMatch (parser.current);
29
+ final match = pattern.firstMatch (parser.current.content );
29
30
if (match != null ) {
30
31
// A block quote marker consists of a `>` together with an optional
31
32
// following space of indentation, see
32
33
// https://spec.commonmark.org/0.30/#block-quote-marker.
33
34
final markerStart = match.match.indexOf ('>' );
34
35
int markerEnd;
35
- if (currentLine.length > 1 ) {
36
+ if (currentLine.content. length > 1 ) {
36
37
var hasSpace = false ;
37
38
// Check if there is a following space if the marker is not at the end
38
39
// of this line.
39
- if (markerStart < currentLine.length - 1 ) {
40
- final nextChar = currentLine.codeUnitAt (markerStart + 1 );
40
+ if (markerStart < currentLine.content. length - 1 ) {
41
+ final nextChar = currentLine.content. codeUnitAt (markerStart + 1 );
41
42
hasSpace = nextChar == $tab || nextChar == $space;
42
43
}
43
44
markerEnd = markerStart + (hasSpace ? 2 : 1 );
44
45
} else {
45
46
markerEnd = markerStart + 1 ;
46
47
}
47
- childLines.add (currentLine.substring (markerEnd));
48
+ childLines.add (Line ( currentLine.content. substring (markerEnd) ));
48
49
parser.advance ();
49
50
continue ;
50
51
}
@@ -59,10 +60,10 @@ class BlockquoteSyntax extends BlockSyntax {
59
60
final otherMatched =
60
61
parser.blockSyntaxes.firstWhere ((s) => s.canParse (parser));
61
62
if ((otherMatched is ParagraphSyntax &&
62
- lastLine.isNotEmpty &&
63
- ! codeFencePattern.hasMatch (lastLine)) ||
63
+ ! lastLine.isBlankLine &&
64
+ ! codeFencePattern.hasMatch (lastLine.content )) ||
64
65
(otherMatched is CodeBlockSyntax &&
65
- ! indentPattern.hasMatch (lastLine))) {
66
+ ! indentPattern.hasMatch (lastLine.content ))) {
66
67
childLines.add (parser.current);
67
68
parser.advance ();
68
69
} else {
0 commit comments