aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorGravatar Frédéric Guillot <fred@miniflux.net>2019-11-30 22:46:12 -0800
committerGravatar Frédéric Guillot <fred@miniflux.net>2019-11-30 22:56:06 -0800
commit120d6ec7d837eac2825de3edb870d63bd0493853 (patch)
tree426374506fbd6b5c274821e7e229818d95ecc252
parent6291b598495732d0470bbfb2f26c7025d64e7880 (diff)
Do no rewrite Youtube description twice in "add_youtube_video" rule
This is already done before in <media:description>.
-rw-r--r--reader/rewrite/rewrite_functions.go2
-rw-r--r--reader/rewrite/rewriter_test.go4
2 files changed, 3 insertions, 3 deletions
diff --git a/reader/rewrite/rewrite_functions.go b/reader/rewrite/rewrite_functions.go
index 8988cc5..8f83aa9 100644
--- a/reader/rewrite/rewrite_functions.go
+++ b/reader/rewrite/rewrite_functions.go
@@ -143,7 +143,7 @@ func addYoutubeVideo(entryURL, entryContent string) string {
if len(matches) == 2 {
video := `<iframe width="650" height="350" frameborder="0" src="https://www.youtube-nocookie.com/embed/` + matches[1] + `" allowfullscreen></iframe>`
- return video + "<p>" + replaceLineFeeds(replaceTextLinks(entryContent)) + "</p>"
+ return video + `<br>` + entryContent
}
return entryContent
}
diff --git a/reader/rewrite/rewriter_test.go b/reader/rewrite/rewriter_test.go
index 27cf425..8c0db6c 100644
--- a/reader/rewrite/rewriter_test.go
+++ b/reader/rewrite/rewriter_test.go
@@ -36,8 +36,8 @@ func TestRewriteWithNoMatchingRule(t *testing.T) {
}
func TestRewriteWithYoutubeLink(t *testing.T) {
- output := Rewriter("https://www.youtube.com/watch?v=1234", "Video Description\nhttp://example.org/path", ``)
- expected := `<iframe width="650" height="350" frameborder="0" src="https://www.youtube-nocookie.com/embed/1234" allowfullscreen></iframe><p>Video Description<br><a href="http://example.org/path">http://example.org/path</a></p>`
+ output := Rewriter("https://www.youtube.com/watch?v=1234", "Video Description", ``)
+ expected := `<iframe width="650" height="350" frameborder="0" src="https://www.youtube-nocookie.com/embed/1234" allowfullscreen></iframe><br>Video Description`
if expected != output {
t.Errorf(`Not expected output: got "%s" instead of "%s"`, output, expected)