Skip to content

Commit db29c6b

Browse files
committed
Refactor output handling with alignment check and container adjustments
1 parent c86a39f commit db29c6b

1 file changed

Lines changed: 12 additions & 1 deletion

File tree

src/BlockListener.php

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,18 @@ protected function wrapElement($wrapper, array $options = [])
8989
$replace[] = $value;
9090
}
9191

92-
$pick->line->output = str_replace($search, $replace, $wrapper).PHP_EOL;
92+
if (in_array('{alignment}', $search) && $replace[0] !== '') {
93+
$container = explode($replace[0], $pick->line->output);
94+
} else {
95+
$container = [];
96+
}
97+
98+
if (isset($container) && count($container) > 1) {
99+
$pick->line->output = $container[0].str_replace($search, $replace, $wrapper).$container[1].PHP_EOL;
100+
} else {
101+
$pick->line->output = str_replace($search, $replace, $wrapper).PHP_EOL;
102+
}
103+
93104
$pick->line->setDone();
94105
}
95106
}

0 commit comments

Comments
 (0)