@ -41,28 +41,30 @@ func GetRenderedTrustPropsWithSearchLinks(ctx *context.Context, repo interface{}
}
}
trustPropNamesMatches := regExp . FindAllStringSubmatch ( trustProps , - 1 )
trustPropNamesMatches := regExp . FindAllStringSubmatch ( trustProps , - 1 )
if trustPropNamesMatches == nil {
return "" , err
}
var trustPropsWithSafeURLs = strings . Clone ( trustProps )
var transformedTrustProps string
var trustPropName string
if trustPropNamesMatches == nil {
var searchQS string
transformedTrustProps = trustProps
} else {
transformedTrustProps = strings . Clone ( trustProps )
var trustPropName string
var searchQS string
for _ , trustPropNameMatches := range trustPropNamesMatches {
for _ , curT rustPropNameMatches := range trustPropNamesMatches {
trustPropName = trustPropNameMatches [ 1 ]
trustPropName = curT rustPropNameMatches[ 1 ]
searchQS = strings . ReplaceAll ( trustPropName , " " , "+" )
searchQS = strings . ReplaceAll ( trustPropName , " " , "+" )
trustPropSubstitutionPattern := fmt . Sprintf (
trustPropSubstitutionPattern := fmt . Sprintf (
` - [ ] %s [найти](/explore/%s?tab=&q=%s) ` ,
` - [ ] %s [найти](/explore/%s?tab=&q=%s) ` ,
trustPropName ,
trustPropName ,
strings . ToLower ( fieldName ) ,
strings . ToLower ( fieldName ) ,
searchQS )
searchQS )
trustPropsWithSafeURLs = strings . Replace ( trustPropsWithSafeURLs , trustPropNameMatches [ 0 ] , trustPropSubstitutionPattern , - 1 )
transformedTrustProps = strings . Replace ( transformedTrustProps , curTrustPropNameMatches [ 0 ] , trustPropSubstitutionPattern , - 1 )
}
}
}
var renderedTrustPropsWithSafeURLs string
var renderedTrustPropsWithSafeURLs string
renderedTrustPropsWithSafeURLs , err = user . GetRenderedTextFieldByValue ( ctx , repo , trustPropsWithSafeURL s )
renderedTrustPropsWithSafeURLs , err = user . GetRenderedTextFieldByValue ( ctx , repo , transformedTr ustProps )
renderedTrustPropsWithTargetBlank := strings . ReplaceAll ( renderedTrustPropsWithSafeURLs , "<a" , "<a target='blank'" )
renderedTrustPropsWithTargetBlank := strings . ReplaceAll ( renderedTrustPropsWithSafeURLs , "<a" , "<a target='blank'" )
return renderedTrustPropsWithTargetBlank , err
return renderedTrustPropsWithTargetBlank , err
}
}