_doFencedCodeBlocks_callback() public method

public _doFencedCodeBlocks_callback ( $matches )
Ejemplo n.º 1
0
 function _doFencedCodeBlocks_callback($matches)
 {
     if ($m = $this->hasShebang($matches[2])) {
         return $this->_doGeshi($m);
     } else {
         return parent::_doFencedCodeBlocks_callback($matches);
     }
 }
Ejemplo n.º 2
0
 /**
  * Overload to support Viper's [code] shortcode. Because awesome.
  */
 public function _doFencedCodeBlocks_callback($matches)
 {
     // just MarkdownExtra_Parser if we're not going ultra-deluxe, or if
     // there wasn't a language class passed
     if (!$this->use_code_shortcode || empty($matches[2])) {
         return parent::_doFencedCodeBlocks_callback($matches);
     }
     $classname =& $matches[2];
     $codeblock = preg_replace_callback('/^\\n+/', array($this, '_doFencedCodeBlocks_newlines'), $matches[4]);
     if ($classname[0] == '.') {
         $classname = substr($classname, 1);
     }
     $codeblock = sprintf($this->shortcode_start, $classname) . "\n{$codeblock}" . $this->shortcode_end;
     return "\n\n" . $this->hashBlock($codeblock) . "\n\n";
 }
Ejemplo n.º 3
0
 /**
  * Overload to support Viper's [code] shortcode. Because awesome.
  */
 public function _doFencedCodeBlocks_callback($matches)
 {
     // in case we have some escaped leading hashes right at the start of the block
     $matches[4] = $this->restore_leading_hash($matches[4]);
     // just MarkdownExtra_Parser if we're not going ultra-deluxe
     if (!$this->use_code_shortcode) {
         return parent::_doFencedCodeBlocks_callback($matches);
     }
     // default to a "text" class if one wasn't passed. Helps with encoding issues later.
     if (empty($matches[2])) {
         $matches[2] = 'text';
     }
     $classname =& $matches[2];
     $codeblock = preg_replace_callback('/^\\n+/', array($this, '_doFencedCodeBlocks_newlines'), $matches[4]);
     if ($classname[0] == '.') {
         $classname = substr($classname, 1);
     }
     $codeblock = esc_html($codeblock);
     $codeblock = sprintf($this->shortcode_start, $classname) . "\n{$codeblock}" . $this->shortcode_end;
     return "\n\n" . $this->hashBlock($codeblock) . "\n\n";
 }