Skip to content

Commit 0996a7c

Browse files
committed
Add indent to godocComment filter
1 parent dbbbb7d commit 0996a7c

File tree

1 file changed

+5
-4
lines changed

1 file changed

+5
-4
lines changed

src/SDK/Language/Go.php

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -267,13 +267,14 @@ public function getParamExample(array $param): string
267267
public function getFilters(): array
268268
{
269269
return [
270-
new TwigFilter('godocComment', function ($value) {
270+
new TwigFilter('godocComment', function ($value, $indent=0) {
271271
$value = explode("\n", $value);
272+
$indent = \str_repeat(' ', $indent);
272273
foreach ($value as $key => $line) {
273-
$value[$key] = "// " . wordwrap($line, 75, "\n// ");
274+
$value[$key] = "// " . wordwrap($line, 75, "\n" . $indent . "// ");
274275
}
275-
return implode("\n", $value);
276-
}, ['is_safe' => ['html']])
276+
return implode("\n" . $indent, $value);
277+
}, ['is_safe' => ['html']]),
277278
];
278279
}
279280
}

0 commit comments

Comments
 (0)