• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

Golang helpers.AbsURL函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Golang中github.com/spf13/hugo/helpers.AbsURL函数的典型用法代码示例。如果您正苦于以下问题:Golang AbsURL函数的具体用法?Golang AbsURL怎么用?Golang AbsURL使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。



在下文中一共展示了AbsURL函数的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Golang代码示例。

示例1: init

func init() {
	funcMap = template.FuncMap{
		"urlize":      helpers.URLize,
		"sanitizeURL": helpers.SanitizeURL,
		"sanitizeurl": helpers.SanitizeURL,
		"eq":          Eq,
		"ne":          Ne,
		"gt":          Gt,
		"ge":          Ge,
		"lt":          Lt,
		"le":          Le,
		"in":          In,
		"slicestr":    Slicestr,
		"substr":      Substr,
		"split":       Split,
		"intersect":   Intersect,
		"isSet":       IsSet,
		"isset":       IsSet,
		"echoParam":   ReturnWhenSet,
		"safeHTML":    SafeHTML,
		"safeCSS":     SafeCSS,
		"safeURL":     SafeURL,
		"absURL":      func(a string) template.HTML { return template.HTML(helpers.AbsURL(a)) },
		"relURL":      func(a string) template.HTML { return template.HTML(helpers.RelURL(a)) },
		"markdownify": Markdownify,
		"first":       First,
		"last":        Last,
		"after":       After,
		"where":       Where,
		"delimit":     Delimit,
		"sort":        Sort,
		"highlight":   Highlight,
		"add":         func(a, b interface{}) (interface{}, error) { return doArithmetic(a, b, '+') },
		"sub":         func(a, b interface{}) (interface{}, error) { return doArithmetic(a, b, '-') },
		"div":         func(a, b interface{}) (interface{}, error) { return doArithmetic(a, b, '/') },
		"mod":         Mod,
		"mul":         func(a, b interface{}) (interface{}, error) { return doArithmetic(a, b, '*') },
		"modBool":     ModBool,
		"lower":       func(a string) string { return strings.ToLower(a) },
		"upper":       func(a string) string { return strings.ToUpper(a) },
		"title":       func(a string) string { return strings.Title(a) },
		"partial":     Partial,
		"ref":         Ref,
		"relref":      RelRef,
		"apply":       Apply,
		"chomp":       Chomp,
		"replace":     Replace,
		"trim":        Trim,
		"dateFormat":  DateFormat,
		"getJSON":     GetJSON,
		"getCSV":      GetCSV,
		"readDir":     ReadDir,
		"seq":         helpers.Seq,
		"getenv":      func(varName string) string { return os.Getenv(varName) },
	}

}
开发者ID:n2xnot,项目名称:hugo,代码行数:57,代码来源:template_funcs.go


示例2: init

func init() {
	funcMap = template.FuncMap{
		"absURL":       func(a string) template.HTML { return template.HTML(helpers.AbsURL(a)) },
		"add":          func(a, b interface{}) (interface{}, error) { return helpers.DoArithmetic(a, b, '+') },
		"after":        after,
		"apply":        apply,
		"base64Decode": base64Decode,
		"base64Encode": base64Encode,
		"chomp":        chomp,
		"countrunes":   countRunes,
		"countwords":   countWords,
		"default":      dfault,
		"dateFormat":   dateFormat,
		"delimit":      delimit,
		"dict":         dictionary,
		"div":          func(a, b interface{}) (interface{}, error) { return helpers.DoArithmetic(a, b, '/') },
		"echoParam":    returnWhenSet,
		"emojify":      emojify,
		"eq":           eq,
		"findRE":       findRE,
		"first":        first,
		"ge":           ge,
		"getCSV":       getCSV,
		"getJSON":      getJSON,
		"getenv":       func(varName string) string { return os.Getenv(varName) },
		"gt":           gt,
		"hasPrefix":    func(a, b string) bool { return strings.HasPrefix(a, b) },
		"highlight":    highlight,
		"humanize":     humanize,
		"in":           in,
		"index":        index,
		"int":          func(v interface{}) int { return cast.ToInt(v) },
		"intersect":    intersect,
		"isSet":        isSet,
		"isset":        isSet,
		"jsonify":      jsonify,
		"last":         last,
		"le":           le,
		"lower":        func(a string) string { return strings.ToLower(a) },
		"lt":           lt,
		"markdownify":  markdownify,
		"md5":          md5,
		"mod":          mod,
		"modBool":      modBool,
		"mul":          func(a, b interface{}) (interface{}, error) { return helpers.DoArithmetic(a, b, '*') },
		"ne":           ne,
		"partial":      partial,
		"plainify":     plainify,
		"pluralize":    pluralize,
		"querify":      querify,
		"readDir":      readDirFromWorkingDir,
		"readFile":     readFileFromWorkingDir,
		"ref":          ref,
		"relURL":       func(a string) template.HTML { return template.HTML(helpers.RelURL(a)) },
		"relref":       relRef,
		"replace":      replace,
		"replaceRE":    replaceRE,
		"safeCSS":      safeCSS,
		"safeHTML":     safeHTML,
		"safeHTMLAttr": safeHTMLAttr,
		"safeJS":       safeJS,
		"safeURL":      safeURL,
		"sanitizeURL":  helpers.SanitizeURL,
		"sanitizeurl":  helpers.SanitizeURL,
		"seq":          helpers.Seq,
		"sha1":         sha1,
		"shuffle":      shuffle,
		"singularize":  singularize,
		"slice":        slice,
		"slicestr":     slicestr,
		"sort":         sortSeq,
		"split":        split,
		"string":       func(v interface{}) string { return cast.ToString(v) },
		"sub":          func(a, b interface{}) (interface{}, error) { return helpers.DoArithmetic(a, b, '-') },
		"substr":       substr,
		"title":        func(a string) string { return strings.Title(a) },
		"trim":         trim,
		"upper":        func(a string) string { return strings.ToUpper(a) },
		"urlize":       helpers.URLize,
		"where":        where,
	}
}
开发者ID:camunda-third-party,项目名称:hugo,代码行数:82,代码来源:template_funcs.go


示例3: init

func init() {
	funcMap = template.FuncMap{
		"urlize":      helpers.URLize,
		"sanitizeURL": helpers.SanitizeURL,
		"sanitizeurl": helpers.SanitizeURL,
		"eq":          Eq,
		"ne":          Ne,
		"gt":          Gt,
		"ge":          Ge,
		"lt":          Lt,
		"le":          Le,
		"in":          In,
		"slicestr":    Slicestr,
		"substr":      Substr,
		"split":       Split,
		"intersect":   Intersect,
		"isSet":       IsSet,
		"isset":       IsSet,
		"echoParam":   ReturnWhenSet,
		"safeHTML":    SafeHTML,
		"safeCSS":     SafeCSS,
		"safeURL":     SafeURL,
		"absURL":      func(a string) template.HTML { return template.HTML(helpers.AbsURL(a)) },
		"relURL":      func(a string) template.HTML { return template.HTML(helpers.RelURL(a)) },
		"markdownify": Markdownify,
		"first":       First,
		"where":       Where,
		"delimit":     Delimit,
		"sort":        Sort,
		"highlight":   Highlight,
		"add":         func(a, b interface{}) (interface{}, error) { return doArithmetic(a, b, '+') },
		"sub":         func(a, b interface{}) (interface{}, error) { return doArithmetic(a, b, '-') },
		"div":         func(a, b interface{}) (interface{}, error) { return doArithmetic(a, b, '/') },
		"mod":         Mod,
		"mul":         func(a, b interface{}) (interface{}, error) { return doArithmetic(a, b, '*') },
		"modBool":     ModBool,
		"lower":       func(a string) string { return strings.ToLower(a) },
		"upper":       func(a string) string { return strings.ToUpper(a) },
		"title":       func(a string) string { return strings.Title(a) },
		"partial":     Partial,
		"ref":         Ref,
		"relref":      RelRef,
		"apply":       Apply,
		"chomp":       Chomp,
		"replace":     Replace,
		"trim":        Trim,
		"dateFormat":  DateFormat,
		"getJSON":     GetJSON,
		"getCSV":      GetCSV,
		"seq":         helpers.Seq,
		"getenv":      func(varName string) string { return os.Getenv(varName) },

		// "getJson" is deprecated. Will be removed in 0.15.
		"getJson": func(urlParts ...string) interface{} {
			helpers.Deprecated("Template", "getJson", "getJSON")
			return GetJSON(urlParts...)
		},
		// "getJson" is deprecated. Will be removed in 0.15.
		"getCsv": func(sep string, urlParts ...string) [][]string {
			helpers.Deprecated("Template", "getCsv", "getCSV")
			return GetCSV(sep, urlParts...)
		},
		// "safeHtml" is deprecated. Will be removed in 0.15.
		"safeHtml": func(text string) template.HTML {
			helpers.Deprecated("Template", "safeHtml", "safeHTML")
			return SafeHTML(text)
		},
		// "safeCss" is deprecated. Will be removed in 0.15.
		"safeCss": func(text string) template.CSS {
			helpers.Deprecated("Template", "safeCss", "safeCSS")
			return SafeCSS(text)
		},
		// "safeUrl" is deprecated. Will be removed in 0.15.
		"safeUrl": func(text string) template.URL {
			helpers.Deprecated("Template", "safeUrl", "safeURL")
			return SafeURL(text)
		},
	}

}
开发者ID:blevesearch,项目名称:hugoidx,代码行数:80,代码来源:template_funcs.go


示例4: init

func init() {
	funcMap = template.FuncMap{
		"urlize":       helpers.URLize,
		"sanitizeURL":  helpers.SanitizeURL,
		"sanitizeurl":  helpers.SanitizeURL,
		"eq":           Eq,
		"ne":           Ne,
		"gt":           Gt,
		"ge":           Ge,
		"lt":           Lt,
		"le":           Le,
		"in":           In,
		"slicestr":     Slicestr,
		"substr":       Substr,
		"intersect":    Intersect,
		"isSet":        IsSet,
		"isset":        IsSet,
		"echoParam":    ReturnWhenSet,
		"safeHTML":     SafeHTML,
		"safeCSS":      SafeCSS,
		"safeURL":      SafeURL,
		"absURL":       func(a string) template.HTML { return template.HTML(helpers.AbsURL(a)) },
		"relURL":       func(a string) template.HTML { return template.HTML(helpers.RelURL(a)) },
		"markdownify":  Markdownify,
		"first":        First,
		"last":         Last,
		"after":        After,
		"where":        Where,
		"delimit":      Delimit,
		"sort":         Sort,
		"highlight":    Highlight,
		"add":          func(a, b interface{}) (interface{}, error) { return doArithmetic(a, b, '+') },
		"sub":          func(a, b interface{}) (interface{}, error) { return doArithmetic(a, b, '-') },
		"div":          func(a, b interface{}) (interface{}, error) { return doArithmetic(a, b, '/') },
		"mod":          Mod,
		"mul":          func(a, b interface{}) (interface{}, error) { return doArithmetic(a, b, '*') },
		"math":         Math,
		"modBool":      ModBool,
		"lower":        func(a string) string { return strings.ToLower(a) },
		"upper":        func(a string) string { return strings.ToUpper(a) },
		"title":        func(a string) string { return strings.Title(a) },
		"partial":      Partial,
		"ref":          Ref,
		"relref":       RelRef,
		"apply":        Apply,
		"chomp":        Chomp,
		"replace":      Replace,
		"trim":         Trim,
		"dateFormat":   DateFormat,
		"getJSON":      GetJSON,
		"getCSV":       GetCSV,
		"readDir":      ReadDir,
		"seq":          helpers.Seq,
		"getenv":       func(varName string) string { return os.Getenv(varName) },
		"base64Decode": Base64Decode,
		"base64Encode": Base64Encode,
		"uuid":         func() string { return uuid.New() },
		"uniquify":     Uniquify,
		"log":          Log,
		"pluralize": func(in interface{}) (string, error) {
			word, err := cast.ToStringE(in)
			if err != nil {
				return "", err
			}
			return inflect.Pluralize(word), nil
		},
		"singularize": func(in interface{}) (string, error) {
			word, err := cast.ToStringE(in)
			if err != nil {
				return "", err
			}
			return inflect.Singularize(word), nil
		},
	}
}
开发者ID:go2mobi,项目名称:hugo,代码行数:75,代码来源:template_funcs.go


示例5: init

func init() {
	funcMap = template.FuncMap{
		"absURL":       func(a string) template.HTML { return template.HTML(helpers.AbsURL(a)) },
		"add":          func(a, b interface{}) (interface{}, error) { return doArithmetic(a, b, '+') },
		"after":        After,
		"apply":        Apply,
		"base64Decode": Base64Decode,
		"base64Encode": Base64Encode,
		"chomp":        Chomp,
		"countrunes":   CountRunes,
		"countwords":   CountWords,
		"dateFormat":   DateFormat,
		"delimit":      Delimit,
		"dict":         Dictionary,
		"div":          func(a, b interface{}) (interface{}, error) { return doArithmetic(a, b, '/') },
		"echoParam":    ReturnWhenSet,
		"eq":           Eq,
		"first":        First,
		"ge":           Ge,
		"getCSV":       GetCSV,
		"getJSON":      GetJSON,
		"getenv":       func(varName string) string { return os.Getenv(varName) },
		"gt":           Gt,
		"hasPrefix":    func(a, b string) bool { return strings.HasPrefix(a, b) },
		"highlight":    Highlight,
		"humanize":     Humanize,
		"in":           In,
		"int":          func(v interface{}) int { return cast.ToInt(v) },
		"intersect":    Intersect,
		"isSet":        IsSet,
		"isset":        IsSet,
		"last":         Last,
		"le":           Le,
		"lower":        func(a string) string { return strings.ToLower(a) },
		"lt":           Lt,
		"markdownify":  Markdownify,
		"mod":          Mod,
		"modBool":      ModBool,
		"mul":          func(a, b interface{}) (interface{}, error) { return doArithmetic(a, b, '*') },
		"ne":           Ne,
		"partial":      Partial,
		"pluralize":    Pluralize,
		"readDir":      ReadDir,
		"ref":          Ref,
		"relURL":       func(a string) template.HTML { return template.HTML(helpers.RelURL(a)) },
		"relref":       RelRef,
		"replace":      Replace,
		"safeCSS":      SafeCSS,
		"safeHTML":     SafeHTML,
		"safeJS":       SafeJS,
		"safeURL":      SafeURL,
		"sanitizeURL":  helpers.SanitizeURL,
		"sanitizeurl":  helpers.SanitizeURL,
		"seq":          helpers.Seq,
		"shuffle":      Shuffle,
		"singularize":  Singularize,
		"slicestr":     Slicestr,
		"sort":         Sort,
		"split":        Split,
		"string":       func(v interface{}) string { return cast.ToString(v) },
		"sub":          func(a, b interface{}) (interface{}, error) { return doArithmetic(a, b, '-') },
		"substr":       Substr,
		"title":        func(a string) string { return strings.Title(a) },
		"trim":         Trim,
		"upper":        func(a string) string { return strings.ToUpper(a) },
		"urlize":       helpers.URLize,
		"where":        Where,
	}
}
开发者ID:pedromg,项目名称:hugo,代码行数:69,代码来源:template_funcs.go



注:本文中的github.com/spf13/hugo/helpers.AbsURL函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Golang helpers.AddContextRoot函数代码示例发布时间:2022-05-28
下一篇:
Golang helpers.AbsPathify函数代码示例发布时间:2022-05-28
热门推荐
热门话题
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap