diff --git a/routes.go b/routes.go index ca14948..cb4320b 100644 --- a/routes.go +++ b/routes.go @@ -215,7 +215,7 @@ func getCodeType(title string) string { return "go" } else if strings.Contains(title, ".html") { return "htmlmixed" - } else if strings.Contains(title, ".txt") || strings.Contains(title, ".md") { + } else if strings.Contains(title, ".md") { return "markdown" } else if strings.Contains(title, ".sh") { return "shell" @@ -258,7 +258,8 @@ func editNote(c *gin.Context) { if totalTime.Seconds() < 1 { totalTimeString = "< 1 s" } - + splitStrings := strings.Split(title, ".") + suffix := splitStrings[len(splitStrings)-1] CodeType := getCodeType(title) c.HTML(http.StatusOK, "index.tmpl", gin.H{ "Title": title, @@ -273,6 +274,7 @@ func editNote(c *gin.Context) { "NoEdit": !currentVersion, "Coding": len(CodeType) > 0, "CodeType": CodeType, + "Suffix": suffix, }) } } diff --git a/templates/index.tmpl b/templates/index.tmpl index c683cd1..79c74f8 100644 --- a/templates/index.tmpl +++ b/templates/index.tmpl @@ -28,7 +28,6 @@ height: auto; } - textarea { width: 100%; margin: 5px 0; @@ -69,6 +68,18 @@ {{ end }} {{ end }} + + {{ if eq .Suffix "txt" }} + + + + {{ end }} + +