From 3a81d34a06eecfb11e4acea12128b3b4836de3bb Mon Sep 17 00:00:00 2001 From: kunfei Date: Fri, 13 Mar 2020 19:57:36 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20=E4=BC=98=E5=8C=96=E4=BB=A3=E7=A0=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../main/java/io/legado/app/utils/JsoupExtensions.kt | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) diff --git a/app/src/main/java/io/legado/app/utils/JsoupExtensions.kt b/app/src/main/java/io/legado/app/utils/JsoupExtensions.kt index b40cdf391..3f347e4a1 100644 --- a/app/src/main/java/io/legado/app/utils/JsoupExtensions.kt +++ b/app/src/main/java/io/legado/app/utils/JsoupExtensions.kt @@ -24,7 +24,6 @@ fun Element.textArray(): Array { } override fun tail(node: Node, depth: Int) { - // make sure there is a space between block tags and immediately following text nodes
One
Two should be "One Two". if (node is Element) { if (node.isBlock && node.nextSibling() is TextNode && !lastCharIsWhitespace( accum @@ -37,12 +36,11 @@ fun Element.textArray(): Array { return text.splitNotBlank("\n") } -private fun appendNormalisedText( - accum: StringBuilder, - textNode: TextNode -) { +private fun appendNormalisedText(accum: StringBuilder, textNode: TextNode) { val text = textNode.wholeText - if (preserveWhitespace(textNode.parentNode()) || textNode is CDataNode) accum.append(text) else StringUtil.appendNormalisedWhitespace( + if (preserveWhitespace(textNode.parentNode()) || textNode is CDataNode) + accum.append(text) + else StringUtil.appendNormalisedWhitespace( accum, text, lastCharIsWhitespace(accum) @@ -50,7 +48,6 @@ private fun appendNormalisedText( } private fun preserveWhitespace(node: Node?): Boolean { - // looks only at this element and five levels up, to prevent recursion & needless stack searches if (node is Element) { var el = node as Element? var i = 0