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

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

Issue 11410033: Make RegExp's constructor non-const. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Move out RegExp constructors to top-level elements. 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
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 String renderToHtml(List<Node> nodes) => new HtmlRenderer().render(nodes); 7 String renderToHtml(List<Node> nodes) => new HtmlRenderer().render(nodes);
8 8
9 /// Translates a parsed AST to HTML. 9 /// Translates a parsed AST to HTML.
10 class HtmlRenderer implements NodeVisitor { 10 class HtmlRenderer implements NodeVisitor {
11 static const _BLOCK_TAGS = const RegExp( 11 static const _BLOCK_TAGS = new RegExp(
12 'blockquote|h1|h2|h3|h4|h5|h6|hr|p|pre'); 12 'blockquote|h1|h2|h3|h4|h5|h6|hr|p|pre');
13 13
14 StringBuffer buffer; 14 StringBuffer buffer;
15 15
16 HtmlRenderer(); 16 HtmlRenderer();
17 17
18 String render(List<Node> nodes) { 18 String render(List<Node> nodes) {
19 buffer = new StringBuffer(); 19 buffer = new StringBuffer();
20 20
21 for (final node in nodes) node.accept(this); 21 for (final node in nodes) node.accept(this);
(...skipping 30 matching lines...) Expand all
52 } else { 52 } else {
53 buffer.add('>'); 53 buffer.add('>');
54 return true; 54 return true;
55 } 55 }
56 } 56 }
57 57
58 void visitElementAfter(Element element) { 58 void visitElementAfter(Element element) {
59 buffer.add('</${element.tag}>'); 59 buffer.add('</${element.tag}>');
60 } 60 }
61 } 61 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698