ctdo.de/html.go

29 lines
790 B
Go
Raw Normal View History

package main
func htmlElement(tag string, innerHTML string, args string) string {
return "<" + tag + " " + args + ">" + innerHTML + "</" + tag + ">"
}
func htmlLinkElement(innerHTML string, destination string, blank bool, args string) string {
b := ""
if blank {
b = "target=\"_blank\""
}
return htmlElement("a", innerHTML, " href=\""+destination+"\" "+b)
}
func htmlInputElement(name string, _type string, value string, args string) string {
return "<input name=\"" + name + "\" type=\"" + _type + "\" value=\"" + value + "\" " + args + ">"
}
func htmlNav(pages [][]string) string {
output := ""
for _, page := range pages {
output += htmlElement("li", htmlLinkElement(page[0], page[1], false, ""), "")
}
return htmlElement("nav", htmlElement("ul", output, ""), "")
}