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

Side by Side Diff: samples/markdown/block_parser.dart

Issue 11273041: Make first and last getters. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Update status files with co19 issue number. Created 8 years, 1 month 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
« no previous file with comments | « samples/calculator/tape.dart ('k') | samples/markdown/inline_parser.dart » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2011, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2011, 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 /// The line contains only whitespace or is empty. 5 /// The line contains only whitespace or is empty.
6 const _RE_EMPTY = const RegExp(r'^([ \t]*)$'); 6 const _RE_EMPTY = const RegExp(r'^([ \t]*)$');
7 7
8 /// A series of `=` or `-` (on the next line) define setext-style headers. 8 /// A series of `=` or `-` (on the next line) define setext-style headers.
9 const _RE_SETEXT = const RegExp(r'^((=+)|(-+))$'); 9 const _RE_SETEXT = const RegExp(r'^((=+)|(-+))$');
10 10
(...skipping 282 matching lines...) Expand 10 before | Expand all | Expand 10 after
293 } else if (tryMatch(_RE_INDENT)) { 293 } else if (tryMatch(_RE_INDENT)) {
294 // Strip off indent and add to current item. 294 // Strip off indent and add to current item.
295 childLines.add(match[1]); 295 childLines.add(match[1]);
296 } else if (BlockSyntax.isAtBlockEnd(parser)) { 296 } else if (BlockSyntax.isAtBlockEnd(parser)) {
297 // Done with the list. 297 // Done with the list.
298 break; 298 break;
299 } else { 299 } else {
300 // Anything else is paragraph text or other stuff that can be in a list 300 // Anything else is paragraph text or other stuff that can be in a list
301 // item. However, if the previous item is a blank line, this means we're 301 // item. However, if the previous item is a blank line, this means we're
302 // done with the list and are starting a new top-level paragraph. 302 // done with the list and are starting a new top-level paragraph.
303 if ((childLines.length > 0) && (childLines.last() == '')) break; 303 if ((childLines.length > 0) && (childLines.last == '')) break;
304 childLines.add(parser.current); 304 childLines.add(parser.current);
305 } 305 }
306 parser.advance(); 306 parser.advance();
307 } 307 }
308 308
309 endItem(); 309 endItem();
310 310
311 // Markdown, because it hates us, specifies two kinds of list items. If you 311 // Markdown, because it hates us, specifies two kinds of list items. If you
312 // have a list like: 312 // have a list like:
313 // 313 //
(...skipping 113 matching lines...) Expand 10 before | Expand all | Expand 10 after
427 while (!BlockSyntax.isAtBlockEnd(parser)) { 427 while (!BlockSyntax.isAtBlockEnd(parser)) {
428 childLines.add(parser.current); 428 childLines.add(parser.current);
429 parser.advance(); 429 parser.advance();
430 } 430 }
431 431
432 final contents = parser.document.parseInline( 432 final contents = parser.document.parseInline(
433 Strings.join(childLines, '\n')); 433 Strings.join(childLines, '\n'));
434 return new Element('p', contents); 434 return new Element('p', contents);
435 } 435 }
436 } 436 }
OLDNEW
« no previous file with comments | « samples/calculator/tape.dart ('k') | samples/markdown/inline_parser.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698