Fixed some bugs around paths and templates
This commit is contained in:
parent
b84425251a
commit
984257fb41
|
|
@ -2,9 +2,9 @@ package progdoc
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"bytes"
|
"bytes"
|
||||||
"html/template"
|
|
||||||
"io"
|
"io"
|
||||||
"os"
|
"os"
|
||||||
|
"text/template"
|
||||||
|
|
||||||
"github.com/yuin/goldmark"
|
"github.com/yuin/goldmark"
|
||||||
"github.com/yuin/goldmark/extension"
|
"github.com/yuin/goldmark/extension"
|
||||||
|
|
|
||||||
|
|
@ -2,11 +2,11 @@ package progdoc
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"bytes"
|
"bytes"
|
||||||
"html/template"
|
|
||||||
"log"
|
"log"
|
||||||
"os"
|
"os"
|
||||||
"path/filepath"
|
"path/filepath"
|
||||||
"strings"
|
"strings"
|
||||||
|
"text/template"
|
||||||
)
|
)
|
||||||
|
|
||||||
func Path(path string) PathBuilder {
|
func Path(path string) PathBuilder {
|
||||||
|
|
@ -59,6 +59,7 @@ func (pb PathBuilder) GoFiles(dir, templateFile string) Option {
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
targetPath := filepath.Join(pb.path, relPath)
|
||||||
|
|
||||||
absName, err := filepath.Abs(path)
|
absName, err := filepath.Abs(path)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
|
@ -81,7 +82,7 @@ func (pb PathBuilder) GoFiles(dir, templateFile string) Option {
|
||||||
}
|
}
|
||||||
|
|
||||||
sm.Pages = append(sm.Pages, sitePage{
|
sm.Pages = append(sm.Pages, sitePage{
|
||||||
Path: relPath,
|
Path: targetPath,
|
||||||
Source: stdLayoutSource{
|
Source: stdLayoutSource{
|
||||||
MainSource: mdTemplateSource{
|
MainSource: mdTemplateSource{
|
||||||
Template: tmpl,
|
Template: tmpl,
|
||||||
|
|
@ -120,7 +121,7 @@ func (pb PathBuilder) Dir(dir string) Option {
|
||||||
|
|
||||||
log.Printf("Page '%s' -> %s", targetPath, path)
|
log.Printf("Page '%s' -> %s", targetPath, path)
|
||||||
sm.Pages = append(sm.Pages, sitePage{
|
sm.Pages = append(sm.Pages, sitePage{
|
||||||
Path: relPath,
|
Path: targetPath,
|
||||||
Source: stdLayoutSource{MainSource: src},
|
Source: stdLayoutSource{MainSource: src},
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue