@@ -81,6 +81,8 @@ def _load_jupyter_server_extension(server_app: ServerApp):
81
81
voila_configuration = VoilaConfiguration (
82
82
parent = server_app , config = load_config_file ()
83
83
)
84
+ page_config_hook = voila_configuration .config .Voila .get ("page_config_hook" , None )
85
+ prelaunch_hook = voila_configuration .config .Voila .get ("prelaunch_hook" , None )
84
86
85
87
template_name = voila_configuration .template
86
88
template_paths = collect_template_paths (["voila" , "nbconvert" ], template_name )
@@ -102,8 +104,6 @@ def _load_jupyter_server_extension(server_app: ServerApp):
102
104
host_pattern = ".*$"
103
105
base_url = url_path_join (web_app .settings ["base_url" ])
104
106
105
- tree_handler_conf = {"voila_configuration" : voila_configuration }
106
-
107
107
themes_dir = pjoin (get_data_dir (), "themes" )
108
108
web_app .add_handlers (
109
109
host_pattern ,
@@ -115,17 +115,25 @@ def _load_jupyter_server_extension(server_app: ServerApp):
115
115
"config" : server_app .config ,
116
116
"template_paths" : template_paths ,
117
117
"voila_configuration" : voila_configuration ,
118
+ "prelaunch_hook" : prelaunch_hook ,
119
+ "page_config_hook" : page_config_hook ,
118
120
},
119
121
),
120
122
(
121
123
url_path_join (base_url , "/voila" ),
122
124
TornadoVoilaTreeHandler ,
123
- tree_handler_conf ,
125
+ {
126
+ "voila_configuration" : voila_configuration ,
127
+ "page_config_hook" : page_config_hook ,
128
+ },
124
129
),
125
130
(
126
131
url_path_join (base_url , "/voila/tree" + path_regex ),
127
132
TornadoVoilaTreeHandler ,
128
- tree_handler_conf ,
133
+ {
134
+ "voila_configuration" : voila_configuration ,
135
+ "page_config_hook" : page_config_hook ,
136
+ },
129
137
),
130
138
(
131
139
url_path_join (base_url , "/voila/templates/(.*)" ),
@@ -162,7 +170,7 @@ def _load_jupyter_server_extension(server_app: ServerApp):
162
170
(
163
171
url_path_join (base_url , r"/voila/api/contents%s" % path_regex ),
164
172
VoilaContentsHandler ,
165
- tree_handler_conf ,
173
+ { "voila_configuration" : voila_configuration } ,
166
174
),
167
175
],
168
176
)
0 commit comments