Skip to content

Commit

Permalink
Merge pull request #201 from ThoughtWorksInc/Atry-patch-1
Browse files Browse the repository at this point in the history
Add textAttributes extractor
  • Loading branch information
Atry committed Aug 9, 2019
2 parents c14f9b5 + fc777f4 commit b752e62
Showing 1 changed file with 9 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -132,8 +132,17 @@ trait XmlExtractor {
case EmptyAttribute() => ""
}

@deprecated("Use [[TextAttributes]] instead", "11.9.0")
protected final val TextAttribute = textAttribute.extract

private def textAttributes: PartialFunction[Tree, Seq[Tree]] = {
case text @ (Text(_) | EntityRef(_)) => Seq(text)
case EmptyAttribute() => Nil
case NodeBuffer(texts @ ((Text(_) | EntityRef(_)) +: _)) => texts
}

protected final val TextAttributes = textAttributes.extract

private def comment: PartialFunction[Tree, String] = {
case q"""new _root_.scala.xml.Comment(${Literal(Constant(commentText: String))})""" =>
commentText
Expand Down

0 comments on commit b752e62

Please sign in to comment.