Skip to content

Commit

Permalink
Fix rendering of the CONTRIBUTING page on Github
Browse files Browse the repository at this point in the history
  • Loading branch information
maseev committed Nov 1, 2017
1 parent dfe45fc commit 034eb5f
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 6 deletions.
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).

0 comments on commit 034eb5f

Please sign in to comment.