diff --git a/js/webpack.config.js b/js/webpack.config.js index da555c053..1b43be027 100644 --- a/js/webpack.config.js +++ b/js/webpack.config.js @@ -14,7 +14,7 @@ var rules = [ { test: /\.svg(\?v=\d+\.\d+\.\d+)?$/, use: 'url-loader?limit=10000&mimetype=image/svg+xml' } ] -var distRoot = path.resolve(__dirname, '..', 'share', 'jupyter', 'voila', 'template', 'default', 'static') +var distRoot = path.resolve(__dirname, '..', 'share', 'jupyter', 'voila', 'templates', 'default', 'static') module.exports = [ { diff --git a/setup.py b/setup.py index dbf793f91..4e9261fee 100644 --- a/setup.py +++ b/setup.py @@ -75,7 +75,7 @@ class NPM(Command): node_modules = os.path.join(node_root, 'node_modules') - template_root = os.path.join(here, 'share', 'jupyter', 'voila', 'template', 'default', 'static') + template_root = os.path.join(here, 'share', 'jupyter', 'voila', 'templates', 'default', 'static') targets = [ os.path.join(template_root, 'voila.js') ] @@ -177,9 +177,9 @@ def _download_pycurl(self, url): return buf.getvalue() def run(self): - css_dest = os.path.join('share', 'jupyter', 'voila', 'template', 'default', 'static', 'index.css') - theme_light_dest = os.path.join('share', 'jupyter', 'voila', 'template', 'default', 'static', 'theme-light.css') - theme_dark_dest = os.path.join('share', 'jupyter', 'voila', 'template', 'default', 'static', 'theme-dark.css') + css_dest = os.path.join('share', 'jupyter', 'voila', 'templates', 'default', 'static', 'index.css') + theme_light_dest = os.path.join('share', 'jupyter', 'voila', 'templates', 'default', 'static', 'theme-light.css') + theme_dark_dest = os.path.join('share', 'jupyter', 'voila', 'templates', 'default', 'static', 'theme-dark.css') try: css = self._download(css_url) @@ -194,7 +194,7 @@ def run(self): return try: - os.mkdir(os.path.join('share', 'jupyter', 'voila', 'template', 'default', 'static')) + os.mkdir(os.path.join('share', 'jupyter', 'voila', 'templates', 'default', 'static')) except OSError: # Use FileExistsError from python 3.3 onward. pass with open(css_dest, 'wb+') as f: @@ -241,7 +241,7 @@ def run(self): ] # Add all the templates -for (dirpath, dirnames, filenames) in os.walk('share/jupyter/voila/template/'): +for (dirpath, dirnames, filenames) in os.walk('share/jupyter/voila/templates/'): if filenames: data_files.append((dirpath, [os.path.join(dirpath, filename) for filename in filenames])) diff --git a/share/jupyter/voila/template/default/nbconvert_templates/base.tpl b/share/jupyter/voila/templates/default/nbconvert_templates/base.tpl similarity index 100% rename from share/jupyter/voila/template/default/nbconvert_templates/base.tpl rename to share/jupyter/voila/templates/default/nbconvert_templates/base.tpl diff --git a/share/jupyter/voila/template/default/nbconvert_templates/lab.tpl b/share/jupyter/voila/templates/default/nbconvert_templates/lab.tpl similarity index 100% rename from share/jupyter/voila/template/default/nbconvert_templates/lab.tpl rename to share/jupyter/voila/templates/default/nbconvert_templates/lab.tpl diff --git a/share/jupyter/voila/template/default/nbconvert_templates/voila.tpl b/share/jupyter/voila/templates/default/nbconvert_templates/voila.tpl similarity index 100% rename from share/jupyter/voila/template/default/nbconvert_templates/voila.tpl rename to share/jupyter/voila/templates/default/nbconvert_templates/voila.tpl diff --git a/share/jupyter/voila/template/default/static/jquery.min.js b/share/jupyter/voila/templates/default/static/jquery.min.js similarity index 100% rename from share/jupyter/voila/template/default/static/jquery.min.js rename to share/jupyter/voila/templates/default/static/jquery.min.js diff --git a/share/jupyter/voila/template/default/static/main.js b/share/jupyter/voila/templates/default/static/main.js similarity index 100% rename from share/jupyter/voila/template/default/static/main.js rename to share/jupyter/voila/templates/default/static/main.js diff --git a/share/jupyter/voila/template/default/static/require.min.js b/share/jupyter/voila/templates/default/static/require.min.js similarity index 100% rename from share/jupyter/voila/template/default/static/require.min.js rename to share/jupyter/voila/templates/default/static/require.min.js diff --git a/share/jupyter/voila/template/default/templates/404.html b/share/jupyter/voila/templates/default/templates/404.html similarity index 100% rename from share/jupyter/voila/template/default/templates/404.html rename to share/jupyter/voila/templates/default/templates/404.html diff --git a/share/jupyter/voila/template/default/templates/browser-open.html b/share/jupyter/voila/templates/default/templates/browser-open.html similarity index 100% rename from share/jupyter/voila/template/default/templates/browser-open.html rename to share/jupyter/voila/templates/default/templates/browser-open.html diff --git a/share/jupyter/voila/template/default/templates/error.html b/share/jupyter/voila/templates/default/templates/error.html similarity index 100% rename from share/jupyter/voila/template/default/templates/error.html rename to share/jupyter/voila/templates/default/templates/error.html diff --git a/share/jupyter/voila/template/default/templates/page.html b/share/jupyter/voila/templates/default/templates/page.html similarity index 100% rename from share/jupyter/voila/template/default/templates/page.html rename to share/jupyter/voila/templates/default/templates/page.html diff --git a/share/jupyter/voila/template/default/templates/tree.html b/share/jupyter/voila/templates/default/templates/tree.html similarity index 100% rename from share/jupyter/voila/template/default/templates/tree.html rename to share/jupyter/voila/templates/default/templates/tree.html diff --git a/share/jupyter/voila/template/gridstack/nbconvert_templates/voila.tpl b/share/jupyter/voila/templates/gridstack/nbconvert_templates/voila.tpl similarity index 100% rename from share/jupyter/voila/template/gridstack/nbconvert_templates/voila.tpl rename to share/jupyter/voila/templates/gridstack/nbconvert_templates/voila.tpl diff --git a/voila/paths.py b/voila/paths.py index 7a81ce1b1..386bfa2ae 100644 --- a/voila/paths.py +++ b/voila/paths.py @@ -28,7 +28,7 @@ def collect_template_paths( - nbconvert template paths, - static paths, - tornado template paths, - by looking in the standard Jupyter data directories (PREFIX/share/jupyter/voila/template) + by looking in the standard Jupyter data directories (PREFIX/share/jupyter/voila/templates) with different prefix values (user directory, sys prefix, and then system prefix) which allows users to override templates locally. @@ -40,8 +40,8 @@ def collect_template_paths( # relative to the package directory (first entry, meaning with highest precedence) search_directories = [] if DEV_MODE: - search_directories.append(os.path.abspath(os.path.join(ROOT, '..', 'share', 'jupyter', 'voila', 'template'))) - search_directories.extend(jupyter_path('voila', 'template')) + search_directories.append(os.path.abspath(os.path.join(ROOT, '..', 'share', 'jupyter', 'voila', 'templates'))) + search_directories.extend(jupyter_path('voila', 'templates')) found_at_least_one = False for search_directory in search_directories: