// SPDX-License-Identifier: AGPL-3.0-or-later package web import "html/template" // Blob is a file: its title with the actions, the notice of a state (too // large, binary, empty), the code, the rendered Markdown with its source // under a fold, or the image; the rail holds the facts, the last change, the // outline and the line selection. templ Blob(l Layout, p BlobPage) { @Shell(l, blobRail(p)) {

{ p.Name } RawHistoryFolder

if p.Notice != "" {

{ p.Notice }

} if p.Image {

{

} if p.Rendered != nil { @ReadmeView(*p.Rendered) } if p.HasCode { if p.Rendered != nil {
source @CodeView(p.Code)
} else { @CodeView(p.Code) } } } } // CodeView is the highlighted lines with a link on each number. A click on a // number selects the line, shift-click extends the selection to a range; the // URL hash (#L10 or #L10-L24) is the state, so a page loaded with a hash is // painted the same way. body[data-sel] feeds the hint badge and the rail. templ CodeView(h template.HTML) {
@templ.Raw(string(h))
} templ blobRail(p BlobPage) {

File

@Facts(p.Facts)
if p.Last != nil {

Last change History

{ p.Last.Short } { p.Last.Subject }

{ p.Last.Author } · if p.Last.WhenAt != "" { }

} if len(p.Outline) > 0 {

On this page

@Outline(p.Outline)
} if p.HasCode {

Selection

none · click a line number, shift-click extends

y copies a permalink pinned to the commit sha

} }