Skip to content

Commit a81078f

Browse files
committed
Add some comments
Signed-off-by: Jack Cherng <[email protected]>
1 parent 22c2f91 commit a81078f

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

src/Renderer/Html/Combined.php

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -399,7 +399,7 @@ protected function fixLinesForNoClosure(array &$lines, array $closures): void
399399
}
400400

401401
/**
402-
* Move boundary newline chars in parts to be extra new parts.
402+
* Extract boundary newlines from parts into new parts.
403403
*
404404
* @param array[] $parts the parts
405405
* @param string[] $closures the closures
@@ -414,10 +414,11 @@ protected function revisePartsForBoundaryNewlines(array &$parts, array $closures
414414
for ($i = \count($parts) - 1; $i >= 0; --$i) {
415415
$part = &$parts[$i];
416416

417+
// deal with leading newlines
417418
$part['content'] = \preg_replace_callback(
418419
"/(?P<closure>{$closureRegexL})(?P<nl>[\r\n]++)/u",
419420
function (array $matches) use (&$parts, $part, $closures): string {
420-
// add a new part for the extract newline chars
421+
// add a new part for the extracted newlines
421422
$part['order'] = -1;
422423
$part['content'] = "{$closures[0]}{$matches['nl']}{$closures[1]}";
423424
$parts[] = $part;
@@ -427,10 +428,11 @@ function (array $matches) use (&$parts, $part, $closures): string {
427428
$part['content']
428429
);
429430

431+
// deal with trailing newlines
430432
$part['content'] = \preg_replace_callback(
431433
"/(?P<nl>[\r\n]++)(?P<closure>{$closureRegexR})/u",
432434
function (array $matches) use (&$parts, $part, $closures): string {
433-
// add a new part for the extract newline chars
435+
// add a new part for the extracted newlines
434436
$part['order'] = 1;
435437
$part['content'] = "{$closures[0]}{$matches['nl']}{$closures[1]}";
436438
$parts[] = $part;

0 commit comments

Comments
 (0)