@ -19,7 +19,7 @@ func Resources(ctx *context.Context) {
repo := ctx . Data [ "Repository" ]
repo := ctx . Data [ "Repository" ]
var err error
var err error
ctx . Data [ "RenderedResources" ] , err = GetRenderedTrustPropsWithSearchLinks ( ctx , repo , "Resources" )
ctx . Data [ "RenderedResources" ] , ctx . Data [ "TransformedTrustProps" ] , err = GetRenderedTrustPropsWithSearchLinks ( ctx , repo , "Resources" )
if err != nil {
if err != nil {
ctx . ServerError ( "Render" , err )
ctx . ServerError ( "Render" , err )
@ -29,7 +29,7 @@ func Resources(ctx *context.Context) {
ctx . HTML ( http . StatusOK , tplResources )
ctx . HTML ( http . StatusOK , tplResources )
}
}
func GetRenderedTrustPropsWithSearchLinks ( ctx * context . Context , repo interface { } , fieldName string ) ( string , error ) {
func GetRenderedTrustPropsWithSearchLinks ( ctx * context . Context , repo interface { } , fieldName string ) ( string , string , error ) {
trustProps := user . GetTextField ( repo , fieldName )
trustProps := user . GetTextField ( repo , fieldName )
var regExp * regexp . Regexp
var regExp * regexp . Regexp
@ -37,7 +37,7 @@ func GetRenderedTrustPropsWithSearchLinks(ctx *context.Context, repo interface{}
regExp , err = regexp . Compile ( ` - \[ \] (.+) ` )
regExp , err = regexp . Compile ( ` - \[ \] (.+) ` )
if err != nil {
if err != nil {
return "" , err
return "" , "" , err
}
}
trustPropNamesMatches := regExp . FindAllStringSubmatch ( trustProps , - 1 )
trustPropNamesMatches := regExp . FindAllStringSubmatch ( trustProps , - 1 )
@ -66,5 +66,5 @@ func GetRenderedTrustPropsWithSearchLinks(ctx *context.Context, repo interface{}
var renderedTrustPropsWithSafeURLs string
var renderedTrustPropsWithSafeURLs string
renderedTrustPropsWithSafeURLs , err = user . GetRenderedTextFieldByValue ( ctx , repo , transformedTrustProps )
renderedTrustPropsWithSafeURLs , err = user . GetRenderedTextFieldByValue ( ctx , repo , transformedTrustProps )
renderedTrustPropsWithTargetBlank := strings . ReplaceAll ( renderedTrustPropsWithSafeURLs , "<a" , "<a target='blank'" )
renderedTrustPropsWithTargetBlank := strings . ReplaceAll ( renderedTrustPropsWithSafeURLs , "<a" , "<a target='blank'" )
return renderedTrustPropsWithTargetBlank , err
return renderedTrustPropsWithTargetBlank , transformedTrustProps , err
}
}