-
Notifications
You must be signed in to change notification settings - Fork 0
/
helper.go
39 lines (34 loc) · 832 Bytes
/
helper.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
package report
import (
"html"
"strings"
"time"
)
const NonBreakingSpace = " "
func IsLess(a_PackageResult, b_PackageResult FinalTestStatus, a_Duration, b_Duration time.Duration) bool {
if a_PackageResult == b_PackageResult {
return a_Duration < b_Duration
}
return a_PackageResult < b_PackageResult
}
func EscapeMarkdown(input string) (escapedMarkdown string) {
replacer := strings.NewReplacer(
"_", "\\_",
"*", "\\*",
"#", "\\#",
"[", "\\[",
"]", "\\]",
"\\", "\\\\",
"`", "\\`",
"\n", " \n",
" ", NonBreakingSpace,
" ", NonBreakingSpace+NonBreakingSpace+NonBreakingSpace+NonBreakingSpace,
// Following are html escapes until HTML5.
`<`, "<",
`>`, ">",
)
return replacer.Replace(input)
}
func EscapeHtml(input string) (escapedHtml string) {
return html.EscapeString(input)
}