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

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

Issue 14712010: Revert 199633 "Doc server manifest page generation" (Closed) Base URL: svn://svn.chromium.org/chrome/
Patch Set: Created 7 years, 7 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 from HTMLParser import HTMLParser 5 from HTMLParser import HTMLParser
6 import logging 6 import logging
7 import os 7 import os
8 import re 8 import re
9 9
10 from docs_server_utils import FormatKey 10 from docs_server_utils import FormatKey
11 from file_system import FileNotFoundError 11 from file_system import FileNotFoundError
12 import compiled_file_system as compiled_fs
12 from third_party.handlebar import Handlebar 13 from third_party.handlebar import Handlebar
13 14
14 # TODO(kalman): rename this HTMLDataSource or other, then have separate intro 15 # TODO(kalman): rename this HTMLDataSource or other, then have separate intro
15 # article data sources created as instances of it. 16 # article data sources created as instances of it.
16 17
17 _H1_REGEX = re.compile('<h1[^>.]*?>.*?</h1>', flags=re.DOTALL) 18 _H1_REGEX = re.compile('<h1[^>.]*?>.*?</h1>', flags=re.DOTALL)
18 19
19 class _IntroParser(HTMLParser): 20 class _IntroParser(HTMLParser):
20 ''' An HTML parser which will parse table of contents and page title info out 21 ''' An HTML parser which will parse table of contents and page title info out
21 of an intro. 22 of an intro.
(...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after
109 return self._cache.GetFromFile('%s/%s' % (base_path, path)) 110 return self._cache.GetFromFile('%s/%s' % (base_path, path))
110 for base_path in self._base_paths: 111 for base_path in self._base_paths:
111 try: 112 try:
112 return get_from_base_path(base_path) 113 return get_from_base_path(base_path)
113 except FileNotFoundError: 114 except FileNotFoundError:
114 continue 115 continue
115 # Not found. Do the first operation again so that we get a stack trace - we 116 # Not found. Do the first operation again so that we get a stack trace - we
116 # know that it'll fail. 117 # know that it'll fail.
117 get_from_base_path(self._base_paths[0]) 118 get_from_base_path(self._base_paths[0])
118 raise AssertionError() 119 raise AssertionError()
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698