Impl complete testing needed
This commit is contained in:
@@ -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)
|
||||
}
|
||||
|
||||
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user