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

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 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'] = []
not at google - send to devlin 2013/10/29 16:25:16 dst_dict['enum_values'] = [{'name': value.name,
Sam McNally 2013/10/30 03:08:37 Done.
330 for enum_value in type_.enum_values: 330 for value in type_.enum_values:
331 dst_dict['enum_values'].append({'name': enum_value}) 331 dst_dict['enum_values'].append(
332 {'name': value.name, 'description': value.description})
332 if len(dst_dict['enum_values']) > 0: 333 if len(dst_dict['enum_values']) > 0:
333 dst_dict['enum_values'][-1]['last'] = True 334 dst_dict['enum_values'][-1]['last'] = True
334 elif type_.instance_of is not None: 335 elif type_.instance_of is not None:
335 dst_dict['simple_type'] = type_.instance_of.lower() 336 dst_dict['simple_type'] = type_.instance_of.lower()
336 else: 337 else:
337 dst_dict['simple_type'] = type_.property_type.name.lower() 338 dst_dict['simple_type'] = type_.property_type.name.lower()
338 339
339 def _GetIntroTableList(self): 340 def _GetIntroTableList(self):
340 '''Create a generic data structure that can be traversed by the templates 341 '''Create a generic data structure that can be traversed by the templates
341 to create an API intro table. 342 to create an API intro table.
(...skipping 307 matching lines...) Expand 10 before | Expand all | Expand 10 after
649 650
650 if self._disable_refs: 651 if self._disable_refs:
651 cache, ext = ( 652 cache, ext = (
652 (self._idl_cache_no_refs, '.idl') if (unix_name in idl_names) else 653 (self._idl_cache_no_refs, '.idl') if (unix_name in idl_names) else
653 (self._json_cache_no_refs, '.json')) 654 (self._json_cache_no_refs, '.json'))
654 else: 655 else:
655 cache, ext = ((self._idl_cache, '.idl') if (unix_name in idl_names) else 656 cache, ext = ((self._idl_cache, '.idl') if (unix_name in idl_names) else
656 (self._json_cache, '.json')) 657 (self._json_cache, '.json'))
657 return self._GenerateHandlebarContext( 658 return self._GenerateHandlebarContext(
658 cache.GetFromFile('%s/%s%s' % (self._base_path, unix_name, ext)).Get()) 659 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