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

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

Issue 10797039: Extensions Docs Server: devtools API (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: move parsing logic into utils Created 8 years, 4 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 | Annotate | Revision Log
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 logging 5 import logging
6 6
7 from HTMLParser import HTMLParser 7 from HTMLParser import HTMLParser
8 8
9 from path_utils import FormatKey 9 from docs_server_utils import FormatKey
10 from third_party.handlebar import Handlebar 10 from third_party.handlebar import Handlebar
11 11
12 class _IntroParser(HTMLParser): 12 class _IntroParser(HTMLParser):
13 """ An HTML parser which will parse table of contents and page title info out 13 """ An HTML parser which will parse table of contents and page title info out
14 of an intro. 14 of an intro.
15 """ 15 """
16 def __init__(self): 16 def __init__(self):
17 HTMLParser.__init__(self) 17 HTMLParser.__init__(self)
18 self.toc = [] 18 self.toc = []
19 self.page_title = None 19 self.page_title = None
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after
72 return self.get(key) 72 return self.get(key)
73 73
74 def get(self, key): 74 def get(self, key):
75 real_path = FormatKey(key) 75 real_path = FormatKey(key)
76 for base_path in self._base_paths: 76 for base_path in self._base_paths:
77 try: 77 try:
78 return self._cache.GetFromFile(base_path + '/' + real_path) 78 return self._cache.GetFromFile(base_path + '/' + real_path)
79 except Exception: 79 except Exception:
80 pass 80 pass
81 return None 81 return None
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698