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

Side by Side Diff: client/web/parameters.dart

Issue 149573008: Factor out the anchor prefix to easily allow switching to #! (Closed) Base URL: https://github.com/dart-lang/dartdoc-viewer.git@master
Patch Set: Fixes from review Created 6 years, 10 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 | « client/web/minimap-library.html ('k') | client/web/search.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 // 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.parameters; 5 library web.parameters;
6 6
7 import 'dart:html'; 7 import 'dart:html';
8 import 'package:dartdoc_viewer/item.dart'; 8 import 'package:dartdoc_viewer/item.dart';
9 import 'package:dartdoc_viewer/location.dart';
9 import 'package:polymer/polymer.dart'; 10 import 'package:polymer/polymer.dart';
10 import 'member.dart'; 11 import 'member.dart';
11 import 'type.dart'; 12 import 'type.dart';
12 13
13 @CustomTag("dartdoc-parameter") 14 @CustomTag("dartdoc-parameter")
14 class ParameterElement extends DartdocElement { 15 class ParameterElement extends DartdocElement {
15 @published List<Parameter> parameters = const []; 16 @published List<Parameter> parameters = const [];
16 17
17 ParameterElement.created() : super.created(); 18 ParameterElement.created() : super.created();
18 19
(...skipping 21 matching lines...) Expand all
40 var optionalOpeningDelimiter = 41 var optionalOpeningDelimiter =
41 optional.isEmpty ? '' : optional.first.isNamed ? '{' : '['; 42 optional.isEmpty ? '' : optional.first.isNamed ? '{' : '[';
42 outerSpan.appendText(optionalOpeningDelimiter); 43 outerSpan.appendText(optionalOpeningDelimiter);
43 } 44 }
44 for (var element in elements) { 45 for (var element in elements) {
45 // Since a dartdoc-annotation cannot be instantiated from Dart code, 46 // Since a dartdoc-annotation cannot be instantiated from Dart code,
46 // the annotations must be built manually. 47 // the annotations must be built manually.
47 element.annotations.annotations.forEach((annotation) { 48 element.annotations.annotations.forEach((annotation) {
48 var anchor = new AnchorElement() 49 var anchor = new AnchorElement()
49 ..text = '@${annotation.simpleType}' 50 ..text = '@${annotation.simpleType}'
50 ..href = '#${annotation.location}'; 51 ..href = '${locationPrefixed(annotation.location)}';
51 outerSpan.append(anchor); 52 outerSpan.append(anchor);
52 outerSpan.appendText(' '); 53 outerSpan.appendText(' ');
53 }); 54 });
54 // Skip dynamic as an outer parameter type (but not as generic) 55 // Skip dynamic as an outer parameter type (but not as generic)
55 var space = ''; 56 var space = '';
56 if (!element.type.isDynamic) { 57 if (!element.type.isDynamic) {
57 outerSpan.append(new TypeElement()..type = element.type); 58 outerSpan.append(new TypeElement()..type = element.type);
58 space = ' '; 59 space = ' ';
59 } 60 }
60 var parameterName = new AnchorElement() 61 var parameterName = new AnchorElement()
61 ..text = element.name 62 ..text = element.name
62 ..href = "#${element.anchorHref}" 63 ..href = element.prefixedAnchorHref
63 ..id = "${element.anchorHrefLocation.anchor}"; 64 ..id = element.anchorHrefLocation.anchor;
64 outerSpan.appendText(space); 65 outerSpan.appendText(space);
65 outerSpan.append(parameterName); 66 outerSpan.append(parameterName);
66 outerSpan.appendText(element.decoration); 67 outerSpan.appendText(element.decoration);
67 if (className == 'required' && optional.isNotEmpty || 68 if (className == 'required' && optional.isNotEmpty ||
68 element != elements.last) { 69 element != elements.last) {
69 outerSpan.appendText(', '); 70 outerSpan.appendText(', ');
70 } 71 }
71 } 72 }
72 if (className == 'optional') { 73 if (className == 'optional') {
73 var optionalClosingDelimiter = 74 var optionalClosingDelimiter =
74 optional.isEmpty ? '' : optional.first.isNamed ? '}' : ']'; 75 optional.isEmpty ? '' : optional.first.isNamed ? '}' : ']';
75 outerSpan.appendText(optionalClosingDelimiter); 76 outerSpan.appendText(optionalClosingDelimiter);
76 } 77 }
77 this.append(outerSpan); 78 this.append(outerSpan);
78 } 79 }
79 } 80 }
OLDNEW
« no previous file with comments | « client/web/minimap-library.html ('k') | client/web/search.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698