@@ -84,7 +84,7 @@ func anyHashPatternExtract(s string) (ret anyHashPatternResult, ok bool) {
84
84
85
85
// fullHashPatternProcessor renders SHA containing URLs
86
86
func fullHashPatternProcessor (ctx * RenderContext , node * html.Node ) {
87
- if ctx .Metas == nil {
87
+ if ctx .RenderOptions . Metas == nil {
88
88
return
89
89
}
90
90
nodeStop := node .NextSibling
@@ -111,7 +111,7 @@ func fullHashPatternProcessor(ctx *RenderContext, node *html.Node) {
111
111
}
112
112
113
113
func comparePatternProcessor (ctx * RenderContext , node * html.Node ) {
114
- if ctx .Metas == nil {
114
+ if ctx .RenderOptions . Metas == nil {
115
115
return
116
116
}
117
117
nodeStop := node .NextSibling
@@ -163,14 +163,14 @@ func comparePatternProcessor(ctx *RenderContext, node *html.Node) {
163
163
// hashCurrentPatternProcessor renders SHA1 strings to corresponding links that
164
164
// are assumed to be in the same repository.
165
165
func hashCurrentPatternProcessor (ctx * RenderContext , node * html.Node ) {
166
- if ctx .Metas == nil || ctx .Metas ["user" ] == "" || ctx .Metas ["repo" ] == "" || (ctx .Repo == nil && ctx .GitRepo == nil ) {
166
+ if ctx .RenderOptions . Metas == nil || ctx .RenderOptions . Metas ["user" ] == "" || ctx .RenderOptions . Metas ["repo" ] == "" || (ctx .RenderHelper . repoFacade == nil && ctx .RenderHelper . gitRepo == nil ) {
167
167
return
168
168
}
169
169
170
170
start := 0
171
171
next := node .NextSibling
172
- if ctx .ShaExistCache == nil {
173
- ctx .ShaExistCache = make (map [string ]bool )
172
+ if ctx .RenderHelper . shaExistCache == nil {
173
+ ctx .RenderHelper . shaExistCache = make (map [string ]bool )
174
174
}
175
175
for node != nil && node != next && start < len (node .Data ) {
176
176
m := globalVars ().hashCurrentPattern .FindStringSubmatchIndex (node .Data [start :])
@@ -191,33 +191,33 @@ func hashCurrentPatternProcessor(ctx *RenderContext, node *html.Node) {
191
191
// a commit in the repository before making it a link.
192
192
193
193
// check cache first
194
- exist , inCache := ctx .ShaExistCache [hash ]
194
+ exist , inCache := ctx .RenderHelper . shaExistCache [hash ]
195
195
if ! inCache {
196
- if ctx .GitRepo == nil {
196
+ if ctx .RenderHelper . gitRepo == nil {
197
197
var err error
198
198
var closer io.Closer
199
- ctx .GitRepo , closer , err = gitrepo .RepositoryFromContextOrOpen (ctx . Ctx , ctx .Repo )
199
+ ctx .RenderHelper . gitRepo , closer , err = gitrepo .RepositoryFromContextOrOpen (ctx , ctx .RenderHelper . repoFacade )
200
200
if err != nil {
201
- log .Error ("unable to open repository: %s Error: %v" , gitrepo .RepoGitURL (ctx .Repo ), err )
201
+ log .Error ("unable to open repository: %s Error: %v" , gitrepo .RepoGitURL (ctx .RenderHelper . repoFacade ), err )
202
202
return
203
203
}
204
204
ctx .AddCancel (func () {
205
205
_ = closer .Close ()
206
- ctx .GitRepo = nil
206
+ ctx .RenderHelper . gitRepo = nil
207
207
})
208
208
}
209
209
210
210
// Don't use IsObjectExist since it doesn't support short hashs with gogit edition.
211
- exist = ctx .GitRepo .IsReferenceExist (hash )
212
- ctx .ShaExistCache [hash ] = exist
211
+ exist = ctx .RenderHelper . gitRepo .IsReferenceExist (hash )
212
+ ctx .RenderHelper . shaExistCache [hash ] = exist
213
213
}
214
214
215
215
if ! exist {
216
216
start = m [3 ]
217
217
continue
218
218
}
219
219
220
- link := util .URLJoin (ctx .Links .Prefix (), ctx .Metas ["user" ], ctx .Metas ["repo" ], "commit" , hash )
220
+ link := util .URLJoin (ctx .RenderOptions . Links .Prefix (), ctx .RenderOptions . Metas ["user" ], ctx . RenderOptions .Metas ["repo" ], "commit" , hash )
221
221
replaceContent (node , m [2 ], m [3 ], createCodeLink (link , base .ShortSha (hash ), "commit" ))
222
222
start = 0
223
223
node = node .NextSibling .NextSibling
0 commit comments