From 1450966efa56338fe6e2e960ad4b9d5f48900524 Mon Sep 17 00:00:00 2001 From: Enno <458526+ennru@users.noreply.github.com> Date: Mon, 30 Mar 2020 09:23:51 +0200 Subject: [PATCH] API doc directives: accept digits in package names (#421) --- .../scala/com/lightbend/paradox/markdown/Directive.scala | 4 ++-- .../lightbend/paradox/markdown/ScaladocDirectiveSpec.scala | 5 +++++ 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/core/src/main/scala/com/lightbend/paradox/markdown/Directive.scala b/core/src/main/scala/com/lightbend/paradox/markdown/Directive.scala index bab81b96..c4e9ec26 100644 --- a/core/src/main/scala/com/lightbend/paradox/markdown/Directive.scala +++ b/core/src/main/scala/com/lightbend/paradox/markdown/Directive.scala @@ -310,8 +310,8 @@ abstract class ApiDocDirective(name: String) } object ApiDocDirective { - /** This relies on the naming convention of packages being all-lowercase (which is rarely broken). */ - def packageDotsToSlash(s: String) = s.replaceAll("(\\b[a-z]+)\\.", "$1/") + /** This relies on the naming convention of packages being all-ascii-lowercase (which is rarely broken), numbers and underscore. */ + def packageDotsToSlash(s: String) = s.replaceAll("(\\b[a-z][a-z0-9_]*)\\.", "$1/") } case class ScaladocDirective(ctx: Writer.Context) diff --git a/tests/src/test/scala/com/lightbend/paradox/markdown/ScaladocDirectiveSpec.scala b/tests/src/test/scala/com/lightbend/paradox/markdown/ScaladocDirectiveSpec.scala index 4123f6bd..ec9ab1e6 100644 --- a/tests/src/test/scala/com/lightbend/paradox/markdown/ScaladocDirectiveSpec.scala +++ b/tests/src/test/scala/com/lightbend/paradox/markdown/ScaladocDirectiveSpec.scala @@ -35,6 +35,11 @@ class ScaladocDirectiveSpec extends MarkdownBaseSpec { html("""
""") } + it should "create accept digits in package names" in { + markdown("@scaladoc[ObjectMetadata](akka.s3.ObjectMetadata)") shouldEqual + html("""""") + } + it should "support 'scaladoc:' as an alternative name" in { markdown("@scaladoc:[Model](org.example.Model)") shouldEqual html("""""")