Let plugins define imports to custom templates.
Things should work now.
This commit is contained in:
parent
d2a8fb1267
commit
fb8fa10570
|
@ -9,6 +9,7 @@ import (
|
||||||
"./templates"
|
"./templates"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
var Ctemplates []string
|
||||||
var Templates = template.New("")
|
var Templates = template.New("")
|
||||||
var PrebuildTmplList []func(User, *HeaderVars) CTmpl
|
var PrebuildTmplList []func(User, *HeaderVars) CTmpl
|
||||||
|
|
||||||
|
@ -18,6 +19,7 @@ type CTmpl struct {
|
||||||
Path string
|
Path string
|
||||||
StructName string
|
StructName string
|
||||||
Data interface{}
|
Data interface{}
|
||||||
|
Imports []string
|
||||||
}
|
}
|
||||||
|
|
||||||
// nolint
|
// nolint
|
||||||
|
@ -30,11 +32,11 @@ func interpreted_topic_template(pi TopicPage, w http.ResponseWriter) error {
|
||||||
}
|
}
|
||||||
|
|
||||||
// nolint
|
// nolint
|
||||||
var template_topic_handle func(TopicPage, http.ResponseWriter) error = interpreted_topic_template
|
var Template_topic_handle func(TopicPage, http.ResponseWriter) error = interpreted_topic_template
|
||||||
var template_topic_alt_handle func(TopicPage, http.ResponseWriter) error = interpreted_topic_template
|
var Template_topic_alt_handle func(TopicPage, http.ResponseWriter) error = interpreted_topic_template
|
||||||
|
|
||||||
// nolint
|
// nolint
|
||||||
var template_topics_handle func(TopicsPage, http.ResponseWriter) error = func(pi TopicsPage, w http.ResponseWriter) error {
|
var Template_topics_handle func(TopicsPage, http.ResponseWriter) error = func(pi TopicsPage, w http.ResponseWriter) error {
|
||||||
mapping, ok := Themes[DefaultThemeBox.Load().(string)].TemplatesMap["topics"]
|
mapping, ok := Themes[DefaultThemeBox.Load().(string)].TemplatesMap["topics"]
|
||||||
if !ok {
|
if !ok {
|
||||||
mapping = "topics"
|
mapping = "topics"
|
||||||
|
@ -43,7 +45,7 @@ var template_topics_handle func(TopicsPage, http.ResponseWriter) error = func(pi
|
||||||
}
|
}
|
||||||
|
|
||||||
// nolint
|
// nolint
|
||||||
var template_forum_handle func(ForumPage, http.ResponseWriter) error = func(pi ForumPage, w http.ResponseWriter) error {
|
var Template_forum_handle func(ForumPage, http.ResponseWriter) error = func(pi ForumPage, w http.ResponseWriter) error {
|
||||||
mapping, ok := Themes[DefaultThemeBox.Load().(string)].TemplatesMap["forum"]
|
mapping, ok := Themes[DefaultThemeBox.Load().(string)].TemplatesMap["forum"]
|
||||||
if !ok {
|
if !ok {
|
||||||
mapping = "forum"
|
mapping = "forum"
|
||||||
|
@ -52,7 +54,7 @@ var template_forum_handle func(ForumPage, http.ResponseWriter) error = func(pi F
|
||||||
}
|
}
|
||||||
|
|
||||||
// nolint
|
// nolint
|
||||||
var template_forums_handle func(ForumsPage, http.ResponseWriter) error = func(pi ForumsPage, w http.ResponseWriter) error {
|
var Template_forums_handle func(ForumsPage, http.ResponseWriter) error = func(pi ForumsPage, w http.ResponseWriter) error {
|
||||||
mapping, ok := Themes[DefaultThemeBox.Load().(string)].TemplatesMap["forums"]
|
mapping, ok := Themes[DefaultThemeBox.Load().(string)].TemplatesMap["forums"]
|
||||||
if !ok {
|
if !ok {
|
||||||
mapping = "forums"
|
mapping = "forums"
|
||||||
|
@ -61,7 +63,7 @@ var template_forums_handle func(ForumsPage, http.ResponseWriter) error = func(pi
|
||||||
}
|
}
|
||||||
|
|
||||||
// nolint
|
// nolint
|
||||||
var template_profile_handle func(ProfilePage, http.ResponseWriter) error = func(pi ProfilePage, w http.ResponseWriter) error {
|
var Template_profile_handle func(ProfilePage, http.ResponseWriter) error = func(pi ProfilePage, w http.ResponseWriter) error {
|
||||||
mapping, ok := Themes[DefaultThemeBox.Load().(string)].TemplatesMap["profile"]
|
mapping, ok := Themes[DefaultThemeBox.Load().(string)].TemplatesMap["profile"]
|
||||||
if !ok {
|
if !ok {
|
||||||
mapping = "profile"
|
mapping = "profile"
|
||||||
|
@ -70,7 +72,7 @@ var template_profile_handle func(ProfilePage, http.ResponseWriter) error = func(
|
||||||
}
|
}
|
||||||
|
|
||||||
// nolint
|
// nolint
|
||||||
var template_create_topic_handle func(CreateTopicPage, http.ResponseWriter) error = func(pi CreateTopicPage, w http.ResponseWriter) error {
|
var Template_create_topic_handle func(CreateTopicPage, http.ResponseWriter) error = func(pi CreateTopicPage, w http.ResponseWriter) error {
|
||||||
mapping, ok := Themes[DefaultThemeBox.Load().(string)].TemplatesMap["create-topic"]
|
mapping, ok := Themes[DefaultThemeBox.Load().(string)].TemplatesMap["create-topic"]
|
||||||
if !ok {
|
if !ok {
|
||||||
mapping = "create-topic"
|
mapping = "create-topic"
|
||||||
|
@ -112,18 +114,18 @@ func compileTemplates() error {
|
||||||
|
|
||||||
var varList = make(map[string]tmpl.VarItem)
|
var varList = make(map[string]tmpl.VarItem)
|
||||||
tpage := TopicPage{"Title", user, headerVars, replyList, topic, 1, 1}
|
tpage := TopicPage{"Title", user, headerVars, replyList, topic, 1, 1}
|
||||||
topicIDTmpl, err := c.Compile("topic.html", "templates/", "TopicPage", tpage, varList)
|
topicIDTmpl, err := c.Compile("topic.html", "templates/", "common.TopicPage", tpage, varList)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
topicIDAltTmpl, err := c.Compile("topic_alt.html", "templates/", "TopicPage", tpage, varList)
|
topicIDAltTmpl, err := c.Compile("topic_alt.html", "templates/", "common.TopicPage", tpage, varList)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
varList = make(map[string]tmpl.VarItem)
|
varList = make(map[string]tmpl.VarItem)
|
||||||
ppage := ProfilePage{"User 526", user, headerVars, replyList, user}
|
ppage := ProfilePage{"User 526", user, headerVars, replyList, user}
|
||||||
profileTmpl, err := c.Compile("profile.html", "templates/", "ProfilePage", ppage, varList)
|
profileTmpl, err := c.Compile("profile.html", "templates/", "common.ProfilePage", ppage, varList)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
@ -141,7 +143,7 @@ func compileTemplates() error {
|
||||||
}
|
}
|
||||||
varList = make(map[string]tmpl.VarItem)
|
varList = make(map[string]tmpl.VarItem)
|
||||||
forumsPage := ForumsPage{"Forum List", user, headerVars, forumList}
|
forumsPage := ForumsPage{"Forum List", user, headerVars, forumList}
|
||||||
forumsTmpl, err := c.Compile("forums.html", "templates/", "ForumsPage", forumsPage, varList)
|
forumsTmpl, err := c.Compile("forums.html", "templates/", "common.ForumsPage", forumsPage, varList)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
@ -149,7 +151,7 @@ func compileTemplates() error {
|
||||||
var topicsList []*TopicsRow
|
var topicsList []*TopicsRow
|
||||||
topicsList = append(topicsList, &TopicsRow{1, "topic-title", "Topic Title", "The topic content.", 1, false, false, "Date", time.Now(), "Date", user3.ID, 1, "", "127.0.0.1", 0, 1, "classname", "", &user2, "", 0, &user3, "General", "/forum/general.2"})
|
topicsList = append(topicsList, &TopicsRow{1, "topic-title", "Topic Title", "The topic content.", 1, false, false, "Date", time.Now(), "Date", user3.ID, 1, "", "127.0.0.1", 0, 1, "classname", "", &user2, "", 0, &user3, "General", "/forum/general.2"})
|
||||||
topicsPage := TopicsPage{"Topic List", user, headerVars, topicsList, forumList, Config.DefaultForum}
|
topicsPage := TopicsPage{"Topic List", user, headerVars, topicsList, forumList, Config.DefaultForum}
|
||||||
topicsTmpl, err := c.Compile("topics.html", "templates/", "TopicsPage", topicsPage, varList)
|
topicsTmpl, err := c.Compile("topics.html", "templates/", "common.TopicsPage", topicsPage, varList)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
@ -158,7 +160,7 @@ func compileTemplates() error {
|
||||||
//topicList = append(topicList,TopicUser{1,"topic-title","Topic Title","The topic content.",1,false,false,"Date","Date",1,"","127.0.0.1",0,1,"classname","","admin-fred","Admin Fred",config.DefaultGroup,"",0,"","","","",58,false})
|
//topicList = append(topicList,TopicUser{1,"topic-title","Topic Title","The topic content.",1,false,false,"Date","Date",1,"","127.0.0.1",0,1,"classname","","admin-fred","Admin Fred",config.DefaultGroup,"",0,"","","","",58,false})
|
||||||
forumItem := BlankForum(1, "general-forum.1", "General Forum", "Where the general stuff happens", true, "all", 0, "", 0)
|
forumItem := BlankForum(1, "general-forum.1", "General Forum", "Where the general stuff happens", true, "all", 0, "", 0)
|
||||||
forumPage := ForumPage{"General Forum", user, headerVars, topicsList, forumItem, 1, 1}
|
forumPage := ForumPage{"General Forum", user, headerVars, topicsList, forumItem, 1, 1}
|
||||||
forumTmpl, err := c.Compile("forum.html", "templates/", "ForumPage", forumPage, varList)
|
forumTmpl, err := c.Compile("forum.html", "templates/", "common.ForumPage", forumPage, varList)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
@ -167,10 +169,12 @@ func compileTemplates() error {
|
||||||
if Dev.DebugMode {
|
if Dev.DebugMode {
|
||||||
log.Print("Registering the templates for the plugins")
|
log.Print("Registering the templates for the plugins")
|
||||||
}
|
}
|
||||||
|
c.SkipHandles(true)
|
||||||
|
|
||||||
for _, tmplfunc := range PrebuildTmplList {
|
for _, tmplfunc := range PrebuildTmplList {
|
||||||
tmplItem := tmplfunc(user, headerVars)
|
tmplItem := tmplfunc(user, headerVars)
|
||||||
varList = make(map[string]tmpl.VarItem)
|
varList = make(map[string]tmpl.VarItem)
|
||||||
compiledTmpl, err := c.Compile(tmplItem.Filename, tmplItem.Path, tmplItem.StructName, tmplItem.Data, varList)
|
compiledTmpl, err := c.Compile(tmplItem.Filename, tmplItem.Path, tmplItem.StructName, tmplItem.Data, varList, tmplItem.Imports...)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
|
@ -14,7 +14,6 @@ import (
|
||||||
)
|
)
|
||||||
|
|
||||||
// TODO: Turn this file into a library
|
// TODO: Turn this file into a library
|
||||||
var cTemplates []string
|
|
||||||
var textOverlapList = make(map[string]int)
|
var textOverlapList = make(map[string]int)
|
||||||
|
|
||||||
// nolint
|
// nolint
|
||||||
|
@ -45,11 +44,12 @@ type CTemplateSet struct {
|
||||||
currentNode parse.NodeType
|
currentNode parse.NodeType
|
||||||
nextNode parse.NodeType
|
nextNode parse.NodeType
|
||||||
//tempVars map[string]string
|
//tempVars map[string]string
|
||||||
doImports bool
|
doImports bool
|
||||||
minify bool
|
minify bool
|
||||||
debug bool
|
debug bool
|
||||||
superDebug bool
|
superDebug bool
|
||||||
expectsInt interface{}
|
skipHandles bool
|
||||||
|
expectsInt interface{}
|
||||||
}
|
}
|
||||||
|
|
||||||
func (c *CTemplateSet) Minify(on bool) {
|
func (c *CTemplateSet) Minify(on bool) {
|
||||||
|
@ -64,7 +64,11 @@ func (c *CTemplateSet) SuperDebug(on bool) {
|
||||||
c.superDebug = on
|
c.superDebug = on
|
||||||
}
|
}
|
||||||
|
|
||||||
func (c *CTemplateSet) Compile(name string, dir string, expects string, expectsInt interface{}, varList map[string]VarItem) (out string, err error) {
|
func (c *CTemplateSet) SkipHandles(on bool) {
|
||||||
|
c.skipHandles = on
|
||||||
|
}
|
||||||
|
|
||||||
|
func (c *CTemplateSet) Compile(name string, dir string, expects string, expectsInt interface{}, varList map[string]VarItem, imports ...string) (out string, err error) {
|
||||||
if c.debug {
|
if c.debug {
|
||||||
fmt.Println("Compiling template '" + name + "'")
|
fmt.Println("Compiling template '" + name + "'")
|
||||||
}
|
}
|
||||||
|
@ -91,6 +95,12 @@ func (c *CTemplateSet) Compile(name string, dir string, expects string, expectsI
|
||||||
"net/http": "net/http",
|
"net/http": "net/http",
|
||||||
"./common": "./common",
|
"./common": "./common",
|
||||||
}
|
}
|
||||||
|
if len(imports) > 0 {
|
||||||
|
for _, importItem := range imports {
|
||||||
|
c.importMap[importItem] = importItem
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
c.varList = varList
|
c.varList = varList
|
||||||
//c.pVarList = ""
|
//c.pVarList = ""
|
||||||
//c.pVarPosition = 0
|
//c.pVarPosition = 0
|
||||||
|
@ -147,9 +157,19 @@ func (c *CTemplateSet) Compile(name string, dir string, expects string, expectsI
|
||||||
}
|
}
|
||||||
|
|
||||||
fout := "// +build !no_templategen\n\n// Code generated by Gosora. More below:\n/* This file was automatically generated by the software. Please don't edit it as your changes may be overwritten at any moment. */\n"
|
fout := "// +build !no_templategen\n\n// Code generated by Gosora. More below:\n/* This file was automatically generated by the software. Please don't edit it as your changes may be overwritten at any moment. */\n"
|
||||||
|
|
||||||
fout += "package main\n" + importList + c.pVarList + "\n"
|
fout += "package main\n" + importList + c.pVarList + "\n"
|
||||||
fout += "// nolint\nfunc init() {\n\ttemplate_" + fname + "_handle = template_" + fname + "\n\t//o_template_" + fname + "_handle = template_" + fname + "\n\tctemplates = append(ctemplates,\"" + fname + "\")\n\tTmplPtrMap[\"" + fname + "\"] = &template_" + fname + "_handle\n\tcommon.TmplPtrMap[\"o_" + fname + "\"] = template_" + fname + "\n}\n\n"
|
fout += "// nolint\nfunc init() {\n"
|
||||||
fout += "// nolint\nfunc template_" + fname + "(tmpl_" + fname + "_vars " + expects + ", w http.ResponseWriter) error {\n" + varString + out + "\treturn nil\n}\n"
|
|
||||||
|
if !c.skipHandles {
|
||||||
|
fout += "\tcommon.Template_" + fname + "_handle = Template_" + fname + "\n"
|
||||||
|
|
||||||
|
fout += "\tcommon.Ctemplates = append(common.Ctemplates,\"" + fname + "\")\n\tcommon.TmplPtrMap[\"" + fname + "\"] = &common.Template_" + fname + "_handle\n"
|
||||||
|
}
|
||||||
|
|
||||||
|
fout += "\tcommon.TmplPtrMap[\"o_" + fname + "\"] = Template_" + fname + "\n}\n\n"
|
||||||
|
|
||||||
|
fout += "// nolint\nfunc Template_" + fname + "(tmpl_" + fname + "_vars " + expects + ", w http.ResponseWriter) error {\n" + varString + out + "\treturn nil\n}\n"
|
||||||
|
|
||||||
fout = strings.Replace(fout, `))
|
fout = strings.Replace(fout, `))
|
||||||
w.Write([]byte(`, " + ", -1)
|
w.Write([]byte(`, " + ", -1)
|
||||||
|
|
|
@ -110,7 +110,7 @@ func PrebuildTmplList(user common.User, headerVars *common.HeaderVars) common.CT
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
listPage := ListPage{"Guild List", user, headerVars, guildList}
|
listPage := ListPage{"Guild List", user, headerVars, guildList}
|
||||||
return common.CTmpl{"guilds_guild_list", "guilds_guild_list.html", "templates/", "guilds.ListPage", listPage}
|
return common.CTmpl{"guilds_guild_list", "guilds_guild_list.html", "templates/", "guilds.ListPage", listPage, []string{"./extend/guilds/lib"}}
|
||||||
}
|
}
|
||||||
|
|
||||||
// TODO: Do this properly via the widget system
|
// TODO: Do this properly via the widget system
|
||||||
|
|
|
@ -9,15 +9,14 @@ import "strconv"
|
||||||
|
|
||||||
// nolint
|
// nolint
|
||||||
func init() {
|
func init() {
|
||||||
template_forum_handle = template_forum
|
common.Template_forum_handle = Template_forum
|
||||||
//o_template_forum_handle = template_forum
|
common.Ctemplates = append(common.Ctemplates,"forum")
|
||||||
ctemplates = append(ctemplates,"forum")
|
common.TmplPtrMap["forum"] = &common.Template_forum_handle
|
||||||
TmplPtrMap["forum"] = &template_forum_handle
|
common.TmplPtrMap["o_forum"] = Template_forum
|
||||||
common.TmplPtrMap["o_forum"] = template_forum
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// nolint
|
// nolint
|
||||||
func template_forum(tmpl_forum_vars ForumPage, w http.ResponseWriter) error {
|
func Template_forum(tmpl_forum_vars common.ForumPage, w http.ResponseWriter) error {
|
||||||
w.Write(header_0)
|
w.Write(header_0)
|
||||||
w.Write([]byte(tmpl_forum_vars.Title))
|
w.Write([]byte(tmpl_forum_vars.Title))
|
||||||
w.Write(header_1)
|
w.Write(header_1)
|
||||||
|
|
|
@ -3,20 +3,19 @@
|
||||||
// Code generated by Gosora. More below:
|
// Code generated by Gosora. More below:
|
||||||
/* This file was automatically generated by the software. Please don't edit it as your changes may be overwritten at any moment. */
|
/* This file was automatically generated by the software. Please don't edit it as your changes may be overwritten at any moment. */
|
||||||
package main
|
package main
|
||||||
import "./common"
|
|
||||||
import "net/http"
|
import "net/http"
|
||||||
|
import "./common"
|
||||||
|
|
||||||
// nolint
|
// nolint
|
||||||
func init() {
|
func init() {
|
||||||
template_forums_handle = template_forums
|
common.Template_forums_handle = Template_forums
|
||||||
//o_template_forums_handle = template_forums
|
common.Ctemplates = append(common.Ctemplates,"forums")
|
||||||
ctemplates = append(ctemplates,"forums")
|
common.TmplPtrMap["forums"] = &common.Template_forums_handle
|
||||||
TmplPtrMap["forums"] = &template_forums_handle
|
common.TmplPtrMap["o_forums"] = Template_forums
|
||||||
common.TmplPtrMap["o_forums"] = template_forums
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// nolint
|
// nolint
|
||||||
func template_forums(tmpl_forums_vars ForumsPage, w http.ResponseWriter) error {
|
func Template_forums(tmpl_forums_vars common.ForumsPage, w http.ResponseWriter) error {
|
||||||
w.Write(header_0)
|
w.Write(header_0)
|
||||||
w.Write([]byte(tmpl_forums_vars.Title))
|
w.Write([]byte(tmpl_forums_vars.Title))
|
||||||
w.Write(header_1)
|
w.Write(header_1)
|
||||||
|
|
|
@ -0,0 +1,118 @@
|
||||||
|
// +build !no_templategen
|
||||||
|
|
||||||
|
// Code generated by Gosora. More below:
|
||||||
|
/* This file was automatically generated by the software. Please don't edit it as your changes may be overwritten at any moment. */
|
||||||
|
package main
|
||||||
|
import "net/http"
|
||||||
|
import "./common"
|
||||||
|
import "./extend/guilds/lib"
|
||||||
|
import "strconv"
|
||||||
|
|
||||||
|
// nolint
|
||||||
|
func init() {
|
||||||
|
common.TmplPtrMap["o_guilds_guild_list"] = Template_guilds_guild_list
|
||||||
|
}
|
||||||
|
|
||||||
|
// nolint
|
||||||
|
func Template_guilds_guild_list(tmpl_guilds_guild_list_vars guilds.ListPage, w http.ResponseWriter) error {
|
||||||
|
w.Write(header_0)
|
||||||
|
w.Write([]byte(tmpl_guilds_guild_list_vars.Title))
|
||||||
|
w.Write(header_1)
|
||||||
|
w.Write([]byte(tmpl_guilds_guild_list_vars.Header.Site.Name))
|
||||||
|
w.Write(header_2)
|
||||||
|
w.Write([]byte(tmpl_guilds_guild_list_vars.Header.ThemeName))
|
||||||
|
w.Write(header_3)
|
||||||
|
if len(tmpl_guilds_guild_list_vars.Header.Stylesheets) != 0 {
|
||||||
|
for _, item := range tmpl_guilds_guild_list_vars.Header.Stylesheets {
|
||||||
|
w.Write(header_4)
|
||||||
|
w.Write([]byte(item))
|
||||||
|
w.Write(header_5)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
w.Write(header_6)
|
||||||
|
if len(tmpl_guilds_guild_list_vars.Header.Scripts) != 0 {
|
||||||
|
for _, item := range tmpl_guilds_guild_list_vars.Header.Scripts {
|
||||||
|
w.Write(header_7)
|
||||||
|
w.Write([]byte(item))
|
||||||
|
w.Write(header_8)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
w.Write(header_9)
|
||||||
|
w.Write([]byte(tmpl_guilds_guild_list_vars.CurrentUser.Session))
|
||||||
|
w.Write(header_10)
|
||||||
|
w.Write([]byte(tmpl_guilds_guild_list_vars.Header.Site.URL))
|
||||||
|
w.Write(header_11)
|
||||||
|
if !tmpl_guilds_guild_list_vars.CurrentUser.IsSuperMod {
|
||||||
|
w.Write(header_12)
|
||||||
|
}
|
||||||
|
w.Write(header_13)
|
||||||
|
w.Write(menu_0)
|
||||||
|
w.Write(menu_1)
|
||||||
|
w.Write([]byte(tmpl_guilds_guild_list_vars.Header.Site.ShortName))
|
||||||
|
w.Write(menu_2)
|
||||||
|
if tmpl_guilds_guild_list_vars.CurrentUser.Loggedin {
|
||||||
|
w.Write(menu_3)
|
||||||
|
w.Write([]byte(tmpl_guilds_guild_list_vars.CurrentUser.Link))
|
||||||
|
w.Write(menu_4)
|
||||||
|
w.Write([]byte(tmpl_guilds_guild_list_vars.CurrentUser.Session))
|
||||||
|
w.Write(menu_5)
|
||||||
|
} else {
|
||||||
|
w.Write(menu_6)
|
||||||
|
}
|
||||||
|
w.Write(menu_7)
|
||||||
|
w.Write(header_14)
|
||||||
|
if tmpl_guilds_guild_list_vars.Header.Widgets.RightSidebar != "" {
|
||||||
|
w.Write(header_15)
|
||||||
|
}
|
||||||
|
w.Write(header_16)
|
||||||
|
if len(tmpl_guilds_guild_list_vars.Header.NoticeList) != 0 {
|
||||||
|
for _, item := range tmpl_guilds_guild_list_vars.Header.NoticeList {
|
||||||
|
w.Write(header_17)
|
||||||
|
w.Write([]byte(item))
|
||||||
|
w.Write(header_18)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
w.Write(guilds_guild_list_0)
|
||||||
|
if len(tmpl_guilds_guild_list_vars.GuildList) != 0 {
|
||||||
|
for _, item := range tmpl_guilds_guild_list_vars.GuildList {
|
||||||
|
w.Write(guilds_guild_list_1)
|
||||||
|
w.Write([]byte(item.Link))
|
||||||
|
w.Write(guilds_guild_list_2)
|
||||||
|
w.Write([]byte(item.Name))
|
||||||
|
w.Write(guilds_guild_list_3)
|
||||||
|
w.Write([]byte(item.Desc))
|
||||||
|
w.Write(guilds_guild_list_4)
|
||||||
|
w.Write([]byte(strconv.Itoa(item.MemberCount)))
|
||||||
|
w.Write(guilds_guild_list_5)
|
||||||
|
w.Write([]byte(item.LastUpdateTime))
|
||||||
|
w.Write(guilds_guild_list_6)
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
w.Write(guilds_guild_list_7)
|
||||||
|
}
|
||||||
|
w.Write(guilds_guild_list_8)
|
||||||
|
w.Write(footer_0)
|
||||||
|
if len(tmpl_guilds_guild_list_vars.Header.Themes) != 0 {
|
||||||
|
for _, item := range tmpl_guilds_guild_list_vars.Header.Themes {
|
||||||
|
if !item.HideFromThemes {
|
||||||
|
w.Write(footer_1)
|
||||||
|
w.Write([]byte(item.Name))
|
||||||
|
w.Write(footer_2)
|
||||||
|
if tmpl_guilds_guild_list_vars.Header.ThemeName == item.Name {
|
||||||
|
w.Write(footer_3)
|
||||||
|
}
|
||||||
|
w.Write(footer_4)
|
||||||
|
w.Write([]byte(item.FriendlyName))
|
||||||
|
w.Write(footer_5)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
w.Write(footer_6)
|
||||||
|
if tmpl_guilds_guild_list_vars.Header.Widgets.RightSidebar != "" {
|
||||||
|
w.Write(footer_7)
|
||||||
|
w.Write([]byte(string(tmpl_guilds_guild_list_vars.Header.Widgets.RightSidebar)))
|
||||||
|
w.Write(footer_8)
|
||||||
|
}
|
||||||
|
w.Write(footer_9)
|
||||||
|
return nil
|
||||||
|
}
|
|
@ -3,21 +3,20 @@
|
||||||
// Code generated by Gosora. More below:
|
// Code generated by Gosora. More below:
|
||||||
/* This file was automatically generated by the software. Please don't edit it as your changes may be overwritten at any moment. */
|
/* This file was automatically generated by the software. Please don't edit it as your changes may be overwritten at any moment. */
|
||||||
package main
|
package main
|
||||||
|
import "./common"
|
||||||
import "strconv"
|
import "strconv"
|
||||||
import "net/http"
|
import "net/http"
|
||||||
import "./common"
|
|
||||||
|
|
||||||
// nolint
|
// nolint
|
||||||
func init() {
|
func init() {
|
||||||
template_profile_handle = template_profile
|
common.Template_profile_handle = Template_profile
|
||||||
//o_template_profile_handle = template_profile
|
common.Ctemplates = append(common.Ctemplates,"profile")
|
||||||
ctemplates = append(ctemplates,"profile")
|
common.TmplPtrMap["profile"] = &common.Template_profile_handle
|
||||||
TmplPtrMap["profile"] = &template_profile_handle
|
common.TmplPtrMap["o_profile"] = Template_profile
|
||||||
common.TmplPtrMap["o_profile"] = template_profile
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// nolint
|
// nolint
|
||||||
func template_profile(tmpl_profile_vars ProfilePage, w http.ResponseWriter) error {
|
func Template_profile(tmpl_profile_vars common.ProfilePage, w http.ResponseWriter) error {
|
||||||
w.Write(header_0)
|
w.Write(header_0)
|
||||||
w.Write([]byte(tmpl_profile_vars.Title))
|
w.Write([]byte(tmpl_profile_vars.Title))
|
||||||
w.Write(header_1)
|
w.Write(header_1)
|
||||||
|
|
|
@ -9,15 +9,14 @@ import "strconv"
|
||||||
|
|
||||||
// nolint
|
// nolint
|
||||||
func init() {
|
func init() {
|
||||||
template_topic_handle = template_topic
|
common.Template_topic_handle = Template_topic
|
||||||
//o_template_topic_handle = template_topic
|
common.Ctemplates = append(common.Ctemplates,"topic")
|
||||||
ctemplates = append(ctemplates,"topic")
|
common.TmplPtrMap["topic"] = &common.Template_topic_handle
|
||||||
TmplPtrMap["topic"] = &template_topic_handle
|
common.TmplPtrMap["o_topic"] = Template_topic
|
||||||
common.TmplPtrMap["o_topic"] = template_topic
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// nolint
|
// nolint
|
||||||
func template_topic(tmpl_topic_vars TopicPage, w http.ResponseWriter) error {
|
func Template_topic(tmpl_topic_vars common.TopicPage, w http.ResponseWriter) error {
|
||||||
w.Write(header_0)
|
w.Write(header_0)
|
||||||
w.Write([]byte(tmpl_topic_vars.Title))
|
w.Write([]byte(tmpl_topic_vars.Title))
|
||||||
w.Write(header_1)
|
w.Write(header_1)
|
||||||
|
|
|
@ -9,15 +9,14 @@ import "./common"
|
||||||
|
|
||||||
// nolint
|
// nolint
|
||||||
func init() {
|
func init() {
|
||||||
template_topic_alt_handle = template_topic_alt
|
common.Template_topic_alt_handle = Template_topic_alt
|
||||||
//o_template_topic_alt_handle = template_topic_alt
|
common.Ctemplates = append(common.Ctemplates,"topic_alt")
|
||||||
ctemplates = append(ctemplates,"topic_alt")
|
common.TmplPtrMap["topic_alt"] = &common.Template_topic_alt_handle
|
||||||
TmplPtrMap["topic_alt"] = &template_topic_alt_handle
|
common.TmplPtrMap["o_topic_alt"] = Template_topic_alt
|
||||||
common.TmplPtrMap["o_topic_alt"] = template_topic_alt
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// nolint
|
// nolint
|
||||||
func template_topic_alt(tmpl_topic_alt_vars TopicPage, w http.ResponseWriter) error {
|
func Template_topic_alt(tmpl_topic_alt_vars common.TopicPage, w http.ResponseWriter) error {
|
||||||
w.Write(header_0)
|
w.Write(header_0)
|
||||||
w.Write([]byte(tmpl_topic_alt_vars.Title))
|
w.Write([]byte(tmpl_topic_alt_vars.Title))
|
||||||
w.Write(header_1)
|
w.Write(header_1)
|
||||||
|
|
|
@ -3,21 +3,20 @@
|
||||||
// Code generated by Gosora. More below:
|
// Code generated by Gosora. More below:
|
||||||
/* This file was automatically generated by the software. Please don't edit it as your changes may be overwritten at any moment. */
|
/* This file was automatically generated by the software. Please don't edit it as your changes may be overwritten at any moment. */
|
||||||
package main
|
package main
|
||||||
|
import "net/http"
|
||||||
import "./common"
|
import "./common"
|
||||||
import "strconv"
|
import "strconv"
|
||||||
import "net/http"
|
|
||||||
|
|
||||||
// nolint
|
// nolint
|
||||||
func init() {
|
func init() {
|
||||||
template_topics_handle = template_topics
|
common.Template_topics_handle = Template_topics
|
||||||
//o_template_topics_handle = template_topics
|
common.Ctemplates = append(common.Ctemplates,"topics")
|
||||||
ctemplates = append(ctemplates,"topics")
|
common.TmplPtrMap["topics"] = &common.Template_topics_handle
|
||||||
TmplPtrMap["topics"] = &template_topics_handle
|
common.TmplPtrMap["o_topics"] = Template_topics
|
||||||
common.TmplPtrMap["o_topics"] = template_topics
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// nolint
|
// nolint
|
||||||
func template_topics(tmpl_topics_vars TopicsPage, w http.ResponseWriter) error {
|
func Template_topics(tmpl_topics_vars common.TopicsPage, w http.ResponseWriter) error {
|
||||||
w.Write(header_0)
|
w.Write(header_0)
|
||||||
w.Write([]byte(tmpl_topics_vars.Title))
|
w.Write([]byte(tmpl_topics_vars.Title))
|
||||||
w.Write(header_1)
|
w.Write(header_1)
|
||||||
|
|
Loading…
Reference in New Issue