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

Side by Side Diff: utils/apidoc/mdn/extract.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 | « utils/apidoc/html_diff.dart ('k') | utils/pub/git_source.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 import 'dart:html'; 1 import 'dart:html';
2 import 'dart:json'; 2 import 'dart:json';
3 3
4 // Workaround for HTML lib missing feature. 4 // Workaround for HTML lib missing feature.
5 Range newRange() { 5 Range newRange() {
6 return document.createRange(); 6 return document.createRange();
7 } 7 }
8 8
9 // Temporary range object to optimize performance computing client rects 9 // Temporary range object to optimize performance computing client rects
10 // from text nodes. 10 // from text nodes.
(...skipping 673 matching lines...) Expand 10 before | Expand all | Expand 10 after
684 for (Element child in e.queryAll("span")) { 684 for (Element child in e.queryAll("span")) {
685 String t = child.text.toLowerCase(); 685 String t = child.text.toLowerCase();
686 if (t.startsWith("obsolete") || t.startsWith("deprecated")) return true; 686 if (t.startsWith("obsolete") || t.startsWith("deprecated")) return true;
687 } 687 }
688 688
689 String text = e.text.toLowerCase(); 689 String text = e.text.toLowerCase();
690 return obsoleteRegExp.hasMatch(text) || deprecatedRegExp.hasMatch(text); 690 return obsoleteRegExp.hasMatch(text) || deprecatedRegExp.hasMatch(text);
691 } 691 }
692 692
693 bool isFirstCharLowerCase(String str) { 693 bool isFirstCharLowerCase(String str) {
694 return new RegExp("^[a-z]").hasMatch(str); 694 return const RegExp("^[a-z]").hasMatch(str);
695 } 695 }
696 696
697 /** 697 /**
698 * Extracts information from a fragment of HTML only searching under the [root] 698 * Extracts information from a fragment of HTML only searching under the [root]
699 * html node. [secitonSelector] specifies the query to use to find candidate 699 * html node. [secitonSelector] specifies the query to use to find candidate
700 * sections of the document to consider (there may be more than one). 700 * sections of the document to consider (there may be more than one).
701 * [currentType] specifies the name of the current class. [members] specifies 701 * [currentType] specifies the name of the current class. [members] specifies
702 * the known class members for this class that we are attempting to find 702 * the known class members for this class that we are attempting to find
703 * documentation for. [propType] indicates whether we are searching for 703 * documentation for. [propType] indicates whether we are searching for
704 * methods, properties, constants, or constructors. 704 * methods, properties, constants, or constructors.
(...skipping 231 matching lines...) Expand 10 before | Expand all | Expand 10 after
936 } 936 }
937 } 937 }
938 } 938 }
939 939
940 String trimHtml(String html) { 940 String trimHtml(String html) {
941 // TODO(jacobr): implement this. Remove spurious enclosing HTML tags, etc. 941 // TODO(jacobr): implement this. Remove spurious enclosing HTML tags, etc.
942 return html; 942 return html;
943 } 943 }
944 944
945 bool maybeName(String name) { 945 bool maybeName(String name) {
946 return new RegExp("^[a-z][a-z0-9A-Z]+\$").hasMatch(name) || 946 return const RegExp("^[a-z][a-z0-9A-Z]+\$").hasMatch(name) ||
947 new RegExp("^[A-Z][A-Z_]*\$").hasMatch(name); 947 const RegExp("^[A-Z][A-Z_]*\$").hasMatch(name);
948 } 948 }
949 949
950 // TODO(jacobr): this element is ugly at the moment but will become easier to 950 // TODO(jacobr): this element is ugly at the moment but will become easier to
951 // read once ElementList supports most of the Element functionality. 951 // read once ElementList supports most of the Element functionality.
952 void markRemoved(var e) { 952 void markRemoved(var e) {
953 if (e != null) { 953 if (e != null) {
954 if (e is Element) { 954 if (e is Element) {
955 e.classes.add(DART_REMOVED); 955 e.classes.add(DART_REMOVED);
956 } else { 956 } else {
957 for (Element el in e) { 957 for (Element el in e) {
958 el.classes.add(DART_REMOVED); 958 el.classes.add(DART_REMOVED);
959 } 959 }
960 } 960 }
961 } 961 }
962 } 962 }
963 963
964 // TODO(jacobr): remove this when the dartium JSON parser handles \n correctly. 964 // TODO(jacobr): remove this when the dartium JSON parser handles \n correctly.
965 String JSONFIXUPHACK(String value) { 965 String JSONFIXUPHACK(String value) {
966 return value.replaceAll("\n", "ZDARTIUMDOESNTESCAPESLASHNJXXXX"); 966 return value.replaceAll("\n", "ZDARTIUMDOESNTESCAPESLASHNJXXXX");
967 } 967 }
968 968
969 String mozToWebkit(String name) { 969 String mozToWebkit(String name) {
970 return name.replaceFirst(new RegExp("^moz"), "webkit"); 970 return name.replaceFirst(const RegExp("^moz"), "webkit");
971 } 971 }
972 972
973 String stripWebkit(String name) { 973 String stripWebkit(String name) {
974 return trimPrefix(name, "webkit"); 974 return trimPrefix(name, "webkit");
975 } 975 }
976 976
977 // TODO(jacobr): be more principled about this. 977 // TODO(jacobr): be more principled about this.
978 String fullNameCleanup(String name) { 978 String fullNameCleanup(String name) {
979 int parenIndex = name.indexOf('('); 979 int parenIndex = name.indexOf('(');
980 if (parenIndex != -1) { 980 if (parenIndex != -1) {
(...skipping 133 matching lines...) Expand 10 before | Expand all | Expand 10 after
1114 } 1114 }
1115 1115
1116 // Flatten the list of known DOM types into a faster and case-insensitive 1116 // Flatten the list of known DOM types into a faster and case-insensitive
1117 // map. 1117 // map.
1118 domTypes = {}; 1118 domTypes = {};
1119 for (final domType in domTypesRaw) { 1119 for (final domType in domTypesRaw) {
1120 domTypes[domType.toLowerCase()] = domType; 1120 domTypes[domType.toLowerCase()] = domType;
1121 } 1121 }
1122 1122
1123 // Fix up links. 1123 // Fix up links.
1124 final SHORT_LINK = new RegExp(r'^[\w/]+$'); 1124 const SHORT_LINK = const RegExp(r'^[\w/]+$');
1125 final INNER_LINK = new RegExp(r'[Ee]n/(?:[\w/]+/|)([\w#.]+)(?:\(\))?$'); 1125 const INNER_LINK = const RegExp(r'[Ee]n/(?:[\w/]+/|)([\w#.]+)(?:\(\))?$');
1126 final MEMBER_LINK = new RegExp(r'(\w+)[.#](\w+)'); 1126 const MEMBER_LINK = const RegExp(r'(\w+)[.#](\w+)');
1127 final RELATIVE_LINK = new RegExp(r'^(?:../)*/?[Ee][Nn]/(.+)'); 1127 const RELATIVE_LINK = const RegExp(r'^(?:../)*/?[Ee][Nn]/(.+)');
1128 1128
1129 // - Make relative links absolute. 1129 // - Make relative links absolute.
1130 // - If we can, take links that point to other MDN pages and retarget them 1130 // - If we can, take links that point to other MDN pages and retarget them
1131 // to appropriate pages in our docs. 1131 // to appropriate pages in our docs.
1132 // TODO(rnystrom): Add rel external to links we didn't fix. 1132 // TODO(rnystrom): Add rel external to links we didn't fix.
1133 for (AnchorElement a in document.queryAll('a')) { 1133 for (AnchorElement a in document.queryAll('a')) {
1134 // Get the raw attribute because we *don't* want the browser to fully- 1134 // Get the raw attribute because we *don't* want the browser to fully-
1135 // qualify the name for us since it has the wrong base address for the 1135 // qualify the name for us since it has the wrong base address for the
1136 // page. 1136 // page.
1137 var href = a.attributes['href']; 1137 var href = a.attributes['href'];
(...skipping 167 matching lines...) Expand 10 before | Expand all | Expand 10 after
1305 } 1305 }
1306 1306
1307 void documentLoaded(event) { 1307 void documentLoaded(event) {
1308 // Load the database of expected methods and properties with an HttpRequest. 1308 // Load the database of expected methods and properties with an HttpRequest.
1309 new HttpRequest.get('${window.location}.json', (req) { 1309 new HttpRequest.get('${window.location}.json', (req) {
1310 data = JSON.parse(req.responseText); 1310 data = JSON.parse(req.responseText);
1311 dbEntry = {'members': [], 'srcUrl': pageUrl}; 1311 dbEntry = {'members': [], 'srcUrl': pageUrl};
1312 run(); 1312 run();
1313 }); 1313 });
1314 } 1314 }
OLDNEW
« no previous file with comments | « utils/apidoc/html_diff.dart ('k') | utils/pub/git_source.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698