diff --git a/src/Pango.php b/src/Pango.php index 6c17092..fc847b4 100644 --- a/src/Pango.php +++ b/src/Pango.php @@ -21,62 +21,76 @@ class Pango \Yggverse\Gemini\Gemtext\Body $body ): string { - // Format body $lines = $body->getLines(); $escaped = []; - /// Format H1 - foreach ($body->getH1() as $index => $h1) + // H1 + foreach ($body->getH1() as $index => $value) { $lines[$index] = sprintf( '%s', self::escape( - $h1 + $value ) ); $escaped[] = $index; } - /// Format H2 - foreach ($body->getH2() as $index => $h2) + // H2 + foreach ($body->getH2() as $index => $value) { $lines[$index] = sprintf( '%s', self::escape( - $h2 + $value ) ); $escaped[] = $index; } - /// Format H3 - foreach ($body->getH3() as $index => $h3) + // H3 + foreach ($body->getH3() as $index => $value) { $lines[$index] = sprintf( '%s', self::escape( - $h3 + $value ) ); $escaped[] = $index; } - /// Escape entities - foreach ($lines as $index => $line) + // H3 + foreach ($body->getH3() as $index => $value) { - if (!in_array($index, $escaped)) - { - $lines[$index] = self::escape( - $line - ); - } + $lines[$index] = sprintf( + '%s', + self::escape( + $value + ) + ); + + $escaped[] = $index; + } + + // Quote + foreach ($body->getQuote() as $index => $value) + { + $lines[$index] = sprintf( + '%s', + self::escape( + $value + ) + ); + + $escaped[] = $index; } - // @TODO links, code, escape entities + // @TODO links, code return implode( PHP_EOL,