File tree Expand file tree Collapse file tree 1 file changed +25
-4
lines changed
lib/jblond/Diff/Renderer/Html Expand file tree Collapse file tree 1 file changed +25
-4
lines changed Original file line number Diff line number Diff line change @@ -208,15 +208,11 @@ public function generateLinesReplace(array $changes): string
208208 $ fromLine = $ changes ['base ' ]['offset ' ] + $ lineNo + 1 ;
209209 $ toLine = " " ;
210210 $ changedLine = " " ;
211-
212211 if (isset ($ changes ['changed ' ]['lines ' ][$ lineNo ])) {
213212 $ toLine = $ changes ['changed ' ]['offset ' ] + $ lineNo + 1 ;
214213 $ changedLine = $ changes ['changed ' ]['lines ' ][$ lineNo ];
215214 }
216215
217- $ line = str_replace (["\0" , "\1" ], $ this ->options ['deleteMarkers ' ], $ line );
218- $ changedLine = str_replace (["\0" , "\1" ], $ this ->options ['insertMarkers ' ], $ changedLine );
219-
220216 $ html .= <<<HTML
221217<tr>
222218 <th> $ fromLine</th>
@@ -230,6 +226,31 @@ public function generateLinesReplace(array $changes): string
230226</tr>
231227HTML ;
232228 }
229+
230+ return $ html ;
231+ }
232+
233+ foreach ($ changes ['changed ' ]['lines ' ] as $ lineNo => $ changedLine ) {
234+ $ toLine = $ changes ['changed ' ]['offset ' ] + $ lineNo + 1 ;
235+ $ fromLine = " " ;
236+ $ line = " " ;
237+ if (isset ($ changes ['base ' ]['lines ' ][$ lineNo ])) {
238+ $ fromLine = $ changes ['base ' ]['offset ' ] + $ lineNo + 1 ;
239+ $ line = $ changes ['base ' ]['lines ' ][$ lineNo ];
240+ }
241+
242+ $ html .= <<<HTML
243+ <tr>
244+ <th> $ fromLine</th>
245+ <td class="Left">
246+ <span> $ line</span>
247+ </td>
248+ <th> $ toLine</th>
249+ <td class="Right">
250+ <span> $ changedLine</span>
251+ </td>
252+ </tr>
253+ HTML ;
233254 }
234255
235256 return $ html ;
You can’t perform that action at this time.
0 commit comments