From 827f6a1dd67cfcc5e5b30d53b486036a6aff7737 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bartosz=20Dziewo=C5=84ski?= Date: Tue, 23 Jun 2015 16:06:26 +0200 Subject: [PATCH] Use -P rather than -O when passing options To allow option values containing commas. -P is new in Pygments 0.9. http://pygments.org/docs/cmdline/#options-and-filters Fixes #4. --- src/KzykHys/Pygments/Pygments.php | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/src/KzykHys/Pygments/Pygments.php b/src/KzykHys/Pygments/Pygments.php index 6ebd652..1938cf9 100644 --- a/src/KzykHys/Pygments/Pygments.php +++ b/src/KzykHys/Pygments/Pygments.php @@ -53,13 +53,9 @@ public function highlight($code, $lexer = null, $formatter = null, $options = ar } if (count($options)) { - $arg = array(); - foreach ($options as $key => $value) { - $arg[] = sprintf('%s=%s', $key, $value); + $builder->add('-P')->add(sprintf('%s=%s', $key, $value)); } - - $builder->add('-O')->add(implode(',', $arg)); } $process = $builder->getProcess()->setStdin($code); @@ -197,4 +193,4 @@ protected function parseList($input) return $list; } -} \ No newline at end of file +}