Skip to content

Commit

Permalink
fix broken accepted search on types
Browse files Browse the repository at this point in the history
  • Loading branch information
F-Amaral committed Sep 12, 2023
1 parent 8c0b7a1 commit 782115a
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 4 deletions.
1 change: 0 additions & 1 deletion cmd/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@ func main() {
header := buildRow()
//content := buildRow()
//footer := buildRow()

pdf.Add(header /*content, footer*/)

err := pdf.Generate("v2.pdf")
Expand Down
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
module github.com/johnfercher/maroto

go 1.13
go 1.18

require (
github.com/boombuler/barcode v1.0.1
Expand Down
8 changes: 6 additions & 2 deletions pkg/v2/types.go
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
package v2

import "slices"

const (
Document = "document"
Row = "row"
Expand All @@ -16,8 +18,10 @@ func (t DocumentType) String() string {
}

func (t DocumentType) Accept(dt string) bool {
_, ok := buildAcceptedMap()[dt]
return ok
if val, ok := buildAcceptedMap()[t.String()]; ok {
return slices.Contains(val, dt)
}
return false
}

func buildAcceptedMap() map[string][]string {
Expand Down

0 comments on commit 782115a

Please sign in to comment.