Exemplo n.º 1
0
 /**
  * Handle the command.
  *
  * @param Markdown $markdown
  */
 public function handle(Markdown $markdown)
 {
     $this->command->info(strip_tags($markdown->transform(file_get_contents(base_path('LICENSE.md')))));
     if (!$this->command->confirm('Do you agree to the provided license and terms of service?')) {
         $this->command->error('You must agree to the license and terms of service before continuing.');
         exit;
     }
 }
Exemplo n.º 2
0
 public function getContentHtml()
 {
     if ($this->codeType == 'html') {
         return $this->ContentHtml = $this->content;
     } else {
         $md = new Markdown();
         $md->no_markup = true;
         $md->no_entities = true;
         return $this->ContentHtml = $md->transform($this->content);
     }
 }
 public function it_should_throw_an_exception_on_an_exception(Markdown $markdown)
 {
     $markdown->transform('bar')->willThrow('Exception');
     $this->shouldThrow('TheWilkyBarKid\\TextFilter\\Exception\\TextFilterFailedException')->during('filter', array('foo'));
 }
Exemplo n.º 4
0
 function it_parses_markdown(\Michelf\Markdown $markdown)
 {
     $markdown->transform('# Markdown')->shouldBeCalled()->willReturn('<h1>Markdown</h1>');
     $this->beConstructedWith($markdown);
     $this->parse('# Markdown')->shouldReturn('<h1>Markdown</h1>');
 }
Exemplo n.º 5
0
 /**
  * {@inheritdoc}
  */
 public function transform($content)
 {
     return parent::transform($content);
 }
 /**
  * Return the rendered content.
  *
  * @return string
  */
 public function rendered()
 {
     return $this->markdown->transform($this->object->getValue());
 }
Exemplo n.º 7
0
 public function apply($content)
 {
     // apply custom behaviour here
     return parent::transform($content);
 }
 protected function doFilter($text)
 {
     return $this->markdown->transform($text);
 }
Exemplo n.º 9
0
 /**
  * Returns the parsed content as HTML
  *
  * @param string $content
  *
  * @return string
  */
 public function getHtml($content)
 {
     return $this->markdown->transform($this->getContentPart($content, static::CONTENT));
 }
Exemplo n.º 10
0
 /**
  * @param string $line
  * @param array $args [optionally]
  * @param array $options [optionally]
  * @return mixed
  */
 public function parseLine($line, array $args = [], array $options = [])
 {
     return $this->markdown->transform($line);
 }
Exemplo n.º 11
0
 }
 // Handle page inclusions `{% include page xxx %}`
 $source = preg_replace_callback('!\\{%\\s+include\\s+page\\s+(' . GP_PAGE_REGEX . ')\\s+%\\}!', function ($m) {
     return is_page($m[1]) ? get_page($m[1]) : $m[1];
 }, $source);
 // Convert integers in URLs to internal page links
 $markdownParser = new Markdown();
 $markdownParser->url_filter_func = function ($url) {
     $m = array();
     if (preg_match('!^\\s*(' . GP_PAGE_REGEX . ')\\s*$!', $url, $m)) {
         $url = "../page/{$m[1]}";
     }
     return $url;
 };
 // Transform the markdown
 $page = $markdownParser->transform($source);
 // Transform page links
 $page = preg_replace_callback('!page (' . GP_PAGE_REGEX . ')!', function ($m) {
     if (is_page($m[1])) {
         return '<a href="../page/' . $m[1] . '">' . $m[0] . '</a>';
     } else {
         return $m[0];
     }
 }, $page);
 // Transform dialogue links `(xxx)> blablabla`
 $page = preg_replace_callback('!\\s*\\((' . GP_PAGE_REGEX . ')\\)\\s*>\\s*(.+?)(</p>)?$!m', function ($m) use($id) {
     if (is_page($m[1])) {
         if ($m[1] != $id) {
             return '&gt; <a class="talk" href="../page/' . $m[1] . '">' . $m[2] . '</a><br>' . (isset($m[3]) ? '</p>' : '');
         } else {
             return '';