Merge pull request #582 from ArthurHoaro/hotfix/nomarkdown
The "nomarkdown" tag is no longer private
This commit is contained in:
commit
bb9ca54838
2 changed files with 20 additions and 5 deletions
|
@ -10,9 +10,8 @@
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* If this tag is used on a shaare, the description won't be processed by Parsedown.
|
* 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.
|
* Parse linklist descriptions.
|
||||||
|
@ -25,11 +24,11 @@ function hook_markdown_render_linklist($data)
|
||||||
{
|
{
|
||||||
foreach ($data['links'] as &$value) {
|
foreach ($data['links'] as &$value) {
|
||||||
if (!empty($value['tags']) && noMarkdownTag($value['tags'])) {
|
if (!empty($value['tags']) && noMarkdownTag($value['tags'])) {
|
||||||
|
$value['taglist'] = stripNoMarkdownTag($value['taglist']);
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
$value['description'] = process_markdown($value['description']);
|
$value['description'] = process_markdown($value['description']);
|
||||||
}
|
}
|
||||||
|
|
||||||
return $data;
|
return $data;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -44,6 +43,7 @@ function hook_markdown_render_feed($data)
|
||||||
{
|
{
|
||||||
foreach ($data['links'] as &$value) {
|
foreach ($data['links'] as &$value) {
|
||||||
if (!empty($value['tags']) && noMarkdownTag($value['tags'])) {
|
if (!empty($value['tags']) && noMarkdownTag($value['tags'])) {
|
||||||
|
$value['tags'] = stripNoMarkdownTag($value['tags']);
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
$value['description'] = process_markdown($value['description']);
|
$value['description'] = process_markdown($value['description']);
|
||||||
|
@ -86,6 +86,19 @@ function noMarkdownTag($tags)
|
||||||
return strpos($tags, NO_MD_TAG) !== false;
|
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.
|
* When link list is displayed, include markdown CSS.
|
||||||
*
|
*
|
||||||
|
|
|
@ -125,7 +125,8 @@ function testNoMarkdownTag()
|
||||||
$data = array(
|
$data = array(
|
||||||
'links' => array(array(
|
'links' => array(array(
|
||||||
'description' => $str,
|
'description' => $str,
|
||||||
'tags' => NO_MD_TAG
|
'tags' => NO_MD_TAG,
|
||||||
|
'taglist' => array(NO_MD_TAG),
|
||||||
))
|
))
|
||||||
);
|
);
|
||||||
|
|
||||||
|
@ -140,7 +141,8 @@ function testNoMarkdownTag()
|
||||||
// nth link
|
// nth link
|
||||||
0 => array(
|
0 => array(
|
||||||
'formatedDescription' => $str,
|
'formatedDescription' => $str,
|
||||||
'tags' => NO_MD_TAG
|
'tags' => NO_MD_TAG,
|
||||||
|
'taglist' => array(),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
|
|
Loading…
Reference in a new issue