chore(tools): Fix doc inclusion tools on Windows (#13685)
This commit is contained in:
parent
043aa0374b
commit
1f3b7e86ef
|
|
@ -91,7 +91,7 @@ func main() {
|
||||||
|
|
||||||
newUnresolved := make(map[string]string)
|
newUnresolved := make(map[string]string)
|
||||||
for name, fn := range unresolved {
|
for name, fn := range unresolved {
|
||||||
if filepath.IsAbs(fn) {
|
if strings.HasPrefix(filepath.ToSlash(fn), "/") {
|
||||||
fn = filepath.Join(root, fn)
|
fn = filepath.Join(root, fn)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -121,7 +121,7 @@ func main() {
|
||||||
pwd = string(filepath.Separator) + pwd
|
pwd = string(filepath.Separator) + pwd
|
||||||
for _, iname := range extractIncludes(tmpl) {
|
for _, iname := range extractIncludes(tmpl) {
|
||||||
ifn := iname
|
ifn := iname
|
||||||
if !filepath.IsAbs(ifn) {
|
if !strings.HasPrefix(ifn, "/") {
|
||||||
ifn = filepath.Join(pwd, ifn)
|
ifn = filepath.Join(pwd, ifn)
|
||||||
}
|
}
|
||||||
newUnresolved[iname] = ifn
|
newUnresolved[iname] = ifn
|
||||||
|
|
|
||||||
|
|
@ -52,10 +52,9 @@ func extractIncludeBlock(txt []byte, includesEx *regexp.Regexp, root string) *in
|
||||||
if len(inc) != 2 {
|
if len(inc) != 2 {
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
include := filepath.FromSlash(string(inc[1]))
|
include := string(inc[1])
|
||||||
// Make absolute paths relative to the include-root if any
|
// Make absolute paths relative to the include-root if any
|
||||||
// Check original value to avoid platform specific slashes
|
if strings.HasPrefix(include, "/") {
|
||||||
if filepath.IsAbs(string(inc[1])) {
|
|
||||||
if root == "" {
|
if root == "" {
|
||||||
log.Printf("Ignoring absolute include %q without include root...", include)
|
log.Printf("Ignoring absolute include %q without include root...", include)
|
||||||
continue
|
continue
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue