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

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
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 308 matching lines...) Expand 10 before | Expand all | Expand 10 after
319 dst_dict['choices'] = self._GenerateTypes(type_.choices) 319 dst_dict['choices'] = self._GenerateTypes(type_.choices)
320 # We keep track of which == last for knowing when to add "or" between 320 # We keep track of which == last for knowing when to add "or" between
321 # choices in templates. 321 # choices in templates.
322 if len(dst_dict['choices']) > 0: 322 if len(dst_dict['choices']) > 0:
323 dst_dict['choices'][-1]['last'] = True 323 dst_dict['choices'][-1]['last'] = True
324 elif type_.property_type == model.PropertyType.REF: 324 elif type_.property_type == model.PropertyType.REF:
325 dst_dict['link'] = self._GetLink(type_.ref_type) 325 dst_dict['link'] = self._GetLink(type_.ref_type)
326 elif type_.property_type == model.PropertyType.ARRAY: 326 elif type_.property_type == model.PropertyType.ARRAY:
327 dst_dict['array'] = self._GenerateType(type_.item_type) 327 dst_dict['array'] = self._GenerateType(type_.item_type)
328 elif type_.property_type == model.PropertyType.ENUM: 328 elif type_.property_type == model.PropertyType.ENUM:
329 dst_dict['enum_values'] = [] 329 dst_dict['enum_values'] = type_.enum_values
330 for enum_value in type_.enum_values:
331 dst_dict['enum_values'].append({'name': enum_value})
332 if len(dst_dict['enum_values']) > 0: 330 if len(dst_dict['enum_values']) > 0:
333 dst_dict['enum_values'][-1]['last'] = True 331 dst_dict['enum_values'][-1] = dict(dst_dict['enum_values'][-1],
332 last=True)
334 elif type_.instance_of is not None: 333 elif type_.instance_of is not None:
335 dst_dict['simple_type'] = type_.instance_of.lower() 334 dst_dict['simple_type'] = type_.instance_of.lower()
336 else: 335 else:
337 dst_dict['simple_type'] = type_.property_type.name.lower() 336 dst_dict['simple_type'] = type_.property_type.name.lower()
338 337
339 def _GetIntroTableList(self): 338 def _GetIntroTableList(self):
340 '''Create a generic data structure that can be traversed by the templates 339 '''Create a generic data structure that can be traversed by the templates
341 to create an API intro table. 340 to create an API intro table.
342 ''' 341 '''
343 intro_rows = [ 342 intro_rows = [
(...skipping 305 matching lines...) Expand 10 before | Expand all | Expand 10 after
649 648
650 if self._disable_refs: 649 if self._disable_refs:
651 cache, ext = ( 650 cache, ext = (
652 (self._idl_cache_no_refs, '.idl') if (unix_name in idl_names) else 651 (self._idl_cache_no_refs, '.idl') if (unix_name in idl_names) else
653 (self._json_cache_no_refs, '.json')) 652 (self._json_cache_no_refs, '.json'))
654 else: 653 else:
655 cache, ext = ((self._idl_cache, '.idl') if (unix_name in idl_names) else 654 cache, ext = ((self._idl_cache, '.idl') if (unix_name in idl_names) else
656 (self._json_cache, '.json')) 655 (self._json_cache, '.json'))
657 return self._GenerateHandlebarContext( 656 return self._GenerateHandlebarContext(
658 cache.GetFromFile('%s/%s%s' % (self._base_path, unix_name, ext)).Get()) 657 cache.GetFromFile('%s/%s%s' % (self._base_path, unix_name, ext)).Get())
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698