summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorOlivier Maridat <olivier.maridat@trialog.com>2014-05-16 09:02:14 +0200
committerOlivier Maridat <olivier.maridat@trialog.com>2014-05-16 09:02:14 +0200
commit4c10cb5c98198eb29a982ee8953763ae4cc665f2 (patch)
tree0a2ae2c6f6ae58e697cdc59ac35a2d879d37ccec
parent2d299f63b85d884895191017a22935562d8f93e5 (diff)
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.
-rw-r--r--.gitignore5
-rw-r--r--core/helper.php7
-rw-r--r--templates/task_show.php2
3 files changed, 13 insertions, 1 deletions
diff --git a/.gitignore b/.gitignore
index 4dd62432..b64b7bbb 100644
--- a/.gitignore
+++ b/.gitignore
@@ -28,6 +28,11 @@
*.sqlite
*.sqlite-journal
+# IDE generated files #
+######################
+.buildpath
+.project
+
# OS generated files #
######################
.DS_Store
diff --git a/core/helper.php b/core/helper.php
index f3c3c3b8..7e65543a 100644
--- a/core/helper.php
+++ b/core/helper.php
@@ -23,6 +23,13 @@ function get_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)
{
require_once __DIR__.'/../vendor/Michelf/MarkdownExtra.inc.php';
diff --git a/templates/task_show.php b/templates/task_show.php
index 97ce7f8c..b16a20a0 100644
--- a/templates/task_show.php
+++ b/templates/task_show.php
@@ -72,7 +72,7 @@
<h2><?= t('Description') ?></h2>
<?php if ($task['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>
<?php else: ?>
<form method="post" action="?controller=task&amp;action=description&amp;task_id=<?= $task['id'] ?>" autocomplete="off">