Wrap any markdown output with a `<section>` and remove explicit containers
This commit is contained in:
parent
d0fbe0b38b
commit
9d0ef4cf33
|
@ -14,6 +14,12 @@ $this->addHelperFunction('nl2br', function ($string) {
|
||||||
return nl2br(str_replace(array('\r\n', '\r', '\n'), '<br>', $string), false);
|
return nl2br(str_replace(array('\r\n', '\r', '\n'), '<br>', $string), false);
|
||||||
});
|
});
|
||||||
|
|
||||||
$this->addHelperFunction('markdown', function ($content) {
|
$this->addHelperFunction('markdown', function ($content, $containerAttribs = null) {
|
||||||
return Markdown::text($content);
|
if (! isset($containerAttribs['class'])) {
|
||||||
|
$containerAttribs['class'] = 'markdown';
|
||||||
|
} else {
|
||||||
|
$containerAttribs['class'] .= ' markdown';
|
||||||
|
}
|
||||||
|
|
||||||
|
return '<section' . $this->propertiesToString($containerAttribs) . '>' . Markdown::text($content) . '</section>';
|
||||||
});
|
});
|
||||||
|
|
|
@ -45,7 +45,7 @@
|
||||||
</tr>
|
</tr>
|
||||||
<tr title="<?= $this->translate('A comment, as entered by the author, associated with the scheduled downtime'); ?>">
|
<tr title="<?= $this->translate('A comment, as entered by the author, associated with the scheduled downtime'); ?>">
|
||||||
<th><?= $this->translate('Comment') ?></th>
|
<th><?= $this->translate('Comment') ?></th>
|
||||||
<td class="comment-text"><?= $this->nl2br($this->markdown($this->downtime->comment)) ?></td>
|
<td><?= $this->nl2br($this->markdown($this->downtime->comment)) ?></td>
|
||||||
</tr>
|
</tr>
|
||||||
</tbody>
|
</tbody>
|
||||||
</table>
|
</table>
|
||||||
|
|
|
@ -65,6 +65,4 @@
|
||||||
} ?>
|
} ?>
|
||||||
</span>
|
</span>
|
||||||
</div>
|
</div>
|
||||||
<p class="comment-text"<?php if (isset($textId)): ?> id="<?= $textId ?>"<?php endif ?>>
|
<?= $this->nl2br($this->markdown($comment->comment, isset($textId) ? ['id' => $textId] : null)) ?>
|
||||||
<?= $this->nl2br($this->markdown($comment->comment)) ?>
|
|
||||||
</p>
|
|
||||||
|
|
|
@ -81,7 +81,5 @@
|
||||||
} ?>
|
} ?>
|
||||||
</span>
|
</span>
|
||||||
</div>
|
</div>
|
||||||
<p class="comment-text"<?php if (isset($textId)): ?> id="<?= $textId ?>"<?php endif ?>>
|
<?= $this->nl2br($this->markdown($downtime->comment, isset($textId) ? ['id' => $textId] : null)) ?>
|
||||||
<?= $this->nl2br($this->markdown($downtime->comment)) ?>
|
|
||||||
</p>
|
|
||||||
</td>
|
</td>
|
||||||
|
|
|
@ -180,11 +180,9 @@ $rowAction = Url::fromPath('monitoring/event/show');
|
||||||
) ?>
|
) ?>
|
||||||
<?php endif ?>
|
<?php endif ?>
|
||||||
<?php endif ?>
|
<?php endif ?>
|
||||||
<p class="overview-plugin-output"><?php if ($icon) {
|
<?php if ($icon) {
|
||||||
echo $this->icon($icon, $iconTitle);
|
echo $this->icon($icon, $iconTitle);
|
||||||
} ?><?= $this->nl2br($this->createTicketLinks($this->markdown($msg)))
|
} ?><?= $this->nl2br($this->createTicketLinks($this->markdown($msg, ['class' => 'overview-plugin-output']))) ?>
|
||||||
// TODO(ak): this allows only a[href] in messages, but plugin output allows more
|
|
||||||
?></p>
|
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
<?php endforeach ?>
|
<?php endforeach ?>
|
||||||
|
|
|
@ -38,7 +38,7 @@ if (($navigation->isEmpty() || ! $navigation->hasRenderableItems()) && $notes ==
|
||||||
<td>
|
<td>
|
||||||
<?= $navigation->getRenderer() ?>
|
<?= $navigation->getRenderer() ?>
|
||||||
<?php if ($notes !== ''): ?>
|
<?php if ($notes !== ''): ?>
|
||||||
<section class="notes"><?= $this->markdown($notes) ?></section>
|
<?= $this->markdown($notes) ?>
|
||||||
<?php endif ?>
|
<?php endif ?>
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
|
@ -24,12 +24,6 @@
|
||||||
float: right;
|
float: right;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Comment text in the comment overview
|
|
||||||
.comment-text {
|
|
||||||
// Reset margin
|
|
||||||
margin: 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Type information for backends in the monitoring config
|
// Type information for backends in the monitoring config
|
||||||
.config-label-meta {
|
.config-label-meta {
|
||||||
font-size: @font-size-small;
|
font-size: @font-size-small;
|
||||||
|
@ -96,7 +90,6 @@
|
||||||
color: @text-color-light;
|
color: @text-color-light;
|
||||||
font-family: @font-family-fixed;
|
font-family: @font-family-fixed;
|
||||||
font-size: @font-size-small;
|
font-size: @font-size-small;
|
||||||
margin: 0;
|
|
||||||
white-space: pre-wrap;
|
white-space: pre-wrap;
|
||||||
// Long text in table cells overflows the table's width if the table's layout is not fixed.
|
// Long text in table cells overflows the table's width if the table's layout is not fixed.
|
||||||
// Thus overflow-wrap will not have any effect. But w/ the following we set a width of any value
|
// Thus overflow-wrap will not have any effect. But w/ the following we set a width of any value
|
||||||
|
|
|
@ -30,6 +30,17 @@
|
||||||
white-space: pre-wrap;
|
white-space: pre-wrap;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.markdown {
|
||||||
|
> * {
|
||||||
|
margin-left: 0;
|
||||||
|
margin-right: 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
> *:last-child {
|
||||||
|
margin-bottom: 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
.pull-right {
|
.pull-right {
|
||||||
float: right;
|
float: right;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue