Commit 7924e6d1 by Carsten Brandt

fixed apidoc context for markdown rendering

parent 3f1a0307
......@@ -34,6 +34,10 @@ class Markdown extends \yii\helpers\Markdown
*/
public static function process($content, $context = null)
{
if (is_string($context)) {
$context = static::$renderer->context->getType($context);
}
$content = trim(parent::process($content, []));
if (!strncmp($content, '<p>', 3) && substr($content, -4, 4) == '</p>') {
$content = substr($content, 3, -4);
......
......@@ -33,7 +33,7 @@ ArrayHelper::multisort($constants, 'name');
<tr<?= $constant->definedBy != $type->name ? ' class="inherited"' : '' ?> id="<?= $constant->name ?>">
<td><?= $constant->name ?><a name="<?= $constant->name ?>-detail"></a></td>
<td><?= $constant->value ?></td>
<td><?= Markdown::process($constant->shortDescription . "\n" . $constant->description, $type) ?></td>
<td><?= Markdown::process($constant->shortDescription . "\n" . $constant->description, $constant->definedBy) ?></td>
<td><?= $this->context->typeLink($constant->definedBy) ?></td>
</tr>
<?php endforeach; ?>
......
......@@ -34,7 +34,7 @@ ArrayHelper::multisort($events, 'name');
<td><?= $this->context->subjectLink($event) ?></td>
<td><?= $this->context->typeLink($event->types) ?></td>
<td>
<?= Markdown::process($event->shortDescription, $type) ?>
<?= Markdown::process($event->shortDescription, $event->definedBy) ?>
<?php if(!empty($event->since)): ?>
(available since version <?php echo $event->since; ?>)
<?php endif; ?>
......
......@@ -37,7 +37,7 @@ foreach($methods as $method): ?>
<?php if($protected && $method->visibility == 'protected' || !$protected && $method->visibility != 'protected'): ?>
<tr<?= $method->definedBy != $type->name ? ' class="inherited"' : '' ?> id="<?= $method->name ?>()">
<td><?= $this->context->subjectLink($method, $method->name.'()') ?></td>
<td><?= Markdown::process($method->shortDescription, $type) ?></td>
<td><?= Markdown::process($method->shortDescription, $method->definedBy) ?></td>
<td><?= $this->context->typeLink($method->definedBy, $type) ?></td>
</tr>
<?php endif; ?>
......
......@@ -38,7 +38,7 @@ foreach($properties as $property): ?>
<tr<?= $property->definedBy != $type->name ? ' class="inherited"' : '' ?> id="<?= $property->name ?>">
<td><?= $this->context->subjectLink($property) ?></td>
<td><?= $this->context->typeLink($property->types) ?></td>
<td><?= Markdown::process($property->shortDescription, $type) ?></td>
<td><?= Markdown::process($property->shortDescription, $property->definedBy) ?></td>
<td><?= $this->context->typeLink($property->definedBy) ?></td>
</tr>
<?php endif; ?>
......
......@@ -25,7 +25,7 @@ if (empty($see)) {
<h4>See Also</h4>
<ul>
<?php foreach($see as $ref): ?>
<li><?= \yii\apidoc\helpers\Markdown::process($ref, $this->context->context->getType($object->definedBy)) ?></li>
<li><?= \yii\apidoc\helpers\Markdown::process($ref, $object->definedBy) ?></li>
<?php endforeach; ?>
</ul>
</div>
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment