Skip to content

Commit 5f31096

Browse files
committed
UPDATE README
1 parent 9d537c8 commit 5f31096

File tree

7 files changed

+24
-18
lines changed

7 files changed

+24
-18
lines changed

.github/templates/README.template.md

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -19,18 +19,20 @@ This will create a new file called `README.md` in your current working directory
1919

2020
Take a look at this `TEMPLATE.md` file:
2121

22-
```markdown
23-
{{{ #://examples/TEMPLATE.md }}}
24-
```
22+
---
23+
24+
{{{ !#://examples/TEMPLATE.md }}}
25+
26+
---
2527

2628
Notice the `{{ #://... }}}` and `{{ @://... }}}`, these are used to include local and remot files in your Template respectively.
2729
This Template will then include `examples/fs/INCREDIBLE.md` and `docker-compose.yaml` (from [Secured Signal API](https://github.com/CodeShellDev/secured-signal-api/blob/main/docker-compose.yaml)) in its File Content.
2830

2931
Which results in:
3032

31-
```markdown
32-
{{{ !#://examples/TEMPLATE.md }}}
33-
```
33+
---
34+
35+
{{{ #://examples/TEMPLATE.md }}}
3436

3537
## Contributing
3638

.prettierignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
examples/**

examples/TEMPLATE.md

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,14 @@
1+
```md
12
Wow, look at this incredible file... 🥳
3+
```
24

35
{{{ #://examples/fs/INCREDIBLE.md }}}
46

7+
```md
58
You want the `docker-compose.yaml` file for Secured Signal API?
69
Really? Here you go:
10+
```
711

812
```yaml
913
{{{ @://https://raw.githubusercontent.com/CodeShellDev/secured-signal-api/refs/heads/main/docker-compose.yaml }}}
10-
```
14+
```

examples/fs/INCREDIBLE.md

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
1-
`cmd/root.go`:
2-
31
```go
2+
// src: cmd/root.go
43
{{{ #://cmd/root.go }}}
5-
```
4+
```

internals/template/get.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,10 +7,10 @@ import (
77
"github.com/codeshelldev/goplater/internals/template/path"
88
)
99

10-
func templateGet(context context.TemplateContext) any {
10+
func templateGet(str string, context context.TemplateContext) any {
1111
var res string
1212

13-
templatePath, err := path.GetTemplatePath(context.Path)
13+
templatePath, err := path.GetTemplatePath(str)
1414

1515
if err != nil {
1616
fmt.Println("error templating:", err.Error())
@@ -22,7 +22,7 @@ func templateGet(context context.TemplateContext) any {
2222
res, context = templatePath.Protocol.ApplyFunc(templatePath.PathComponent.Value, context)
2323

2424
res, context = templatePath.Operator.ApplyFunc(templatePath.PathComponent.Value, res, context)
25-
25+
2626
res = cleanOutput(res, context)
2727

2828
return res

internals/template/path/operators/supress.go

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
package operators
22

33
import (
4+
"fmt"
45
"strings"
56

67
"github.com/codeshelldev/goplater/internals/template/context"
@@ -12,6 +13,8 @@ func init() {
1213
Name: "supress",
1314
AllowedProtocols: []types.TemplateProtocol{{ Name: "local" },{ Name: "remote" }},
1415
ApplyFunc: func(pathComponent, content string, context context.TemplateContext) (string, context.TemplateContext) {
16+
fmt.Println(context)
17+
1518
return content, context
1619
},
1720
MatchFunc: func(match string) (bool, string) {

internals/template/render.go

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -30,11 +30,8 @@ func templateStr(str string, context context.TemplateContext, variables map[stri
3030
}
3131

3232
templt := templateutils.CreateTemplateWithFunc(context.Path, template.FuncMap{
33-
"get": func (path string) any {
34-
newContext := context
35-
newContext.Path = path
36-
37-
return templateGet(newContext)
33+
"get": func (str string) any {
34+
return templateGet(str, context)
3835
},
3936
})
4037

0 commit comments

Comments
 (0)