本文整理汇总了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
}