|
87 | 87 | # |
88 | 88 | html_theme = 'sphinx_rtd_theme' |
89 | 89 |
|
| 90 | + |
90 | 91 | # Theme options are theme-specific and customize the look and feel of a theme |
91 | 92 | # further. For a list of options available for each theme, see the |
92 | 93 | # documentation. |
|
128 | 129 | } |
129 | 130 |
|
130 | 131 |
|
131 | | -# -- Add Holoviews js and css ------------------------------------------------ |
132 | | - |
133 | | -def setup(app): |
| 132 | +def get_holoviews_js_css(): |
134 | 133 | from holoviews.plotting import Renderer |
| 134 | + dependencies = {**Renderer.core_dependencies, |
| 135 | + **Renderer.extra_dependencies} |
| 136 | + required = ['jQueryUI', 'jQuery', 'require'] |
| 137 | + js = [url for name in required for url in dependencies[name].get('js', [])] |
| 138 | + css = [url for name in required for url in dependencies[name].get('css', [])] |
| 139 | + return js, css |
135 | 140 |
|
136 | | - hv_js, hv_css = Renderer.html_assets( |
137 | | - extras=False, backends=[], script=True) |
138 | | - |
139 | | - fname_css = 'holoviews.css' |
140 | | - fname_js = 'holoviews.js' |
141 | | - static_dir = 'source/_static' |
142 | 141 |
|
143 | | - os.makedirs(static_dir, exist_ok=True) |
| 142 | +js, css = get_holoviews_js_css() |
| 143 | +html_context = {'holoviews_js_files': js} |
144 | 144 |
|
145 | | - with open(f'{static_dir}/{fname_css}', 'w') as f: |
146 | | - hv_css = hv_css.split('<style>')[1].replace('</style>', '') |
147 | | - f.write(hv_css) |
148 | 145 |
|
149 | | - with open(f'{static_dir}/{fname_js}', 'w') as f: |
150 | | - f.write(hv_js) |
151 | | - |
152 | | - app.add_stylesheet(fname_css) |
153 | | - app.add_javascript(fname_js) |
154 | | - |
155 | | - dependencies = {**Renderer.core_dependencies, **Renderer.extra_dependencies} |
156 | | - for name, type_url in dependencies.items(): |
157 | | - if name in ['bootstrap']: |
158 | | - continue |
159 | | - |
160 | | - for url in type_url.get('js', []): |
161 | | - app.add_javascript(url) |
162 | | - for url in type_url.get('css', []): |
163 | | - app.add_stylesheet(url) |
| 146 | +def setup(app): |
| 147 | + for url in css: |
| 148 | + app.add_stylesheet(url) |
164 | 149 |
|
165 | 150 | app.add_javascript("https://unpkg.com/@jupyter-widgets/html-manager@0.14.4/dist/embed-amd.js") |
0 commit comments