Skip to content

Commit

Permalink
Handle root related links
Browse files Browse the repository at this point in the history
  • Loading branch information
mkondratek authored and romanowski committed Oct 2, 2020
1 parent 0667d9d commit 1230f83
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 5 deletions.
4 changes: 2 additions & 2 deletions documentation/docs/static-page/links.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,6 @@ title: Links

Our side supports standard markdown links:
- TODO Using standard [urls](https://pl.wikipedia.org/wiki/Uniform_Resource_Locator)
- TODO To [other pages](/docs/static-page/random.html) (or [md base file](/docs/static-page/tables.md)) in our documentation that using paths relative to root od documentation e.g. `/docs/static-page/random.html` for this project
- TODO To [other pages](/docs/static-page/samples/random.html) (or [md base file](samples/tables.md)) in our documentation that using paths relative to this file e.g. using `random.html` (or `tables.md`)
- TODO To [other (html) pages](/docs/static-page/samples/plain_html_file.html) (or [md based files](/docs/static-page/samples/plain_md_file.md)) in our documentation that using paths relative to root od documentation e.g. `/docs/static-page/sample/plain_html_file.html` for this project
- TODO To [other (html) pages](samples/plain_html_file.html) (or [md based files](samples/plain_md_file.md)) in our documentation that using paths relative to this file e.g. using `samples/plain_html_file.html`
- TODO To API using `[fully.quallifty.Name]`
15 changes: 12 additions & 3 deletions src/main/kotlin/com/virtuslab/dokka/site/processors.kt
Original file line number Diff line number Diff line change
Expand Up @@ -174,7 +174,7 @@ class SitePagesCreator(cxt: DokkaContext) : BaseStaticSiteProcessor(cxt) {


private fun isValidTemplate(file: File): Boolean =
(file.isDirectory && !file.name.startsWith("_")) ||
(file.isDirectory && !file.name.startsWith("_")) ||
file.name.endsWith(".md") ||
file.name.endsWith(".html")

Expand Down Expand Up @@ -204,9 +204,18 @@ class SitePagesCreator(cxt: DokkaContext) : BaseStaticSiteProcessor(cxt) {
null
}

private fun parseMarkdown(page: PreResolvedPage, dri: Set<DRI>, allDirs: Map<String, DRI>): ContentNode {
private fun parseMarkdown(page: PreResolvedPage, dri: Set<DRI>, allDRIs: Map<String, DRI>): ContentNode {
val nodes = if (page.hasMarkdown) {
val parser = ExtendableMarkdownParser(page.code, allDirs::get)
val parser = ExtendableMarkdownParser(page.code) { link ->
val driKey = if (link.startsWith("/")) {
// handle root related links
link.replace('/', '.').removePrefix(".")
} else {
// todo handle relative links
link
}
allDRIs[driKey]
}

val docTag = try {
parser.parse()
Expand Down

0 comments on commit 1230f83

Please sign in to comment.