[go-nuts] Re: Golang Templates

2020-07-16 Thread Brian Candler
The next thing to do  is to boil this down to a standalone test case in the 
golang playground.

Are you saying the template is not being expanded correctly at line 155? 
https://github.com/ali2210/WizDwarf/blob/master/main.go#L155

Are you sure the value of LifeCode is what you expect? Try printing it at 
that point.

If it is, then write a small program which sets LifeCode to that fixed 
value, and expands the template.  If that works, then you know the problem 
is somewhere else.  If it doesn't work, then you know the problem is with 
template expansion and someone can help you debug it, because they have the 
code in the go playground where they can easily edit and test it.

-- 
You received this message because you are subscribed to the Google Groups 
"golang-nuts" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to golang-nuts+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/golang-nuts/9186d5ba-daf6-4660-afa2-1f0b94267283o%40googlegroups.com.


[go-nuts] Re: Golang Templates

2020-07-15 Thread Ali Hassan
https://github.com/ali2210/WizDwarf/blob/master/visualize.html

On Wednesday, July 15, 2020 at 3:14:51 PM UTC+5, Ali Hassan wrote:
>
> 
> {{range .}}
>   {{if ne .Symbol " "}}
>{{.Symbol}}
>  {{end}}
>{{end}}
>
>
> var div=document.getElementById('List'); 
> var point = div.getElementsByTagName('span');
>
> console.log(point[0].innerHTML)
>
>
> Actual Output: Empty string
> Excepted Output: Y 
> How to resolve this 
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"golang-nuts" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to golang-nuts+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/golang-nuts/d27eec42-be5c-461b-b400-95612518606bo%40googlegroups.com.


[go-nuts] Re: Golang Templates

2020-07-15 Thread Ali Hassan
yes it is https://github.com/ali2210/WizDwarf/blob/master/main.go [line: 
150-158]

On Wednesday, July 15, 2020 at 3:14:51 PM UTC+5, Ali Hassan wrote:
>
> 
> {{range .}}
>   {{if ne .Symbol " "}}
>{{.Symbol}}
>  {{end}}
>{{end}}
>
>
> var div=document.getElementById('List'); 
> var point = div.getElementsByTagName('span');
>
> console.log(point[0].innerHTML)
>
>
> Actual Output: Empty string
> Excepted Output: Y 
> How to resolve this 
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"golang-nuts" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to golang-nuts+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/golang-nuts/4987a7dd-95a8-4354-b160-367bfcb22bbao%40googlegroups.com.


[go-nuts] Re: Golang Templates

2020-07-15 Thread Ali Hassan
Yes it is 

func Visualize(w http.ResponseWriter, r *http.Request){
temp := template.Must(template.ParseFiles("visualize.html"))
if r.Method == "GET" {
fmt.Println("Url:", r.URL.Path)
fmt.Println("Method:" + r.Method)
temp.Execute(w,LifeCode)
}
}

On Wednesday, July 15, 2020 at 3:14:51 PM UTC+5, Ali Hassan wrote:
>
> 
> {{range .}}
>   {{if ne .Symbol " "}}
>{{.Symbol}}
>  {{end}}
>{{end}}
>
>
> var div=document.getElementById('List'); 
> var point = div.getElementsByTagName('span');
>
> console.log(point[0].innerHTML)
>
>
> Actual Output: Empty string
> Excepted Output: Y 
> How to resolve this 
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"golang-nuts" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to golang-nuts+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/golang-nuts/99f48dc9-65a9-43b6-9bcd-df0245d9da17o%40googlegroups.com.


[go-nuts] Re: Golang Templates

2020-07-15 Thread Ali Hassan
Yeah this is Javascript and Go 

https://github.com/ali2210/WizDwarf/blob/master/visualize.html
https://github.com/ali2210/WizDwarf/blob/master/js/visual.js



func Visualize(w http.ResponseWriter, r *http.Request){
temp := template.Must(template.ParseFiles("visualize.html"))
   if r.Method == "GET" {
 fmt.Println("Url:", r.URL.Path)
fmt.Println("Method:" + r.Method)
  temp.Execute(w,LifeCode)
   
   }
}




On Wednesday, July 15, 2020 at 3:14:51 PM UTC+5, Ali Hassan wrote:
>
> 
> {{range .}}
>   {{if ne .Symbol " "}}
>{{.Symbol}}
>  {{end}}
>{{end}}
>
>
> var div=document.getElementById('List'); 
> var point = div.getElementsByTagName('span');
>
> console.log(point[0].innerHTML)
>
>
> Actual Output: Empty string
> Excepted Output: Y 
> How to resolve this 
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"golang-nuts" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to golang-nuts+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/golang-nuts/03c51bac-34f5-4688-8b21-ee594a757ea7o%40googlegroups.com.


[go-nuts] Re: Golang Templates

2020-07-15 Thread Brian Candler
What language is that code written in?  It looks more like Javascript than 
Go to me.

If you have a problem with some Go code, please can you show the Go code - 
ideally as a self-contained runnable example at play.golang.org

-- 
You received this message because you are subscribed to the Google Groups 
"golang-nuts" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to golang-nuts+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/golang-nuts/6af11a19-70d9-47ec-af9e-74ac1c1f710ao%40googlegroups.com.