func (this *ApiController) Markdown() { if this.IsAjax() { result := map[string]interface{}{ "success": false, } action := this.GetString("action") switch action { case "preview": content := this.GetString("content") result["preview"] = g.RenderMarkdown(content) result["success"] = true } this.Data["json"] = result this.ServeJson() } }
func (this *MainController) Read() { ident := this.GetString(":ident") b := blog.OneByIdent(ident) if b == nil { this.Ctx.WriteString("no such article") return } b.Views = b.Views + 1 blog.Update(b, "") this.Data["Blog"] = b this.Data["Content"] = g.RenderMarkdown(blog.ReadBlogContent(b).Content) this.Data["PageTitle"] = b.Title this.Data["Catalog"] = catalog.OneById(b.CatalogId) this.Layout = "layout/default.html" this.TplNames = "article/read.html" }