add URL to Page struct

This commit is contained in:
ed 2020-01-04 16:33:11 +01:00
parent 06b03d7480
commit 13c42b1ec2
1 changed files with 3 additions and 4 deletions

View File

@ -83,12 +83,11 @@ func fparse(fname string) Game{
case string(line[0]) == ":":
sline := strings.Split(line, " ")
url := sline[0][1:] + ".html"
fmt.Println(url)
//fmt.Println(url)
body := strings.Join(sline[1:]," ")
fmt.Println(body)
//fmt.Println(body)
game.Pages = append(game.Pages, Page{Body:body,
URL: url})
//game.Pages = append(game.Pages, Page{Body:cutFirstWord(line)})
case string(line[0]) == "-":
newLink := line2link(line)
game.Pages[pcount].Links = append(game.Pages[pcount].Links, newLink)
@ -99,7 +98,7 @@ func fparse(fname string) Game{
func main() {
game := fparse("model")
fmt.Println(game)
//fmt.Println(game)
/*
l1 := hlink{url:"01.html",text:"First"}
l2 := hlink{url:"02.html",text:"Second"}