all repos — legit @ 34521a5bc308c168d43f168e325ac4f43d5dd835

web frontend for git, written in go

routes: add syntax highlight

Gabriel A. Giovanini
commit

34521a5bc308c168d43f168e325ac4f43d5dd835

parent

de182443db91ca71508c3466418bcdf1fe09531f

1 file changed, 9 insertions(+), 2 deletions(-)

changed files
M routes/routes.goroutes/routes.go
@@ -225,6 +225,10 @@ return
} contents, err := gr.FileContent(treePath) + if err != nil { + d.Write500(w) + return + } data := make(map[string]any) data["name"] = name data["displayname"] = getDisplayName(name)
@@ -235,9 +239,12 @@
if raw { d.showRaw(contents, w) } else { - d.showFile(contents, data, w) + if d.c.Meta.SyntaxHighlight == "" { + d.showFile(contents, data, w) + } else { + d.showFileWithHighlight(treePath, contents, data, w) + } } - return } func (d *deps) Archive(w http.ResponseWriter, r *http.Request) {