Skip to content

Commit

Permalink
API doc directives: accept digits in package names (#421)
Browse files Browse the repository at this point in the history
  • Loading branch information
ennru authored Mar 30, 2020
1 parent a0bc62a commit 1450966
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,11 @@ class ScaladocDirectiveSpec extends MarkdownBaseSpec {
html("""<p><a href="http://example.org/api/0.1.2/org/example/Model.html" title="org.example.Model"><code>Model</code></a></p>""")
}

it should "create accept digits in package names" in {
markdown("@scaladoc[ObjectMetadata](akka.s3.ObjectMetadata)") shouldEqual
html("""<p><a href="http://doc.akka.io/api/akka/2.4.10/akka/s3/ObjectMetadata.html" title="akka.s3.ObjectMetadata"><code>ObjectMetadata</code></a></p>""")
}

it should "support 'scaladoc:' as an alternative name" in {
markdown("@scaladoc:[Model](org.example.Model)") shouldEqual
html("""<p><a href="http://example.org/api/0.1.2/org/example/Model.html" title="org.example.Model"><code>Model</code></a></p>""")
Expand Down

0 comments on commit 1450966

Please sign in to comment.