mirror of
https://github.com/jupyter/notebook.git
synced 2024-12-21 04:10:17 +08:00
DEV: Add IPython.html to the default template path.
This makes it possible to override a file with a template that also inherits from that file. For example, this makes it possible to override a single block of notebook.html by creating a file called notebook.html that inherits from templates/notebook.html.
This commit is contained in:
parent
cd1304961f
commit
c1196da096
@ -3,8 +3,22 @@
|
||||
import os
|
||||
# Packagers: modify this line if you store the notebook static files elsewhere
|
||||
DEFAULT_STATIC_FILES_PATH = os.path.join(os.path.dirname(__file__), "static")
|
||||
# Packagers: modify this line if you store the notebook template files elsewhere
|
||||
DEFAULT_TEMPLATE_FILES_PATH = os.path.join(os.path.dirname(__file__), "templates")
|
||||
|
||||
# Packagers: modify the next line if you store the notebook template files
|
||||
# elsewhere
|
||||
|
||||
# Include both IPython/html/ and IPython/html/templates/. This makes it
|
||||
# possible for users to override a template with a file that inherits from that
|
||||
# template.
|
||||
#
|
||||
# For example, if you want to override a specific block of notebook.html, you
|
||||
# can create a file called notebook.html that inherits from from
|
||||
# templates/notebook.html, and the latter will resolve correctly to the base
|
||||
# implementation.
|
||||
DEFAULT_TEMPLATE_PATH_LIST = [
|
||||
os.path.dirname(__file__),
|
||||
os.path.join(os.path.dirname(__file__), "templates"),
|
||||
]
|
||||
|
||||
del os
|
||||
|
||||
|
@ -53,7 +53,7 @@ from tornado.log import LogFormatter, app_log, access_log, gen_log
|
||||
|
||||
from IPython.html import (
|
||||
DEFAULT_STATIC_FILES_PATH,
|
||||
DEFAULT_TEMPLATE_FILES_PATH,
|
||||
DEFAULT_TEMPLATE_PATH_LIST,
|
||||
)
|
||||
from .base.handlers import Template404
|
||||
from .log import log_request
|
||||
@ -536,8 +536,8 @@ class NotebookApp(BaseIPythonApplication):
|
||||
|
||||
@property
|
||||
def template_file_path(self):
|
||||
"""return extra paths + the default location"""
|
||||
return self.extra_template_paths + [DEFAULT_TEMPLATE_FILES_PATH]
|
||||
"""return extra paths + the default locations"""
|
||||
return self.extra_template_paths + DEFAULT_TEMPLATE_PATH_LIST
|
||||
|
||||
nbextensions_path = List(Unicode, config=True,
|
||||
help="""paths for Javascript extensions. By default, this is just IPYTHONDIR/nbextensions"""
|
||||
|
Loading…
Reference in New Issue
Block a user