diff options
42 files changed, 121 insertions, 110 deletions
diff --git a/src/Formats/HtmlFormatService.kt b/src/Formats/HtmlFormatService.kt index 3415bfd7..8442c66f 100644 --- a/src/Formats/HtmlFormatService.kt +++ b/src/Formats/HtmlFormatService.kt @@ -82,10 +82,6 @@ public open class HtmlFormatService(locationService: LocationService, to.appendln("</td>") } - override fun formatLink(text: String, location: Location): String { - return "<a href=\"${location.path}\">${text}</a>" - } - override fun formatLink(text: String, href: String): String { return "<a href=\"${href}\">${text}</a>" } @@ -139,7 +135,7 @@ public open class HtmlFormatService(locationService: LocationService, val link = ContentNodeLink(node) link.append(languageService.render(node, LanguageService.RenderMode.FULL)) val signature = formatText(location, link) - to.appendln("${formatLink(signature, location)}<br/>") + to.appendln("<a href=\"${location.path}\">${signature}</a><br/>") } override fun appendOutlineLevel(to: StringBuilder, body: () -> Unit) { diff --git a/src/Formats/KotlinWebsiteFormatService.kt b/src/Formats/KotlinWebsiteFormatService.kt index 4f7a013a..5e616fad 100644 --- a/src/Formats/KotlinWebsiteFormatService.kt +++ b/src/Formats/KotlinWebsiteFormatService.kt @@ -22,6 +22,8 @@ public class KotlinWebsiteFormatService(locationService: LocationService, return "" } + /* + TODO this should be a LocationService override fun formatLink(text: String, location: Location): String { val href = location.path.replace("\\", "/") .replaceAfterLast(".", "html") @@ -29,6 +31,7 @@ public class KotlinWebsiteFormatService(locationService: LocationService, return "<a href=\"${href}\">${text}</a>" } + */ override fun formatLink(text: String, href: String): String { return "<a href=\"${href}\">${text}</a>" diff --git a/src/Formats/MarkdownFormatService.kt b/src/Formats/MarkdownFormatService.kt index 3598f29d..b855ec9c 100644 --- a/src/Formats/MarkdownFormatService.kt +++ b/src/Formats/MarkdownFormatService.kt @@ -50,10 +50,6 @@ public open class MarkdownFormatService(locationService: LocationService, return "~~$text~~" } - override public fun formatLink(text: String, location: Location): String { - return "[$text](${location.path})" - } - override fun formatLink(text: String, href: String): String { return "[$text]($href)" } diff --git a/src/Formats/StructuredFormatService.kt b/src/Formats/StructuredFormatService.kt index 10650ab2..32e22fd7 100644 --- a/src/Formats/StructuredFormatService.kt +++ b/src/Formats/StructuredFormatService.kt @@ -3,7 +3,7 @@ package org.jetbrains.dokka import java.util.LinkedHashMap import org.jetbrains.dokka.LanguageService.RenderMode -public data class FormatLink(val text: String, val location: Location) +public data class FormatLink(val text: String, val href: String) public abstract class StructuredFormatService(val locationService: LocationService, val languageService: LanguageService) : FormatService { @@ -25,9 +25,8 @@ public abstract class StructuredFormatService(val locationService: LocationServi public abstract fun formatSymbol(text: String): String public abstract fun formatKeyword(text: String): String public abstract fun formatIdentifier(text: String): String - public abstract fun formatLink(text: String, location: Location): String public abstract fun formatLink(text: String, href: String): String - public open fun formatLink(link: FormatLink): String = formatLink(formatText(link.text), link.location) + public open fun formatLink(link: FormatLink): String = formatLink(formatText(link.text), link.href) public abstract fun formatStrong(text: String): String public abstract fun formatStrikethrough(text: String): String public abstract fun formatEmphasis(text: String): String @@ -55,7 +54,7 @@ public abstract class StructuredFormatService(val locationService: LocationServi is ContentListItem -> append(formatListItem(formatText(location, content.children))) is ContentNodeLink -> { - val linkTo = locationService.relativeLocation(location, content.node, extension) + val linkTo = location.relativePathTo(locationService.location(content.node), extension) val linkText = formatText(location, content.children) append(formatLink(linkText, linkTo)) } @@ -77,7 +76,7 @@ public abstract class StructuredFormatService(val locationService: LocationServi open public fun link(from: DocumentationNode, to: DocumentationNode): FormatLink = link(from, to, extension) open public fun link(from: DocumentationNode, to: DocumentationNode, extension: String): FormatLink { - return FormatLink(to.name, locationService.relativeLocation(from, to, extension)) + return FormatLink(to.name, locationService.relativePathToLocation(from, to, extension)) } fun appendDocumentation(location: Location, to: StringBuilder, overloads: Iterable<DocumentationNode>) { @@ -133,7 +132,7 @@ public abstract class StructuredFormatService(val locationService: LocationServi private fun DocumentationNode.appendOverrides(to: StringBuilder) { overrides.forEach { to.append("Overrides ") - val location = locationService.relativeLocation(this, it, extension) + val location = locationService.relativePathToLocation(this, it, extension) appendLine(to, formatLink(FormatLink(it.owner!!.name + "." + it.name, location))) } } @@ -210,7 +209,7 @@ public abstract class StructuredFormatService(val locationService: LocationServi override fun appendNodes(location: Location, to: StringBuilder, nodes: Iterable<DocumentationNode>) { val breakdownByLocation = nodes.groupBy { node -> - formatBreadcrumbs(node.path.map { link(node, it) }) + formatBreadcrumbs(node.path.filterNot { it.name.isEmpty() }.map { link(node, it) }) } for ((breadcrumbs, items) in breakdownByLocation) { diff --git a/src/Generation/ConsoleGenerator.kt b/src/Generation/ConsoleGenerator.kt index f52c6f4b..2f2daa55 100644 --- a/src/Generation/ConsoleGenerator.kt +++ b/src/Generation/ConsoleGenerator.kt @@ -4,7 +4,7 @@ public class ConsoleGenerator(val signatureGenerator: LanguageService, val locat val IndentStep = " " public fun generate(node: DocumentationNode, indent: String = "") { - println("@${locationService.location(node).file}") + println("@${locationService.location(node).path}") generateHeader(node, indent) //generateDetails(node, indent) generateMembers(node, indent) diff --git a/src/Generation/FileGenerator.kt b/src/Generation/FileGenerator.kt index 128f3260..22090937 100644 --- a/src/Generation/FileGenerator.kt +++ b/src/Generation/FileGenerator.kt @@ -4,7 +4,7 @@ import java.io.FileOutputStream import java.io.OutputStreamWriter public class FileGenerator(val signatureGenerator: LanguageService, - val locationService: LocationService, + val locationService: FileLocationService, val formatService: FormatService, val outlineService: OutlineFormatService?) { diff --git a/src/Locations/FoldersLocationService.kt b/src/Locations/FoldersLocationService.kt index db06dc2c..6f3954c4 100644 --- a/src/Locations/FoldersLocationService.kt +++ b/src/Locations/FoldersLocationService.kt @@ -3,15 +3,18 @@ package org.jetbrains.dokka import java.io.File public fun FoldersLocationService(root: String): FoldersLocationService = FoldersLocationService(File(root)) -public class FoldersLocationService(val root: File) : LocationService { - override fun location(node: DocumentationNode): Location { - val parts = node.path.map { identifierToFilename(it.name) } - val folder = if (node.members.none()) { - // leaf node, use file in owner's folder - parts.joinToString("/", limit = parts.size - 1, truncated = "") + "/" + parts.last() - } else { - parts.joinToString("/") + (if (parts.none()) "" else "/") + "index" - } - return Location(File(root, folder)) +public class FoldersLocationService(val root: File) : FileLocationService { + override fun location(node: DocumentationNode): FileLocation { + return FileLocation(File(root, relativePathToNode(node))) } -}
\ No newline at end of file +} + +fun relativePathToNode(node: DocumentationNode): String { + val parts = node.path.map { identifierToFilename(it.name) }.filterNot { it.isEmpty() } + return if (node.members.none()) { + // leaf node, use file in owner's folder + parts.joinToString("/") + } else { + parts.joinToString("/") + (if (parts.none()) "" else "/") + "index" + } +} diff --git a/src/Locations/LocationService.kt b/src/Locations/LocationService.kt index 26a67382..d364c511 100644 --- a/src/Locations/LocationService.kt +++ b/src/Locations/LocationService.kt @@ -2,6 +2,11 @@ package org.jetbrains.dokka import java.io.File +public trait Location { + val path: String get + fun relativePathTo(other: Location, extension: String): String +} + /** * Represents locations in the documentation in the form of [path](File). * @@ -10,9 +15,18 @@ import java.io.File * $file: [File] for this location * $path: [String] representing path of this location */ -public data class Location(val file: File) { - public val path : String +public data class FileLocation(val file: File): Location { + override val path : String get() = file.path + + override fun relativePathTo(other: Location, extension: String): String { + if (other !is FileLocation) { + throw IllegalArgumentException("$other is not a FileLocation") + } + val ownerFolder = file.getParentFile()!! + val memberPath = other.file.appendExtension(extension) + return ownerFolder.getRelativePath(memberPath).path + } } /** @@ -32,6 +46,11 @@ public trait LocationService { } +public trait FileLocationService: LocationService { + override fun location(node: DocumentationNode): FileLocation +} + + public fun identifierToFilename(path: String): String { val escaped = path.replace('<', '-').replace('>', '-') val lowercase = escaped.replaceAll("[A-Z]") { matchResult -> "-" + matchResult.group().toLowerCase() } @@ -41,15 +60,6 @@ public fun identifierToFilename(path: String): String { /** * Returns relative location between two nodes. Used for relative links in documentation. */ -fun LocationService.relativeLocation(owner: DocumentationNode, node: DocumentationNode, extension: String): Location { - return relativeLocation(location(owner), node, extension) -} - -/** - * Returns relative location between base location and a node. Used for relative links in documentation. - */ -fun LocationService.relativeLocation(owner: Location, node: DocumentationNode, extension: String): Location { - val ownerFolder = owner.file.getParentFile()!! - val memberPath = location(node).file.appendExtension(extension) - return Location(ownerFolder.getRelativePath(memberPath)) +fun LocationService.relativePathToLocation(owner: DocumentationNode, node: DocumentationNode, extension: String): String { + return location(owner).relativePathTo(location(node), extension) } diff --git a/src/Locations/SingleFolderLocationService.kt b/src/Locations/SingleFolderLocationService.kt index 4f926959..aefab450 100644 --- a/src/Locations/SingleFolderLocationService.kt +++ b/src/Locations/SingleFolderLocationService.kt @@ -3,9 +3,9 @@ package org.jetbrains.dokka import java.io.File public fun SingleFolderLocationService(root: String): SingleFolderLocationService = SingleFolderLocationService(File(root)) -public class SingleFolderLocationService(val root: File) : LocationService { - override fun location(node: DocumentationNode): Location { +public class SingleFolderLocationService(val root: File) : FileLocationService { + override fun location(node: DocumentationNode): FileLocation { val filename = node.path.map { identifierToFilename(it.name) }.joinToString("-") - return Location(File(root, filename)) + return FileLocation(File(root, filename)) } }
\ No newline at end of file diff --git a/test/data/format/accessor.get.md b/test/data/format/accessor.get.md index 2f6ffbeb..67a2f395 100644 --- a/test/data/format/accessor.get.md +++ b/test/data/format/accessor.get.md @@ -1,4 +1,4 @@ -[test](out.md) / [](out.md) / [C](out.md) / [x](out.md) / [get](out.md) +[test](test/index) / [C](test/-c/index) / [x](test/-c/x/index) / [get](test/-c/x/get) # get diff --git a/test/data/format/accessor.set.md b/test/data/format/accessor.set.md index aadb77da..4350fcd3 100644 --- a/test/data/format/accessor.set.md +++ b/test/data/format/accessor.set.md @@ -1,4 +1,4 @@ -[test](out.md) / [](out.md) / [C](out.md) / [x](out.md) / [set](out.md) +[test](test/index) / [C](test/-c/index) / [x](test/-c/x/index) / [set](test/-c/x/set) # set diff --git a/test/data/format/annotationClass.md b/test/data/format/annotationClass.md index cefd5212..936217d2 100644 --- a/test/data/format/annotationClass.md +++ b/test/data/format/annotationClass.md @@ -1,4 +1,4 @@ -[test](out.md) / [](out.md) / [fancy](out.md) +[test](test/index) / [fancy](test/fancy/index) # fancy @@ -10,5 +10,5 @@ ### Constructors -| [<init>](out.md) | `public fancy()` | +| [<init>](test/fancy/-init-) | `public fancy()` | diff --git a/test/data/format/annotationParams.md b/test/data/format/annotationParams.md index 8fd26b94..80fe52cf 100644 --- a/test/data/format/annotationParams.md +++ b/test/data/format/annotationParams.md @@ -1,4 +1,4 @@ -[test](out.md) / [](out.md) / [f](out.md) +[test](test/index) / [f](test/f) # f diff --git a/test/data/format/annotations.md b/test/data/format/annotations.md index d7435adf..04d16129 100644 --- a/test/data/format/annotations.md +++ b/test/data/format/annotations.md @@ -1,4 +1,4 @@ -[test](out.md) / [](out.md) / [Foo](out.md) +[test](test/index) / [Foo](test/-foo/index) # Foo @@ -10,17 +10,17 @@ ### Constructors -| [<init>](out.md) | `public Foo()` | +| [<init>](test/-foo/-init-) | `public Foo()` | ### Properties -| [x](out.md) | `inline val x: Int` | +| [x](test/-foo/x) | `inline val x: Int` | ### Functions -| [bar](out.md) | `inline fun bar(noinline notInlined: () -> Unit): Unit` | +| [bar](test/-foo/bar) | `inline fun bar(noinline notInlined: () -> Unit): Unit` | diff --git a/test/data/format/bracket.html b/test/data/format/bracket.html index 24a7aec2..5630073d 100644 --- a/test/data/format/bracket.html +++ b/test/data/format/bracket.html @@ -3,7 +3,7 @@ <title>test / foo</title> </HEAD> <BODY> -<a href="out.html">test</a> / <a href="out.html"></a> / <a href="out.html">foo</a><br/> +<a href="test/index">test</a> / <a href="test/foo">foo</a><br/> <br/> <h1>foo</h1> <code><span class="keyword">fun </span><span class="identifier">foo</span><span class="symbol">(</span><span class="symbol">)</span><span class="symbol">: </span><span class="identifier">Unit</span></code><br/> diff --git a/test/data/format/brokenLink.html b/test/data/format/brokenLink.html index 7c2585b8..32135787 100644 --- a/test/data/format/brokenLink.html +++ b/test/data/format/brokenLink.html @@ -3,7 +3,7 @@ <title>test / f</title> </HEAD> <BODY> -<a href="out.html">test</a> / <a href="out.html"></a> / <a href="out.html">f</a><br/> +<a href="test/index">test</a> / <a href="test/f">f</a><br/> <br/> <h1>f</h1> <code><span class="keyword">fun </span><span class="identifier">f</span><span class="symbol">(</span><span class="symbol">)</span><span class="symbol">: </span><span class="identifier">Unit</span></code><br/> diff --git a/test/data/format/classWithDefaultObject.html b/test/data/format/classWithDefaultObject.html index 1fd648ff..ca6f2305 100644 --- a/test/data/format/classWithDefaultObject.html +++ b/test/data/format/classWithDefaultObject.html @@ -3,7 +3,7 @@ <title>test / Klass</title> </HEAD> <BODY> -<a href="out.html">test</a> / <a href="out.html"></a> / <a href="out.html">Klass</a><br/> +<a href="test/index">test</a> / <a href="test/-klass/index">Klass</a><br/> <br/> <h1>Klass</h1> <code><span class="keyword">class </span><span class="identifier">Klass</span></code><br/> @@ -14,7 +14,7 @@ <tbody> <tr> <td> -<a href="out.html"><init></a></td> +<a href="test/-klass/-init-"><init></a></td> <td> <code><span class="keyword">public</span> <span class="identifier">Klass</span><span class="symbol">(</span><span class="symbol">)</span></code></td> </tr> @@ -25,7 +25,7 @@ <tbody> <tr> <td> -<a href="out.html">x</a></td> +<a href="test/-klass/x">x</a></td> <td> <code><span class="keyword">val </span><span class="identifier">x</span><span class="symbol">: </span><span class="identifier">Int</span></code></td> </tr> @@ -36,7 +36,7 @@ <tbody> <tr> <td> -<a href="out.html">foo</a></td> +<a href="test/-klass/foo">foo</a></td> <td> <code><span class="keyword">fun </span><span class="identifier">foo</span><span class="symbol">(</span><span class="symbol">)</span><span class="symbol">: </span><span class="identifier">Unit</span></code></td> </tr> diff --git a/test/data/format/classWithDefaultObject.md b/test/data/format/classWithDefaultObject.md index 030d5a21..d9f6a8fe 100644 --- a/test/data/format/classWithDefaultObject.md +++ b/test/data/format/classWithDefaultObject.md @@ -1,4 +1,4 @@ -[test](out.md) / [](out.md) / [Klass](out.md) +[test](test/index) / [Klass](test/-klass/index) # Klass @@ -10,17 +10,17 @@ ### Constructors -| [<init>](out.md) | `public Klass()` | +| [<init>](test/-klass/-init-) | `public Klass()` | ### Default Object Properties -| [x](out.md) | `val x: Int` | +| [x](test/-klass/x) | `val x: Int` | ### Default Object Functions -| [foo](out.md) | `fun foo(): Unit` | +| [foo](test/-klass/foo) | `fun foo(): Unit` | diff --git a/test/data/format/codeSpan.html b/test/data/format/codeSpan.html index d2209b83..cc553043 100644 --- a/test/data/format/codeSpan.html +++ b/test/data/format/codeSpan.html @@ -3,7 +3,7 @@ <title>test / foo</title> </HEAD> <BODY> -<a href="out.html">test</a> / <a href="out.html"></a> / <a href="out.html">foo</a><br/> +<a href="test/index">test</a> / <a href="test/foo">foo</a><br/> <br/> <h1>foo</h1> <code><span class="keyword">fun </span><span class="identifier">foo</span><span class="symbol">(</span><span class="symbol">)</span><span class="symbol">: </span><span class="identifier">Unit</span></code><br/> diff --git a/test/data/format/deprecated.class.html b/test/data/format/deprecated.class.html index 030dd12b..bc44620d 100644 --- a/test/data/format/deprecated.class.html +++ b/test/data/format/deprecated.class.html @@ -2,21 +2,21 @@ <HEAD> </HEAD> <BODY> -<a href="out.html">test</a> / <a href="out.html"></a> / <a href="out.html">C</a><br/> +<a href="test/index">test</a> / <a href="test/-c/index">C</a><br/> <br/> <h1>C</h1> <code><span class="keyword">class </span><s><span class="identifier">C</span></s></code><br/> <strong>Deprecated: </strong>This class sucks<br/> <br/> <br/> -<a href="out.html">test</a> / <a href="out.html"></a> / <a href="out.html">f</a><br/> +<a href="test/index">test</a> / <a href="test/f">f</a><br/> <br/> <h1>f</h1> <code><span class="keyword">fun </span><s><span class="identifier">f</span></s><span class="symbol">(</span><span class="symbol">)</span><span class="symbol">: </span><span class="identifier">Unit</span></code><br/> <strong>Deprecated: </strong>This function sucks<br/> <br/> <br/> -<a href="out.html">test</a> / <a href="out.html"></a> / <a href="out.html">p</a><br/> +<a href="test/index">test</a> / <a href="test/p/index">p</a><br/> <br/> <h1>p</h1> <code><span class="keyword">val </span><s><span class="identifier">p</span></s><span class="symbol">: </span><span class="identifier">Int</span></code><br/> @@ -28,7 +28,7 @@ <tbody> <tr> <td> -<a href="out.html"><init></a></td> +<a href="test/-c/-init-"><init></a></td> <td> <code><span class="keyword">public</span> <span class="identifier">C</span><span class="symbol">(</span><span class="symbol">)</span></code></td> </tr> @@ -39,7 +39,7 @@ <tbody> <tr> <td> -<a href="out.html">get</a></td> +<a href="test/p/get">get</a></td> <td> <code><span class="identifier">get</span><span class="symbol">(</span><span class="symbol">)</span><span class="symbol">: </span><span class="identifier">Int</span></code></td> </tr> diff --git a/test/data/format/deprecated.package.html b/test/data/format/deprecated.package.html index 000d2015..8e3c2aa9 100644 --- a/test/data/format/deprecated.package.html +++ b/test/data/format/deprecated.package.html @@ -3,7 +3,7 @@ <title>test / root package</title> </HEAD> <BODY> -<a href="out.html">test</a> / <a href="out.html"></a><br/> +<a href="test/index">test</a><br/> <br/> <h1></h1> <code><span class="keyword">package</span> <span class="identifier"></span></code><br/> @@ -14,7 +14,7 @@ <tbody> <tr> <td> -<a href="out.html">C</a></td> +<a href="test/-c/index">C</a></td> <td> <code><span class="keyword">class </span><s><span class="identifier">C</span></s></code></td> </tr> @@ -25,7 +25,7 @@ <tbody> <tr> <td> -<a href="out.html">p</a></td> +<a href="test/p/index">p</a></td> <td> <code><span class="keyword">val </span><s><span class="identifier">p</span></s><span class="symbol">: </span><span class="identifier">Int</span></code></td> </tr> @@ -36,7 +36,7 @@ <tbody> <tr> <td> -<a href="out.html">f</a></td> +<a href="test/f">f</a></td> <td> <code><span class="keyword">fun </span><s><span class="identifier">f</span></s><span class="symbol">(</span><span class="symbol">)</span><span class="symbol">: </span><span class="identifier">Unit</span></code></td> </tr> diff --git a/test/data/format/emptyDescription.md b/test/data/format/emptyDescription.md index 6b2fd2b4..e82e7228 100644 --- a/test/data/format/emptyDescription.md +++ b/test/data/format/emptyDescription.md @@ -1,4 +1,4 @@ -[test](out.md) / [](out.md) / [fn](out.md) +[test](test/index) / [fn](test/fn) # fn diff --git a/test/data/format/enumClass.md b/test/data/format/enumClass.md index e260c18f..09efc792 100644 --- a/test/data/format/enumClass.md +++ b/test/data/format/enumClass.md @@ -1,4 +1,4 @@ -[test](out.md) / [](out.md) / [InlineOption](out.md) +[test](test/index) / [InlineOption](test/-inline-option/index) # InlineOption @@ -10,6 +10,6 @@ ### Enum Values -| [LOCAL_CONTINUE_AND_BREAK](out.md) | `` | -| [ONLY_LOCAL_RETURN](out.md) | `` | +| [LOCAL_CONTINUE_AND_BREAK](test/-inline-option/-l-o-c-a-l_-c-o-n-t-i-n-u-e_-a-n-d_-b-r-e-a-k) | `` | +| [ONLY_LOCAL_RETURN](test/-inline-option/-o-n-l-y_-l-o-c-a-l_-r-e-t-u-r-n) | `` | diff --git a/test/data/format/enumClass.value.md b/test/data/format/enumClass.value.md index bec97d80..bcb685d1 100644 --- a/test/data/format/enumClass.value.md +++ b/test/data/format/enumClass.value.md @@ -1,4 +1,4 @@ -[test](out.md) / [](out.md) / [InlineOption](out.md) / [LOCAL_CONTINUE_AND_BREAK](out.md) +[test](test/index) / [InlineOption](test/-inline-option/index) / [LOCAL_CONTINUE_AND_BREAK](test/-inline-option/-l-o-c-a-l_-c-o-n-t-i-n-u-e_-a-n-d_-b-r-e-a-k) # LOCAL_CONTINUE_AND_BREAK diff --git a/test/data/format/extensions.class.md b/test/data/format/extensions.class.md index a9747756..a4767ace 100644 --- a/test/data/format/extensions.class.md +++ b/test/data/format/extensions.class.md @@ -1,15 +1,15 @@ -[test](out.md) / [foo](out.md) / [String](out.md) +[test](test/index) / [foo](test/foo/index) / [String](test/foo/-string/index) ### Extensions for String -| [fn](out.md) | `fun String.fn(): Unit` +| [fn](test/foo/-string/fn) | `fun String.fn(): Unit` `fun String.fn(x: Int): Unit` Function with receiver | -| [foobar](out.md) | `val String.foobar: Int` +| [foobar](test/foo/-string/foobar/index) | `val String.foobar: Int` Property with receiver. | diff --git a/test/data/format/extensions.package.md b/test/data/format/extensions.package.md index a456e64e..d4ab577e 100644 --- a/test/data/format/extensions.package.md +++ b/test/data/format/extensions.package.md @@ -1,4 +1,4 @@ -[test](out.md) / [foo](out.md) +[test](test/index) / [foo](test/foo/index) # foo @@ -10,5 +10,5 @@ ### Extensions for External Classes -| [String](out.md) | `` | +| [String](test/foo/-string/index) | `` | diff --git a/test/data/format/functionWithDefaultParameter.md b/test/data/format/functionWithDefaultParameter.md index 435fe6d2..43bd8d70 100644 --- a/test/data/format/functionWithDefaultParameter.md +++ b/test/data/format/functionWithDefaultParameter.md @@ -1,4 +1,4 @@ -[test](out.md) / [](out.md) / [f](out.md) +[test](test/index) / [f](test/f) # f diff --git a/test/data/format/htmlEscaping.html b/test/data/format/htmlEscaping.html index c031447a..29c4bf0e 100644 --- a/test/data/format/htmlEscaping.html +++ b/test/data/format/htmlEscaping.html @@ -3,7 +3,7 @@ <title>test / x</title> </HEAD> <BODY> -<a href="out.html">test</a> / <a href="out.html"></a> / <a href="out.html">x</a><br/> +<a href="test/index">test</a> / <a href="test/x">x</a><br/> <br/> <h1>x</h1> <code><span class="keyword">fun </span><span class="symbol"><</span><span class="identifier">T</span><span class="symbol">> </span><span class="identifier">x</span><span class="symbol">(</span><span class="symbol">)</span><span class="symbol">: </span><span class="identifier">T?</span></code><br/> diff --git a/test/data/format/overloads.html b/test/data/format/overloads.html index 7a7bd6cf..9189483d 100644 --- a/test/data/format/overloads.html +++ b/test/data/format/overloads.html @@ -3,7 +3,7 @@ <title>test / root package</title> </HEAD> <BODY> -<a href="out.html">test</a> / <a href="out.html"></a><br/> +<a href="test/index">test</a><br/> <br/> <h1></h1> <code><span class="keyword">package</span> <span class="identifier"></span></code><br/> @@ -14,7 +14,7 @@ <tbody> <tr> <td> -<a href="out.html">f</a></td> +<a href="test/f">f</a></td> <td> <code><span class="keyword">fun </span><span class="identifier">f</span><span class="symbol">(</span><span class="identifier">x</span><span class="symbol">: </span><span class="identifier">Int</span><span class="symbol">)</span><span class="symbol">: </span><span class="identifier">Unit</span></code><br/> <code><span class="keyword">fun </span><span class="identifier">f</span><span class="symbol">(</span><span class="identifier">x</span><span class="symbol">: </span><span class="identifier">String</span><span class="symbol">)</span><span class="symbol">: </span><span class="identifier">Unit</span></code><p>Performs an action on x.</p> diff --git a/test/data/format/overloadsWithDescription.html b/test/data/format/overloadsWithDescription.html index 4d43cb05..b29ca658 100644 --- a/test/data/format/overloadsWithDescription.html +++ b/test/data/format/overloadsWithDescription.html @@ -3,12 +3,12 @@ <title>test / f</title> </HEAD> <BODY> -<a href="out.html">test</a> / <a href="out.html"></a> / <a href="out.html">f</a><br/> +<a href="test/index">test</a> / <a href="test/f">f</a><br/> <br/> <h1>f</h1> <code><span class="keyword">fun </span><span class="identifier">f</span><span class="symbol">(</span><span class="identifier">x</span><span class="symbol">: </span><span class="identifier">Int</span><span class="symbol">)</span><span class="symbol">: </span><span class="identifier">Unit</span></code><br/> <code><span class="keyword">fun </span><span class="identifier">f</span><span class="symbol">(</span><span class="identifier">x</span><span class="symbol">: </span><span class="identifier">String</span><span class="symbol">)</span><span class="symbol">: </span><span class="identifier">Unit</span></code><br/> -<p>Performs an action on <a href="out.html">x</a>.</p> +<p>Performs an action on <a href="test/f/x">x</a>.</p> <h3>Description</h3> <p>This is a long description.</p> <br/> diff --git a/test/data/format/overloadsWithDifferentDescriptions.html b/test/data/format/overloadsWithDifferentDescriptions.html index 6d174529..66f8e9a6 100644 --- a/test/data/format/overloadsWithDifferentDescriptions.html +++ b/test/data/format/overloadsWithDifferentDescriptions.html @@ -3,7 +3,7 @@ <title>test / f</title> </HEAD> <BODY> -<a href="out.html">test</a> / <a href="out.html"></a> / <a href="out.html">f</a><br/> +<a href="test/index">test</a> / <a href="test/f">f</a><br/> <br/> <h1>f</h1> <code><span class="keyword">fun </span><span class="identifier">f</span><span class="symbol">(</span><span class="identifier">x</span><span class="symbol">: </span><span class="identifier">Int</span><span class="symbol">)</span><span class="symbol">: </span><span class="identifier">Unit</span></code><br/> diff --git a/test/data/format/overridingFunction.md b/test/data/format/overridingFunction.md index 6670ca00..2c898b9c 100644 --- a/test/data/format/overridingFunction.md +++ b/test/data/format/overridingFunction.md @@ -1,9 +1,9 @@ -[test](out.md) / [](out.md) / [D](out.md) / [f](out.md) +[test](test/index) / [D](test/-d/index) / [f](test/-d/f) # f `fun f(): Unit` -Overrides [C.f](out.md) +Overrides [C.f](test/-c/f) diff --git a/test/data/format/paramTag.md b/test/data/format/paramTag.md index 5f324699..aacda66f 100644 --- a/test/data/format/paramTag.md +++ b/test/data/format/paramTag.md @@ -1,4 +1,4 @@ -[test](out.md) / [](out.md) / [f](out.md) +[test](test/index) / [f](test/f) # f diff --git a/test/data/format/parenthesis.html b/test/data/format/parenthesis.html index f3328d90..c36b311b 100644 --- a/test/data/format/parenthesis.html +++ b/test/data/format/parenthesis.html @@ -3,7 +3,7 @@ <title>test / foo</title> </HEAD> <BODY> -<a href="out.html">test</a> / <a href="out.html"></a> / <a href="out.html">foo</a><br/> +<a href="test/index">test</a> / <a href="test/foo">foo</a><br/> <br/> <h1>foo</h1> <code><span class="keyword">fun </span><span class="identifier">foo</span><span class="symbol">(</span><span class="symbol">)</span><span class="symbol">: </span><span class="identifier">Unit</span></code><br/> diff --git a/test/data/format/propertyVar.md b/test/data/format/propertyVar.md index 45a77a62..f2110992 100644 --- a/test/data/format/propertyVar.md +++ b/test/data/format/propertyVar.md @@ -1,4 +1,4 @@ -[test](out.md) / [](out.md) / [x](out.md) +[test](test/index) / [x](test/x) # x diff --git a/test/data/format/see.html b/test/data/format/see.html index 42e20e35..b3ffb74b 100644 --- a/test/data/format/see.html +++ b/test/data/format/see.html @@ -2,23 +2,23 @@ <HEAD> </HEAD> <BODY> -<a href="out.html">test</a> / <a href="out.html"></a> / <a href="out.html">quux</a><br/> +<a href="test/index">test</a> / <a href="test/quux">quux</a><br/> <br/> <h1>quux</h1> <code><span class="keyword">fun </span><span class="identifier">quux</span><span class="symbol">(</span><span class="symbol">)</span><span class="symbol">: </span><span class="identifier">Unit</span></code><br/> <strong>See Also</strong><br/> -<p><a href="out.html">foo</a></p> -<p><a href="out.html">bar</a></p> +<p><a href="test/foo">foo</a></p> +<p><a href="test/bar">bar</a></p> <br/> <br/> <br/> -<a href="out.html">test</a> / <a href="out.html"></a> / <a href="out.html">foo</a><br/> +<a href="test/index">test</a> / <a href="test/foo">foo</a><br/> <br/> <h1>foo</h1> <code><span class="keyword">fun </span><span class="identifier">foo</span><span class="symbol">(</span><span class="symbol">)</span><span class="symbol">: </span><span class="identifier">Unit</span></code><br/> <br/> <br/> -<a href="out.html">test</a> / <a href="out.html"></a> / <a href="out.html">bar</a><br/> +<a href="test/index">test</a> / <a href="test/bar">bar</a><br/> <br/> <h1>bar</h1> <code><span class="keyword">fun </span><span class="identifier">bar</span><span class="symbol">(</span><span class="symbol">)</span><span class="symbol">: </span><span class="identifier">Unit</span></code><br/> diff --git a/test/data/format/throwsTag.md b/test/data/format/throwsTag.md index 9f8b75c3..d0a4e610 100644 --- a/test/data/format/throwsTag.md +++ b/test/data/format/throwsTag.md @@ -1,4 +1,4 @@ -[test](out.md) / [](out.md) / [f](out.md) +[test](test/index) / [f](test/f) # f diff --git a/test/data/format/tripleBackticks.html b/test/data/format/tripleBackticks.html index 8cd378f0..25302b04 100644 --- a/test/data/format/tripleBackticks.html +++ b/test/data/format/tripleBackticks.html @@ -3,7 +3,7 @@ <title>test / f</title> </HEAD> <BODY> -<a href="out.html">test</a> / <a href="out.html"></a> / <a href="out.html">f</a><br/> +<a href="test/index">test</a> / <a href="test/f">f</a><br/> <br/> <h1>f</h1> <code><span class="keyword">fun </span><span class="identifier">f</span><span class="symbol">(</span><span class="symbol">)</span><span class="symbol">: </span><span class="identifier">Unit</span></code><br/> diff --git a/test/data/format/typeLink.html b/test/data/format/typeLink.html index 3f83dbda..06c31454 100644 --- a/test/data/format/typeLink.html +++ b/test/data/format/typeLink.html @@ -3,10 +3,10 @@ <title>test / Bar</title> </HEAD> <BODY> -<a href="out.html">test</a> / <a href="out.html"></a> / <a href="out.html">Bar</a><br/> +<a href="test/index">test</a> / <a href="test/-bar/index">Bar</a><br/> <br/> <h1>Bar</h1> -<code><span class="keyword">class </span><span class="identifier">Bar</span><span class="symbol"> : </span><a href="out.html"><span class="identifier">Foo</span></a></code><br/> +<code><span class="keyword">class </span><span class="identifier">Bar</span><span class="symbol"> : </span><a href="test/-foo/index"><span class="identifier">Foo</span></a></code><br/> <br/> <br/> <h3>Constructors</h3> @@ -14,7 +14,7 @@ <tbody> <tr> <td> -<a href="out.html"><init></a></td> +<a href="test/-bar/-init-"><init></a></td> <td> <code><span class="keyword">public</span> <span class="identifier">Bar</span><span class="symbol">(</span><span class="symbol">)</span></code></td> </tr> diff --git a/test/data/format/typeParameterBounds.md b/test/data/format/typeParameterBounds.md index 1c779537..91fd456a 100644 --- a/test/data/format/typeParameterBounds.md +++ b/test/data/format/typeParameterBounds.md @@ -1,4 +1,4 @@ -[test](out.md) / [](out.md) / [generic](out.md) +[test](test/index) / [generic](test/generic) # generic diff --git a/test/data/format/varargsFunction.md b/test/data/format/varargsFunction.md index 04bb3d39..7a087428 100644 --- a/test/data/format/varargsFunction.md +++ b/test/data/format/varargsFunction.md @@ -1,4 +1,4 @@ -[test](out.md) / [](out.md) / [f](out.md) +[test](test/index) / [f](test/f) # f diff --git a/test/src/TestAPI.kt b/test/src/TestAPI.kt index 95fe655e..d47770f8 100644 --- a/test/src/TestAPI.kt +++ b/test/src/TestAPI.kt @@ -99,8 +99,12 @@ fun ContentNode.toTestString(): String { }.toString() } -val tempLocation = Location(File("/tmp/out")) +class InMemoryLocation(override val path: String): Location { + override fun relativePathTo(other: Location, extension: String): String = other.path +} object InMemoryLocationService: LocationService { - override fun location(node: DocumentationNode) = tempLocation; + override fun location(node: DocumentationNode) = InMemoryLocation(relativePathToNode(node)); } + +val tempLocation = InMemoryLocation("") |