Skip to content

Fix rendering of the CONTRIBUTING page on Github #3426

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Nov 3, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -3,18 +3,21 @@ package dottydoc
package staticsite

import com.vladsch.flexmark.ast._
import com.vladsch.flexmark.util.sequence.CharSubSequence
import model.{ Package, NonEntity, Val, Def, TypeAlias }
import com.vladsch.flexmark.util.sequence.{BasedSequence, CharSubSequence}
import model.{Def, NonEntity, Package, TypeAlias, Val}
import dottydoc.util.MemberLookup

object MarkdownLinkVisitor {
private val EntityLink = """([^\.]+)(\.[^\.]+)*""".r
def apply(node: Node, docs: Map[String, Package], params: Map[String, AnyRef]): Unit =
(new NodeVisitor(
new NodeVisitor(
new VisitHandler(classOf[Link], new Visitor[Link] with MemberLookup {
override def visit(node: Link): Unit = {
def isExternal(url: BasedSequence) =
url.startsWith("http") || url.startsWith("https")

val url = node.getUrl
if (url.endsWith(".md")) node.setUrl {
if (url.endsWith(".md") && !isExternal(url)) node.setUrl {
url.subSequence(0, url.lastIndexOf('.')).append(".html")
}
else if (EntityLink.unapplySeq(url.toString).isDefined) {
Expand All @@ -37,6 +40,6 @@ object MarkdownLinkVisitor {
}
}
})
))
)
.visit(node)
}
2 changes: 1 addition & 1 deletion docs/docs/contributing/getting-started.md
Original file line number Diff line number Diff line change
Expand Up @@ -75,4 +75,4 @@ $ sbt
```

Before contributing to Dotty, we invite you to consult the
[Dotty Developer Guidelines](https://github.com/lampepfl/dotty/blob/master/CONTRIBUTING).
[Dotty Developer Guidelines](https://github.com/lampepfl/dotty/blob/master/CONTRIBUTING.md).