| Index: chrome/common/extensions/docs/server2/handlebar_dict_generator.py
|
| diff --git a/chrome/common/extensions/docs/server2/handlebar_dict_generator.py b/chrome/common/extensions/docs/server2/handlebar_dict_generator.py
|
| index 456aa831bf2084e5e55c8ab15c0b292694b26406..f58fb3ff9fb6564cae2eeec8c9eaf4f0b5ce042c 100644
|
| --- a/chrome/common/extensions/docs/server2/handlebar_dict_generator.py
|
| +++ b/chrome/common/extensions/docs/server2/handlebar_dict_generator.py
|
| @@ -44,7 +44,8 @@ class HandlebarDictGenerator(object):
|
| """Uses a Model from the JSON Schema Compiler and generates a dict that
|
| a Handlebar template can use for a data source.
|
| """
|
| - def __init__(self, json):
|
| + def __init__(self, json, samples):
|
| + self._samples = samples
|
| clean_json = copy.deepcopy(json)
|
| _RemoveNoDocs(clean_json)
|
| try:
|
| @@ -59,11 +60,21 @@ class HandlebarDictGenerator(object):
|
| 'types': map(self._GenerateType, self._namespace.types.values()),
|
| 'functions': self._GenerateFunctions(self._namespace.functions),
|
| 'events': map(self._GenerateEvent, self._namespace.events.values()),
|
| - 'properties': self._GenerateProperties(self._namespace.properties)
|
| + 'properties': self._GenerateProperties(self._namespace.properties),
|
| + 'samples': self._FilterSamples(self._samples, self._namespace.name)
|
| }
|
| except Exception as e:
|
| logging.info(e)
|
|
|
| + def _FilterSamples(self, samples, api_name):
|
| + return_samples = []
|
| + for sample in samples:
|
| + for api in sample['api_calls']:
|
| + if '.' + api_name + '.' in api['name']:
|
| + return_samples.append(sample)
|
| + break
|
| + return return_samples
|
| +
|
| def _GenerateType(self, type_):
|
| type_dict = {
|
| 'name': type_.name,
|
|
|