mirror of
https://github.com/RGBCube/HTMNIX
synced 2025-07-26 23:47:43 +00:00
Add another note about evaulation
This commit is contained in:
parent
305ea7eea6
commit
3e11d78f54
1 changed files with 25 additions and 0 deletions
25
README.md
25
README.md
|
@ -70,6 +70,30 @@ which will be available in every HTMNIX file and the HTMNIX REPL
|
||||||
> - `let in`'s.
|
> - `let in`'s.
|
||||||
> - Expressions that have spaces in them.
|
> - Expressions that have spaces in them.
|
||||||
|
|
||||||
|
> Adding onto the previous note, if you want to see how your
|
||||||
|
> HTMNIX file is **actually** evaluated, you can run the following command:
|
||||||
|
>
|
||||||
|
> ```sh
|
||||||
|
> nix-instantiate --parse html.nix
|
||||||
|
> ```
|
||||||
|
>
|
||||||
|
> This will insert a ton of parens everywhere, thus un-ambiguating the parsing.
|
||||||
|
> Here is an example:
|
||||||
|
>
|
||||||
|
> ```nix
|
||||||
|
> nix-instantiate --parse - << :end
|
||||||
|
> <ul>
|
||||||
|
> <li>"That's all!"<.li>
|
||||||
|
> <.ul>
|
||||||
|
> :end
|
||||||
|
> ```
|
||||||
|
>
|
||||||
|
> This produces the following output:
|
||||||
|
>
|
||||||
|
> ```nix
|
||||||
|
> (__findFile __nixPath "ul" (__findFile __nixPath "li") "That's all!" (__findFile __nixPath ".li") (__findFile __nixPath ".ul"))
|
||||||
|
> ```
|
||||||
|
|
||||||
Create a directory listing:
|
Create a directory listing:
|
||||||
|
|
||||||
```nix
|
```nix
|
||||||
|
@ -139,6 +163,7 @@ let
|
||||||
{ name = "Skid"; comment = "<script>alert('Got you!')</script>"; } # Does not work as all strings are escaped by default.
|
{ name = "Skid"; comment = "<script>alert('Got you!')</script>"; } # Does not work as all strings are escaped by default.
|
||||||
];
|
];
|
||||||
in
|
in
|
||||||
|
|
||||||
<ul>
|
<ul>
|
||||||
(map
|
(map
|
||||||
(comment: <li>(call ./comment.nix comment)<.li>)
|
(comment: <li>(call ./comment.nix comment)<.li>)
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue