@@ -55,11 +55,13 @@ protected function redererChanges(array $changes): string
5555 */
5656 protected function renderTableHeader (): string
5757 {
58+ $ colspan = ($ this ->options ['lineNumbers ' ] ? ' colspan="2" ' : '' );
59+
5860 return
5961 '<thead> ' .
6062 '<tr> ' .
61- '<th colspan="2" > ' . $ this ->_ ('old_version ' ) . '</th> ' .
62- '<th colspan="2" > ' . $ this ->_ ('new_version ' ) . '</th> ' .
63+ '<th ' . $ colspan . ' > ' . $ this ->_ ('old_version ' ) . '</th> ' .
64+ '<th ' . $ colspan . ' > ' . $ this ->_ ('new_version ' ) . '</th> ' .
6365 '</tr> ' .
6466 '</thead> ' ;
6567 }
@@ -69,10 +71,12 @@ protected function renderTableHeader(): string
6971 */
7072 protected function renderTableSeparateBlock (): string
7173 {
74+ $ colspan = (!$ this ->options ['lineNumbers ' ] ? '2 ' : '4 ' );
75+
7276 return
7377 '<tbody class="skipped"> ' .
7478 '<tr> ' .
75- '<td colspan="4 "></td> ' .
79+ '<td colspan=" ' . $ colspan . ' "></td> ' .
7680 '</tr> ' .
7781 '</tbody> ' ;
7882 }
@@ -117,9 +121,15 @@ protected function renderTableEqual(array $change): string
117121
118122 $ html .=
119123 '<tr> ' .
120- '<th class="n-old"> ' . $ oldLineNum . '</th> ' .
124+ ($ this ->options ['lineNumbers ' ] ?
125+ '<th class="n-old"> ' . $ oldLineNum . '</th> '
126+ : ''
127+ ) .
121128 '<td class="old"> ' . $ oldLine . '</td> ' .
122- '<th class="n-new"> ' . $ newLineNum . '</th> ' .
129+ ($ this ->options ['lineNumbers ' ] ?
130+ '<th class="n-new"> ' . $ newLineNum . '</th> '
131+ : ''
132+ ) .
123133 '<td class="new"> ' . $ newLine . '</td> ' .
124134 '</tr> ' ;
125135 }
@@ -141,9 +151,15 @@ protected function renderTableInsert(array $change): string
141151
142152 $ html .=
143153 '<tr> ' .
144- '<th></th> ' .
154+ ($ this ->options ['lineNumbers ' ] ?
155+ '<th></th> '
156+ : ''
157+ ) .
145158 '<td class="old"></td> ' .
146- '<th class="n-new"> ' . $ newLineNum . '</th> ' .
159+ ($ this ->options ['lineNumbers ' ] ?
160+ '<th class="n-new"> ' . $ newLineNum . '</th> '
161+ : ''
162+ ) .
147163 '<td class="new"> ' . $ newLine . '</td> ' .
148164 '</tr> ' ;
149165 }
@@ -165,9 +181,15 @@ protected function renderTableDelete(array $change): string
165181
166182 $ html .=
167183 '<tr> ' .
168- '<th class="n-old"> ' . $ oldLineNum . '</th> ' .
184+ ($ this ->options ['lineNumbers ' ] ?
185+ '<th class="n-old"> ' . $ oldLineNum . '</th> '
186+ : ''
187+ ) .
169188 '<td class="old"> ' . $ oldLine . '</td> ' .
170- '<th></th> ' .
189+ ($ this ->options ['lineNumbers ' ] ?
190+ '<th></th> '
191+ : ''
192+ ) .
171193 '<td class="new"></td> ' .
172194 '</tr> ' ;
173195 }
@@ -198,9 +220,15 @@ protected function renderTableReplace(array $change): string
198220
199221 $ html .=
200222 '<tr> ' .
201- '<th class="n-old"> ' . $ oldLineNum . '</th> ' .
223+ ($ this ->options ['lineNumbers ' ] ?
224+ '<th class="n-old"> ' . $ oldLineNum . '</th> '
225+ : ''
226+ ) .
202227 '<td class="old"><span> ' . $ oldLine . '</span></td> ' .
203- '<th class="n-new"> ' . $ newLineNum . '</th> ' .
228+ ($ this ->options ['lineNumbers ' ] ?
229+ '<th class="n-new"> ' . $ newLineNum . '</th> '
230+ : ''
231+ ) .
204232 '<td class="new"> ' . $ newLine . '</td> ' .
205233 '</tr> ' ;
206234 }
@@ -218,9 +246,15 @@ protected function renderTableReplace(array $change): string
218246
219247 $ html .=
220248 '<tr> ' .
221- '<th class="n-old"> ' . $ oldLineNum . '</th> ' .
249+ ($ this ->options ['lineNumbers ' ] ?
250+ '<th class="n-old"> ' . $ oldLineNum . '</th> '
251+ : ''
252+ ) .
222253 '<td class="old"><span> ' . $ oldLine . '</span></td> ' .
223- '<th class="n-new"> ' . $ newLineNum . '</th> ' .
254+ ($ this ->options ['lineNumbers ' ] ?
255+ '<th class="n-new"> ' . $ newLineNum . '</th> '
256+ : ''
257+ ) .
224258 '<td class="new"> ' . $ newLine . '</td> ' .
225259 '</tr> ' ;
226260 }
0 commit comments