OLD | NEW |
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 Loading... |
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 |
OLD | NEW |