예제 #1
0
 /**
  * Encodes the content into HTML based on Markdown
  *
  * @return  void
  */
 protected function _cache_content()
 {
     $this->cached_content = Markdown::encode($this->content);
     if (preg_match_all('/<p>(.*)<\\/p>/', $this->cached_content, $matches)) {
         $this->description = substr(strip_tags($matches[1][0]), 0, 500);
     }
 }
예제 #2
0
 /**
  * 
  * Encodes special Markdown characters to they are not parsed by
  * plugins.
  * 
  * @param string $text Source text.
  * 
  * @param bool $only_backslash Only encode backslashed characters.
  * 
  * @return string The encoded text.
  * 
  */
 protected function _encode($text, $only_backslash = false)
 {
     return $this->_markdown->encode($text, $only_backslash);
 }
예제 #3
0
파일: MarkdownTest.php 프로젝트: gekt/www
 public function testEncoding()
 {
     $formatter = new Markdown();
     $data = array('name' => 'Joe', 'age' => 21, 'employed' => true, 'body' => "Lorem ipsum dolor\nsit amet");
     $this->assertSame(file_get_contents(__DIR__ . '/fixtures/joe.md'), $formatter->encode($data));
 }