aboutsummaryrefslogtreecommitdiffhomepage
path: root/application/formatter
diff options
context:
space:
mode:
authorArthurHoaro <arthur@hoa.ro>2020-11-08 14:07:33 +0100
committerGitHub <noreply@github.com>2020-11-08 14:07:33 +0100
commitd9d71b10c3bc70a0881d630b37dc4e918c9e812f (patch)
treed8f772a9106fbd5072ebee1b9fa536babe90f7b1 /application/formatter
parentc51d65238be43d61b7e6a6f9940948afea0c13fa (diff)
parent8a1ce1da15fdbae99b24700b06f2008c7a657603 (diff)
downloadShaarli-d9d71b10c3bc70a0881d630b37dc4e918c9e812f.tar.gz
Shaarli-d9d71b10c3bc70a0881d630b37dc4e918c9e812f.tar.zst
Shaarli-d9d71b10c3bc70a0881d630b37dc4e918c9e812f.zip
Merge pull request #1621 from ArthurHoaro/feature/tag-separators
Diffstat (limited to 'application/formatter')
-rw-r--r--application/formatter/BookmarkDefaultFormatter.php7
-rw-r--r--application/formatter/BookmarkFormatter.php3
2 files changed, 6 insertions, 4 deletions
diff --git a/application/formatter/BookmarkDefaultFormatter.php b/application/formatter/BookmarkDefaultFormatter.php
index 149a3eb9..51bea0f1 100644
--- a/application/formatter/BookmarkDefaultFormatter.php
+++ b/application/formatter/BookmarkDefaultFormatter.php
@@ -68,15 +68,16 @@ class BookmarkDefaultFormatter extends BookmarkFormatter
68 */ 68 */
69 protected function formatTagListHtml($bookmark) 69 protected function formatTagListHtml($bookmark)
70 { 70 {
71 $tagsSeparator = $this->conf->get('general.tags_separator', ' ');
71 if (empty($bookmark->getAdditionalContentEntry('search_highlight')['tags'])) { 72 if (empty($bookmark->getAdditionalContentEntry('search_highlight')['tags'])) {
72 return $this->formatTagList($bookmark); 73 return $this->formatTagList($bookmark);
73 } 74 }
74 75
75 $tags = $this->tokenizeSearchHighlightField( 76 $tags = $this->tokenizeSearchHighlightField(
76 $bookmark->getTagsString(), 77 $bookmark->getTagsString($tagsSeparator),
77 $bookmark->getAdditionalContentEntry('search_highlight')['tags'] 78 $bookmark->getAdditionalContentEntry('search_highlight')['tags']
78 ); 79 );
79 $tags = $this->filterTagList(explode(' ', $tags)); 80 $tags = $this->filterTagList(tags_str2array($tags, $tagsSeparator));
80 $tags = escape($tags); 81 $tags = escape($tags);
81 $tags = $this->replaceTokensArray($tags); 82 $tags = $this->replaceTokensArray($tags);
82 83
@@ -88,7 +89,7 @@ class BookmarkDefaultFormatter extends BookmarkFormatter
88 */ 89 */
89 protected function formatTagString($bookmark) 90 protected function formatTagString($bookmark)
90 { 91 {
91 return implode(' ', $this->formatTagList($bookmark)); 92 return implode($this->conf->get('general.tags_separator'), $this->formatTagList($bookmark));
92 } 93 }
93 94
94 /** 95 /**
diff --git a/application/formatter/BookmarkFormatter.php b/application/formatter/BookmarkFormatter.php
index e1b7f705..124ce78b 100644
--- a/application/formatter/BookmarkFormatter.php
+++ b/application/formatter/BookmarkFormatter.php
@@ -267,7 +267,7 @@ abstract class BookmarkFormatter
267 */ 267 */
268 protected function formatTagString($bookmark) 268 protected function formatTagString($bookmark)
269 { 269 {
270 return implode(' ', $this->formatTagList($bookmark)); 270 return implode($this->conf->get('general.tags_separator', ' '), $this->formatTagList($bookmark));
271 } 271 }
272 272
273 /** 273 /**
@@ -351,6 +351,7 @@ abstract class BookmarkFormatter
351 351
352 /** 352 /**
353 * Format tag list, e.g. remove private tags if the user is not logged in. 353 * Format tag list, e.g. remove private tags if the user is not logged in.
354 * TODO: this method is called multiple time to format tags, the result should be cached.
354 * 355 *
355 * @param array $tags 356 * @param array $tags
356 * 357 *