mirror of
https://github.com/schollz/cowyo.git
synced 2023-08-10 21:13:00 +03:00
Updated .txt suffix
This commit is contained in:
parent
e8d368065b
commit
bc9fb92a5c
@ -215,7 +215,7 @@ func getCodeType(title string) string {
|
|||||||
return "go"
|
return "go"
|
||||||
} else if strings.Contains(title, ".html") {
|
} else if strings.Contains(title, ".html") {
|
||||||
return "htmlmixed"
|
return "htmlmixed"
|
||||||
} else if strings.Contains(title, ".txt") || strings.Contains(title, ".md") {
|
} else if strings.Contains(title, ".md") {
|
||||||
return "markdown"
|
return "markdown"
|
||||||
} else if strings.Contains(title, ".sh") {
|
} else if strings.Contains(title, ".sh") {
|
||||||
return "shell"
|
return "shell"
|
||||||
@ -258,7 +258,8 @@ func editNote(c *gin.Context) {
|
|||||||
if totalTime.Seconds() < 1 {
|
if totalTime.Seconds() < 1 {
|
||||||
totalTimeString = "< 1 s"
|
totalTimeString = "< 1 s"
|
||||||
}
|
}
|
||||||
|
splitStrings := strings.Split(title, ".")
|
||||||
|
suffix := splitStrings[len(splitStrings)-1]
|
||||||
CodeType := getCodeType(title)
|
CodeType := getCodeType(title)
|
||||||
c.HTML(http.StatusOK, "index.tmpl", gin.H{
|
c.HTML(http.StatusOK, "index.tmpl", gin.H{
|
||||||
"Title": title,
|
"Title": title,
|
||||||
@ -273,6 +274,7 @@ func editNote(c *gin.Context) {
|
|||||||
"NoEdit": !currentVersion,
|
"NoEdit": !currentVersion,
|
||||||
"Coding": len(CodeType) > 0,
|
"Coding": len(CodeType) > 0,
|
||||||
"CodeType": CodeType,
|
"CodeType": CodeType,
|
||||||
|
"Suffix": suffix,
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -28,7 +28,6 @@
|
|||||||
height: auto;
|
height: auto;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
textarea {
|
textarea {
|
||||||
width: 100%;
|
width: 100%;
|
||||||
margin: 5px 0;
|
margin: 5px 0;
|
||||||
@ -69,6 +68,18 @@
|
|||||||
<script src="/static/js/xml.js"></script>
|
<script src="/static/js/xml.js"></script>
|
||||||
{{ end }}
|
{{ end }}
|
||||||
{{ end }}
|
{{ end }}
|
||||||
|
|
||||||
|
{{ if eq .Suffix "txt" }}
|
||||||
|
<tag autocomplete="off" autocorrect="off" autocapitalize="off" spellcheck="false"/>
|
||||||
|
<link href='https://fonts.googleapis.com/css?family=Ubuntu+Mono|Droid+Sans+Mono' rel='stylesheet' type='text/css'>
|
||||||
|
<style type="text/css">
|
||||||
|
textarea {
|
||||||
|
font: 400 18px/1.62 'Ubuntu Mono','Droid Sans Mono';
|
||||||
|
}
|
||||||
|
</style>
|
||||||
|
{{ end }}
|
||||||
|
|
||||||
|
|
||||||
</head>
|
</head>
|
||||||
|
|
||||||
<body>
|
<body>
|
||||||
|
Loading…
Reference in New Issue
Block a user