59 lines
1.5 KiB
Go
59 lines
1.5 KiB
Go
package main
|
|
|
|
import (
|
|
"fmt"
|
|
"os"
|
|
"path/filepath"
|
|
|
|
"github.com/rogeecn/database_render/internal/template"
|
|
)
|
|
|
|
func main() {
|
|
// Test template loading
|
|
builtinPath, _ := filepath.Abs("./web/templates/builtin")
|
|
customPath, _ := filepath.Abs("./web/templates/custom")
|
|
|
|
fmt.Printf("Builtin path: %s\n", builtinPath)
|
|
fmt.Printf("Custom path: %s\n", customPath)
|
|
|
|
// Check if paths exist
|
|
if _, err := os.Stat(builtinPath); os.IsNotExist(err) {
|
|
fmt.Printf("Builtin path does not exist: %s\n", builtinPath)
|
|
return
|
|
}
|
|
|
|
if _, err := os.Stat(customPath); os.IsNotExist(err) {
|
|
fmt.Printf("Custom path does not exist: %s\n", customPath)
|
|
return
|
|
}
|
|
|
|
// Test loading list template for categories
|
|
loader := template.NewTemplateLoader(template.TemplateConfig{
|
|
BuiltinPath: builtinPath,
|
|
CustomPath: customPath,
|
|
CacheEnabled: false,
|
|
})
|
|
|
|
tmpl, err := loader.LoadTemplate("list", "categories")
|
|
if err != nil {
|
|
fmt.Printf("Error loading template: %v\n", err)
|
|
return
|
|
}
|
|
|
|
fmt.Printf("Template loaded successfully: %v\n", tmpl != nil)
|
|
|
|
// Test file existence
|
|
builtinList := filepath.Join(builtinPath, "list.html")
|
|
if _, err := os.Stat(builtinList); err != nil {
|
|
fmt.Printf("Builtin list.html not found: %v\n", err)
|
|
} else {
|
|
fmt.Printf("Builtin list.html found: %s\n", builtinList)
|
|
}
|
|
|
|
layoutFile := filepath.Join(builtinPath, "layout.html")
|
|
if _, err := os.Stat(layoutFile); err != nil {
|
|
fmt.Printf("Layout.html not found: %v\n", err)
|
|
} else {
|
|
fmt.Printf("Layout.html found: %s\n", layoutFile)
|
|
}
|
|
} |