Пример #1
0
// isSuccess is a helper function that executes a block iff the status
// is success, else it executes the else block.
func isSuccess(conditional bool, options *raymond.Options) string {
	if !conditional {
		return options.Inverse()
	}

	switch options.ParamStr(0) {
	case "success":
		return options.Fn()
	default:
		return options.Inverse()
	}
}
Пример #2
0
// isFailure is a helper function that executes a block iff the status
// is a form of failure, else it executes the else block.
func isFailure(conditional bool, options *raymond.Options) string {
	if !conditional {
		return options.Inverse()
	}

	switch options.ParamStr(0) {
	case "failure", "error", "killed":
		return options.Fn()
	default:
		return options.Inverse()
	}
}
Пример #3
0
func urlencode(options *raymond.Options) string {
	return url.QueryEscape(options.Fn())
}
Пример #4
0
func formHelper(options *raymond.Options) string {
	return "<form>" + options.Fn() + "</form>"
}
Пример #5
0
func rawThreeHelper(a, b, c string, options *raymond.Options) string {
	return options.Fn() + a + b + c
}
Пример #6
0
func rawHelper(options *raymond.Options) string {
	return options.Fn()
}