From 8c4e60186d393a7c42b6bc09e81ba3051092076e Mon Sep 17 00:00:00 2001 From: ArthurHoaro Date: Mon, 30 May 2016 18:51:00 +0200 Subject: The tag is no longer private A private tag is never loaded for visitor, making this feature useless. --- plugins/markdown/markdown.php | 19 ++++++++++++++++--- 1 file changed, 16 insertions(+), 3 deletions(-) (limited to 'plugins/markdown') diff --git a/plugins/markdown/markdown.php b/plugins/markdown/markdown.php index 57fcce32..5f56ecc2 100644 --- a/plugins/markdown/markdown.php +++ b/plugins/markdown/markdown.php @@ -10,9 +10,8 @@ require_once 'Parsedown.php'; /* * If this tag is used on a shaare, the description won't be processed by Parsedown. - * Using a private tag so it won't appear for visitors. */ -define('NO_MD_TAG', '.nomarkdown'); +define('NO_MD_TAG', 'nomarkdown'); /** * Parse linklist descriptions. @@ -25,11 +24,11 @@ function hook_markdown_render_linklist($data) { foreach ($data['links'] as &$value) { if (!empty($value['tags']) && noMarkdownTag($value['tags'])) { + $value['taglist'] = stripNoMarkdownTag($value['taglist']); continue; } $value['description'] = process_markdown($value['description']); } - return $data; } @@ -44,6 +43,7 @@ function hook_markdown_render_feed($data) { foreach ($data['links'] as &$value) { if (!empty($value['tags']) && noMarkdownTag($value['tags'])) { + $value['tags'] = stripNoMarkdownTag($value['tags']); continue; } $value['description'] = process_markdown($value['description']); @@ -86,6 +86,19 @@ function noMarkdownTag($tags) return strpos($tags, NO_MD_TAG) !== false; } +/** + * Remove the no-markdown meta tag so it won't be displayed. + * + * @param string $tags Tag list. + * + * @return string tag list without no markdown tag. + */ +function stripNoMarkdownTag($tags) +{ + unset($tags[array_search(NO_MD_TAG, $tags)]); + return array_values($tags); +} + /** * When link list is displayed, include markdown CSS. * -- cgit v1.2.3