From dfb1566259c8fb39c3a114e35243c0ca897d93bb Mon Sep 17 00:00:00 2001 From: Daniel Vogel Date: Mon, 25 Nov 2024 13:10:08 +0100 Subject: [PATCH] Fix ListItem and Hidden --- src/Converter/PostProcessors/Color.php | 4 ++-- src/Converter/PostProcessors/Hidden.php | 7 ++++--- src/Converter/PostProcessors/ListItems.php | 5 +++-- 3 files changed, 9 insertions(+), 7 deletions(-) diff --git a/src/Converter/PostProcessors/Color.php b/src/Converter/PostProcessors/Color.php index 2f4e502..c046423 100644 --- a/src/Converter/PostProcessors/Color.php +++ b/src/Converter/PostProcessors/Color.php @@ -14,8 +14,8 @@ public function process( string $text ): string { // remove leading / which is placed by pandoc between File: and the file title $regEx = '#(.*?)#'; $text = preg_replace_callback( $regEx, static function ( $matches ) { - $color = $matches[1]; - $text = $matches[2]; + $color = $matches[1]; + $text = $matches[2]; $replacement = '' . $text . ''; return $replacement; }, $text ); diff --git a/src/Converter/PostProcessors/Hidden.php b/src/Converter/PostProcessors/Hidden.php index ee5df1d..a72b7ed 100644 --- a/src/Converter/PostProcessors/Hidden.php +++ b/src/Converter/PostProcessors/Hidden.php @@ -18,9 +18,10 @@ public function process( string $text ): string { $hide = $matches[2]; $flags = $matches[3]; $text = $matches[4]; - - - $replacement = '
'; + + $replacement = '
'; $replacement .= $text; $replacement .= '
'; diff --git a/src/Converter/PostProcessors/ListItems.php b/src/Converter/PostProcessors/ListItems.php index 19453f6..2bbe798 100644 --- a/src/Converter/PostProcessors/ListItems.php +++ b/src/Converter/PostProcessors/ListItems.php @@ -19,7 +19,7 @@ public function process( string $text ): string { if ( $posStar !== false && $posStar === 0 ) { $this->splitList( '*', $line, $output ); - } else if ( $posHash !== false && $posHash === 0 ) { + } elseif ( $posHash !== false && $posHash === 0 ) { $this->splitList( '#', $line, $output ); } else { $output[] = $line; @@ -32,7 +32,8 @@ public function process( string $text ): string { private function splitList( string $separator, string $line, array &$output ): void { $listLines = explode( $separator, $line ); - array_shift( $listLines ); // get rid of first empty element + // get rid of first empty element + array_shift( $listLines ); $newLine = ''; foreach ( $listLines as $listLine ) {