aboutsummaryrefslogtreecommitdiffhomepage
path: root/tests/formatter/BookmarkDefaultFormatterTest.php
diff options
context:
space:
mode:
authorArthurHoaro <arthur@hoa.ro>2021-01-19 17:49:19 +0100
committerArthurHoaro <arthur@hoa.ro>2021-01-19 17:49:19 +0100
commit9ef8555ad298668bcb8537ccdd2ab6560f44177f (patch)
treeba23e5d76d3d1f9eb95231ea6504d283f86d7722 /tests/formatter/BookmarkDefaultFormatterTest.php
parentffa39719a17982e6a6cac9bc3f758aa12fa69973 (diff)
downloadShaarli-9ef8555ad298668bcb8537ccdd2ab6560f44177f.tar.gz
Shaarli-9ef8555ad298668bcb8537ccdd2ab6560f44177f.tar.zst
Shaarli-9ef8555ad298668bcb8537ccdd2ab6560f44177f.zip
Support search highlights when matching URL content
DefaultFormatter: - format 'a' tag content and not href attribute - format hashtags properly Markdown(Extra)Formatter: - Extend Parsedown to format highlight properly: https://github.com/erusev/parsedown/wiki/Tutorial:-Create-Extensions Fixes #1681
Diffstat (limited to 'tests/formatter/BookmarkDefaultFormatterTest.php')
-rw-r--r--tests/formatter/BookmarkDefaultFormatterTest.php11
1 files changed, 9 insertions, 2 deletions
diff --git a/tests/formatter/BookmarkDefaultFormatterTest.php b/tests/formatter/BookmarkDefaultFormatterTest.php
index 4fcc5dd1..983960b6 100644
--- a/tests/formatter/BookmarkDefaultFormatterTest.php
+++ b/tests/formatter/BookmarkDefaultFormatterTest.php
@@ -211,13 +211,17 @@ class BookmarkDefaultFormatterTest extends TestCase
211 $this->formatter = new BookmarkDefaultFormatter($this->conf, false); 211 $this->formatter = new BookmarkDefaultFormatter($this->conf, false);
212 212
213 $bookmark = new Bookmark(); 213 $bookmark = new Bookmark();
214 $bookmark->setDescription('This guide extends and expands on PSR-1, the basic coding standard.'); 214 $bookmark->setDescription(
215 'This guide extends and expands on PSR-1, the basic coding standard.' . PHP_EOL .
216 'https://www.php-fig.org/psr/psr-1/'
217 );
215 $bookmark->addAdditionalContentEntry( 218 $bookmark->addAdditionalContentEntry(
216 'search_highlight', 219 'search_highlight',
217 ['description' => [ 220 ['description' => [
218 ['start' => 0, 'end' => 10], // "This guide" 221 ['start' => 0, 'end' => 10], // "This guide"
219 ['start' => 45, 'end' => 50], // basic 222 ['start' => 45, 'end' => 50], // basic
220 ['start' => 58, 'end' => 67], // standard. 223 ['start' => 58, 'end' => 67], // standard.
224 ['start' => 84, 'end' => 87], // fig
221 ]] 225 ]]
222 ); 226 );
223 227
@@ -226,7 +230,10 @@ class BookmarkDefaultFormatterTest extends TestCase
226 $this->assertSame( 230 $this->assertSame(
227 '<span class="search-highlight">This guide</span> extends and expands on PSR-1, the ' . 231 '<span class="search-highlight">This guide</span> extends and expands on PSR-1, the ' .
228 '<span class="search-highlight">basic</span> coding ' . 232 '<span class="search-highlight">basic</span> coding ' .
229 '<span class="search-highlight">standard.</span>', 233 '<span class="search-highlight">standard.</span><br />' . PHP_EOL .
234 '<a href="https://www.php-fig.org/psr/psr-1/">' .
235 'https://www.php-<span class="search-highlight">fig</span>.org/psr/psr-1/' .
236 '</a>',
230 $link['description'] 237 $link['description']
231 ); 238 );
232 } 239 }