本文整理匯總了Golang中github.com/aymerick/raymond.Options類的典型用法代碼示例。如果您正苦於以下問題:Golang Options類的具體用法?Golang Options怎麽用?Golang Options使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。
在下文中一共展示了Options類的10個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Golang代碼示例。
示例1: detectDataHelper
func detectDataHelper(options *raymond.Options) string {
if val, ok := options.DataFrame().Get("exclaim").(string); ok {
return val
}
return ""
}
示例2: isSuccess
// 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()
}
}
示例3: isFailure
// 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()
}
}
示例4: listHelper
func listHelper(context interface{}, options *raymond.Options) string {
val := reflect.ValueOf(context)
switch val.Kind() {
case reflect.Array, reflect.Slice:
if val.Len() > 0 {
result := "<ul>"
for i := 0; i < val.Len(); i++ {
result += "<li>"
result += options.FnWith(val.Index(i).Interface())
result += "</li>"
}
result += "</ul>"
return result
}
}
return "<p>" + options.Inverse() + "</p>"
}
示例5: urlencode
func urlencode(options *raymond.Options) string {
return url.QueryEscape(options.Fn())
}
示例6: formCtxHelper
func formCtxHelper(context interface{}, options *raymond.Options) string {
return "<form>" + options.FnWith(context) + "</form>"
}
示例7: formHelper
func formHelper(options *raymond.Options) string {
return "<form>" + options.Fn() + "</form>"
}
示例8: rawThreeHelper
func rawThreeHelper(a, b, c string, options *raymond.Options) string {
return options.Fn() + a + b + c
}
示例9: rawHelper
func rawHelper(options *raymond.Options) string {
return options.Fn()
}
示例10: linkHelper
func linkHelper(prefix string, options *raymond.Options) string {
return fmt.Sprintf(`<a href="%s/%s">%s</a>`, prefix, options.ValueStr("url"), options.ValueStr("text"))
}