Skip to content

Commit

Permalink
Add textAttributes extractor
Browse files Browse the repository at this point in the history
  • Loading branch information
Atry committed Aug 9, 2019
1 parent c14f9b5 commit fc777f4
Showing 1 changed file with 9 additions and 0 deletions.
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 fc777f4

Please sign in to comment.