gosora/template_topic.go
Azareal d4ad7f1a4c Dramatically improved Gosora's speed by two to four times.
Admins and mods can now see the IP Addresses of users.
The last IP Address of a user is now tracked.
The IP Addresses a user used to create replies and topics are now tracked.
Dramatically improved the speed of templates with the new Fragment System. More optimisations to come!
Decreased the memory usage of compiled templates with the new Fragment System.
build.bat now provides more information on what it's doing.
Added the `go generate` command to the .bat files in preparation for the future.
We're currently in the process of overhauling the benchmark system to run tests in parallel rather than serially. More news on that later.
We're also looking into the best way of integrating pprof with the benchmarks for detailed profiling.
The internal and notfound errors are now static pages.
Internal Error pages are now served properly.
Optimised most of the errors.
Added an internal flag for checking if the plugins have been initialised yet. Mainly for tests.
Decoupled the global initialisation code from the tests.
Removed URL Tags from Tempra Simple. We're pondering over how to re-introduce this in a less intrusive way.
Template file writing is now multi-threaded.
The number of maximum open connections is now explicitly set.
Removed the Name field from the page struct.
Turned some of the most frequently hit queries into prepared statements.
Added the [rand] BBCode.
Converted the NoticeList map into a slice.
Added the missing_tag error type to the [url] tag.
error_notfound is now used for when the router can't find a route.
Fixed a bug in the custom page route where both the page AND the error is served when the page doesn't exist.
Removed some deferrals.
Reduced the number of allocations on the topic page.
run.bat now provides more information on what it's doing.
2017-01-17 07:55:46 +00:00

164 lines
4.1 KiB
Go

/* 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 "io"
import "strconv"
import "html/template"
func init() {
template_topic_handle = template_topic
//o_template_topic_handle = template_topic
ctemplates = append(ctemplates,"topic")
tmpl_ptr_map["topic"] = &template_topic_handle
tmpl_ptr_map["o_topic"] = template_topic
}
func template_topic(tmpl_topic_vars TopicPage, w io.Writer) {
w.Write(header_0)
w.Write([]byte(tmpl_topic_vars.Title))
w.Write(header_1)
w.Write([]byte(tmpl_topic_vars.CurrentUser.Session))
w.Write(header_2)
w.Write(menu_0)
if tmpl_topic_vars.CurrentUser.Loggedin {
w.Write(menu_1)
w.Write([]byte(strconv.Itoa(tmpl_topic_vars.CurrentUser.ID)))
w.Write(menu_2)
if tmpl_topic_vars.CurrentUser.Is_Super_Mod {
w.Write(menu_3)
}
w.Write(menu_4)
w.Write([]byte(tmpl_topic_vars.CurrentUser.Session))
w.Write(menu_5)
} else {
w.Write(menu_6)
}
w.Write(menu_7)
w.Write(header_3)
if len(tmpl_topic_vars.NoticeList) != 0 {
for _, item := range tmpl_topic_vars.NoticeList {
w.Write(header_4)
w.Write([]byte(item))
w.Write(header_5)
}
}
w.Write(topic_0)
w.Write([]byte(strconv.Itoa(tmpl_topic_vars.Topic.ID)))
w.Write(topic_1)
if tmpl_topic_vars.Topic.Sticky {
w.Write(topic_2)
} else {
if tmpl_topic_vars.Topic.Is_Closed {
w.Write(topic_3)
}
}
w.Write(topic_4)
w.Write([]byte(tmpl_topic_vars.Topic.Title))
w.Write(topic_5)
if tmpl_topic_vars.Topic.Is_Closed {
w.Write(topic_6)
}
if tmpl_topic_vars.CurrentUser.Is_Mod {
w.Write(topic_7)
w.Write([]byte(strconv.Itoa(tmpl_topic_vars.Topic.ID)))
w.Write(topic_8)
w.Write([]byte(strconv.Itoa(tmpl_topic_vars.Topic.ID)))
w.Write(topic_9)
if tmpl_topic_vars.Topic.Sticky {
w.Write(topic_10)
w.Write([]byte(strconv.Itoa(tmpl_topic_vars.Topic.ID)))
w.Write(topic_11)
} else {
w.Write(topic_12)
w.Write([]byte(strconv.Itoa(tmpl_topic_vars.Topic.ID)))
w.Write(topic_13)
}
w.Write(topic_14)
w.Write([]byte(tmpl_topic_vars.Topic.Title))
w.Write(topic_15)
}
w.Write(topic_16)
w.Write([]byte(strconv.Itoa(tmpl_topic_vars.Topic.ID)))
w.Write(topic_17)
w.Write([]byte(tmpl_topic_vars.CurrentUser.Session))
w.Write(topic_18)
if tmpl_topic_vars.Topic.Avatar != "" {
w.Write(topic_19)
w.Write([]byte(tmpl_topic_vars.Topic.Avatar))
w.Write(topic_20)
if tmpl_topic_vars.Topic.ContentLines <= 5 {
w.Write(topic_21)
}
w.Write(topic_22)
w.Write([]byte(string(tmpl_topic_vars.Topic.Css)))
}
w.Write(topic_23)
w.Write([]byte(string(tmpl_topic_vars.Topic.Content.(template.HTML))))
w.Write(topic_24)
w.Write([]byte(string(tmpl_topic_vars.Topic.Content.(template.HTML))))
w.Write(topic_25)
w.Write([]byte(strconv.Itoa(tmpl_topic_vars.Topic.CreatedBy)))
w.Write(topic_26)
w.Write([]byte(tmpl_topic_vars.Topic.CreatedByName))
w.Write(topic_27)
if tmpl_topic_vars.Topic.Tag != "" {
w.Write(topic_28)
w.Write([]byte(tmpl_topic_vars.Topic.Tag))
} else {
w.Write(topic_29)
w.Write([]byte(strconv.Itoa(tmpl_topic_vars.Topic.Level)))
}
w.Write(topic_30)
if len(tmpl_topic_vars.ItemList) != 0 {
for _, item := range tmpl_topic_vars.ItemList {
w.Write(topic_31)
if item.Avatar != "" {
w.Write(topic_32)
w.Write([]byte(item.Avatar))
w.Write(topic_33)
if item.ContentLines <= 5 {
w.Write(topic_34)
}
w.Write(topic_35)
w.Write([]byte(string(item.Css)))
}
w.Write(topic_36)
w.Write([]byte(string(item.ContentHtml)))
w.Write(topic_37)
w.Write([]byte(strconv.Itoa(item.CreatedBy)))
w.Write(topic_38)
w.Write([]byte(item.CreatedByName))
w.Write(topic_39)
if tmpl_topic_vars.CurrentUser.Perms.EditReply {
w.Write(topic_40)
w.Write([]byte(strconv.Itoa(item.ID)))
w.Write(topic_41)
}
if tmpl_topic_vars.CurrentUser.Perms.DeleteReply {
w.Write(topic_42)
w.Write([]byte(strconv.Itoa(item.ID)))
w.Write(topic_43)
}
w.Write(topic_44)
w.Write([]byte(strconv.Itoa(item.ID)))
w.Write(topic_45)
w.Write([]byte(tmpl_topic_vars.CurrentUser.Session))
w.Write(topic_46)
if item.Tag != "" {
w.Write(topic_47)
w.Write([]byte(item.Tag))
} else {
w.Write(topic_48)
w.Write([]byte(strconv.Itoa(item.Level)))
}
w.Write(topic_49)
}
}
w.Write(topic_50)
if tmpl_topic_vars.CurrentUser.Perms.CreateReply {
w.Write(topic_51)
w.Write([]byte(strconv.Itoa(tmpl_topic_vars.Topic.ID)))
w.Write(topic_52)
}
w.Write(footer_0)
}