From 984257fb414b08dbf5788946f47f6ef33b4be678 Mon Sep 17 00:00:00 2001 From: Leon Mika Date: Sun, 8 Feb 2026 10:50:39 +1100 Subject: [PATCH] Fixed some bugs around paths and templates --- mdsource.go | 2 +- pathbuilder.go | 7 ++++--- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/mdsource.go b/mdsource.go index 8712c43..9072bb7 100644 --- a/mdsource.go +++ b/mdsource.go @@ -2,9 +2,9 @@ package progdoc import ( "bytes" - "html/template" "io" "os" + "text/template" "github.com/yuin/goldmark" "github.com/yuin/goldmark/extension" diff --git a/pathbuilder.go b/pathbuilder.go index c871c2a..d0798bb 100644 --- a/pathbuilder.go +++ b/pathbuilder.go @@ -2,11 +2,11 @@ package progdoc import ( "bytes" - "html/template" "log" "os" "path/filepath" "strings" + "text/template" ) func Path(path string) PathBuilder { @@ -59,6 +59,7 @@ func (pb PathBuilder) GoFiles(dir, templateFile string) Option { if err != nil { return nil } + targetPath := filepath.Join(pb.path, relPath) absName, err := filepath.Abs(path) if err != nil { @@ -81,7 +82,7 @@ func (pb PathBuilder) GoFiles(dir, templateFile string) Option { } sm.Pages = append(sm.Pages, sitePage{ - Path: relPath, + Path: targetPath, Source: stdLayoutSource{ MainSource: mdTemplateSource{ Template: tmpl, @@ -120,7 +121,7 @@ func (pb PathBuilder) Dir(dir string) Option { log.Printf("Page '%s' -> %s", targetPath, path) sm.Pages = append(sm.Pages, sitePage{ - Path: relPath, + Path: targetPath, Source: stdLayoutSource{MainSource: src}, }) }