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

Unified Diff: chrome/common/extensions/docs/server2/intro_data_source.py

Issue 10834130: Extensions Docs Server: Doc conversion script - SVN (Closed) Base URL: https://src.chromium.org/chrome/trunk/src/
Patch Set: 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 side-by-side diff with in-line comments
Download patch
Index: chrome/common/extensions/docs/server2/intro_data_source.py
===================================================================
--- chrome/common/extensions/docs/server2/intro_data_source.py (revision 150606)
+++ chrome/common/extensions/docs/server2/intro_data_source.py (working copy)
@@ -2,9 +2,8 @@
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
-import logging
-
from HTMLParser import HTMLParser
+import re
from docs_server_utils import FormatKey
from third_party.handlebar import Handlebar
@@ -58,10 +57,12 @@
def __init__(self, cache_builder, base_paths):
self._cache = cache_builder.build(self._MakeIntroDict)
self._base_paths = base_paths
+ self._intro_regex = re.compile('<h1[^>.]*?>.*?</h1>', flags=re.DOTALL)
def _MakeIntroDict(self, intro):
parser = _IntroParser()
parser.feed(intro)
+ intro = re.sub(self._intro_regex, '', intro, count=1)
return {
'intro': Handlebar(intro),
'toc': parser.toc,

Powered by Google App Engine
This is Rietveld 408576698