File tree Expand file tree Collapse file tree 3 files changed +33
-3
lines changed Expand file tree Collapse file tree 3 files changed +33
-3
lines changed Original file line number Diff line number Diff line change @@ -74,9 +74,8 @@ object EntityLink {
74
74
def unapply (el : EntityLink ): Option [(Inline , LinkTo )] = Some ((el.title, el.link))
75
75
}
76
76
final case class HtmlTag (data : String ) extends Inline {
77
- private val Pattern = """ (?ms)\A<(/?)(.*?)[\s>].*\z""" .r
78
77
private val (isEnd, tagName) = data match {
79
- case Pattern (s1, s2) =>
78
+ case HtmlTag . Pattern (s1, s2) =>
80
79
(! s1.isEmpty, Some (s2.toLowerCase))
81
80
case _ =>
82
81
(false , None )
@@ -86,8 +85,13 @@ final case class HtmlTag(data: String) extends Inline {
86
85
isEnd && tagName == open.tagName
87
86
}
88
87
88
+ def close = tagName collect {
89
+ case name if ! HtmlTag .TagsNotToClose (name) && ! data.endsWith(s " </ $name> " ) => HtmlTag (s " </ $name> " )
90
+ }
91
+ }
92
+ object HtmlTag {
93
+ private val Pattern = """ (?ms)\A<(/?)(.*?)[\s>].*\z""" .r
89
94
private val TagsNotToClose = Set (" br" , " img" )
90
- def close = tagName collect { case name if ! TagsNotToClose (name) => HtmlTag (s " </ $name> " ) }
91
95
}
92
96
93
97
/** The summary of a comment, usually its first sentence. There must be exactly one summary per body. */
Original file line number Diff line number Diff line change
1
+ Chain(List(Chain(List(Text(Demonstrates a scala issue in which the closing link tag is duplicated), Text(
2
+ ), HtmlTag(<a href="https://link">title</a>), Text(
3
+ ), Text()))))
4
+ Done.
Original file line number Diff line number Diff line change
1
+ import scala .tools .nsc .doc .model ._
2
+ import scala .tools .partest .ScaladocModelTest
3
+
4
+ object Test extends ScaladocModelTest {
5
+ override def code = """
6
+ object Foo {
7
+ /**
8
+ * Demonstrates a scala issue in which the closing link tag is duplicated
9
+ * <a href="https://link">title</a>
10
+ */
11
+ def bar = ???
12
+ }
13
+ """
14
+
15
+ def scaladocSettings = " "
16
+
17
+ def testModel (root : Package ) = {
18
+ import access ._
19
+ val thing = root._object(" Foo" )._method(" bar" )
20
+ println(thing.comment.get.short)
21
+ }
22
+ }
You can’t perform that action at this time.
0 commit comments