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

Side by Side Diff: chrome/common/extensions/docs/server2/api_data_source.py

Issue 39113003: Docserver: Display enum value descriptions in API docs. (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: Created 7 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
« no previous file with comments | « no previous file | chrome/common/extensions/docs/server2/app.yaml » ('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) 2012 The Chromium Authors. All rights reserved. 1 # Copyright (c) 2012 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 import copy 5 import copy
6 import json 6 import json
7 import logging 7 import logging
8 import os 8 import os
9 from collections import defaultdict, Mapping 9 from collections import defaultdict, Mapping
10 10
(...skipping 325 matching lines...) Expand 10 before | Expand all | Expand 10 after
336 dst_dict['choices'] = self._GenerateTypes(type_.choices) 336 dst_dict['choices'] = self._GenerateTypes(type_.choices)
337 # We keep track of which == last for knowing when to add "or" between 337 # We keep track of which == last for knowing when to add "or" between
338 # choices in templates. 338 # choices in templates.
339 if len(dst_dict['choices']) > 0: 339 if len(dst_dict['choices']) > 0:
340 dst_dict['choices'][-1]['last'] = True 340 dst_dict['choices'][-1]['last'] = True
341 elif type_.property_type == model.PropertyType.REF: 341 elif type_.property_type == model.PropertyType.REF:
342 dst_dict['link'] = self._GetLink(type_.ref_type) 342 dst_dict['link'] = self._GetLink(type_.ref_type)
343 elif type_.property_type == model.PropertyType.ARRAY: 343 elif type_.property_type == model.PropertyType.ARRAY:
344 dst_dict['array'] = self._GenerateType(type_.item_type) 344 dst_dict['array'] = self._GenerateType(type_.item_type)
345 elif type_.property_type == model.PropertyType.ENUM: 345 elif type_.property_type == model.PropertyType.ENUM:
346 dst_dict['enum_values'] = [] 346 dst_dict['enum_values'] = [
347 for enum_value in type_.enum_values: 347 {'name': value.name, 'description': value.description}
348 dst_dict['enum_values'].append({'name': enum_value}) 348 for value in type_.enum_values]
349 if len(dst_dict['enum_values']) > 0: 349 if len(dst_dict['enum_values']) > 0:
350 dst_dict['enum_values'][-1]['last'] = True 350 dst_dict['enum_values'][-1]['last'] = True
351 elif type_.instance_of is not None: 351 elif type_.instance_of is not None:
352 dst_dict['simple_type'] = type_.instance_of.lower() 352 dst_dict['simple_type'] = type_.instance_of.lower()
353 else: 353 else:
354 dst_dict['simple_type'] = type_.property_type.name.lower() 354 dst_dict['simple_type'] = type_.property_type.name.lower()
355 355
356 def _GetIntroTableList(self): 356 def _GetIntroTableList(self):
357 '''Create a generic data structure that can be traversed by the templates 357 '''Create a generic data structure that can be traversed by the templates
358 to create an API intro table. 358 to create an API intro table.
(...skipping 300 matching lines...) Expand 10 before | Expand all | Expand 10 after
659 659
660 if disable_refs: 660 if disable_refs:
661 cache, ext = ( 661 cache, ext = (
662 (self._idl_cache_no_refs, '.idl') if (unix_name in idl_names) else 662 (self._idl_cache_no_refs, '.idl') if (unix_name in idl_names) else
663 (self._json_cache_no_refs, '.json')) 663 (self._json_cache_no_refs, '.json'))
664 else: 664 else:
665 cache, ext = ((self._idl_cache, '.idl') if (unix_name in idl_names) else 665 cache, ext = ((self._idl_cache, '.idl') if (unix_name in idl_names) else
666 (self._json_cache, '.json')) 666 (self._json_cache, '.json'))
667 return self._GenerateHandlebarContext( 667 return self._GenerateHandlebarContext(
668 cache.GetFromFile('%s/%s%s' % (self._base_path, unix_name, ext)).Get()) 668 cache.GetFromFile('%s/%s%s' % (self._base_path, unix_name, ext)).Get())
OLDNEW
« no previous file with comments | « no previous file | chrome/common/extensions/docs/server2/app.yaml » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698