fix(0002): spelling and consistency
This commit is contained in:
parent
6bf4b97108
commit
8a14df1d17
2 changed files with 8 additions and 6 deletions
|
@ -100,6 +100,7 @@
|
|||
'';
|
||||
|
||||
installPhase = ''
|
||||
chmod -R u+rw build
|
||||
mv build $out
|
||||
'';
|
||||
};
|
||||
|
@ -108,6 +109,7 @@
|
|||
buildInputs = with pkgs; [
|
||||
luajit
|
||||
confgen.packages.${system}.default
|
||||
haxe
|
||||
nodePackages.uglify-js
|
||||
gnumake
|
||||
luajitPackages.luafilesystem
|
||||
|
|
|
@ -18,7 +18,7 @@ evolved into a universal template engine for generating... anything you could th
|
|||
Confgen is a template engine. If you've never heard that term before, it's basically a tool that
|
||||
takes in a file with placeholders in it, and then inserts some data in place of them. This might
|
||||
sound unspectacular at first, but that's also a gross oversimplification. Confgen, for one, doesn't
|
||||
only let you have placeholders (expression blocks), but also lets you have control flow (code
|
||||
only let you have placeholders (expression blocks), but also lets you have control flow (statement
|
||||
blocks). `for`s, `if`s and functions are all fair game. What makes Confgen even more special is
|
||||
that, unlike most template engines, it doesn't implement all these daunting concepts itself, but
|
||||
instead harnesses the full power of the [Lua](https://lua.org) programming language (basic knowledge
|
||||
|
@ -245,7 +245,7 @@ This should look familiar. All our `<% oc %> ... <% cc %>` blocks have been inse
|
|||
like our post-processor! This is what makes arbitrary control flow possible. Contrarily, our
|
||||
`<% oe %> ... <% ce %>` blocks have been replaced with `tmpl:pushValue(...)`. `pushValue` is simply a
|
||||
mostly invisible function from Confgen that turns the given value to a string and appends it to the
|
||||
output. Something else that should be jumps out here are all those calls to `pushLitIdx` (push
|
||||
output. Something else that should be jumping out here are all those calls to `pushLitIdx` (push
|
||||
literal (at) index). In short, Confgen uses this number to look up a span from your template's
|
||||
source code, stored in the opaque `tmplcode` object to append to the output.
|
||||
|
||||
|
@ -289,9 +289,9 @@ Also, two times two is <% oe %> 2 * 2 <% ce %>.
|
|||
</html>
|
||||
```
|
||||
"Alright, now he's gone completely nuts" I hear you say. First, you are probably completely
|
||||
corrent, and second, if you don't understand this on a syntactical level, please re-read the
|
||||
previous section (repeat this procedure until you have internalized how expression blocks and code
|
||||
blocks work :P).
|
||||
correct, and second, if you don't understand this on a syntactical level, please re-read the
|
||||
previous section (repeat this procedure until you have internalized how expression blocks and
|
||||
statement blocks work :P).
|
||||
|
||||
A subtemplate is nothing but another instance of a template (`tmpl`) that is passed to the function
|
||||
we wrote here. This changes all the generated statements inside our function to refer to that new,
|
||||
|
@ -344,7 +344,7 @@ We could now use this in another template:
|
|||
<% oc %> opt.greet(tmpl, "my Friend") <% cc %>
|
||||
```
|
||||
|
||||
> **Note**: We use a code block here rather than an expression block, because the `greet` function
|
||||
> **Note**: We use a statement block here rather than an expression block, because the `greet` function
|
||||
> pushes to our template, not returning any value.
|
||||
|
||||
Alright, I think that's probably enough insanity for one article, but there are more to come!
|
||||
|
|
Loading…
Reference in a new issue