INNER CODE UNIT · Go

GetValidatorTemplate

simagix/keyhole · comparator.go:393

func GetValidatorTemplate() (*template.Template, error) {
	return template.New("validator").Funcs(template.FuncMap{
		"printTarget": func(target interface{}, source interface{}) template.HTML {
			printer := message.NewPrinter(language.English)
			if target == source {
				return template.HTML(printer.Sprintf(`%v`, target))
			}
			return template.HTML(fmt.Sprintf(`<span style="color:red; background-color: #FFFF00">%v</span>`, printer.Sprintf("%v", target)))
		},
		"numPrinter": func(n int64) string {
			printer := message.NewPrinter(language.English)
			return printer.Sprintf("%v", n)
		},
		"add": func(a int, b int) string {
			return fmt.Sprintf("%v", a+b)
		},
		"IsPrint": func(docs []ErrorMessage) bool {
			return (len(docs) > 0)

View source record →

📰 Research Paper
Loading…
⏳ Fetching content…