Skip to content

Commit

Permalink
fix readme
Browse files Browse the repository at this point in the history
  • Loading branch information
David Krause (enthus1ast) committed Aug 9, 2024
1 parent 657ea66 commit 5241a69
Showing 1 changed file with 7 additions and 7 deletions.
14 changes: 7 additions & 7 deletions readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ proc renderIndex(title: string, users: seq[User]): string =
## so it can access all variables like `title` and `users`
## the return variable could be `string` or `Rope` or
## anything which has a `&=`(obj: YourObj, str: string) proc.
compileTemplateFile(getScriptDir() / "index.nimja")
compileTemplateFile("index.nimja", baseDir = getScriptDir())
proc main {.async.} =
var server = newAsyncHttpServer()
Expand Down Expand Up @@ -258,7 +258,7 @@ you should use it like so:
```nim
import os # for `/`
proc myRenderProc(someParam: string): string =
compileTemplateFile(getScriptDir() / "myFile.html")
compileTemplateFile("myFile.html", baseDir = getScriptDir())
echo myRenderProc("test123")
```
Expand Down Expand Up @@ -379,7 +379,7 @@ situations where you want to inline a render call.
```nim
let leet = 1337
echo tmpls("foo {{leet}}")
echo tmplf(getScriptDir() / "templates" / "myfile.nimja")
echo tmplf("templates" / "myfile.nimja", baseDir = getScriptDir())
```

A context can be supplied to the template, to override variable names:
Expand Down Expand Up @@ -525,7 +525,7 @@ if the child.nimja is compiled then rendered like so:

```nim
proc renderChild(): string =
compileTemplateFile(getScriptDir() / "child.nimja")
compileTemplateFile("child.nimja", baseDir = getScriptDir())
echo renderChild()
```
Expand Down Expand Up @@ -780,7 +780,7 @@ Good for documentation etc..

```nim
proc test(): string =
let path = (getScriptDir() / "tests/basic" / "includeRawT.txt")
let path = ("tests/basic" / "includeRawT.txt", baseDir = getScriptDir())
compileTemplateStr("""pre{{ includeRaw(path) }}suf""")
```

Expand Down Expand Up @@ -1012,10 +1012,10 @@ import os # for `/`
proc index*(): string {.exportc, dynlib.} =
var foos = 1351 # change me i'm dynamic :)
compileTemplateFile(getScriptDir() / "templates/index.nimja")
compileTemplateFile("templates/index.nimja", baseDir = getScriptDir())
proc detail*(id: string): string {.exportc, dynlib.} =
compileTemplateFile(getScriptDir() / "templates/detail.nimja")
compileTemplateFile("templates/detail.nimja", baseDir = getScriptDir())
```

Expand Down

0 comments on commit 5241a69

Please # to comment.