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

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

Issue 80183002: Correct $ref links in extensions documentation server relative location. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Feedback Created 7 years 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 data_source import DataSource 10 from data_source import DataSource
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
43 self._cache = server_instance.compiled_fs_factory.Create( 43 self._cache = server_instance.compiled_fs_factory.Create(
44 server_instance.host_file_system_provider.GetTrunk(), 44 server_instance.host_file_system_provider.GetTrunk(),
45 self._MakeIntro, 45 self._MakeIntro,
46 IntroDataSource) 46 IntroDataSource)
47 self._ref_resolver = server_instance.ref_resolver_factory.Create() 47 self._ref_resolver = server_instance.ref_resolver_factory.Create()
48 48
49 def _MakeIntro(self, intro_path, intro): 49 def _MakeIntro(self, intro_path, intro):
50 # Guess the name of the API from the path to the intro. 50 # Guess the name of the API from the path to the intro.
51 api_name = os.path.splitext(intro_path.split('/')[-1])[0] 51 api_name = os.path.splitext(intro_path.split('/')[-1])[0]
52 intro_with_links = self._ref_resolver.ResolveAllLinks( 52 intro_with_links = self._ref_resolver.ResolveAllLinks(
53 intro, namespace=api_name) 53 intro, relative_to=self._request.path, namespace=api_name)
54 54
55 # The templates generate a title for intros based on the API name. 55 # The templates generate a title for intros based on the API name.
56 expect_title = '/intros/' not in intro_path 56 expect_title = '/intros/' not in intro_path
57 57
58 # TODO(kalman): In order to pick up every header tag, and therefore make a 58 # TODO(kalman): In order to pick up every header tag, and therefore make a
59 # complete TOC, the render context of the Handlebar needs to be passed 59 # complete TOC, the render context of the Handlebar needs to be passed
60 # through to here. Even if there were a mechanism to do this it would 60 # through to here. Even if there were a mechanism to do this it would
61 # break caching; we'd need to do the TOC parsing *after* rendering the full 61 # break caching; we'd need to do the TOC parsing *after* rendering the full
62 # template, and that would probably be expensive. 62 # template, and that would probably be expensive.
63 parse_result = ParseDocument( 63 parse_result = ParseDocument(
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after
106 except FileNotFoundError: 106 except FileNotFoundError:
107 continue 107 continue
108 # Not found. Do the first operation again so that we get a stack trace - we 108 # Not found. Do the first operation again so that we get a stack trace - we
109 # know that it'll fail. 109 # know that it'll fail.
110 get_from_base_path(base_paths[0]) 110 get_from_base_path(base_paths[0])
111 raise AssertionError() 111 raise AssertionError()
112 112
113 def Cron(self): 113 def Cron(self):
114 # TODO(kalman): Walk through the intros and articles directory. 114 # TODO(kalman): Walk through the intros and articles directory.
115 return Future(value=()) 115 return Future(value=())
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698