Skip to content

Commit 9a1015d

Browse files
committed
Specify type lambda parameter in Elements#filter method
It was `Element` when jsoup was `1.11.3`
1 parent 93d032c commit 9a1015d

File tree

2 files changed

+10
-6
lines changed

2 files changed

+10
-6
lines changed

aztec/src/main/kotlin/org/wordpress/aztec/source/Format.kt

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,8 @@ import android.text.SpannableStringBuilder
55
import android.text.TextUtils
66
import org.jsoup.Jsoup
77
import org.jsoup.nodes.Document
8+
import org.jsoup.nodes.Element
9+
import org.jsoup.select.Elements
810
import org.wordpress.aztec.spans.AztecQuoteSpan
911
import org.wordpress.aztec.spans.AztecVisualLinebreak
1012
import org.wordpress.aztec.spans.EndOfParagraphMarker
@@ -30,9 +32,10 @@ object Format {
3032
CleaningUtils.cleanNestedBoldTags(doc)
3133
if (isCalypsoFormat) {
3234
// remove empty span tags
33-
doc.select("*")
34-
.filter { !it.hasText() && it.tagName() == "span" && it.childNodes().size == 0 }
35-
.forEach { it.remove() }
35+
val select: Elements = doc.select("*")
36+
select.filter { element: Element ->
37+
!element.hasText() && element.tagName() == "span" && element.childNodes().size == 0
38+
}.forEach { it.remove() }
3639

3740
html = replaceAll(doc.body().html(), iframePlaceholder, "iframe")
3841

aztec/src/main/kotlin/org/wordpress/aztec/util/CleaningUtils.kt

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ package org.wordpress.aztec.util
22

33
import org.jsoup.Jsoup
44
import org.jsoup.nodes.Document
5+
import org.jsoup.nodes.Element
56
import org.jsoup.parser.Parser
67

78
object CleaningUtils {
@@ -10,12 +11,12 @@ object CleaningUtils {
1011
fun cleanNestedBoldTags(doc: Document) {
1112
// clean all nested <b> tags that don't contain anything
1213
doc.select("b > b")
13-
.filter { !it.hasText() }
14+
.filter { element: Element -> !element.hasText() }
1415
.forEach { it.remove() }
1516

1617
// unwrap text in between nested <b> tags that have some text in them
1718
doc.select("b > b")
18-
.filter { it.hasText() }
19+
.filter { element: Element -> element.hasText() }
1920
.forEach { it.unwrap() }
2021
}
2122

@@ -25,4 +26,4 @@ object CleaningUtils {
2526
cleanNestedBoldTags(doc)
2627
return doc.html()
2728
}
28-
}
29+
}

0 commit comments

Comments
 (0)