summaryrefslogtreecommitdiff
path: root/scanner.go
diff options
context:
space:
mode:
authorhorus_arch2015-06-15 17:07:43 +0200
committerhorus_arch2015-06-15 17:07:43 +0200
commit1276eba6a546b61b8396e838e3043f2e609ce7d4 (patch)
tree555fc6aa9ef45bc43cbde7c2ff1ac02c7c62e7b2 /scanner.go
parente205935a4fd7ae56a352d5dd8d1b69f143afb09c (diff)
parentdd4baa267dbdfe279aab5f4122305ac51c0c6a3d (diff)
downloaduhttpd-1276eba6a546b61b8396e838e3043f2e609ce7d4.tar.gz
Merge branch 'master' of git.iamfabulous.de:uhttpd
Diffstat (limited to 'scanner.go')
-rw-r--r--scanner.go11
1 files changed, 6 insertions, 5 deletions
diff --git a/scanner.go b/scanner.go
index 6679a80..9b35de3 100644
--- a/scanner.go
+++ b/scanner.go
@@ -6,13 +6,14 @@ package main
*/
import "C"
import (
+ "html/template"
"log"
"strings"
)
type Link struct {
- Url string
- Text string
+ Url template.URL
+ Text template.HTML
IsDir bool
}
@@ -28,16 +29,16 @@ func getToken(input string) []Link {
if token == C.TOKEN_URL {
// flex reads the href attr
- l.Url = C.GoString(C.yylval)
+ l.Url = template.URL(C.GoString(C.yylval))
- if strings.HasSuffix(l.Url, "/") {
+ if strings.HasSuffix(C.GoString(C.yylval), "/") {
l.IsDir = true
}
} else if token == C.TOKEN_TEXT {
// flex reads the link description
- l.Text = C.GoString(C.yylval)
+ l.Text = template.HTML(C.GoString(C.yylval))
ls = append(ls, l)
l = Link{}
} else {