mirror of
https://github.com/0xJacky/nginx-ui.git
synced 2025-05-12 19:05:55 +02:00
feat: added format code to config editor
This commit is contained in:
parent
5cc9068f5f
commit
594c61a0ff
13 changed files with 230 additions and 22 deletions
|
@ -2,9 +2,17 @@ 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
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue