summaryrefslogtreecommitdiffstats
path: root/templates/repo/diff_box.tmpl
diff options
context:
space:
mode:
authorAndrey Nering <andrey.nering@gmail.com>2016-02-21 18:45:24 -0300
committerAndrey Nering <andrey.nering@gmail.com>2016-02-21 18:45:24 -0300
commitd160c7e565ef3c3429ca601b5a10b13949579b36 (patch)
treea69cefeb2419ece9f0ee102f2fdf986ce3d6d3ee /templates/repo/diff_box.tmpl
parent8ac04a3f291c5cf1a9474c1affeb04a1f94ea5a8 (diff)
downloadgitea-d160c7e565ef3c3429ca601b5a10b13949579b36.tar.gz
gitea-d160c7e565ef3c3429ca601b5a10b13949579b36.zip
Little refactoring of diff highlight.
Moving cache variable to template instead of in the struct.
Diffstat (limited to 'templates/repo/diff_box.tmpl')
-rw-r--r--templates/repo/diff_box.tmpl7
1 files changed, 4 insertions, 3 deletions
diff --git a/templates/repo/diff_box.tmpl b/templates/repo/diff_box.tmpl
index f96ebda52d..455f07002c 100644
--- a/templates/repo/diff_box.tmpl
+++ b/templates/repo/diff_box.tmpl
@@ -34,6 +34,7 @@
</div>
{{range $i, $file := .Diff.Files}}
+ {{$highlightClass := $file.GetHighlightClass}}
<div class="diff-file-box diff-box file-content" id="diff-{{.Index}}">
<h4 class="ui top attached normal header">
<div class="diff-counter count ui left">
@@ -76,13 +77,13 @@
<span rel="{{if $line.LeftIdx}}diff-{{Sha1 $file.Name}}L{{$line.LeftIdx}}{{end}}">{{if $line.LeftIdx}}{{$line.LeftIdx}}{{end}}</span>
</td>
<td class="lines-code halfwidth">
- <pre><code class="wrap {{if $file.GetHighlightClass}}language-{{$file.GetHighlightClass}}{{else}}nohighlight{{end}}">{{if $line.LeftIdx}}{{$section.GetComputedInlineDiffFor $line}}{{end}}</code></pre>
+ <pre><code class="wrap {{if $highlightClass}}language-{{$highlightClass}}{{else}}nohighlight{{end}}">{{if $line.LeftIdx}}{{$section.GetComputedInlineDiffFor $line}}{{end}}</code></pre>
</td>
<td class="lines-num lines-num-new">
<span rel="{{if $line.RightIdx}}diff-{{Sha1 $file.Name}}R{{$line.RightIdx}}{{end}}">{{if $line.RightIdx}}{{$line.RightIdx}}{{end}}</span>
</td>
<td class="lines-code halfwidth">
- <pre><code class="wrap {{if $file.GetHighlightClass}}language-{{$file.GetHighlightClass}}{{else}}nohighlight{{end}}">{{if $line.RightIdx}}{{$section.GetComputedInlineDiffFor $line}}{{end}}</code></pre>
+ <pre><code class="wrap {{if $highlightClass}}language-{{$highlightClass}}{{else}}nohighlight{{end}}">{{if $line.RightIdx}}{{$section.GetComputedInlineDiffFor $line}}{{end}}</code></pre>
</td>
</tr>
{{end}}
@@ -104,7 +105,7 @@
</td>
{{end}}
<td class="lines-code">
- <pre><code class="{{if $file.GetHighlightClass}}language-{{$file.GetHighlightClass}}{{else}}nohighlight{{end}}">{{$section.GetComputedInlineDiffFor $line}}</code></pre>
+ <pre><code class="{{if $highlightClass}}language-{{$highlightClass}}{{else}}nohighlight{{end}}">{{$section.GetComputedInlineDiffFor $line}}</code></pre>
</td>
</tr>
{{end}}