FAQ
Hello,

I have simple code:
http://play.golang.org/p/sRlJkGzA9e

Is it possible so that when I use:
myTemp := `<div>{{template "T1"}}</div>`
parser will output <div></div> instead of throwing error?

Best regards

--

Search Discussions

  • Chris dollin at Dec 17, 2012 at 10:30 am

    On 17 December 2012 10:15, Dobrosław Żybort wrote:

    I have simple code:
    http://play.golang.org/p/sRlJkGzA9e

    Is it possible so that when I use:
    myTemp := `<div>{{template "T1"}}</div>`
    parser will output <div></div> instead of throwing error?
    That's what it did for me -- deleting the ONE from myTemp
    made it output <div></div>.

    Have I misunderstood your question?

    Chris

    --
    Chris "allusive" Dollin

    --
  • Dobrosław Żybort at Dec 17, 2012 at 11:02 am
    I should write more:

    I'm doing examples from http://shadynasty.biz/
    I have _base.html file with {{ template "some" }} codes and more files like
    index.html and archive.html where I add {{ define "some" }}text{{ end }} to
    render.
    Now I have some specific pages (like showOne.html) when I would like to add
    some additional css link to header. So I added {{ template "customCss" }}to
    _base.html. Now I need to add {{ define "customCss" }}some link{{ end }} toshowOne.htmlfile and empty{{ define "customCss" }}{{ end }}to all other files, otherwise I will get error.

    Is there a way to omit unnecessary empty {{ define "customCss" }}{{ end }}lines from other files?

    Best regards

    W dniu poniedziałek, 17 grudnia 2012 11:30:23 UTC+1 użytkownik chris dollin
    napisał:
    On 17 December 2012 10:15, Dobrosław Żybort wrote:

    I have simple code:
    http://play.golang.org/p/sRlJkGzA9e

    Is it possible so that when I use:
    myTemp := `<div>{{template "T1"}}</div>`
    parser will output <div></div> instead of throwing error?
    That's what it did for me -- deleting the ONE from myTemp
    made it output <div></div>.

    Have I misunderstood your question?

    Chris

    --
    Chris "allusive" Dollin
    --

Related Discussions

Discussion Navigation
viewthread | post
Discussion Overview
groupgolang-nuts @
categoriesgo
postedDec 17, '12 at 10:16a
activeDec 17, '12 at 11:02a
posts3
users2
websitegolang.org

People

Translate

site design / logo © 2022 Grokbase