本文整理匯總了Golang中github.com/strongo/templates.RenderContext類的典型用法代碼示例。如果您正苦於以下問題:Golang RenderContext類的具體用法?Golang RenderContext怎麽用?Golang RenderContext使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。
在下文中一共展示了RenderContext類的6個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Golang代碼示例。
示例1: RenderBlock_content
func (t Index_html) RenderBlock_content(c templates.RenderContext) error {
if _, err := c.WriteString("<p>"); err != nil {
return err
}
if _, err := c.WriteString(t.i18n.GetText("Put your content here.")); err != nil {
return err
}
for _, authorCard := range t.authorCards {
c.WriteString("\n<li>")
authorCard.Render(c)
c.WriteString("</li>")
}
if _, err := c.WriteString("</p>"); err != nil {
return err
}
return nil
}
示例2: Render
func (self *AuthorCard) Render(c templates.RenderContext) {
c.WriteString("<div>\nAuthor: ")
self.component.WhenDataReady()
// log.Print("Render: " + self.Author.Name)
c.WriteString(self.author.Name)
c.WriteString("\n</div>")
}
示例3: RenderBlock_content
func (t layout_html_struct) RenderBlock_content(c templates.RenderContext) error {
_, err := c.WriteString("{BLOCK content}")
return err
}
示例4: RenderBlock_page_title
func (t layout_html_struct) RenderBlock_page_title(c templates.RenderContext) error {
_, err := c.WriteString("{BLOCK page_title}")
return err
}
示例5: Render
func (layout layout_html_struct) Render(c templates.RenderContext, payload Payload_Layout_html) error {
if _, err := c.WriteString("<!DOCTYPE html>\n<html>\n<head>\n<title>"); err != nil {
return err
}
if err := layout.template.RenderBlock_head_title(c); err != nil {
return err
}
c.WriteString("</title>\n</head>\n<body style=\"background-color: ")
c.WriteString(payload.BgColor)
c.WriteString(";\">\n<h1>")
if _, err := c.WriteString(layout.i18n.GetText("Welcome to page")); err != nil {
return err
}
c.WriteString(" ")
if err := layout.template.RenderBlock_page_title(c); err != nil {
return err
}
c.WriteString("\n<h1>\n")
if err := layout.template.RenderBlock_menu(c); err != nil {
return err
}
c.WriteString("\n<hr/>\n")
if err := layout.template.RenderBlock_content(c); err != nil {
return err
}
c.WriteString("\n</body>\n</html>") // Lines 10:11
return nil
}
示例6: RenderBlock_page_title
func (t Index_html) RenderBlock_page_title(c templates.RenderContext) error {
_, err := c.WriteString("Index.html!")
return err
}