Fixed some bugs around paths and templates

This commit is contained in:
Leon Mika 2026-02-08 10:50:39 +11:00
parent b84425251a
commit 984257fb41
2 changed files with 5 additions and 4 deletions

View file

@ -2,9 +2,9 @@ package progdoc
import (
"bytes"
"html/template"
"io"
"os"
"text/template"
"github.com/yuin/goldmark"
"github.com/yuin/goldmark/extension"

View file

@ -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},
})
}