The html-1
type can be used to serves browser requests directly, or to inline
code snippets into a page.
Inlining a file means executing its .Inline
method and embedding the result.
Requests will be served with Content-Type text/html; charset=utf-8
.
What makes this app special is that it extracts the <head>
tags of any
inlined files and puts them all in its own response <head>
.
Additionally, it allows you to write inline scripts within the html-1
file, as those will be detected and automatically trusted via
Content-Security-Policy
headers.
The following snippets will be replaced with inlined file’s responses:
<? inline(query) ?>
<? inline(query, wrap) ?>
where query
is a string file selector that is resolved relative to the file
itself, and wrap
is boolean true or false [default true]. If true, the inlined
files will be wrapped in the following HTML snippet so that client side tools
can recognize the file (in the browser), so that it will become a handle for
the file, giving you file selection, drag-and-drop, cut/copy/paste, etc.
functionality.
<div class="o1-file" data-o1-path="/path"></div>
<div class="-wrapper">
<div class="-left">
<? inline('menu', false) ?>
</div>
<div class="-right">
<? inline(':1:c') ?>
</div>
</div>
.Main
.Request
.Inline