Example #1
0
 public function getHtmlContentAttribute()
 {
     if (!isset($this->parser)) {
         $this->parser = new Markdown();
     }
     $html = Shortcodes::process($this->attributes['content']);
     $html = $this->parser->text($html);
     return $html;
 }
Example #2
0
    public function testShortCodesAreRendered()
    {
        Shortcodes::register(new Identity());
        $page = new Page();
        $page->content = <<<'MARKDOWN'
[identity]hello[/identity]
MARKDOWN;
        $this->assertEquals("<p>hello</p>", $page->toArray()['html_content']);
    }
Example #3
0
 public function testCreateAndGetPageWithAssets()
 {
     Shortcodes::register(new Tweet());
     $page = new Page();
     $page->content = "[tweet id=\"20\"]";
     $page->save();
     $this->assertContains("twttr.widgets.createTweet", $page->html_content);
     $this->assertEquals(1, count(Assets::all()));
     $asset = Assets::all()[0];
     $this->assertEquals('script', $asset->getType());
     $this->assertEquals('//platform.twitter.com/widgets.js', $asset->getLocation());
     $page = new Page();
     $page->content = '# datatext';
     $page->save();
     $fetched = Pages::getPage($page->id);
     $this->assertEquals('<h1>datatext</h1>', $fetched['page']['html_content']);
 }