| OLD | NEW |
| 1 /** | 1 /** |
| 2 * A library for extracting the documentation from the various HTML libraries | 2 * A library for extracting the documentation from the various HTML libraries |
| 3 * ([dart:html], [dart:svg], [dart:web_audio], [dart:indexed_db]) and saving | 3 * ([dart:html], [dart:svg], [dart:web_audio], [dart:indexed_db]) and saving |
| 4 * those documentation comments to a JSON file. | 4 * those documentation comments to a JSON file. |
| 5 */ | 5 */ |
| 6 | 6 |
| 7 library docs; | 7 library docs; |
| 8 | 8 |
| 9 import '../../../../sdk/lib/_internal/compiler/implementation/mirrors/mirrors.da
rt'; | 9 import '../../../../sdk/lib/_internal/compiler/implementation/mirrors/mirrors.da
rt'; |
| 10 import '../../../../sdk/lib/_internal/dartdoc/lib/src/json_serializer.dart'; | 10 import '../../../../sdk/lib/_internal/dartdoc/lib/src/json_serializer.dart'; |
| (...skipping 10 matching lines...) Expand all Loading... |
| 21 /** | 21 /** |
| 22 * Converts the libraries in [HTML_LIBRARY_NAMES] to a json file at [jsonPath] | 22 * Converts the libraries in [HTML_LIBRARY_NAMES] to a json file at [jsonPath] |
| 23 * given the library path at [libPath]. | 23 * given the library path at [libPath]. |
| 24 * | 24 * |
| 25 * The json output looks like: | 25 * The json output looks like: |
| 26 * { | 26 * { |
| 27 * $library_name: { | 27 * $library_name: { |
| 28 * $interface_name: { | 28 * $interface_name: { |
| 29 * comment: "$comment" | 29 * comment: "$comment" |
| 30 * members: { | 30 * members: { |
| 31 * $member: "$comment", | 31 * $member: [ |
| 32 * $comment1, |
| 33 * ... |
| 34 * ], |
| 32 * ... | 35 * ... |
| 33 * } | 36 * } |
| 34 * }, | 37 * }, |
| 35 * ... | 38 * ... |
| 36 * }, | 39 * }, |
| 37 * ... | 40 * ... |
| 38 * } | 41 * } |
| 39 * | 42 * |
| 40 * Returns `true` if any errors were encountered, `false` otherwise. | 43 * Returns `true` if any errors were encountered, `false` otherwise. |
| 41 */ | 44 */ |
| (...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 85 libMirror.classes.values.toList()); | 88 libMirror.classes.values.toList()); |
| 86 | 89 |
| 87 for (ClassMirror classMirror in sortedClasses) { | 90 for (ClassMirror classMirror in sortedClasses) { |
| 88 var classJson = {}; | 91 var classJson = {}; |
| 89 var sortedMembers = _sortAndFilterMirrors( | 92 var sortedMembers = _sortAndFilterMirrors( |
| 90 classMirror.members.values.toList()); | 93 classMirror.members.values.toList()); |
| 91 | 94 |
| 92 var membersJson = {}; | 95 var membersJson = {}; |
| 93 for (var memberMirror in sortedMembers) { | 96 for (var memberMirror in sortedMembers) { |
| 94 var memberDomName = domNames(memberMirror)[0]; | 97 var memberDomName = domNames(memberMirror)[0]; |
| 95 var memberComment = computeComment(memberMirror); | 98 var memberComment = computeUntrimmedCommentAsList(memberMirror); |
| 96 if (memberComment != null) { | 99 |
| 100 // Remove interface name from Dom Name. |
| 101 if (memberDomName.indexOf('.') >= 0) { |
| 102 memberDomName = memberDomName.slice(memberDomName.indexOf('.') + 1); |
| 103 } |
| 104 |
| 105 if (!memberComment.isEmpty) { |
| 97 membersJson.putIfAbsent(memberDomName, () => memberComment); | 106 membersJson.putIfAbsent(memberDomName, () => memberComment); |
| 98 } | 107 } |
| 99 } | 108 } |
| 100 | 109 |
| 101 var classComment = computeComment(classMirror); | 110 var classComment = computeUntrimmedCommentAsList(classMirror); |
| 102 if (classComment != null) { | 111 if (!classComment.isEmpty) { |
| 103 classJson.putIfAbsent('comment', () => classComment); | 112 classJson.putIfAbsent('comment', () => classComment); |
| 104 } | 113 } |
| 105 if (!membersJson.isEmpty) { | 114 if (!membersJson.isEmpty) { |
| 106 classJson.putIfAbsent('members', () => | 115 classJson.putIfAbsent('members', () => |
| 107 membersJson); | 116 membersJson); |
| 108 } | 117 } |
| 109 | 118 |
| 110 if (!classJson.isEmpty) { | 119 if (!classJson.isEmpty) { |
| 111 libraryJson.putIfAbsent(domNames(classMirror)[0], () => | 120 libraryJson.putIfAbsent(domNames(classMirror)[0], () => |
| 112 classJson); | 121 classJson); |
| (...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 148 for (var s in tags.reflectee.split(',')) { | 157 for (var s in tags.reflectee.split(',')) { |
| 149 domNames.add(s.trim()); | 158 domNames.add(s.trim()); |
| 150 } | 159 } |
| 151 | 160 |
| 152 if (domNames.length == 1 && domNames[0] == 'none') return <String>[]; | 161 if (domNames.length == 1 && domNames[0] == 'none') return <String>[]; |
| 153 return domNames; | 162 return domNames; |
| 154 } else { | 163 } else { |
| 155 return <String>[]; | 164 return <String>[]; |
| 156 } | 165 } |
| 157 } | 166 } |
| OLD | NEW |