aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRunxi Yu <me@runxiyu.org>2025-02-11 11:15:42 +0800
committerRunxi Yu <me@runxiyu.org>2025-02-11 11:15:42 +0800
commit252921635a661a0231ca713565fa37b0faacd793 (patch)
tree47c2a8d08aa093bffecf9b08bf74d0052aea23e8
parent.editorconfig: Init (diff)
downloadforge-252921635a661a0231ca713565fa37b0faacd793.tar.gz
forge-252921635a661a0231ca713565fa37b0faacd793.tar.zst
forge-252921635a661a0231ca713565fa37b0faacd793.zip
*.go: Reformat
-rw-r--r--handle_repo_tree.go8
-rw-r--r--template_funcs.go2
2 files changed, 5 insertions, 5 deletions
diff --git a/handle_repo_tree.go b/handle_repo_tree.go
index 4c3eaa1..7a99692 100644
--- a/handle_repo_tree.go
+++ b/handle_repo_tree.go
@@ -4,8 +4,8 @@ import (
"bytes"
"html/template"
"net/http"
- "strings"
"path"
+ "strings"
chroma_formatters_html "github.com/alecthomas/chroma/v2/formatters/html"
chroma_lexers "github.com/alecthomas/chroma/v2/lexers"
@@ -77,7 +77,7 @@ func handle_repo_tree(w http.ResponseWriter, r *http.Request) {
}
formatted_encapsulated := template.HTML(formatted_unencapsulated.Bytes())
data["file_contents"] = formatted_encapsulated
-
+
err = templates.ExecuteTemplate(w, "repo_tree_file", data)
if err != nil {
_, _ = w.Write([]byte("Error rendering template: " + err.Error()))
@@ -87,8 +87,8 @@ func handle_repo_tree(w http.ResponseWriter, r *http.Request) {
}
}
- if len(raw_path_spec) != 0 && raw_path_spec[len(raw_path_spec) - 1] != '/' {
- http.Redirect(w, r, path.Base(path_spec) + "/", http.StatusSeeOther)
+ if len(raw_path_spec) != 0 && raw_path_spec[len(raw_path_spec)-1] != '/' {
+ http.Redirect(w, r, path.Base(path_spec)+"/", http.StatusSeeOther)
return
}
diff --git a/template_funcs.go b/template_funcs.go
index 08932ba..19a92ec 100644
--- a/template_funcs.go
+++ b/template_funcs.go
@@ -10,6 +10,6 @@ func first_line(s string) string {
return before
}
-func base_name (s string) string {
+func base_name(s string) string {
return path.Base(s)
}