| 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 a1aa78234c5e9c21a9b6454ef151e5f3df0e3bbd..b1eac2fe82621c5680c6d4b0ca7551893ad68651 100644
|
| --- a/chrome/common/extensions/docs/server2/handlebar_dict_generator.py
|
| +++ b/chrome/common/extensions/docs/server2/handlebar_dict_generator.py
|
| @@ -32,8 +32,7 @@ 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, samples):
|
| - self._samples = samples
|
| + def __init__(self, json):
|
| clean_json = copy.deepcopy(json)
|
| _RemoveNoDocs(clean_json)
|
| try:
|
| @@ -68,22 +67,18 @@ class HandlebarDictGenerator(object):
|
| { 'href': ref_dict['href'], 'text': ref_dict['text'], 'rest': rest })
|
| return ''.join(formatted_description)
|
|
|
| - def Generate(self):
|
| - try:
|
| - return {
|
| - 'name': self._namespace.name,
|
| - '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),
|
| - 'samples': self._FilterSamples(self._samples, self._namespace.name)
|
| - }
|
| - except Exception as e:
|
| - logging.error(e)
|
| - raise
|
| + def Generate(self, samples):
|
| + return {
|
| + 'name': self._namespace.name,
|
| + '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),
|
| + 'samples': self._FilterSamples(samples),
|
| + }
|
|
|
| - def _FilterSamples(self, samples, api_name):
|
| - api_search = '.' + api_name + '.'
|
| + def _FilterSamples(self, samples):
|
| + api_search = '.' + self._namespace.name + '.'
|
| return [sample for sample in samples
|
| if any(api_search in api['name'] for api in sample['api_calls'])]
|
|
|
|
|