Skip to content

Commit d1183df

Browse files
committed
docs, new html markup syntax
1 parent 1b6e961 commit d1183df

12 files changed

Lines changed: 355 additions & 326 deletions

docs/docs/cross-site-request-forgery.html

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -37,15 +37,15 @@ <h2 id="falco-xsrf-support">Falco XSRF Support</h2>
3737
open Falco.Security
3838

3939
let formView token =
40-
Elem.html [] [
41-
Elem.body [] [
42-
Elem.form [ Attr.methodPost ] [
40+
_html [] [
41+
_body [] [
42+
_form [ _methodPost_ ] [
4343
// using the CSRF HTML helper, recommended to include as first
4444
// form element
4545
Xsrf.antiforgeryInput token
46-
Elem.control &quot;first_name&quot; [] [ Text.raw &quot;First Name&quot; ]
47-
Elem.control &quot;first_name&quot; [] [ Text.raw &quot;First Name&quot; ]
48-
Elem.input [ Attr.typeSubmit ]
46+
_control &quot;first_name&quot; [] [ _text &quot;First Name&quot; ]
47+
_control &quot;first_name&quot; [] [ _text &quot;First Name&quot; ]
48+
_input [ _typeSubmit_ ]
4949
]
5050
]
5151
]

docs/docs/example-hello-world-mvc.html

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -44,24 +44,24 @@ <h2 id="view">View</h2>
4444

4545
let layout content =
4646
Templates.html5 &quot;en&quot;
47-
[ Elem.link [ Attr.href &quot;/style.css&quot;; Attr.rel &quot;stylesheet&quot; ] ]
47+
[ _link [ _href_ &quot;/style.css&quot;; _rel_ &quot;stylesheet&quot; ] ]
4848
content
4949

5050
module GreetingView =
5151
/// HTML view for /greet/html
5252
let detail greeting =
5353
layout [
54-
Text.h1 $&quot;Hello {greeting.Name} from /html&quot;
55-
Elem.hr []
56-
Text.p &quot;Greet other ways:&quot;
57-
Elem.nav [] [
58-
Elem.a
59-
[ Attr.href (Url.greetPlainText greeting.Name) ]
60-
[ Text.raw &quot;Greet in text&quot;]
61-
Text.raw &quot; | &quot;
62-
Elem.a
63-
[ Attr.href (Url.greetJson greeting.Name) ]
64-
[ Text.raw &quot;Greet in JSON &quot; ]
54+
_h1' $&quot;Hello {greeting.Name} from /html&quot;
55+
_hr []
56+
_p' &quot;Greet other ways:&quot;
57+
_nav [] [
58+
_a
59+
[ _href_ (Url.greetPlainText greeting.Name) ]
60+
[ _text &quot;Greet in text&quot;]
61+
_text &quot; | &quot;
62+
_a
63+
[ _href_ (Url.greetJson greeting.Name) ]
64+
[ _text &quot;Greet in JSON &quot; ]
6565
]
6666
]
6767
</code></pre>
@@ -81,11 +81,11 @@ <h2 id="errors">Errors</h2>
8181
module ErrorController =
8282
let notFound : HttpHandler =
8383
Response.withStatusCode 404 &gt;&gt;
84-
Response.ofHtml (View.layout [ Text.h1 &quot;Not Found&quot; ])
84+
Response.ofHtml (View.layout [ _h1' &quot;Not Found&quot; ])
8585

8686
let serverException : HttpHandler =
8787
Response.withStatusCode 500 &gt;&gt;
88-
Response.ofHtml (View.layout [ Text.h1 &quot;Server Error&quot; ])
88+
Response.ofHtml (View.layout [ _h1' &quot;Server Error&quot; ])
8989
</code></pre>
9090
<p>Here we see the <a href="repsonse.html#response-modifiers"><code>HttpResponseModifier</code></a> at play, which set the status code before buffering out the HTML response. We'll reference these pages later when be <a href="#web-server">build the web server</a>.</p>
9191
<h2 id="controller">Controller</h2>

docs/docs/example-htmx.html

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -15,10 +15,10 @@ <h2 id="layout">Layout</h2>
1515
<p>First we'll define a simple layout and enable htmx by including the script. Notice the strongly typed reference, <code>HtmxScript.cdnSrc</code>, which is provided by Falco.Htmx and resolves to the official CDN URL.</p>
1616
<pre><code class="language-fsharp">module View =
1717
let template content =
18-
Elem.html [ Attr.lang &quot;en&quot; ] [
19-
Elem.head [] [
20-
Elem.script [ Attr.src HtmxScript.cdnSrc ] [] ]
21-
Elem.body []
18+
_html [ _lang &quot;en&quot; ] [
19+
_head [] [
20+
_script [ _src HtmxScript.cdnSrc ] [] ]
21+
_body []
2222
content ]
2323
</code></pre>
2424
<h2 id="components">Components</h2>
@@ -29,20 +29,20 @@ <h2 id="components">Components</h2>
2929

3030
module Components =
3131
let clicker =
32-
Elem.button
32+
_button
3333
[ Hx.get &quot;/click&quot;
3434
Hx.swapOuterHtml ]
35-
[ Text.raw &quot;Click Me&quot; ]
35+
[ _text &quot;Click Me&quot; ]
3636

3737
let resetter =
38-
Elem.div [ Attr.id &quot;wrapper&quot; ] [
39-
Text.h2 &quot;Way to go! You clicked it!&quot;
40-
Elem.br []
41-
Elem.button
38+
_div [ _id &quot;wrapper&quot; ] [
39+
_h2' &quot;Way to go! You clicked it!&quot;
40+
_br []
41+
_button
4242
[ Hx.get &quot;/reset&quot;
4343
Hx.swapOuterHtml
4444
Hx.targetCss &quot;#wrapper&quot; ]
45-
[ Text.raw &quot;Reset&quot; ] ]
45+
[ _text &quot;Reset&quot; ] ]
4646
</code></pre>
4747
<p>The <code>clicker</code> component is a simple button that will send a GET request to the server when clicked. The response will replace the button with the <code>resetter</code> component which will be rendered in the same location and can be used to restore the original state.</p>
4848
<h2 id="handlers">Handlers</h2>
@@ -51,7 +51,7 @@ <h2 id="handlers">Handlers</h2>
5151
let handleIndex : HttpHandler =
5252
let html =
5353
View.template [
54-
Text.h1 &quot;Example: Click &amp; Swap&quot;
54+
_h1' &quot;Example: Click &amp; Swap&quot;
5555
View.Components.clicker ]
5656

5757
Response.ofHtml html

0 commit comments

Comments
 (0)