Skip to content

Commit

Permalink
task: removing deps and updating to go 1.22
Browse files Browse the repository at this point in the history
  • Loading branch information
paganotoni committed Aug 6, 2024
1 parent 7f2c245 commit 5e64024
Show file tree
Hide file tree
Showing 91 changed files with 1,462 additions and 465 deletions.
4 changes: 0 additions & 4 deletions .github/FUNDING.yml

This file was deleted.

15 changes: 7 additions & 8 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# Plush

[![Standard Test](https://github.com/gobuffalo/plush/actions/workflows/standard-go-test.yml/badge.svg)](https://github.com/gobuffalo/plush/actions/workflows/standard-go-test.yml)
[![Go Reference](https://pkg.go.dev/badge/github.com/gobuffalo/plush/v4.svg)](https://pkg.go.dev/github.com/gobuffalo/plush/v4)
[![Go Reference](https://pkg.go.dev/badge/github.com/gobuffalo/plush/v5.svg)](https://pkg.go.dev/github.com/gobuffalo/plush/v5)

Plush is the templating system that [Go](http://golang.org) both needs _and_ deserves. Powerful, flexible, and extendable, Plush is there to make writing your templates that much easier.

Expand Down Expand Up @@ -207,8 +207,8 @@ for (i,v) in [1, 2, 3,4,5,6,7,8,9,10] {
if (i > 0) {
continue
}
return v
}
return v
}
```

You can terminate the for loop with `break`:
Expand All @@ -217,8 +217,8 @@ for (i,v) in [1, 2, 3,4,5,6,7,8,9,10] {
if (i > 5) {
break
}
return v
}
return v
}
```

The values inside the `()` part of the statement are the names you wish to give to the key (or index) and the value of the expression. The `expression` can be an array, map, or iterator type.
Expand Down Expand Up @@ -294,9 +294,9 @@ fmt.Print(s)
// output: 45
```

## Helpers
## Default helpers

For a full list, and documentation of, all the Helpers included in Plush, see [`github.com/gobuffalo/helpers`](https://godoc.org/github.com/gobuffalo/helpers).
Plush ships with a comprehensive list of helpers to make your life easier. For more info check the helpers package.

### Custom Helpers

Expand Down Expand Up @@ -350,4 +350,3 @@ This package absolutely 100% could not have been written without the help of Tho
Not only did the book make understanding the process of writing lexers, parsers, and asts, but it also provided the basis for the syntax of Plush itself.

If you have yet to read Thorsten's book, I can't recommend it enough. Please go and buy it!

35 changes: 0 additions & 35 deletions SHOULDERS.md

This file was deleted.

2 changes: 1 addition & 1 deletion ast/ast.go
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package ast

import "github.com/gobuffalo/plush/v4/token"
import "github.com/gobuffalo/plush/v5/token"

type TokenAble struct {
token.Token
Expand Down
4 changes: 2 additions & 2 deletions ast/ast_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@ package ast_test
import (
"testing"

"github.com/gobuffalo/plush/v4/ast"
"github.com/gobuffalo/plush/v4/token"
"github.com/gobuffalo/plush/v5/ast"
"github.com/gobuffalo/plush/v5/token"
"github.com/stretchr/testify/require"
)

Expand Down
2 changes: 1 addition & 1 deletion ast/return_statement.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ package ast
import (
"bytes"

"github.com/gobuffalo/plush/v4/token"
"github.com/gobuffalo/plush/v5/token"
)

type ReturnStatement struct {
Expand Down
6 changes: 3 additions & 3 deletions comments_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ package plush_test
import (
"testing"

"github.com/gobuffalo/plush/v4"
"github.com/gobuffalo/plush/v5"
"github.com/stretchr/testify/require"
)

Expand Down Expand Up @@ -32,12 +32,12 @@ func Test_BlockComment(t *testing.T) {
r := require.New(t)
input := map[string]string{
"test1": `
<%# this is
<%# this is
a block comment %>
Hi
`,
"test2": `
<% <%# this is
<% <%# this is
a block comment %> %>
Hi`,
}
Expand Down
6 changes: 3 additions & 3 deletions compiler.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,16 +3,16 @@ package plush
import (
"fmt"

"github.com/gobuffalo/plush/v4/token"
"github.com/gobuffalo/plush/v5/token"

"html/template"
"reflect"
"regexp"
"strings"
"time"

"github.com/gobuffalo/helpers/hctx"
"github.com/gobuffalo/plush/v4/ast"
"github.com/gobuffalo/plush/v5/ast"
"github.com/gobuffalo/plush/v5/helpers/hctx"
)

type ErrUnknownIdentifier struct {
Expand Down
6 changes: 3 additions & 3 deletions context.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import (
"context"
"sync"

"github.com/gobuffalo/helpers/hctx"
"github.com/gobuffalo/plush/v5/helpers/hctx"
)

var _ context.Context = &Context{}
Expand Down Expand Up @@ -85,7 +85,7 @@ func NewContextWith(data map[string]interface{}) *Context {
moot: &sync.Mutex{},
}

for k, v := range Helpers.helpers {
for k, v := range Helpers.All() {
if !c.Has(k) {
c.Set(k, v)
}
Expand All @@ -105,7 +105,7 @@ func NewContextWithOuter(data map[string]interface{}, out *Context) *Context {
moot: &sync.Mutex{},
}

for k, v := range Helpers.helpers {
for k, v := range Helpers.All() {
if !c.Has(k) && !c.outer.Has(k) {
c.Set(k, v)
}
Expand Down
2 changes: 1 addition & 1 deletion context_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import (

"golang.org/x/sync/errgroup"

"github.com/gobuffalo/plush/v4"
"github.com/gobuffalo/plush/v5"
"github.com/stretchr/testify/require"
)

Expand Down
2 changes: 1 addition & 1 deletion error_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import (
"errors"
"testing"

"github.com/gobuffalo/plush/v4"
"github.com/gobuffalo/plush/v5"
"github.com/stretchr/testify/require"
)

Expand Down
2 changes: 1 addition & 1 deletion escape_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import (
"html/template"
"testing"

"github.com/gobuffalo/plush/v4"
"github.com/gobuffalo/plush/v5"
"github.com/stretchr/testify/require"
)

Expand Down
2 changes: 1 addition & 1 deletion example_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import (
"html/template"
"log"

"github.com/gobuffalo/plush/v4"
"github.com/gobuffalo/plush/v5"
)

// ExampleRender using `if`, `for`, `else`, functions, etc...
Expand Down
28 changes: 14 additions & 14 deletions for_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import (
"strings"
"testing"

"github.com/gobuffalo/plush/v4"
"github.com/gobuffalo/plush/v5"
"github.com/stretchr/testify/require"
)

Expand Down Expand Up @@ -43,13 +43,13 @@ func Test_Render_For_Array_Continue(t *testing.T) {
input := `<%= for (i,v) in [1, 2, 3,4,5,6,7,8,9,10] {
%>Start<%
if (v == 1 || v ==3 || v == 5 || v == 7 || v == 9) {
%>Odd<%
continue
}
return v
return v
} %>`
s, err := plush.Render(input, plush.NewContext())

Expand All @@ -60,13 +60,13 @@ func Test_Render_For_Array_Continue(t *testing.T) {
func Test_Render_For_Array_WithNoOutput(t *testing.T) {
r := require.New(t)
input := `<%= for (i,v) in [1, 2, 3,4,5,6,7,8,9,10] {
if (v == 1 || v == 2 || v ==3 || v == 4|| v == 5 || v == 6 || v == 7 || v == 8 || v == 9 || v == 10) {
continue
}
return v
return v
} %>`
s, err := plush.Render(input, plush.NewContext())

Expand All @@ -79,7 +79,7 @@ func Test_Render_For_Array_WithoutContinue(t *testing.T) {
input := `<%= for (i,v) in [1, 2, 3,4,5,6,7,8,9,10] {
if (v == 1 || v ==3 || v == 5 || v == 7 || v == 9) {
}
return v
return v
} %>`
s, err := plush.Render(input, plush.NewContext())

Expand All @@ -91,7 +91,7 @@ func Test_Render_For_Array_ContinueNoControl(t *testing.T) {
r := require.New(t)
input := `<%= for (i,v) in [1, 2, 3,4,5,6,7,8,9,10] {
continue
return v
return v
} %>`
s, err := plush.Render(input, plush.NewContext())

Expand All @@ -104,13 +104,13 @@ func Test_Render_For_Array_Break_String(t *testing.T) {
input := `<%= for (i,v) in [1, 2, 3,4,5,6,7,8,9,10] {
%>Start<%
if (v == 5) {
%>Odd<%
break
}
return v
return v
} %>`
s, err := plush.Render(input, plush.NewContext())

Expand All @@ -124,7 +124,7 @@ func Test_Render_For_Array_WithBreakFirstValue(t *testing.T) {
if (v == 1 || v ==3 || v == 5 || v == 7 || v == 9) {
break
}
return v
return v
} %>`
s, err := plush.Render(input, plush.NewContext())

Expand All @@ -139,7 +139,7 @@ func Test_Render_For_Array_WithBreakFirstValueWithReturn(t *testing.T) {
%><%=v%><%
break
}
return v
return v
} %>`
s, err := plush.Render(input, plush.NewContext())

Expand All @@ -150,7 +150,7 @@ func Test_Render_For_Array_Break(t *testing.T) {
r := require.New(t)
input := `<%= for (i,v) in [1, 2, 3,4,5,6,7,8,9,10] {
break
return v
return v
} %>`
s, err := plush.Render(input, plush.NewContext())

Expand Down
18 changes: 0 additions & 18 deletions forms.go

This file was deleted.

6 changes: 3 additions & 3 deletions functions_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import (
"html/template"
"testing"

"github.com/gobuffalo/plush/v4"
"github.com/gobuffalo/plush/v5"
"github.com/stretchr/testify/require"
)

Expand Down Expand Up @@ -152,7 +152,7 @@ func Test_Render_Function_With_Backticks_And_Quotes(t *testing.T) {
papers.updated_at,
papers.id,
papers.name,
( setweight(to_tsvector(papers.name::text), 'A'::"char") ||
( setweight(to_tsvector(papers.name::text), 'A'::"char") ||
setweight(to_tsvector(papers.author_name), 'B'::"char")
) || setweight(to_tsvector(papers.description), 'C'::"char")
AS paper_vector
Expand All @@ -171,7 +171,7 @@ func Test_Render_Function_With_Backticks_And_Quotes(t *testing.T) {
papers.updated_at,
papers.id,
papers.name,
( setweight(to_tsvector(papers.name::text), 'A'::"char") ||
( setweight(to_tsvector(papers.name::text), 'A'::"char") ||
setweight(to_tsvector(papers.author_name), 'B'::"char")
) || setweight(to_tsvector(papers.description), 'C'::"char")
AS paper_vector
Expand Down
20 changes: 14 additions & 6 deletions go.mod
Original file line number Diff line number Diff line change
@@ -1,11 +1,19 @@
module github.com/gobuffalo/plush/v4
module github.com/gobuffalo/plush/v5

go 1.16
go 1.22

require (
github.com/gobuffalo/github_flavored_markdown v1.1.4
github.com/gobuffalo/helpers v0.6.7
github.com/gobuffalo/flect v1.0.2
github.com/gobuffalo/tags/v3 v3.1.4
github.com/stretchr/testify v1.8.4
golang.org/x/sync v0.3.0
github.com/stretchr/testify v1.9.0
golang.org/x/sync v0.8.0
)

require (
github.com/davecgh/go-spew v1.1.1 // indirect
github.com/fatih/structs v1.1.0 // indirect
github.com/kr/pretty v0.1.0 // indirect
github.com/pmezard/go-difflib v1.0.0 // indirect
gopkg.in/check.v1 v1.0.0-20190902080502-41f04d3bba15 // indirect
gopkg.in/yaml.v3 v3.0.1 // indirect
)
Loading

0 comments on commit 5e64024

Please sign in to comment.