diff --git a/project/Dependencies.scala b/project/Dependencies.scala index 7267df2..f3b561c 100644 --- a/project/Dependencies.scala +++ b/project/Dependencies.scala @@ -1,15 +1,8 @@ import sbt._ -object Version { - val classgraph = "4.8.47" - val jtidy = "r938" - val sbtParadox = "0.6.5" - val scalatest = "3.0.8" -} - object Library { - val classgraph = "io.github.classgraph" % "classgraph" % Version.classgraph - val jtidy = "net.sf.jtidy" % "jtidy" % Version.jtidy - val sbtParadox = "com.lightbend.paradox" % "sbt-paradox" % Version.sbtParadox - val scalatest = "org.scalatest" %% "scalatest" % Version.scalatest + val classgraph = "io.github.classgraph" % "classgraph" % "4.8.47" + val jtidy = "net.sf.jtidy" % "jtidy" % "r938" + val sbtParadox = "com.lightbend.paradox" % "sbt-paradox" % "0.6.6" + val scalatest = "org.scalatest" %% "scalatest" % "3.0.8" } diff --git a/src/main/scala/com/lightbend/paradox/apidoc/ApidocDirective.scala b/src/main/scala/com/lightbend/paradox/apidoc/ApidocDirective.scala index bcdbaaa..e381d1c 100644 --- a/src/main/scala/com/lightbend/paradox/apidoc/ApidocDirective.scala +++ b/src/main/scala/com/lightbend/paradox/apidoc/ApidocDirective.scala @@ -18,7 +18,7 @@ package com.lightbend.paradox.apidoc import com.lightbend.paradox.markdown.InlineDirective import org.pegdown.Printer -import org.pegdown.ast.{DirectiveNode, TextNode, Visitor} +import org.pegdown.ast.{DirectiveNode, Visitor} class ApidocDirective(allClassesAndObjects: IndexedSeq[String], properties: Map[String, String]) extends InlineDirective("apidoc") { @@ -35,8 +35,8 @@ class ApidocDirective(allClassesAndObjects: IndexedSeq[String], properties: Map[ matched.split('.').last + generics def javaLabel(matched: String): String = scalaLabel(matched) - .replaceAll("\\[", "<") - .replaceAll("\\]", ">") + .replaceAll("\\[", "<") + .replaceAll("\\]", ">") .replaceAll("_", "?") override def toString = @@ -80,9 +80,14 @@ class ApidocDirective(allClassesAndObjects: IndexedSeq[String], properties: Map[ } } - def syntheticNode(group: String, doctype: String, label: String, fqcn: String, node: DirectiveNode): DirectiveNode = { - val syntheticSource = new DirectiveNode.Source.Direct(fqcn) - val attributes = new org.pegdown.ast.DirectiveAttributes.AttributeMap() + private def syntheticNode( + group: String, + doctype: String, + label: String, + fqcn: String, + node: DirectiveNode + ): DirectiveNode = { + val attributes = new org.pegdown.ast.DirectiveAttributes.AttributeMap() new DirectiveNode( DirectiveNode.Format.Inline, group, @@ -94,10 +99,10 @@ class ApidocDirective(allClassesAndObjects: IndexedSeq[String], properties: Map[ DirectiveNode.Format.Inline, doctype + "doc", label, - syntheticSource, + new DirectiveNode.Source.Direct(fqcn), node.attributes, - fqcn, - new TextNode(label) + label, // contents + null ) ) } diff --git a/src/sbt-test/apidoc/multi-project/build.sbt b/src/sbt-test/apidoc/multi-project/build.sbt index bfa7120..2359be3 100644 --- a/src/sbt-test/apidoc/multi-project/build.sbt +++ b/src/sbt-test/apidoc/multi-project/build.sbt @@ -9,7 +9,7 @@ val docs = project "scaladoc.apidoc.base_url" -> "https://localhost:8000", "javadoc.apidoc.base_url" -> "https://localhost:8000" ), - apidocRootPackage := "" + apidocRootPackage := "apidoc" ) val root = project diff --git a/src/sbt-test/apidoc/multi-project/expected/index.html b/src/sbt-test/apidoc/multi-project/expected/index.html index bf077df..ea59613 100644 --- a/src/sbt-test/apidoc/multi-project/expected/index.html +++ b/src/sbt-test/apidoc/multi-project/expected/index.html @@ -1 +1 @@ -
Api link to sub-project LibClassLibClass
+Api link to sub-project LibClass
LibClass
Api link to a class that is both in scaladsl and javadsl packages, but has no javadoc configured: FlowFlow
-Api link to a class that is in common package, but has no javadoc configured GraphStageGraphStage
-Api link to a class that is both in scaladsl and javadsl packages, and has javadoc configured: BehaviorsBehaviors
\ No newline at end of file +Api link to a class that is both in scaladsl and javadsl packages, but has no javadoc configured: Flow
Flow
Api link to a class that is in common package, but has no javadoc configured GraphStage
GraphStage
Api link to a class that is both in scaladsl and javadsl packages, and has javadoc configured: Behaviors
Behaviors
- |Envelope
- |Envelope
+ |Envelope
+ |Envelope
|
- |Flow
- |Flow
+ |Flow
+ |Flow
|
- |Replicator
- |Replicator
+ |Replicator
+ |Replicator
|
- |Replicator
- |Replicator
+ |Replicator
+ |Replicator
|
- |ActorRef
- |ActorRef
+ |ActorRef
+ |ActorRef
|
- |ActorRef
- |ActorRef
+ |ActorRef
+ |ActorRef
|
- |ClusterClient
- |ClusterClient
+ |ClusterClient
+ |ClusterClient
|
- |Source<ServerSentEvent, ?>
- |Source[ServerSentEvent, _]
+ |Source<ServerSentEvent, ?>
+ |Source[ServerSentEvent, _]
|
- |Flow<Message, Message, Mat>
- |Flow[Message, Message, Mat]
+ |Flow<Message, Message, Mat>
+ |Flow[Message, Message, Mat]
|
- |Marshaller<Try<A>, B>
- |Marshaller[Try[A], B]
+ |Marshaller<Try<A>, B>
+ |Marshaller[Try[A], B]
|