mirror of
https://github.com/caddyserver/caddy.git
synced 2026-01-17 01:30:34 +00:00
This commit is contained in:
@@ -18,6 +18,7 @@ import (
|
||||
"bytes"
|
||||
"io"
|
||||
"slices"
|
||||
"strings"
|
||||
"unicode"
|
||||
)
|
||||
|
||||
@@ -209,6 +210,15 @@ func Format(input []byte) []byte {
|
||||
}
|
||||
}
|
||||
|
||||
if strings.Contains(quotes, "`") {
|
||||
if ch == '`' && space && !beginningOfLine {
|
||||
write(' ')
|
||||
}
|
||||
write(ch)
|
||||
space = false
|
||||
continue
|
||||
}
|
||||
|
||||
if unicode.IsSpace(ch) {
|
||||
space = true
|
||||
heredocEscaped = false
|
||||
|
||||
@@ -464,6 +464,17 @@ block2 {
|
||||
}
|
||||
`,
|
||||
},
|
||||
{
|
||||
description: "issue #7425: multiline backticked string indentation",
|
||||
input: `https://localhost:8953 {
|
||||
respond ` + "`" + `Here are some random numbers:
|
||||
|
||||
{{randNumeric 16}}
|
||||
|
||||
Hope this helps.` + "`" + `
|
||||
}`,
|
||||
expect: "https://localhost:8953 {\n\trespond `Here are some random numbers:\n\n{{randNumeric 16}}\n\nHope this helps.`\n}",
|
||||
},
|
||||
} {
|
||||
// the formatter should output a trailing newline,
|
||||
// even if the tests aren't written to expect that
|
||||
|
||||
Reference in New Issue
Block a user