diff options
Diffstat (limited to 'plugins/markdown/markdown.php')
-rw-r--r-- | plugins/markdown/markdown.php | 27 |
1 files changed, 19 insertions, 8 deletions
diff --git a/plugins/markdown/markdown.php b/plugins/markdown/markdown.php index a764b6fa..0cf6e6e2 100644 --- a/plugins/markdown/markdown.php +++ b/plugins/markdown/markdown.php | |||
@@ -22,7 +22,7 @@ function hook_markdown_render_linklist($data) | |||
22 | { | 22 | { |
23 | foreach ($data['links'] as &$value) { | 23 | foreach ($data['links'] as &$value) { |
24 | if (!empty($value['tags']) && noMarkdownTag($value['tags'])) { | 24 | if (!empty($value['tags']) && noMarkdownTag($value['tags'])) { |
25 | $value['taglist'] = stripNoMarkdownTag($value['taglist']); | 25 | $value = stripNoMarkdownTag($value); |
26 | continue; | 26 | continue; |
27 | } | 27 | } |
28 | $value['description'] = process_markdown($value['description']); | 28 | $value['description'] = process_markdown($value['description']); |
@@ -41,7 +41,7 @@ function hook_markdown_render_feed($data) | |||
41 | { | 41 | { |
42 | foreach ($data['links'] as &$value) { | 42 | foreach ($data['links'] as &$value) { |
43 | if (!empty($value['tags']) && noMarkdownTag($value['tags'])) { | 43 | if (!empty($value['tags']) && noMarkdownTag($value['tags'])) { |
44 | $value['tags'] = stripNoMarkdownTag($value['tags']); | 44 | $value = stripNoMarkdownTag($value); |
45 | continue; | 45 | continue; |
46 | } | 46 | } |
47 | $value['description'] = process_markdown($value['description']); | 47 | $value['description'] = process_markdown($value['description']); |
@@ -63,6 +63,7 @@ function hook_markdown_render_daily($data) | |||
63 | foreach ($data['cols'] as &$value) { | 63 | foreach ($data['cols'] as &$value) { |
64 | foreach ($value as &$value2) { | 64 | foreach ($value as &$value2) { |
65 | if (!empty($value2['tags']) && noMarkdownTag($value2['tags'])) { | 65 | if (!empty($value2['tags']) && noMarkdownTag($value2['tags'])) { |
66 | $value2 = stripNoMarkdownTag($value2); | ||
66 | continue; | 67 | continue; |
67 | } | 68 | } |
68 | $value2['formatedDescription'] = process_markdown($value2['formatedDescription']); | 69 | $value2['formatedDescription'] = process_markdown($value2['formatedDescription']); |
@@ -81,20 +82,30 @@ function hook_markdown_render_daily($data) | |||
81 | */ | 82 | */ |
82 | function noMarkdownTag($tags) | 83 | function noMarkdownTag($tags) |
83 | { | 84 | { |
84 | return strpos($tags, NO_MD_TAG) !== false; | 85 | return preg_match('/(^|\s)'. NO_MD_TAG .'(\s|$)/', $tags); |
85 | } | 86 | } |
86 | 87 | ||
87 | /** | 88 | /** |
88 | * Remove the no-markdown meta tag so it won't be displayed. | 89 | * Remove the no-markdown meta tag so it won't be displayed. |
89 | * | 90 | * |
90 | * @param string $tags Tag list. | 91 | * @param array $link Link data. |
91 | * | 92 | * |
92 | * @return string tag list without no markdown tag. | 93 | * @return array Updated link without no markdown tag. |
93 | */ | 94 | */ |
94 | function stripNoMarkdownTag($tags) | 95 | function stripNoMarkdownTag($link) |
95 | { | 96 | { |
96 | unset($tags[array_search(NO_MD_TAG, $tags)]); | 97 | if (! empty($link['taglist'])) { |
97 | return array_values($tags); | 98 | $offset = array_search(NO_MD_TAG, $link['taglist']); |
99 | if ($offset !== false) { | ||
100 | unset($link['taglist'][$offset]); | ||
101 | } | ||
102 | } | ||
103 | |||
104 | if (!empty($link['tags'])) { | ||
105 | str_replace(NO_MD_TAG, '', $link['tags']); | ||
106 | } | ||
107 | |||
108 | return $link; | ||
98 | } | 109 | } |
99 | 110 | ||
100 | /** | 111 | /** |