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

Side by Side Diff: pkg/third_party/html5lib/test/support.dart

Issue 178843003: [html5lib] triple slash comment style (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: remove extra check Created 6 years, 9 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 /** Support code for the tests in this directory. */ 1 /// Support code for the tests in this directory.
2 library support; 2 library support;
3 3
4 import 'dart:io'; 4 import 'dart:io';
5 import 'dart:collection'; 5 import 'dart:collection';
6 import 'package:path/path.dart' as path; 6 import 'package:path/path.dart' as path;
7 import 'package:html5lib/src/treebuilder.dart'; 7 import 'package:html5lib/src/treebuilder.dart';
8 import 'package:html5lib/dom.dart'; 8 import 'package:html5lib/dom.dart';
9 import 'package:html5lib/dom_parsing.dart'; 9 import 'package:html5lib/dom_parsing.dart';
10 10
11 typedef TreeBuilder TreeBuilderFactory(bool namespaceHTMLElements); 11 typedef TreeBuilder TreeBuilderFactory(bool namespaceHTMLElements);
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after
65 data[key] = '${data[key]}$line\n'; 65 data[key] = '${data[key]}$line\n';
66 } 66 }
67 } 67 }
68 68
69 if (data.length > 0) { 69 if (data.length > 0) {
70 result.add(normaliseOutput(data)); 70 result.add(normaliseOutput(data));
71 } 71 }
72 return result; 72 return result;
73 } 73 }
74 74
75 /** 75 /// If the current heading is a test section heading return the heading,
76 * If the current heading is a test section heading return the heading, 76 /// otherwise return null.
77 * otherwise return null.
78 */
79 static String sectionHeading(String line) { 77 static String sectionHeading(String line) {
80 return line.startsWith("#") ? line.substring(1).trim() : null; 78 return line.startsWith("#") ? line.substring(1).trim() : null;
81 } 79 }
82 80
83 static Map normaliseOutput(Map data) { 81 static Map normaliseOutput(Map data) {
84 // Remove trailing newlines 82 // Remove trailing newlines
85 data.forEach((key, value) { 83 data.forEach((key, value) {
86 if (value.endsWith("\n")) { 84 if (value.endsWith("\n")) {
87 data[key] = value.substring(0, value.length - 1); 85 data[key] = value.substring(0, value.length - 1);
88 } 86 }
89 }); 87 });
90 return data; 88 return data;
91 } 89 }
92 } 90 }
93 91
94 /** 92 /// Serialize the [document] into the html5 test data format.
95 * Serialize the [document] into the html5 test data format.
96 */
97 testSerializer(Document document) { 93 testSerializer(Document document) {
98 return (new TestSerializer()..visit(document)).toString(); 94 return (new TestSerializer()..visit(document)).toString();
99 } 95 }
100 96
101 /** Serializes the DOM into test format. See [testSerializer]. */ 97 /// Serializes the DOM into test format. See [testSerializer].
102 class TestSerializer extends TreeVisitor { 98 class TestSerializer extends TreeVisitor {
103 final StringBuffer _str; 99 final StringBuffer _str;
104 int _indent = 0; 100 int _indent = 0;
105 String _spaces = ''; 101 String _spaces = '';
106 102
107 TestSerializer() : _str = new StringBuffer(); 103 TestSerializer() : _str = new StringBuffer();
108 104
109 String toString() => _str.toString(); 105 String toString() => _str.toString();
110 106
111 int get indent => _indent; 107 int get indent => _indent;
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after
158 key = "${attr.prefix} ${attr.name}"; 154 key = "${attr.prefix} ${attr.name}";
159 } 155 }
160 _newline(); 156 _newline();
161 _str.write('$key="$v"'); 157 _str.write('$key="$v"');
162 } 158 }
163 indent -= 2; 159 indent -= 2;
164 } 160 }
165 visitChildren(node); 161 visitChildren(node);
166 } 162 }
167 } 163 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698