summaryrefslogtreecommitdiff
path: root/app/src/main/java/org/terst/feedreader/ui
diff options
context:
space:
mode:
Diffstat (limited to 'app/src/main/java/org/terst/feedreader/ui')
-rw-r--r--app/src/main/java/org/terst/feedreader/ui/ReaderScreen.kt5
-rw-r--r--app/src/main/java/org/terst/feedreader/ui/ReaderWebView.kt7
2 files changed, 10 insertions, 2 deletions
diff --git a/app/src/main/java/org/terst/feedreader/ui/ReaderScreen.kt b/app/src/main/java/org/terst/feedreader/ui/ReaderScreen.kt
index f08088b..9952dc5 100644
--- a/app/src/main/java/org/terst/feedreader/ui/ReaderScreen.kt
+++ b/app/src/main/java/org/terst/feedreader/ui/ReaderScreen.kt
@@ -221,7 +221,8 @@ private fun ReaderContent(
feedContent = loaded.feedContentHtml
// A previously-cached extraction can be the site's cookie-consent notice rather
- // than the article (reported live on a New Republic feature). That is dropped
+ // than the article (reported live on a New Republic feature), or an older
+ // extraction holding raw TeX source where its maths should be. Either is dropped
// from the cache on read, which leaves nothing to show -- so re-extract, or the
// repair would just turn a wrong article into a blank one.
val cachedExtraction = loadCachedExtraction(loaded.extractedContent) {
@@ -239,7 +240,7 @@ private fun ReaderContent(
if (loadedFeed?.readerModeEnabled == true) {
isReaderMode = true
}
- if (loadedFeed?.readerModeEnabled == true || cachedExtraction.discardedConsentNotice) {
+ if (loadedFeed?.readerModeEnabled == true || cachedExtraction.discarded) {
if (readerContent == null) {
isExtracting = true
val result = ReaderExtractor.extractResult(context, loaded.link)
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 6d96e79..f1400d3 100644
--- a/app/src/main/java/org/terst/feedreader/ui/ReaderWebView.kt
+++ b/app/src/main/java/org/terst/feedreader/ui/ReaderWebView.kt
@@ -514,6 +514,13 @@ fun wrapReaderHtml(
explicit width/height was deliberately sized by the page itself, so leave
those alone -- just cap the ones that would otherwise size themselves. */
svg:not([width]):not([height]) { max-width: 32px; max-height: 32px; }
+ /* Maths arrives as MathML, which the WebView renders itself -- no script, no webfont,
+ no stylesheet of KaTeX's (see ReaderExtractor). It only needs containing: an aligned
+ multi-line derivation is routinely wider than a phone screen, and <math> obeys
+ neither the img nor the svg clamp above, so without this one wide equation drags the
+ whole article into horizontal scrolling. */
+ math { max-width: 100%; }
+ math[display="block"] { display: block; overflow-x: auto; overflow-y: hidden; margin: 1em 0; }
</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 ""