diff --git a/src/Ciconia/Renderer/HtmlRenderer.php b/src/Ciconia/Renderer/HtmlRenderer.php index bafc312..bbeab28 100644 --- a/src/Ciconia/Renderer/HtmlRenderer.php +++ b/src/Ciconia/Renderer/HtmlRenderer.php @@ -29,6 +29,8 @@ public function renderParagraph($content, array $options = array()) $tag->setText($content); $tag->setAttributes($options['attr']); + $this->getEmitter()->emit('tag', [$tag]); + return $tag->render(); } @@ -46,6 +48,8 @@ public function renderHeader($content, array $options = array()) $tag->setAttributes($options['attr']); $tag->setText($content); + $this->getEmitter()->emit('tag', [$tag]); + return $tag->render(); } @@ -68,6 +72,8 @@ public function renderCodeBlock($content, array $options = array()) ->render() ); + $this->getEmitter()->emit('tag', [$tag]); + return $tag->render(); } @@ -80,6 +86,8 @@ public function renderCodeSpan($content, array $options = array()) $tag->setType(Tag::TYPE_INLINE); $tag->setText($content); + $this->getEmitter()->emit('tag', [$tag]); + return $tag->render(); } @@ -105,6 +113,8 @@ public function renderLink($content, array $options = array()) $tag->setAttribute('title', $options['title']); } + $this->getEmitter()->emit('tag', [$tag]); + return $tag->render(); } @@ -116,6 +126,8 @@ public function renderBlockQuote($content, array $options = array()) $tag = Tag::create('blockquote') ->setText($content->wrap("\n", "\n")); + $this->getEmitter()->emit('tag', [$tag]); + return $tag->render(); } @@ -138,6 +150,8 @@ public function renderList($content, array $options = array()) $tag->setText($content->prepend("\n")); $tag->setAttributes($options['attr']); + $this->getEmitter()->emit('tag', [$tag]); + return $tag->render(); } @@ -146,7 +160,12 @@ public function renderList($content, array $options = array()) */ public function renderListItem($content, array $options = array()) { - return Tag::create('li')->setText($content)->render(); + $tag = Tag::create('li') + ->setText($content); + + $this->getEmitter()->emit('tag', [$tag]); + + return $tag->render(); } /** @@ -154,10 +173,13 @@ public function renderListItem($content, array $options = array()) */ public function renderHorizontalRule(array $options = array()) { - return Tag::create('hr') + $tag = Tag::create('hr') ->setType(Tag::TYPE_INLINE) - ->setEmptyTagSuffix($this->getEmptyTagSuffix()) - ->render(); + ->setEmptyTagSuffix($this->getEmptyTagSuffix()); + + $this->getEmitter()->emit('tag', [$tag]); + + return $tag->render(); } /** @@ -174,6 +196,8 @@ public function renderImage($src, array $options = array()) ->setAttribute('src', $src) ->setAttributes($options['attr']); + $this->getEmitter()->emit('tag', [$tag]); + return $tag->render(); } @@ -182,7 +206,12 @@ public function renderImage($src, array $options = array()) */ public function renderBoldText($text, array $options = array()) { - return Tag::create('strong')->setText($text)->render(); + $tag = Tag::create('strong') + ->setText($text); + + $this->getEmitter()->emit('tag', [$tag]); + + return $tag->render(); } /** @@ -190,7 +219,12 @@ public function renderBoldText($text, array $options = array()) */ public function renderItalicText($text, array $options = array()) { - return Tag::create('em')->setText($text)->render(); + $tag = Tag::create('em') + ->setText($text); + + $this->getEmitter()->emit('tag', [$tag]); + + return $tag->render(); } /** @@ -198,10 +232,13 @@ public function renderItalicText($text, array $options = array()) */ public function renderLineBreak(array $options = array()) { - return Tag::create('br') + $tag = Tag::create('br') ->setType(Tag::TYPE_INLINE) - ->setEmptyTagSuffix($this->getEmptyTagSuffix()) - ->render(); + ->setEmptyTagSuffix($this->getEmptyTagSuffix()); + + $this->getEmitter()->emit('tag', [$tag]); + + return $tag->render(); } /** @@ -216,6 +253,8 @@ public function renderTag($tagName, $content, $tagType = Tag::TYPE_BLOCK, array $tag->setText($content); $tag->setAttributes($options['attr']); + $this->getEmitter()->emit('tag', [$tag]); + return $tag->render(); }