Ejemplo n.º 1
0
 public function handleInput(FileInterface $scribbleFile)
 {
     $this->scribbleFile = $scribbleFile;
     if (preg_match('/<!-- *scribble-ignore-snippets: *(1|true) *-->/', $scribbleFile->getSource())) {
         return $scribbleFile->getSource();
     }
     // find all occurences (match entire document) and fire for each occurence
     $this->regexPart = '(' . $scribbleFile->getLeftKeywordDelimiter() . ' *scribble-snippet: *(.*?) *' . $scribbleFile->getRightKeywordDelimiter() . '( *\\n| *$))';
     return preg_replace_callback('/' . $this->regexPart . '/is', array($this, 'includeSnippet'), $scribbleFile->getSource());
 }
 public function handleOutput(FileInterface $scribbleFile, $output)
 {
     $ld = $scribbleFile->getLeftKeywordDelimiter();
     $rd = $scribbleFile->getRightKeywordDelimiter();
     return preg_replace('/<p>' . $ld . ' *scribble-language-hint: *([\\w-]*) *' . $rd . '<\\/p>\\s*<pre><code>/i', '<pre class="' . "\$1" . '"><code class="' . "\$1" . '">', $output);
 }