Skip to content

Commit

Permalink
Adds a new event named 'tag'
Browse files Browse the repository at this point in the history
  • Loading branch information
kzykhys committed Jan 24, 2014
1 parent 63bf138 commit bf77eb2
Showing 1 changed file with 48 additions and 9 deletions.
57 changes: 48 additions & 9 deletions src/Ciconia/Renderer/HtmlRenderer.php
Original file line number Diff line number Diff line change
Expand Up @@ -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();
}

Expand All @@ -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();
}

Expand All @@ -68,6 +72,8 @@ public function renderCodeBlock($content, array $options = array())
->render()
);

$this->getEmitter()->emit('tag', [$tag]);

return $tag->render();
}

Expand All @@ -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();
}

Expand All @@ -105,6 +113,8 @@ public function renderLink($content, array $options = array())
$tag->setAttribute('title', $options['title']);
}

$this->getEmitter()->emit('tag', [$tag]);

return $tag->render();
}

Expand All @@ -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();
}

Expand All @@ -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();
}

Expand All @@ -146,18 +160,26 @@ 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();
}

/**
* {@inheritdoc}
*/
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();
}

/**
Expand All @@ -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();
}

Expand All @@ -182,26 +206,39 @@ 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();
}

/**
* {@inheritdoc}
*/
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();
}

/**
* {@inheritdoc}
*/
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();
}

/**
Expand All @@ -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();
}

Expand Down

0 comments on commit bf77eb2

Please sign in to comment.