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

Side by Side Diff: pkg/analysis_server/tool/spec/from_html.dart

Issue 1351323004: Add '<!doctype html>' to spec. (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Created 5 years, 3 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
« no previous file with comments | « pkg/analysis_server/doc/api.html ('k') | pkg/analysis_server/tool/spec/spec_input.html » ('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) 2014, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2014, 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 /** 5 /**
6 * Code for reading an HTML API description. 6 * Code for reading an HTML API description.
7 */ 7 */
8 library from.html; 8 library from.html;
9 9
10 import 'dart:io'; 10 import 'dart:io';
(...skipping 275 matching lines...) Expand 10 before | Expand all | Expand 10 after
286 return types; 286 return types;
287 } 287 }
288 288
289 /** 289 /**
290 * Read the API description from the file 'spec_input.html'. 290 * Read the API description from the file 'spec_input.html'.
291 */ 291 */
292 Api readApi() { 292 Api readApi() {
293 File htmlFile = new File('spec_input.html'); 293 File htmlFile = new File('spec_input.html');
294 String htmlContents = htmlFile.readAsStringSync(); 294 String htmlContents = htmlFile.readAsStringSync();
295 dom.Document document = parser.parse(htmlContents); 295 dom.Document document = parser.parse(htmlContents);
296 return apiFromHtml(document.firstChild); 296 dom.Element htmlElement = document.children
297 .singleWhere((element) => element.localName.toLowerCase() == 'html');
298 return apiFromHtml(htmlElement);
297 } 299 }
298 300
299 void recurse(dom.Element parent, String context, 301 void recurse(dom.Element parent, String context,
300 Map<String, ElementProcessor> elementProcessors) { 302 Map<String, ElementProcessor> elementProcessors) {
301 for (String key in elementProcessors.keys) { 303 for (String key in elementProcessors.keys) {
302 if (!specialElements.contains(key)) { 304 if (!specialElements.contains(key)) {
303 throw new Exception('$context: $key is not a special element'); 305 throw new Exception('$context: $key is not a special element');
304 } 306 }
305 } 307 }
306 for (dom.Node node in parent.nodes) { 308 for (dom.Node node in parent.nodes) {
(...skipping 229 matching lines...) Expand 10 before | Expand all | Expand 10 after
536 TypeDefinition typeDefinition = typeDefinitionFromHtml(child); 538 TypeDefinition typeDefinition = typeDefinitionFromHtml(child);
537 types[typeDefinition.name] = typeDefinition; 539 types[typeDefinition.name] = typeDefinition;
538 } 540 }
539 }); 541 });
540 return new Types(types, html); 542 return new Types(types, html);
541 } 543 }
542 544
543 typedef void ElementProcessor(dom.Element element); 545 typedef void ElementProcessor(dom.Element element);
544 546
545 typedef void TextProcessor(dom.Text text); 547 typedef void TextProcessor(dom.Text text);
OLDNEW
« no previous file with comments | « pkg/analysis_server/doc/api.html ('k') | pkg/analysis_server/tool/spec/spec_input.html » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698