Skip to content

Commit

Permalink
Merge pull request #110 from xushiwei/q
Browse files Browse the repository at this point in the history
README.md
  • Loading branch information
xushiwei authored Mar 12, 2024
2 parents a58ab64 + 36cea50 commit e36cd2f
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 8 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,7 @@ run ":8080"

### yaptest: HTTP Test Framework

yaptest is a web server testing framework. This classfile has the file suffix `_ytest.gox`.
[yaptest](ytest) is a web server testing framework. This classfile has the file suffix `_ytest.gox`.

Suppose we have a web server ([foo/get_p_#id.yap](ytest/demo/foo/get_p_%23id.yap)):

Expand Down
6 changes: 6 additions & 0 deletions internal/htmltempl/template.go
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,12 @@ func parseFS(fsys fs.FS, delimLeft, delimRight, suffix string) (*template.Templa
if len(filenames) == 0 {
return nil, fmt.Errorf("template: pattern matches no files: %#q", pattern)
}
if delimLeft == "" {
delimLeft = "{{"
}
if delimRight == "" {
delimRight = "}}"
}
t := template.New("").Delims(delimLeft, delimRight)
return parseFiles(t, readFileFS(fsys, delimLeft, delimRight, suffix), filenames...)
}
Expand Down
6 changes: 0 additions & 6 deletions internal/templ/template.go
Original file line number Diff line number Diff line change
Expand Up @@ -37,12 +37,6 @@ type iBuilder interface {
func TranslateEx[Builder iBuilder](b Builder, text, delimLeft, delimRight string) bool {
offs := make([]int, 0, 16)
base := 0
if delimLeft == "" {
delimLeft = "{{"
}
if delimRight == "" {
delimRight = "}}"
}
for {
pos := strings.Index(text[base:], delimLeft)
if pos < 0 {
Expand Down
2 changes: 1 addition & 1 deletion internal/templ/template_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ efg
t.Fatal("translate(noScriptEnd):", ret)
}
var b bytes.Buffer
TranslateEx(&b, yapScriptIn, "", "")
TranslateEx(&b, yapScriptIn, "{{", "}}")
if b.String() != yapScriptOut {
t.Fatal("TranslateEx:", b.String())
}
Expand Down

0 comments on commit e36cd2f

Please sign in to comment.