{% import "fmt" %} {% import "strconv" %} {% import "github.com/bakape/meguca/common" %} {% import "github.com/bakape/meguca/lang" %} {% import "github.com/bakape/meguca/imager/assets" %} {% import "github.com/bakape/meguca/util" %} {% func renderArticle(p common.Post, c articleContext) %}{% stripspace %} {% code id := strconv.FormatUint(p.ID, 10) %} {% code ln := lang.Get() %}
{%= deletedToggle() %}
{%= renderSticky(c.sticky) %} {%= renderLocked(c.locked) %} {% if c.subject != "" %} {% if c.board != "" %} /{%s= c.board %}/ {% endif %}

「{%s c.subject %}」

{% endif %} {% if p.Name != "" || p.Trip == "" %} {% if p.Name != "" %} {%s p.Name %} {% else %} {%s= ln.Common.Posts["anon"] %} {% endif %} {% endif %} {% if p.Trip != "" %} !{%s p.Trip %} {% endif %} {% if p.Auth != common.NotStaff %} ##{% space %}{%s= ln.Common.Posts[p.Auth.String()] %} {% endif %} {% if p.Flag != "" %} {% code title, ok := countryMap[p.Flag] %} {% if !ok %} {% code title = p.Flag %} {% endif %} {% endif %} {% if c.index && c.subject != "" %} {%= expandLink("all", id) %} {%= last100Link("all", id) %} {% endif %} {%= controlLink() %} {% if c.op == p.ID %} {%= threadWatcherToggle(p.ID) %} {% endif %}
{% code var src string %} {% if p.Image != nil %} {% code img := *p.Image %} {% code src = assets.SourcePath(img.FileType, img.SHA1) %}
{%= imageSearch(c.root, img) %} {% if img.Audio %} {% endif %} {% if img.Length != 0 %} {% code l := img.Length %} {% if l < 60 %} {%s= fmt.Sprintf("0:%02d", l) %} {% else %} {% code min := l / 60 %} {%s= fmt.Sprintf("%02d:%02d", min, l - min * 60) %} {% endif %} {% endif %} {%s= readableFileSize(img.Size) %} {% if img.Dims != [4]uint16{} %} {%s= strconv.FormatUint(uint64(img.Dims[0]), 10) %} x {%s= strconv.FormatUint(uint64(img.Dims[1]), 10) %} {% endif %} {% if img.Artist != "" %} {%s img.Artist %} {% endif %} {% if img.Title != "" %} {%s img.Title %} {% endif %} {% code name := imageName(img.FileType, img.Name) %} {%s= name %}
{% endif %}
{% if p.Image != nil %} {% code img := *p.Image %}
{% switch %} {% case img.ThumbType == common.NoFile %} {% code var file string %} {% switch img.FileType %} {% case common.WEBM, common.MP4, common.MP3, common.OGG, common.FLAC %} {% code file = "audio" %} {% default %} {% code file = "file" %} {% endswitch %} {% case img.Spoiler %} {% comment %} TODO: board-specific server-side spoiler rendering {% endcomment %} {% default %} {% endswitch %}
{% endif %}
{%= body(p, c.op, c.board, c.index, c.rbText, c.pyu) %}
{% for _, e := range p.Moderation %} {%= postModeration(e) %}
{% endfor %}
{% if c.omit != 0 %} {% if c.imageOmit == 0 %} {%s= fmt.Sprintf(ln.Common.Format["postsOmitted"], c.omit) %} {% else %} {%s= fmt.Sprintf(ln.Common.Format["postsAndImagesOmitted"], c.omit, c.imageOmit) %} {% endif %} {%s= ln.Common.Posts["seeAll"] %} {% endif %} {% if bls := c.backlinks[p.ID]; len(bls) != 0 %} {% for _, l := range bls %} {%= postLink(l, c.index || l.OP != c.op, c.index) %} {% endfor %} {% endif %}
{% endstripspace %}{% endfunc %} Render image search links according to file type {% func imageSearch(root string, img common.Image) %}{% stripspace %} {% if img.ThumbType == common.NoFile || img.FileType == common.PDF %} {% return %} {% endif %} {% code url := root + assets.ImageSearchPath(img.ImageCommon) %} G Yd Iq Sn Wa {% switch img.FileType %} {% case common.JPEG, common.PNG, common.GIF, common.WEBM %} Ds {% endswitch %} {% switch img.FileType %} {% case common.JPEG, common.PNG %} Ex {% endswitch %} {% endstripspace %}{% endfunc %}