Skip to content

Commit

Permalink
Merge pull request #1089 from wordpress-mobile/bump_jsoup_1_15_3
Browse files Browse the repository at this point in the history
Bump jsoup to 1.15.3
  • Loading branch information
wzieba committed Aug 8, 2024
2 parents 2d66175 + 5bee1c9 commit bdd9858
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 7 deletions.
7 changes: 4 additions & 3 deletions aztec/src/main/kotlin/org/wordpress/aztec/source/Format.kt
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import android.text.SpannableStringBuilder
import android.text.TextUtils
import org.jsoup.Jsoup
import org.jsoup.nodes.Document
import org.jsoup.nodes.Element
import org.wordpress.aztec.spans.AztecQuoteSpan
import org.wordpress.aztec.spans.AztecVisualLinebreak
import org.wordpress.aztec.spans.EndOfParagraphMarker
Expand All @@ -30,9 +31,9 @@ object Format {
CleaningUtils.cleanNestedBoldTags(doc)
if (isCalypsoFormat) {
// remove empty span tags
doc.select("*")
.filter { !it.hasText() && it.tagName() == "span" && it.childNodes().size == 0 }
.forEach { it.remove() }
doc.select("*").filter { element: Element ->
!element.hasText() && element.tagName() == "span" && element.childNodes().size == 0
}.forEach { it.remove() }

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

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ package org.wordpress.aztec.util

import org.jsoup.Jsoup
import org.jsoup.nodes.Document
import org.jsoup.nodes.Element
import org.jsoup.parser.Parser

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

// unwrap text in between nested <b> tags that have some text in them
doc.select("b > b")
.filter { it.hasText() }
.filter { element: Element -> element.hasText() }
.forEach { it.unwrap() }
}

Expand All @@ -25,4 +26,4 @@ object CleaningUtils {
cleanNestedBoldTags(doc)
return doc.html()
}
}
}
2 changes: 1 addition & 1 deletion build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ ext {
picassoVersion = '2.5.2'
robolectricVersion = '4.11'
jUnitVersion = '4.12'
jSoupVersion = '1.11.3'
jSoupVersion = '1.15.3'
wordpressUtilsVersion = '3.5.0'
espressoVersion = '3.0.1'

Expand Down

0 comments on commit bdd9858

Please sign in to comment.