@@ -695,8 +695,8 @@ func TestIsFullURL(t *testing.T) {
695
695
func TestRender_FilePreview (t * testing.T ) {
696
696
setting .AppURL = markup .TestAppURL
697
697
markup .Init (& markup.ProcessorHelper {
698
- GetRepoFileContent : func (ctx context.Context , ownerName string , repoName string , commitSha string , filePath string ) ([]template.HTML , error ) {
699
- buf := []byte ( "A\n B\n C\n D\n " )
698
+ GetRepoFileContent : func (ctx context.Context , ownerName , repoName , commitSha , filePath string ) ([]template.HTML , error ) {
699
+ buf := []byte ("A\n B\n C\n D\n " )
700
700
return highlight .PlainText (buf ), nil
701
701
},
702
702
GetLocale : func (ctx context.Context ) (translation.Locale , error ) {
@@ -709,39 +709,39 @@ func TestRender_FilePreview(t *testing.T) {
709
709
710
710
test := func (input , expected string ) {
711
711
buffer , err := markup .RenderString (& markup.RenderContext {
712
- Ctx : git .DefaultContext ,
712
+ Ctx : git .DefaultContext ,
713
713
RelativePath : ".md" ,
714
- Metas : localMetas ,
714
+ Metas : localMetas ,
715
715
}, input )
716
716
assert .NoError (t , err )
717
717
assert .Equal (t , strings .TrimSpace (expected ), strings .TrimSpace (buffer ))
718
718
}
719
719
720
720
test (
721
721
commitFilePreview ,
722
- `<p></p>` +
723
- `<div class="file-preview-box">` +
724
- `<div class="header">` +
725
- `<a href="http://localhost:3000/gogits/gogs/src/commit/b6dd6210eaebc915fd5be5579c58cce4da2e2579/path/to/file.go#L1-L2" class="muted" rel="nofollow">path/to/file.go</a>` +
726
- `<span class="text small grey">` +
727
- `Lines 1 to 2 in <a href="http://localhost:3000/gogits/gogs/src/commit/b6dd6210eaebc915fd5be5579c58cce4da2e2579" class="text black" rel="nofollow">b6dd621</a>` +
728
- `</span>` +
729
- `</div>` +
730
- `<div class="ui table">` +
731
- `<table class="file-preview">` +
732
- `<tbody>` +
733
- `<tr>` +
734
- `<td id="user-content-L1" class="lines-num"><span id="user-content-L1" data-line-number="1"></span></td>` +
735
- `<td rel="L1" class="lines-code chroma"><code class="code-inner">A` + "\n " + `</code></td>` +
736
- `</tr>` +
737
- `<tr>` +
738
- `<td id="user-content-L2" class="lines-num"><span id="user-content-L2" data-line-number="2"></span></td>` +
739
- `<td rel="L2" class="lines-code chroma"><code class="code-inner">B` + "\n " + `</code></td>` +
740
- `</tr>` +
741
- `</tbody>` +
742
- `</table>` +
743
- `</div>` +
744
- `</div>` +
745
- `<p></p>` ,
722
+ `<p></p>` +
723
+ `<div class="file-preview-box">` +
724
+ `<div class="header">` +
725
+ `<a href="http://localhost:3000/gogits/gogs/src/commit/b6dd6210eaebc915fd5be5579c58cce4da2e2579/path/to/file.go#L1-L2" class="muted" rel="nofollow">path/to/file.go</a>` +
726
+ `<span class="text small grey">` +
727
+ `Lines 1 to 2 in <a href="http://localhost:3000/gogits/gogs/src/commit/b6dd6210eaebc915fd5be5579c58cce4da2e2579" class="text black" rel="nofollow">b6dd621</a>` +
728
+ `</span>` +
729
+ `</div>` +
730
+ `<div class="ui table">` +
731
+ `<table class="file-preview">` +
732
+ `<tbody>` +
733
+ `<tr>` +
734
+ `<td id="user-content-L1" class="lines-num"><span id="user-content-L1" data-line-number="1"></span></td>` +
735
+ `<td rel="L1" class="lines-code chroma"><code class="code-inner">A` + "\n " + `</code></td>` +
736
+ `</tr>` +
737
+ `<tr>` +
738
+ `<td id="user-content-L2" class="lines-num"><span id="user-content-L2" data-line-number="2"></span></td>` +
739
+ `<td rel="L2" class="lines-code chroma"><code class="code-inner">B` + "\n " + `</code></td>` +
740
+ `</tr>` +
741
+ `</tbody>` +
742
+ `</table>` +
743
+ `</div>` +
744
+ `</div>` +
745
+ `<p></p>` ,
746
746
)
747
747
}
0 commit comments