route_info.go
func (ri *RouteInfo) BuildPathHelper() RouteHelperFunc {
	cRoute := ri
	return func(opts map[string]interface{}) (template.HTML, error) {
		pairs := []string{}
		for k, v := range opts {
			pairs = append(pairs, k)
			pairs = append(pairs, fmt.Sprintf("%v", v))
		}

		url, err := cRoute.MuxRoute.URL(pairs...)
		if err != nil {
			return "", errors.Wrapf(err, "missing parameters for %v", cRoute.Path)
		}

		result := url.Path
		result = addExtraParamsTo(result, opts)

		return template.HTML(result), nil
	}
}
func (ri *RouteInfo) BuildPathHelper() RouteHelperFunc {
	cRoute := ri
	return func(opts map[string]interface{}) (template.HTML, error) {
		pairs := []string{}
		for k, v := range opts {
			pairs = append(pairs, k)
			pairs = append(pairs, fmt.Sprintf("%v", v))
		}

		url, err := cRoute.MuxRoute.URL(pairs...)
		if err != nil {
			return "", errors.Wrapf(err, "missing parameters for %v", cRoute.Path)
		}

		result := url.Path
		result = addExtraParamsTo(result, opts)

		return template.HTML(result), nil
	}
}
func ( ri * RouteInfo ) BuildPathHelper ( ) RouteHelperFunc { cRoute := ri return func ( opts map [ string ] interface { } ) ( template . HTML , error ) { pairs := [ ] string { } for k , v := range opts { pairs = append ( pairs , k ) pairs = append ( pairs , fmt . Sprintf ( " " , v ) ) } url , err := cRoute . MuxRoute . URL ( pairs ... ) if err != nil { return " " , errors . Wrapf ( err , " " , cRoute . Path ) } result := url . Path result = addExtraParamsTo ( result , opts ) return template . HTML ( result ) , nil } }
// BuildPathHelper Builds a routeHelperfunc for a particular RouteInfo
BuildPathHelper Builds a routeHelperfunc for a particular RouteInfo