Impl complete testing needed

This commit is contained in:
Bel LaPointe
2019-11-21 13:12:30 -07:00
parent 3079cd163f
commit a140d0eade
15 changed files with 111 additions and 33 deletions

View File

@@ -71,6 +71,10 @@ func (p Path) MultiLink() string {
return full
}
func (p Path) FullLI() string {
return fmt.Sprintf(`<li><a href=%q>%s</a></li>`, p.HREF, p.HREF)
}
func (p Path) LI() string {
return fmt.Sprintf(`<li><a href=%q>%s</a></li>`, p.HREF, p.Base)
}

View File

@@ -2,10 +2,14 @@ package filetree
type Paths []Path
func (p Paths) List() string {
func (p Paths) List(full ...bool) string {
content := "<ul>\n"
for _, path := range p {
content += path.LI() + "\n"
if len(full) > 0 && full[0] {
content += path.FullLI() + "\n"
} else {
content += path.LI() + "\n"
}
}
content += "</ul>\n"
return content