Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

v5 #190

Merged
merged 7 commits into from
Aug 6, 2024
Merged

v5 #190

Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 0 additions & 4 deletions .github/FUNDING.yml

This file was deleted.

48 changes: 43 additions & 5 deletions .github/workflows/standard-go-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,49 @@ name: Standard Test

on:
push:
branches: [ main ]
branches: [main]
pull_request:

jobs:
call-standard-test:
name: Test
uses: gobuffalo/.github/.github/workflows/go-test.yml@v1
secrets: inherit
dependency-review:
if: ${{ github.event_name == 'pull_request' }}
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Dependency Review
uses: actions/dependency-review-action@v1

standard-go-test:
name: go${{ matrix.go-version }}/${{ matrix.os }}
runs-on: ${{ matrix.os }}
strategy:
matrix:
go-version:
- "1.21"
- "1.22"
os:
- "ubuntu-latest"
- "macos-latest"
- "windows-latest"

steps:
- uses: actions/checkout@v3

- name: Set up Go
uses: actions/setup-go@v5
with:
go-version: ${{ matrix.go-version }}

- name: Test
if: ${{ matrix.os != 'windows-latest' }}
env:
YARN_ENABLE_IMMUTABLE_INSTALLS: 0
run: |
go test -v -p 1 -race -cover -tags "sqlite,integration" ./...

- name: Short Test
if: ${{ matrix.os == 'windows-latest' }}
env:
YARN_ENABLE_IMMUTABLE_INSTALLS: 0
run: |
go test -v -p 1 -tags "sqlite,integration" ./...
29 changes: 25 additions & 4 deletions .github/workflows/standard-stale.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,28 @@ on:
- cron: "30 1 * * *"

jobs:
call-standard-autocloser:
name: Autocloser
uses: gobuffalo/.github/.github/workflows/stale.yml@v1
secrets: inherit
stale:
runs-on: ubuntu-latest
permissions:
issues: write # for actions/stale to close stale issues
pull-requests: write # for actions/stale to close stale PRs

steps:
- uses: actions/stale@v6
with:
repo-token: ${{ secrets.GITHUB_TOKEN }}
days-before-issue-stale: 30
days-before-issue-close: 7
days-before-pr-stale: 45
days-before-pr-close: 7
stale-issue-message: "This issue is stale because it has been open 30 days with no activity. Remove stale label or comment. Otherwise, this will be closed in 7 days."
stale-pr-message: "This PR is stale because it has been open 45 days with no activity. Remove stale label or comment. Otherwise, this will be closed in 7 days."
close-issue-message: "This issue was closed because it has been stalled for 30+7 days with no activity."
close-pr-message: "This PR was closed because it has been stalled for 45+7 days with no activity."
stale-issue-label: "stale"
stale-pr-label: "stale"
close-issue-label: "s: closed"
close-pr-label: "s: closed"
exempt-issue-labels: "bug,security,s: accepted,s: blocked,s: hold"
exempt-pr-labels: "bug,security,s: accepted,s: blocked,s: hold"
exempt-all-milestones: true
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 @@ -4,16 +4,16 @@ import (
"fmt"
"unsafe"

"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
Loading
Loading