pyscript minimum working example
This commit is contained in:
parent
9d09803ddc
commit
38a192abb6
4 changed files with 63 additions and 1 deletions
|
|
@ -1,5 +1,6 @@
|
|||
#import "./custom_html.typ" as chtml
|
||||
#import "./html_utils.typ": get-css, get-js
|
||||
#import "./pyscript.typ": state-use-pyscript, state-pyscript-headers, state-pyscript-version
|
||||
|
||||
/// Generate the html <head> element for the page.
|
||||
#let html_head(
|
||||
|
|
@ -35,7 +36,8 @@
|
|||
|
||||
// The width=device-width part sets the width of the page to follow the screen-width of the device (which will vary depending on the device).
|
||||
// The initial-scale=1.0 part sets the initial zoom level when the page is first loaded by the browser.
|
||||
html.meta(name: "viewport", content: "width=device-width, initial-scale=1.0")
|
||||
// it resize the content instead of only resizeing the visual 'window'. (https://developer.chrome.com/blog/viewport-resize-behavior#:%7E:text=Through%20the%20interactive-widget%20key,Visual%20Viewport%20and%20Layout%20Viewport.)
|
||||
html.meta(name: "viewport", content: "width=device-width, initial-scale=1.0, interactive-widget=resizes-content")
|
||||
|
||||
// Only set the Referer header for out request to the same origin
|
||||
html.meta(name: "referrer", content: "same-origin")
|
||||
|
|
@ -93,6 +95,18 @@
|
|||
}
|
||||
}}
|
||||
|
||||
context if state-use-pyscript.final() {
|
||||
assert(
|
||||
state-pyscript-version.final() != none,
|
||||
message: "Cannot run python script: pyscript-version is not set"
|
||||
)
|
||||
assert(
|
||||
state-pyscript-version.final() in state-pyscript-headers.final(),
|
||||
message: "Cannot run python script: urls for " + state-pyscript-version.final() + " not set in pyscript-urls"
|
||||
)
|
||||
state-pyscript-headers.final().at(state-pyscript-version.final())
|
||||
}
|
||||
|
||||
html.style(get-css())
|
||||
html.script(get-js())
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue