mirror of
				https://github.com/flame-engine/flame.git
				synced 2025-10-31 00:48:47 +08:00 
			
		
		
		
	docs: Take PUBLISH_PATH into account when building docs (#1499)
This commit is contained in:
		| @ -81,7 +81,7 @@ class FlutterAppDirective(SphinxDirective): | |||||||
|         self._ensure_compiled() |         self._ensure_compiled() | ||||||
|  |  | ||||||
|         page = self.options.get('page', '') |         page = self.options.get('page', '') | ||||||
|         iframe_url = '/' + self.html_dir + '/index.html?' + page |         iframe_url = _doc_root() + self.html_dir + '/index.html?' + page | ||||||
|         result = [] |         result = [] | ||||||
|         if 'popup' in self.modes: |         if 'popup' in self.modes: | ||||||
|             result.append(Button( |             result.append(Button( | ||||||
| @ -172,13 +172,22 @@ class FlutterAppDirective(SphinxDirective): | |||||||
|         with open(target_file, 'wt') as out: |         with open(target_file, 'wt') as out: | ||||||
|             out.write('<!DOCTYPE html>\n') |             out.write('<!DOCTYPE html>\n') | ||||||
|             out.write('<html>\n<head>\n') |             out.write('<html>\n<head>\n') | ||||||
|             out.write('<base href="/%s/">\n' % self.html_dir) |             out.write('<base href="%s%s/">\n' % (_doc_root(), self.html_dir)) | ||||||
|             out.write('<title>%s</title>\n' % self.app_name) |             out.write('<title>%s</title>\n' % self.app_name) | ||||||
|             out.write('</head>\n<body>\n') |             out.write('</head>\n<body>\n') | ||||||
|             out.write('<script src="main.dart.js"></script>\n') |             out.write('<script src="main.dart.js"></script>\n') | ||||||
|             out.write('</body>\n</html>\n') |             out.write('</body>\n</html>\n') | ||||||
|  |  | ||||||
|  |  | ||||||
|  | def _doc_root(): | ||||||
|  |     root = os.environ.get('PUBLISH_PATH', '') | ||||||
|  |     if not root.startswith('/'): | ||||||
|  |         root = '/' + root | ||||||
|  |     if not root.endswith('/'): | ||||||
|  |         root = root + '/' | ||||||
|  |     return root | ||||||
|  |  | ||||||
|  |  | ||||||
| # ------------------------------------------------------------------------------ | # ------------------------------------------------------------------------------ | ||||||
| # Nodes | # Nodes | ||||||
| # ------------------------------------------------------------------------------ | # ------------------------------------------------------------------------------ | ||||||
|  | |||||||
		Reference in New Issue
	
	Block a user
	 Pasha Stetsenko
					Pasha Stetsenko