improved diff
parent
74b3c953de
commit
3a27a0c146
|
@ -291,6 +291,8 @@ func ParsePatch(reader io.Reader) (*Diff, error) {
|
||||||
curSection.Lines = append(curSection.Lines, diffLine)
|
curSection.Lines = append(curSection.Lines, diffLine)
|
||||||
continue
|
continue
|
||||||
} else if line[0] == '@' {
|
} else if line[0] == '@' {
|
||||||
|
curSection = &DiffSection{}
|
||||||
|
curFile.Sections = append(curFile.Sections, curSection)
|
||||||
ss := strings.Split(line, "@@")
|
ss := strings.Split(line, "@@")
|
||||||
diffLine := &DiffLine{Type: SectionLine, Content:"@@ "+ss[len(ss)-2]}
|
diffLine := &DiffLine{Type: SectionLine, Content:"@@ "+ss[len(ss)-2]}
|
||||||
curSection.Lines = append(curSection.Lines, diffLine)
|
curSection.Lines = append(curSection.Lines, diffLine)
|
||||||
|
|
|
@ -63,7 +63,8 @@
|
||||||
<div class="panel-body file-body file-code code-view code-diff">
|
<div class="panel-body file-body file-code code-view code-diff">
|
||||||
<table>
|
<table>
|
||||||
<tbody>
|
<tbody>
|
||||||
{{range .Content}}
|
{{range .Sections}}
|
||||||
|
{{range .Lines}}
|
||||||
<tr class="same-code nl-1 ol-1">
|
<tr class="same-code nl-1 ol-1">
|
||||||
<td class="lines-num lines-num-old">
|
<td class="lines-num lines-num-old">
|
||||||
<span rel="L1"></span>
|
<span rel="L1"></span>
|
||||||
|
@ -72,10 +73,11 @@
|
||||||
<span rel="L1"></span>
|
<span rel="L1"></span>
|
||||||
</td>
|
</td>
|
||||||
<td class="lines-code">
|
<td class="lines-code">
|
||||||
<pre>{{.}}</pre>
|
<pre>{{.Content}}</pre>
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
{{end}}
|
{{end}}
|
||||||
|
{{end}}
|
||||||
<!-- <tr class="same-code nl-2 ol-2">
|
<!-- <tr class="same-code nl-2 ol-2">
|
||||||
<td class="lines-num lines-num-old">
|
<td class="lines-num lines-num-old">
|
||||||
<span rel="L1">2</span>
|
<span rel="L1">2</span>
|
||||||
|
|
Loading…
Reference in New Issue