Skip to content

Commit d1d700e

Browse files
authored
Merge pull request #5754 from Philippus/issue/html-tag-in-hover
fix regression in scaladoc
2 parents f771395 + cf64718 commit d1d700e

File tree

3 files changed

+25
-30
lines changed

3 files changed

+25
-30
lines changed

src/scaladoc/scala/tools/nsc/doc/html/Page.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -121,6 +121,6 @@ object Page {
121121
case Text(text) => text
122122
case Summary(in) => inlineToStr(in)
123123
case HtmlTag(tag) => "<[^>]*>".r.replaceAllIn(tag, "")
124-
case EntityLink(Text(text), _) => text
124+
case EntityLink(in, _) => inlineToStr(in)
125125
}
126126
}
Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1 @@
1-
Chain(List(Chain(List(Text(This comment contains ), Superscript(Text(superscript))))))
2-
Chain(List(Chain(List(Text(This comment contains ), Subscript(Text(subscript))))))
3-
Chain(List(Chain(List(Text(This comment contains a link ), Link(https://scala.epfl.ch/,Text(https://scala.epfl.ch/))))))
4-
Chain(List(Chain(List(Text(This comment contains an ), HtmlTag(<strong>html tag</strong>)))))
5-
Chain(List(Chain(List(Text(This comment contains a), HtmlTag(<br>), Text( single html tag)))))
6-
Chain(List(Chain(List(Text(This comment contains nested ), HtmlTag(<strong>html<br> tags</strong>)))))
7-
This comment contains superscript
8-
This comment contains subscript
9-
This comment contains a link https://scala.epfl.ch/
10-
This comment contains an html tag
11-
This comment contains a single html tag
12-
This comment contains nested html tags
131
Done.

test/scaladoc/run/inlineToStr-strips-unwanted-text.scala

Lines changed: 24 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,9 @@ object Test extends ScaladocModelTest {
2121
2222
/** This comment contains nested <strong>html<br> tags</strong> */
2323
def quuz = ???
24+
25+
/** This comment contains a [[corge ,,link with a subscript title,,]] */
26+
def corge = ???
2427
}
2528
"""
2629
def scaladocSettings = ""
@@ -30,22 +33,26 @@ object Test extends ScaladocModelTest {
3033
import access._
3134

3235
val foo = root._class("Foo")
33-
val bar = foo._method("bar")
34-
val baz = foo._method("baz")
35-
val qux = foo._method("qux")
36-
val quux = foo._method("quux")
37-
val quuz = foo._method("quuz")
38-
println(foo.comment.get.short)
39-
println(bar.comment.get.short)
40-
println(baz.comment.get.short)
41-
println(qux.comment.get.short)
42-
println(quux.comment.get.short)
43-
println(quuz.comment.get.short)
44-
println(Page.inlineToStr(foo.comment.get.short))
45-
println(Page.inlineToStr(bar.comment.get.short))
46-
println(Page.inlineToStr(baz.comment.get.short))
47-
println(Page.inlineToStr(qux.comment.get.short))
48-
println(Page.inlineToStr(quux.comment.get.short))
49-
println(Page.inlineToStr(quuz.comment.get.short))
36+
37+
val fooStr = Page.inlineToStr(foo.comment.get.short)
38+
assert(fooStr == "This comment contains superscript", fooStr)
39+
40+
val barStr = Page.inlineToStr(foo._method("bar").comment.get.short)
41+
assert(barStr == "This comment contains subscript", barStr)
42+
43+
val bazStr = Page.inlineToStr(foo._method("baz").comment.get.short)
44+
assert(bazStr == "This comment contains a link https://scala.epfl.ch/", bazStr)
45+
46+
val quxStr = Page.inlineToStr(foo._method("qux").comment.get.short)
47+
assert(quxStr == "This comment contains an html tag", quxStr)
48+
49+
val quuxStr = Page.inlineToStr(foo._method("quux").comment.get.short)
50+
assert(quuxStr == "This comment contains a single html tag", quuxStr)
51+
52+
val quuzStr = Page.inlineToStr(foo._method("quuz").comment.get.short)
53+
assert(quuzStr == "This comment contains nested html tags", quuzStr)
54+
55+
val corgeStr = Page.inlineToStr(foo._method("corge").comment.get.short)
56+
assert(corgeStr == "This comment contains a link with a subscript title", corgeStr)
5057
}
5158
}

0 commit comments

Comments
 (0)