File tree Expand file tree Collapse file tree 2 files changed +10
-6
lines changed
aztec/src/main/kotlin/org/wordpress/aztec Expand file tree Collapse file tree 2 files changed +10
-6
lines changed Original file line number Diff line number Diff line change @@ -5,6 +5,8 @@ import android.text.SpannableStringBuilder
55import android.text.TextUtils
66import org.jsoup.Jsoup
77import org.jsoup.nodes.Document
8+ import org.jsoup.nodes.Element
9+ import org.jsoup.select.Elements
810import org.wordpress.aztec.spans.AztecQuoteSpan
911import org.wordpress.aztec.spans.AztecVisualLinebreak
1012import 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
Original file line number Diff line number Diff line change @@ -2,6 +2,7 @@ package org.wordpress.aztec.util
22
33import org.jsoup.Jsoup
44import org.jsoup.nodes.Document
5+ import org.jsoup.nodes.Element
56import org.jsoup.parser.Parser
67
78object 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+ }
You can’t perform that action at this time.
0 commit comments