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

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

Issue 12996003: Dynamically generate a heading for Extension Docs API pages (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Addressing comments - Patch currently being broken up Created 7 years, 6 months 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
8 7
9 import compiled_file_system as compiled_fs 8 import compiled_file_system as compiled_fs
10 from third_party.json_schema_compiler.model import UnixName 9 from third_party.json_schema_compiler.model import UnixName
11 10
12 class SidenavDataSource(object): 11 class SidenavDataSource(object):
13 """This class reads in and caches a JSON file representing the side navigation 12 """This class reads in and caches a JSON file representing the side navigation
14 menu. 13 menu.
15 """ 14 """
16 class Factory(object): 15 class Factory(object):
17 def __init__(self, compiled_fs_factory, json_path, base_path): 16 def __init__(self, compiled_fs_factory, json_path, base_path):
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after
72 logging.warn('Paths in sidenav must be qualified. %s is not.' % href) 71 logging.warn('Paths in sidenav must be qualified. %s is not.' % href)
73 href = '/' + href 72 href = '/' + href
74 item['href'] = '%s%s' % (self._file_dir, href) 73 item['href'] = '%s%s' % (self._file_dir, href)
75 74
76 def get(self, key): 75 def get(self, key):
77 sidenav = copy.deepcopy(self._cache.GetFromFile( 76 sidenav = copy.deepcopy(self._cache.GetFromFile(
78 '%s/%s_sidenav.json' % (self._json_path, key))) 77 '%s/%s_sidenav.json' % (self._json_path, key)))
79 self._AddSelected(sidenav) 78 self._AddSelected(sidenav)
80 self._QualifyHrefs(sidenav) 79 self._QualifyHrefs(sidenav)
81 return sidenav 80 return sidenav
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698