Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(348)

Side by Side Diff: sdk/lib/_internal/dartdoc/lib/src/markdown/block_parser.dart

Issue 11783009: Big merge from experimental to bleeding edge. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 7 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file
2 // for details. All rights reserved. Use of this source code is governed by a 2 // for details. All rights reserved. Use of this source code is governed by a
3 // BSD-style license that can be found in the LICENSE file. 3 // BSD-style license that can be found in the LICENSE file.
4 4
5 part of markdown; 5 part of markdown;
6 6
7 /// The line contains only whitespace or is empty. 7 /// The line contains only whitespace or is empty.
8 final _RE_EMPTY = new RegExp(r'^([ \t]*)$'); 8 final _RE_EMPTY = new RegExp(r'^([ \t]*)$');
9 9
10 /// A series of `=` or `-` (on the next line) define setext-style headers. 10 /// A series of `=` or `-` (on the next line) define setext-style headers.
(...skipping 117 matching lines...) Expand 10 before | Expand all | Expand 10 after
128 childLines.add(match[1]); 128 childLines.add(match[1]);
129 parser.advance(); 129 parser.advance();
130 } 130 }
131 131
132 return childLines; 132 return childLines;
133 } 133 }
134 134
135 /// Gets whether or not [parser]'s current line should end the previous block. 135 /// Gets whether or not [parser]'s current line should end the previous block.
136 static bool isAtBlockEnd(BlockParser parser) { 136 static bool isAtBlockEnd(BlockParser parser) {
137 if (parser.isDone) return true; 137 if (parser.isDone) return true;
138 return syntaxes.some((s) => s.canParse(parser) && s.canEndBlock); 138 return syntaxes.any((s) => s.canParse(parser) && s.canEndBlock);
139 } 139 }
140 } 140 }
141 141
142 class EmptyBlockSyntax extends BlockSyntax { 142 class EmptyBlockSyntax extends BlockSyntax {
143 RegExp get pattern => _RE_EMPTY; 143 RegExp get pattern => _RE_EMPTY;
144 144
145 Node parse(BlockParser parser) { 145 Node parse(BlockParser parser) {
146 parser.advance(); 146 parser.advance();
147 147
148 // Don't actually emit anything. 148 // Don't actually emit anything.
(...skipping 306 matching lines...) Expand 10 before | Expand all | Expand 10 after
455 while (!BlockSyntax.isAtBlockEnd(parser)) { 455 while (!BlockSyntax.isAtBlockEnd(parser)) {
456 childLines.add(parser.current); 456 childLines.add(parser.current);
457 parser.advance(); 457 parser.advance();
458 } 458 }
459 459
460 final contents = parser.document.parseInline( 460 final contents = parser.document.parseInline(
461 Strings.join(childLines, '\n')); 461 Strings.join(childLines, '\n'));
462 return new Element('p', contents); 462 return new Element('p', contents);
463 } 463 }
464 } 464 }
OLDNEW
« no previous file with comments | « sdk/lib/_internal/dartdoc/lib/src/json_serializer.dart ('k') | sdk/lib/_internal/dartdoc/lib/src/markdown/html_renderer.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698