예제 #1
0
파일: ext.go 프로젝트: mchudgins/gostatic
func ProcessExt(page *gostatic.Page, args []string) error {
	if len(args) < 1 {
		return errors.New(
			"'ext' rule requires an extension prefixed with dot")
	}
	newExt := args[0]

	ext := filepath.Ext(page.Path)
	if ext == "" {
		page.Path = page.Path + newExt
	} else {
		page.Path = page.Path[0:len(page.Path)-len(ext)] + newExt
	}
	return nil
}
예제 #2
0
func ProcessDirectorify(page *gostatic.Page, args []string) error {
	if filepath.Base(page.Path) != "index.html" {
		page.Path = strings.Replace(page.Path, ".html", "/index.html", 1)
	}
	return nil
}