OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 /** | 5 /** |
6 * @fileoverview This file is the controller for generating extension | 6 * @fileoverview This file is the controller for generating extension |
7 * doc pages. | 7 * doc pages. |
8 * | 8 * |
9 * It expects to have available via XHR (relative path): | 9 * It expects to have available via XHR (relative path): |
10 * 1) API_TEMPLATE which is the main template for the api pages. | 10 * 1) API_TEMPLATE which is the main template for the api pages. |
(...skipping 478 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
489 | 489 |
490 function getCallbackParameters(parameters) { | 490 function getCallbackParameters(parameters) { |
491 return parameters[parameters.length - 1]; | 491 return parameters[parameters.length - 1]; |
492 } | 492 } |
493 | 493 |
494 function getAnchorName(type, name, scope) { | 494 function getAnchorName(type, name, scope) { |
495 return type + "-" + (scope ? scope + "-" : "") + name; | 495 return type + "-" + (scope ? scope + "-" : "") + name; |
496 } | 496 } |
497 | 497 |
498 function shouldExpandObject(object) { | 498 function shouldExpandObject(object) { |
499 return (object.type == "object" && object.properties); | 499 return (object.type == "object" && object.properties) || |
| 500 (object.type == "array" && object.items && object.items.properties); |
500 } | 501 } |
501 | 502 |
502 function getPropertyListFromObject(object) { | 503 function getPropertyListFromObject(object) { |
503 var propertyList = []; | 504 var propertyList = []; |
504 for (var p in object.properties) { | 505 var properties = object.properties; |
505 var prop = object.properties[p]; | 506 if (!properties && object.type === "array" && object.items) { |
| 507 properties = object.items.properties; |
| 508 } |
| 509 for (var p in properties) { |
| 510 var prop = properties[p]; |
506 // Do not render properties marked as "nodoc": true. | 511 // Do not render properties marked as "nodoc": true. |
507 if (prop.nodoc) { | 512 if (prop.nodoc) { |
508 continue; | 513 continue; |
509 } | 514 } |
510 prop.name = p; | 515 prop.name = p; |
511 propertyList.push(prop); | 516 propertyList.push(prop); |
512 } | 517 } |
513 return propertyList; | 518 return propertyList; |
514 } | 519 } |
515 | 520 |
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
554 | 559 |
555 function sortByName(a, b) { | 560 function sortByName(a, b) { |
556 if (a.name < b.name) { | 561 if (a.name < b.name) { |
557 return -1; | 562 return -1; |
558 } | 563 } |
559 if (a.name > b.name) { | 564 if (a.name > b.name) { |
560 return 1; | 565 return 1; |
561 } | 566 } |
562 return 0; | 567 return 0; |
563 } | 568 } |
OLD | NEW |