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

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

Issue 11312203: "Reverting 14829-14832" (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: 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/markdown/block_parser.dart ('k') | samples/swarm/swarm_ui_lib/base/Device.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 String renderToHtml(List<Node> nodes) => new HtmlRenderer().render(nodes); 5 String renderToHtml(List<Node> nodes) => new HtmlRenderer().render(nodes);
6 6
7 /// Translates a parsed AST to HTML. 7 /// Translates a parsed AST to HTML.
8 class HtmlRenderer implements NodeVisitor { 8 class HtmlRenderer implements NodeVisitor {
9 static final _BLOCK_TAGS = new RegExp( 9 static const _BLOCK_TAGS = const RegExp(
10 'blockquote|h1|h2|h3|h4|h5|h6|hr|p|pre'); 10 'blockquote|h1|h2|h3|h4|h5|h6|hr|p|pre');
11 11
12 StringBuffer buffer; 12 StringBuffer buffer;
13 13
14 HtmlRenderer(); 14 HtmlRenderer();
15 15
16 String render(List<Node> nodes) { 16 String render(List<Node> nodes) {
17 buffer = new StringBuffer(); 17 buffer = new StringBuffer();
18 18
19 for (final node in nodes) node.accept(this); 19 for (final node in nodes) node.accept(this);
(...skipping 25 matching lines...) Expand all
45 } else { 45 } else {
46 buffer.add('>'); 46 buffer.add('>');
47 return true; 47 return true;
48 } 48 }
49 } 49 }
50 50
51 void visitElementAfter(Element element) { 51 void visitElementAfter(Element element) {
52 buffer.add('</${element.tag}>'); 52 buffer.add('</${element.tag}>');
53 } 53 }
54 } 54 }
OLDNEW
« no previous file with comments | « samples/markdown/block_parser.dart ('k') | samples/swarm/swarm_ui_lib/base/Device.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698