Skip to content
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

Update dokka to 1.4 #23

Merged
merged 1 commit into from
Sep 10, 2020
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
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -4,3 +4,4 @@
build/
gradle/
lib/
out
7 changes: 4 additions & 3 deletions build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ plugins {
}

group = "com.virtuslab.dokka"
version = "0.1.1"
version = "0.1.3-SNAPSHOT"

tasks.withType(KotlinCompile::class).all {
val language_version: String by project
Expand All @@ -34,11 +34,12 @@ dependencies {
implementation("org.jetbrains.dokka:dokka-base:$dokka_version")
implementation("com.vladsch.flexmark:flexmark-all:0.42.12")
implementation("nl.big-o:liqp:0.6.7")
implementation("org.jetbrains.kotlinx:kotlinx-html-jvm:0.6.10")
implementation("org.jetbrains.kotlinx:kotlinx-html-jvm:0.7.2")

implementation("junit:junit:4.13")

dokkaHtmlPlugin(project(":"))
testImplementation("org.jetbrains.dokka:dokka-core:$dokka_version")
}

// Gradle metadata
Expand Down Expand Up @@ -83,5 +84,5 @@ publishing {

// Configure dokka
tasks.dokkaHtml {
pluginsConfiguration += "ExternalDocsTooKey" to "documentation"
pluginsConfiguration.put("ExternalDocsTooKey", "documentation")
}
7 changes: 7 additions & 0 deletions documentation/_layouts/vl_html_layout.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
<header>
Powered by <a href="https://www.virtuslab.com/">VirtusLab</a>
</header>

<div>
{{ content }}
</div>
12 changes: 12 additions & 0 deletions documentation/docs/static-page/links.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
---
layout: vl_header
title: Links
---

## Links

Our side supports stadnard 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 API using `[fully.quallifty.Name]`
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
---
layout: vl_header
title: Sample html page
title: Sample md page
---

Hello world!
6 changes: 6 additions & 0 deletions documentation/docs/static-page/samples/html_template.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
---
layout: vl_html_layout
title: Use Html template
---

## Test 123
6 changes: 6 additions & 0 deletions documentation/docs/static-page/samples/index.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
---
layout: vl_header
title: Samples
---

Samples for our **plugin**
1 change: 1 addition & 0 deletions documentation/docs/static-page/samples/no_md_nor_html.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
I am text file!
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
---
hasFrame: false
---
<h1>No frame!</h1>
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
<h1>Plain html file</h1>
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
## Plain file
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
<h1>Plain Html file</h1>
1 change: 1 addition & 0 deletions documentation/docs/static-page/samples/plain_md_file.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
# Plain Md file
21 changes: 21 additions & 0 deletions documentation/docs/static-page/samples/tables.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
---
layout: vl_html_layout
title: Tables
---

## Tables


Some random table (to show how we render it).

## SBT Commands Cheat Sheet ##
The basics of working with Dotty codebase are documented [here](https://dotty.epfl.ch/docs/contributing/getting-started.html) and [here](https://dotty.epfl.ch/docs/contributing/workflow.html). Below is a cheat sheet of some frequently used commands (to be used from SBT console – `sbt`).


| Command | Description |
| ---------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------- |
| `dotc ../issues/Playground.scala` | Compile the given file – path relative to the Dotty directory. Output the compiled class files to the Dotty directory itself. |
| `dotr Playground` | Run the compiled class `Playground`. Dotty directory is on classpath by default. |
| `repl` | Start REPL |
| `testOnly dotty.tools.dotc.CompilationTests -- *pos` | Run test (method) `pos` from `CompilationTests` suite. |
| `testCompilation sample` | In all test suites, run test files containing the word `sample` in their title. |
2 changes: 1 addition & 1 deletion documentation/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ layout: vl_header

**Yes, this page was generated using dokka-site**

You can learn more from out [documentation](dokka-site/index.html).
You can learn more from our [documentation](dokka-site/index.html).

## Getting started

Expand Down
4 changes: 2 additions & 2 deletions gradle.properties
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
kotlin.code.style=official

kotlin_version=1.4-M3
dokka_version=1.4.0-rc
kotlin_version=1.4.0
dokka_version=1.4.0

language_version=1.4
1 change: 1 addition & 0 deletions settings.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -17,5 +17,6 @@ pluginManagement {
mavenCentral()
jcenter()
gradlePluginPortal()
mavenLocal()
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ class StaticSitePlugin : DokkaPlugin() {

val customRenderer by extending {
(CoreExtensions.renderer
providing { ctx -> ExternalDocsToolRenderer(ctx) }
providing { ctx -> RendererDispatcher(ctx) }
override dokkaBase.htmlRenderer)
}

Expand Down
26 changes: 26 additions & 0 deletions src/main/kotlin/com/virtuslab/dokka/site/contentNodes.kt
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
package com.virtuslab.dokka.site

import org.jetbrains.dokka.model.DisplaySourceSet
import org.jetbrains.dokka.model.properties.PropertyContainer
import org.jetbrains.dokka.pages.*

data class PartiallyRenderedContent(
val page: PreResolvedPage,
override val children: List<ContentNode>,
override val dci: DCI,
override val sourceSets: Set<DisplaySourceSet>,
override val style: Set<Style> = emptySet(),
override val extra: PropertyContainer<ContentNode> = PropertyContainer.empty()
) : ContentNode {
override fun hasAnyContent(): Boolean = children.find { hasAnyContent() } != null

override fun withNewExtras(newExtras: PropertyContainer<ContentNode>): ContentNode =
copy(extra = extra)

override fun withSourceSets(sourceSets: Set<DisplaySourceSet>): ContentNode =
copy(sourceSets = sourceSets)

val allResources: List<String> by lazy {
page.render("").resources
}
}
15 changes: 11 additions & 4 deletions src/main/kotlin/com/virtuslab/dokka/site/locationProvider.kt
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package com.virtuslab.dokka.site

import org.jetbrains.dokka.base.resolvers.local.DefaultLocationProvider
import org.jetbrains.dokka.base.resolvers.local.DokkaLocationProvider
import org.jetbrains.dokka.base.resolvers.local.LocationProvider
import org.jetbrains.dokka.base.resolvers.local.LocationProviderFactory
import org.jetbrains.dokka.pages.PageNode
Expand All @@ -13,10 +13,17 @@ class StaticSiteLocationProviderFactory(private val ctx: DokkaContext) : Locatio
}
}

class StaticSiteLocationProvider(ctx: DokkaContext, pageNode: RootPageNode) : DefaultLocationProvider(pageNode, ctx) {
class StaticSiteLocationProvider(ctx: DokkaContext, pageNode: RootPageNode) : DokkaLocationProvider(pageNode, ctx) {
override fun pathTo(node: PageNode, context: PageNode?): String =
if (node is BaseStaticSiteProcessor.BasePageNode && node.dri.contains(docsRootDRI))
"index"
if (node is BaseStaticSiteProcessor.StaticPageNode)
if (node.dri.contains(docsRootDRI)) "index"
else {
// replace title with original markdown file name
val original = super.pathTo(node, context)
val paths = original.split("/")
val fileName = node.loadedTemplate.file.name
(paths.dropLast(1) + listOf(fileName)).joinToString("/")
}
else
super.pathTo(node, context)
}
Loading