OLD | NEW |
1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2013, 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 library web.comment; | 5 library web.comment; |
6 | 6 |
7 import 'dart:html'; | 7 import 'dart:html'; |
8 import 'dart:js' as js; | 8 import 'dart:js' as js; |
9 import 'package:dartdoc_viewer/item.dart'; | 9 import 'package:dartdoc_viewer/item.dart'; |
10 import 'package:dartdoc_viewer/location.dart'; | 10 import 'package:dartdoc_viewer/location.dart'; |
(...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
76 /// If [link] refers to a method/function parameter, i.e. it's of the form | 76 /// If [link] refers to a method/function parameter, i.e. it's of the form |
77 /// dart-core.Object.doStuff.param OR | 77 /// dart-core.Object.doStuff.param OR |
78 /// dart-async.runZoned.param | 78 /// dart-async.runZoned.param |
79 /// representing either a method or a function. then replace it with the | 79 /// representing either a method or a function. then replace it with the |
80 /// last two elements as part of an @ tag instead. e.g. | 80 /// last two elements as part of an @ tag instead. e.g. |
81 /// dart-core.Object@id_doStuff.param. Return true if we did so. | 81 /// dart-core.Object@id_doStuff.param. Return true if we did so. |
82 bool _replaceWithParameterReference(AnchorElement link, DocsLocation loc) { | 82 bool _replaceWithParameterReference(AnchorElement link, DocsLocation loc) { |
83 var item = loc.item(viewer.homePage); | 83 var item = loc.item(viewer.homePage); |
84 if (item is! Parameter) return false; | 84 if (item is! Parameter) return false; |
85 var newAnchor = new AnchorElement() | 85 var newAnchor = new AnchorElement() |
86 ..href = "#${item.anchorHref}" | 86 ..href = item.prefixedAnchorHref |
87 ..text = loc.lastName; | 87 ..text = loc.lastName; |
88 link.replaceWith(newAnchor); | 88 link.replaceWith(newAnchor); |
89 return true; | 89 return true; |
90 } | 90 } |
91 | 91 |
92 void _resolveLink(AnchorElement link) { | 92 void _resolveLink(AnchorElement link) { |
93 if (link.href != '') return; | 93 if (link.href != '') return; |
94 var loc = new DocsLocation(link.text); | 94 var loc = new DocsLocation(link.text); |
95 if (_replaceWithParameterReference(link, loc)) return; | 95 if (_replaceWithParameterReference(link, loc)) return; |
96 if (searchIndex.map.containsKey(link.text)) { | 96 if (searchIndex.map.containsKey(link.text)) { |
(...skipping 15 matching lines...) Expand all Loading... |
112 return; | 112 return; |
113 } | 113 } |
114 // If markdown links to private or otherwise unknown members are | 114 // If markdown links to private or otherwise unknown members are |
115 // found, make them <i> tags instead of <a> tags for CSS. | 115 // found, make them <i> tags instead of <a> tags for CSS. |
116 link.replaceWith(new Element.tag('i')..text = link.text); | 116 link.replaceWith(new Element.tag('i')..text = link.text); |
117 } | 117 } |
118 | 118 |
119 void _setLinkReference(AnchorElement link, DocsLocation loc) { | 119 void _setLinkReference(AnchorElement link, DocsLocation loc) { |
120 var linkable = new LinkableType(loc.withAnchor); | 120 var linkable = new LinkableType(loc.withAnchor); |
121 link | 121 link |
122 ..href = '#${linkable.location}' | 122 ..href = locationPrefixed(linkable.location) |
123 ..text = linkable.simpleType; | 123 ..text = linkable.simpleType; |
124 } | 124 } |
125 } | 125 } |
OLD | NEW |