You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
nginx-ui/server/pkg/nginx/format_code.go

19 lines
414 B
Go

package nginx
import (
"github.com/tufanbarisyildirim/gonginx"
"github.com/tufanbarisyildirim/gonginx/parser"
)
func (c *NgxConfig) FmtCode() (fmtContent string) {
fmtContent = gonginx.DumpConfig(c.c, gonginx.IndentedStyle)
return
}
func FmtCode(content string) (fmtContent string) {
p := parser.NewStringParser(content)
c := p.Parse()
fmtContent = gonginx.DumpConfig(c, gonginx.IndentedStyle)
return
}