File tree Expand file tree Collapse file tree 3 files changed +6
-12
lines changed
Expand file tree Collapse file tree 3 files changed +6
-12
lines changed Original file line number Diff line number Diff line change @@ -101,11 +101,7 @@ class ReactPyPyscriptApp(ReactPyApp):
101101 def render_index_html (self ) -> None :
102102 """Process the index.html and store the results in this class."""
103103 head_content = vdom_head_to_html (self .parent .html_head )
104- noscript = (
105- html_noscript_path_to_html (self .parent .html_noscript_path )
106- if self .parent .html_noscript_path
107- else ""
108- )
104+ noscript = html_noscript_path_to_html (self .parent .html_noscript_path or "" )
109105 pyscript_setup = pyscript_setup_html (
110106 extra_py = self .parent .extra_py ,
111107 extra_js = self .parent .extra_js ,
Original file line number Diff line number Diff line change @@ -238,11 +238,7 @@ async def __call__(
238238
239239 def render_index_html (self ) -> None :
240240 """Process the index.html and store the results in this class."""
241- noscript = (
242- html_noscript_path_to_html (self .parent .html_noscript_path )
243- if self .parent .html_noscript_path
244- else ""
245- )
241+ noscript = html_noscript_path_to_html (self .parent .html_noscript_path )
246242 self ._index_html = (
247243 "<!doctype html>"
248244 f'<html lang="{ self .parent .html_lang } ">'
Original file line number Diff line number Diff line change @@ -47,8 +47,10 @@ def vdom_head_to_html(head: VdomDict) -> str:
4747 raise ValueError ("Head element must be constructed with `html.head`." )
4848
4949
50- def html_noscript_path_to_html (path : str | Path ) -> str :
51- return f"<noscript>{ Path (path ).read_text (encoding = 'utf-8' )} </noscript>"
50+ def html_noscript_path_to_html (path : str | Path | None = "" , default_text = "Please enable JavaScript to view this site." ) -> str :
51+ if path :
52+ return f"<noscript>{ Path (path ).read_text (encoding = 'utf-8' )} </noscript>"
53+ return f"<noscript>{ default_text } </noscript>"
5254
5355
5456def process_settings (settings : ReactPyConfig ) -> None :
You can’t perform that action at this time.
0 commit comments