tree.go
func (l *Leaf) URLPath(pairs ...string) string {
	if len(pairs)%2 != 0 {
		panic("number of pairs does not match")
	}

	urlPath := l.rawPattern
	parent := l.parent
	for parent != nil {
		urlPath = parent.rawPattern + "/" + urlPath
		parent = parent.parent
	}
	for i := 0; i < len(pairs); i += 2 {
		if len(pairs[i]) == 0 {
			panic("pair value cannot be empty: " + com.ToStr(i))
		} else if pairs[i][0] != ':' && pairs[i] != "*" && pairs[i] != "*.*" {
			pairs[i] = ":" + pairs[i]
		}
		urlPath = strings.Replace(urlPath, pairs[i], pairs[i+1], 1)
	}
	return urlPath
}
func (l *Leaf) URLPath(pairs ...string) string {
	if len(pairs)%2 != 0 {
		panic("number of pairs does not match")
	}

	urlPath := l.rawPattern
	parent := l.parent
	for parent != nil {
		urlPath = parent.rawPattern + "/" + urlPath
		parent = parent.parent
	}
	for i := 0; i < len(pairs); i += 2 {
		if len(pairs[i]) == 0 {
			panic("pair value cannot be empty: " + com.ToStr(i))
		} else if pairs[i][0] != ':' && pairs[i] != "*" && pairs[i] != "*.*" {
			pairs[i] = ":" + pairs[i]
		}
		urlPath = strings.Replace(urlPath, pairs[i], pairs[i+1], 1)
	}
	return urlPath
}
func ( l * Leaf ) URLPath ( pairs ... string ) string { if len ( pairs ) % 2 != 0 { panic ( " " ) } urlPath := l . rawPattern parent := l . parent for parent != nil { urlPath = parent . rawPattern + " " + urlPath parent = parent . parent } for i := 0 ; i < len ( pairs ) ; i += 2 { if len ( pairs [ i ] ) == 0 { panic ( " " + com . ToStr ( i ) ) } else if pairs [ i ] [ 0 ] != ':' && pairs [ i ] != " " && pairs [ i ] != " " { pairs [ i ] = " " + pairs [ i ] } urlPath = strings . Replace ( urlPath , pairs [ i ] , pairs [ i + 1 ] , 1 ) } return urlPath }
// URLPath build path part of URL by given pair values.
URLPath build path part of URL by given pair values .