Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Fixed regular expression used for replacing tabs.

  • Loading branch information...
commit cc3d0d15c240e0880ef5de4554796802334286ec 1 parent 3655428
@psychoticmeow psychoticmeow authored
Showing with 8 additions and 10 deletions.
  1. +8 −10 lib/bitter/formats/symphony.php
View
18 lib/bitter/formats/symphony.php
@@ -2,7 +2,7 @@
/*----------------------------------------------------------------------------*/
class BitterFormatSymphony extends BitterFormat {
- protected $tabsize = 4;
+ protected $tabsize = 2;
protected $line = 1;
protected $output = '';
@@ -19,19 +19,17 @@ public function process($source) {
}
protected function processTabs() {
- if (!function_exists('__expander')) eval("
- function __expander(\$matches) {
- return \$matches[1] . str_repeat(
- ' ', strlen(\$matches[2]) * {$this->tabsize} - (strlen(\$matches[1]) % {$this->tabsize})
- );
- }
- ");
-
while (strstr($this->output, "\t")) {
- $this->output = preg_replace_callback('%^([^\t\n]*)(\t+)%m', '__expander', $this->output);
+ $this->output = preg_replace_callback('%^([^\t]*)(\t+)%m', array($this, 'processTabsLine'), $this->output);
}
}
+ protected function processTabsLine($matches) {
+ return $matches[1] . str_repeat(
+ ' ', strlen($matches[2]) * $this->tabsize - (strlen($matches[1]) % $this->tabsize)
+ );
+ }
+
protected function processLines() {
$tokens = preg_split('%(<span class=".*?">|</span>)%', $this->output, 0, PREG_SPLIT_DELIM_CAPTURE);
$stack = array(); $this->output = '';
Please sign in to comment.
Something went wrong with that request. Please try again.