{% import "strconv" %} {% import "github.com/bakape/meguca/lang" %} {% import "github.com/bakape/meguca/common" %} {% import "github.com/bakape/meguca/config" %} {% import "encoding/json" %} {% func renderThread(postHTML []byte, id uint64, board string, abbrev, locked bool, pos common.ModerationLevel) %}{% stripspace %} {% code conf := config.GetBoardConfigs(board) %} {% code ln := lang.Get() %} {% if !locked %} {% endif %} {%s= ln.Common.UI["bottom"] %} {%s= ln.Common.UI["return"] %} {%s= ln.Common.UI["catalog"] %} {%s= ln.Common.Posts["expandImages"] %} {%= hoverReveal("span", conf.Notice, ln.Common.UI["showNotice"]) %} {%= hoverReveal("span", conf.Rules, ln.Common.UI["rules"]) %}
{%z= postHTML %}
{% if !locked %} {% endif %}
{%s= ln.Common.UI["return"] %} {%s= ln.Common.UI["catalog"] %} {%s= ln.Common.UI["top"] %} {% if !abbrev %} {%s= ln.Common.UI["last"] %}{% space %}100 {% endif %} {%= loadingImage(board) %} {% endstripspace %}{% endfunc %} ThreadPosts renders the post content of a thread. Separate function to allow caching of generated posts. {% func ThreadPosts(t common.Thread, json []byte) %}{% stripspace %}
{% code bls := extractBacklinks(1<<10, t) %} {%= renderThreadPosts(t, bls, config.Get().RootURL, false) %} {%= encodeBacklinks(bls) %}
{% endstripspace %}{% endfunc %} Common functionality between index board pages and threads pages {% func renderThreadPosts(t common.Thread, bls backlinks, root string, index bool) %}{% stripspace %} {% code boardConfig := config.GetBoardConfigs(t.Board) %} {% code c := articleContext{ index: index, sticky: t.Sticky, locked: t.Locked, rbText: boardConfig.RbText, pyu: boardConfig.Pyu, op: t.ID, board: t.Board, subject: t.Subject, root: root, backlinks: bls, } %} {% code c.omit, c.imageOmit = CalculateOmit(t) %} {%= renderArticle(t.Post, c) %} {% code c.sticky = false %} {% code c.locked = false %} {% code c.omit, c.imageOmit = 0, 0 %} {% code c.subject = "" %} {% for _, p := range t.Posts %} {%= renderArticle(p, c) %} {% endfor %} {% endstripspace %}{% endfunc %} {% func encodeBacklinks(bls backlinks) %}{% stripspace %} {% endstripspace %}{% endfunc %}