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

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

Issue 14273041: Doc server manifest page generation (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: fix imports Created 7 years, 5 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 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
13 from third_party.handlebar import Handlebar 12 from third_party.handlebar import Handlebar
14 13
15 # TODO(kalman): rename this HTMLDataSource or other, then have separate intro 14 # TODO(kalman): rename this HTMLDataSource or other, then have separate intro
16 # article data sources created as instances of it. 15 # article data sources created as instances of it.
17 16
18 _H1_REGEX = re.compile('<h1[^>.]*?>.*?</h1>', flags=re.DOTALL) 17 _H1_REGEX = re.compile('<h1[^>.]*?>.*?</h1>', flags=re.DOTALL)
19 18
20 class _IntroParser(HTMLParser): 19 class _IntroParser(HTMLParser):
21 ''' An HTML parser which will parse table of contents and page title info out 20 ''' An HTML parser which will parse table of contents and page title info out
22 of an intro. 21 of an intro.
(...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after
110 return self._cache.GetFromFile('%s/%s' % (base_path, path)) 109 return self._cache.GetFromFile('%s/%s' % (base_path, path))
111 for base_path in self._base_paths: 110 for base_path in self._base_paths:
112 try: 111 try:
113 return get_from_base_path(base_path) 112 return get_from_base_path(base_path)
114 except FileNotFoundError: 113 except FileNotFoundError:
115 continue 114 continue
116 # Not found. Do the first operation again so that we get a stack trace - we 115 # Not found. Do the first operation again so that we get a stack trace - we
117 # know that it'll fail. 116 # know that it'll fail.
118 get_from_base_path(self._base_paths[0]) 117 get_from_base_path(self._base_paths[0])
119 raise AssertionError() 118 raise AssertionError()
OLDNEW
« no previous file with comments | « chrome/common/extensions/docs/server2/cron.yaml ('k') | chrome/common/extensions/docs/server2/manifest_data_source.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698