Skip to content

Commit

Permalink
update jsoup (#2706)
Browse files Browse the repository at this point in the history
* update jsoup

* update to match new Jsoup naming
  • Loading branch information
paul-butcher authored Sep 16, 2024
1 parent 3efb871 commit bb19f5d
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 7 deletions.
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
package weco.pipeline.transformer.calm

import org.jsoup.Jsoup
import org.jsoup.safety.Whitelist
import org.jsoup.safety.Safelist
import org.jsoup.nodes.Document.OutputSettings
import org.jsoup.parser.Parser

Expand All @@ -13,19 +13,19 @@ object NormaliseText {
* a, b, blockquote, br, cite, code, dd, dl, dt, em, i, li, ol, p, pre, q,
* small, span, strike, strong, sub, sup, u, ul
*/
val basic = Whitelist.basic()
val basic = Safelist.basic()

/* The none whitelist prevents all HTML tags
*/
val none = Whitelist.none()
val none = Safelist.none()

/* The onlyItalics whitelist prevents all HTML tags apart from i
*/
val onlyItalics = Whitelist.none().addTags("i")
val onlyItalics = Safelist.none().addTags("i")

private val settings = new OutputSettings().prettyPrint(false)

def apply(str: String, whitelist: Whitelist = basic): String =
def apply(str: String, whitelist: Safelist = basic): String =
Jsoup
.clean(str, "", whitelist, settings)
.linesIterator
Expand Down
5 changes: 3 additions & 2 deletions project/Dependencies.scala
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,8 @@ import sbt._
import scala.language.reflectiveCalls
object WellcomeDependencies {

val defaultVersion = "32.42.0" // This is automatically bumped by the scala-libs release process, do not edit this line manually
val defaultVersion =
"32.42.0" // This is automatically bumped by the scala-libs release process, do not edit this line manually

lazy val versions = new {
val typesafe = defaultVersion
Expand Down Expand Up @@ -104,7 +105,7 @@ object ExternalDependencies {
val scalaGraph = "1.12.5"
val enumeratum = "1.6.1"
val enumeratumScalacheck = "1.6.1"
val jsoup = "1.13.1"
val jsoup = "1.18.1"
val logback = "1.1.8"
val scalatestPlus = "3.2.12.0"
val scalatestPlusMockitoArtifactId = "mockito-4-5"
Expand Down

0 comments on commit bb19f5d

Please sign in to comment.