Skip to content

Commit e29c383

Browse files
committed
Scala3doc: improve Wiki syntax for the stdlib
1 parent 01c9a8d commit e29c383

File tree

2 files changed

+22
-14
lines changed

2 files changed

+22
-14
lines changed

scala3doc/src/dotty/dokka/tasty/comments/wiki/Converter.scala

+9-6
Original file line numberDiff line numberDiff line change
@@ -115,18 +115,21 @@ class Converter(val repr: Repr) extends BaseConverter {
115115

116116
case Superscript(i) =>
117117
def name = inl.getClass.getSimpleName
118-
println(s"WARN: not yet supported: $name")
118+
println(s"WARN: Wiki syntax tag not yet fully supported: $name")
119119
emitInline(i)
120120

121121
case Subscript(i) =>
122122
def name = inl.getClass.getSimpleName
123-
println(s"WARN: not yet supported: $name")
123+
println(s"WARN: Wiki syntax tag not yet fully supported: $name")
124124
emitInline(i)
125125

126-
case _: (RepresentationLink | HtmlTag) =>
127-
def name = inl.getClass.getSimpleName
128-
println(s"WARN: not yet supported: $name")
129-
name // doesn't compile if name is a val
126+
case HtmlTag(content) =>
127+
emit(dkkd.Html(List(dkk.text(content)).asJava, kt.emptyMap))
128+
129+
case _: RepresentationLink =>
130+
val name = inl.getClass.getSimpleName
131+
println(s"WARN: Wiki syntax tag not yet supported: $name")
132+
emit(dkk.text(name))
130133
}
131134

132135
def convertInline(inl: Inline): Seq[dkkd.DocTag] =

scala3doc/src/dotty/dokka/transformers/ScalaCommentToContentConverter.scala

+13-8
Original file line numberDiff line numberDiff line change
@@ -23,14 +23,19 @@ object ScalaCommentToContentConverter extends DocTagToContentConverter {
2323
title = docTag.getParams.asScala.get("title")
2424
))
2525
List(res).asJava
26-
case h: Html => List(
27-
HtmlContentNode(
28-
h.getChildren.asScala.collect{case c: Text => c}.head.getBody,
29-
dci,
30-
sourceSets.asScala.toSet.toDisplay.asScala.toSet,
31-
styles.asScala.toSet
32-
)
33-
).asJava
26+
27+
case h: Html =>
28+
val children = h.getChildren
29+
require(children.size() == 1)
30+
require(children.get(0).isInstanceOf[Text])
31+
List(
32+
HtmlContentNode(
33+
children.get(0).asInstanceOf[Text].getBody,
34+
dci,
35+
sourceSets.asScala.toSet.toDisplay.asScala.toSet,
36+
styles.asScala.toSet
37+
)
38+
).asJava
3439
case other => super.buildContent(other, dci, sourceSets, styles, extra)
3540
}
3641

0 commit comments

Comments
 (0)