diff --git a/templates/repo/diff/box.tmpl b/templates/repo/diff/box.tmpl
index bbb2cc41d..275dc5150 100644
--- a/templates/repo/diff/box.tmpl
+++ b/templates/repo/diff/box.tmpl
@@ -118,57 +118,7 @@
{{template "repo/diff/image_diff" dict "file" . "root" $}}
{{else}}
{{if $.IsSplitStyle}}
- {{range $j, $section := $file.Sections}}
- {{range $k, $line := $section.Lines}}
-
- {{if eq .GetType 4}}
-
- {{if or (eq $line.GetExpandDirection 3) (eq $line.GetExpandDirection 5) }}
-
- {{svg "octicon-fold-down"}}
-
- {{end}}
- {{if or (eq $line.GetExpandDirection 3) (eq $line.GetExpandDirection 4) }}
-
- {{svg "octicon-fold-up"}}
-
- {{end}}
- {{if eq $line.GetExpandDirection 2}}
-
- {{svg "octicon-fold"}}
-
- {{end}}
- |
- {{$section.GetComputedInlineDiffFor $line}} |
- {{else}}
- |
- {{if $line.LeftIdx}}{{end}} |
- {{if and $.SignedUserID $line.CanComment $.PageIsPullFiles (not (eq .GetType 2))}}{{end}}{{if $line.LeftIdx}}{{$section.GetComputedInlineDiffFor $line}}{{end}} |
- |
- {{if $line.RightIdx}}{{end}} |
- {{if and $.SignedUserID $line.CanComment $.PageIsPullFiles (not (eq .GetType 3))}}{{end}}{{if $line.RightIdx}}{{$section.GetComputedInlineDiffFor $line}}{{end}} |
- {{end}}
-
- {{if gt (len $line.Comments) 0}}
-
- {{end}}
- {{end}}
- {{end}}
+ {{template "repo/diff/section_split" dict "file" . "root" $}}
{{else}}
{{template "repo/diff/section_unified" dict "file" . "root" $}}
{{end}}
diff --git a/templates/repo/diff/section_split.tmpl b/templates/repo/diff/section_split.tmpl
new file mode 100644
index 000000000..7e62bf3e1
--- /dev/null
+++ b/templates/repo/diff/section_split.tmpl
@@ -0,0 +1,52 @@
+{{$file := .file}}
+{{range $j, $section := $file.Sections}}
+ {{range $k, $line := $section.Lines}}
+
+ {{if eq .GetType 4}}
+
+ {{if or (eq $line.GetExpandDirection 3) (eq $line.GetExpandDirection 5) }}
+
+ {{svg "octicon-fold-down"}}
+
+ {{end}}
+ {{if or (eq $line.GetExpandDirection 3) (eq $line.GetExpandDirection 4) }}
+
+ {{svg "octicon-fold-up"}}
+
+ {{end}}
+ {{if eq $line.GetExpandDirection 2}}
+
+ {{svg "octicon-fold"}}
+
+ {{end}}
+ |
+ {{$section.GetComputedInlineDiffFor $line}} |
+ {{else}}
+ |
+ {{if $line.LeftIdx}}{{end}} |
+ {{if and $.root.SignedUserID $line.CanComment $.root.PageIsPullFiles (not (eq .GetType 2))}}{{end}}{{if $line.LeftIdx}}{{$section.GetComputedInlineDiffFor $line}}{{end}} |
+ |
+ {{if $line.RightIdx}}{{end}} |
+ {{if and $.root.SignedUserID $line.CanComment $.root.PageIsPullFiles (not (eq .GetType 3))}}{{end}}{{if $line.RightIdx}}{{$section.GetComputedInlineDiffFor $line}}{{end}} |
+ {{end}}
+
+ {{if gt (len $line.Comments) 0}}
+
+ {{end}}
+ {{end}}
+{{end}}