Add a specific Kanboard description parser
This parser still calls the markdown parser, but also replace #<task number> to a link to the given task.
This commit is contained in:
5
.gitignore
vendored
5
.gitignore
vendored
@@ -28,6 +28,11 @@
|
|||||||
*.sqlite
|
*.sqlite
|
||||||
*.sqlite-journal
|
*.sqlite-journal
|
||||||
|
|
||||||
|
# IDE generated files #
|
||||||
|
######################
|
||||||
|
.buildpath
|
||||||
|
.project
|
||||||
|
|
||||||
# OS generated files #
|
# OS generated files #
|
||||||
######################
|
######################
|
||||||
.DS_Store
|
.DS_Store
|
||||||
|
|||||||
@@ -23,6 +23,13 @@ function get_username()
|
|||||||
return $_SESSION['user']['username'];
|
return $_SESSION['user']['username'];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function parse($text)
|
||||||
|
{
|
||||||
|
$text = markdown($text);
|
||||||
|
$text = preg_replace('!#(\d+)!i', '<a href="?controller=task&action=show&task_id=$1">$0</a>', $text);
|
||||||
|
return $text;
|
||||||
|
}
|
||||||
|
|
||||||
function markdown($text)
|
function markdown($text)
|
||||||
{
|
{
|
||||||
require_once __DIR__.'/../vendor/Michelf/MarkdownExtra.inc.php';
|
require_once __DIR__.'/../vendor/Michelf/MarkdownExtra.inc.php';
|
||||||
|
|||||||
@@ -72,7 +72,7 @@
|
|||||||
<h2><?= t('Description') ?></h2>
|
<h2><?= t('Description') ?></h2>
|
||||||
<?php if ($task['description']): ?>
|
<?php if ($task['description']): ?>
|
||||||
<article class="markdown task-show-description">
|
<article class="markdown task-show-description">
|
||||||
<?= Helper\markdown($task['description']) ?: t('There is no description.') ?>
|
<?= Helper\parse($task['description']) ?: t('There is no description.') ?>
|
||||||
</article>
|
</article>
|
||||||
<?php else: ?>
|
<?php else: ?>
|
||||||
<form method="post" action="?controller=task&action=description&task_id=<?= $task['id'] ?>" autocomplete="off">
|
<form method="post" action="?controller=task&action=description&task_id=<?= $task['id'] ?>" autocomplete="off">
|
||||||
|
|||||||
Reference in New Issue
Block a user