From 0ef961a180207792fe55bc962eaf4e4760b87db2 Mon Sep 17 00:00:00 2001 From: Zack Scholl Date: Thu, 31 Mar 2016 09:06:55 -0400 Subject: [PATCH] Updated .txt suffix Former-commit-id: 7511a9aef07caf6a743d5e8f66a29290fe6ab919 [formerly 0d1fc564280e837c7f7777beaf4793fb63d72d39] [formerly 8a84a6ec9d8e8646d41864e99399ea3f17a5decf [formerly bc9fb92a5c7ed78abf1f506c931ab8b675889dcd]] Former-commit-id: 1c0be5813c4f073afdc0449161fde8ea1ca3b0a0 [formerly f7b0345a820e23490e8ff1d9fba036f4d8d021c1] Former-commit-id: 8944ccbee8627c1c75d0d534914e14e9846e43b6 --- routes.go | 6 ++++-- templates/index.tmpl | 13 ++++++++++++- 2 files changed, 16 insertions(+), 3 deletions(-) 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 }} + +