summaryrefslogtreecommitdiff
path: root/app/src/main/java/org/terst/feedreader/ui/ReaderWebView.kt
diff options
context:
space:
mode:
Diffstat (limited to 'app/src/main/java/org/terst/feedreader/ui/ReaderWebView.kt')
-rw-r--r--app/src/main/java/org/terst/feedreader/ui/ReaderWebView.kt9
1 files changed, 7 insertions, 2 deletions
diff --git a/app/src/main/java/org/terst/feedreader/ui/ReaderWebView.kt b/app/src/main/java/org/terst/feedreader/ui/ReaderWebView.kt
index 68562e8..fd0c6af 100644
--- a/app/src/main/java/org/terst/feedreader/ui/ReaderWebView.kt
+++ b/app/src/main/java/org/terst/feedreader/ui/ReaderWebView.kt
@@ -508,12 +508,17 @@ private fun escapeHtml(text: String): String = text
// on whatever heading Readability happened to keep in bodyContent (increasingly nothing --
// see ReaderExtractor's <header> stripping) or on the top app bar's title, which truncates
// to one line and was the only place a long title showed up before this.
+// Six arguments, but five of them are defaulted document-assembly inputs that no caller has to
+// spell out, and the only thing they have in common is "something the page needs" -- bundling
+// them into a type purely to satisfy the count would make the call sites longer, not shorter.
+@Suppress("LongParameterList")
fun wrapReaderHtml(
bodyContent: String,
title: String? = null,
publishedAt: Long? = null,
imageUrl: String? = null,
- fontSizePx: Int = DEFAULT_READER_FONT_SIZE_PX
+ fontSizePx: Int = DEFAULT_READER_FONT_SIZE_PX,
+ baseUrl: String? = null
): String {
val processedBody = replaceGenericIframes(replaceYouTubeIframes(bodyContent))
// NB: linkifyImagesForZoom runs at the very end (below, over hero + body together), after
@@ -576,6 +581,6 @@ fun wrapReaderHtml(
</style></head>
<body>${if (!title.isNullOrBlank()) "<h1 class=\"article-title\">${escapeHtml(title)}</h1>" else ""}${
if (publishedAt != null) "<p class=\"article-date\">${escapeHtml(absoluteDateText(publishedAt))}</p>" else ""
- }${linkifyImagesForZoom(heroHtml + processedBody)}</body></html>
+ }${linkifyImagesForZoom(heroHtml + processedBody, baseUrl)}</body></html>
""".trimIndent()
}