diff options
Diffstat (limited to 'plugins/base/src/main/kotlin/resolvers/local')
-rw-r--r-- | plugins/base/src/main/kotlin/resolvers/local/LocationProvider.kt | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/plugins/base/src/main/kotlin/resolvers/local/LocationProvider.kt b/plugins/base/src/main/kotlin/resolvers/local/LocationProvider.kt index 3775e94e..0a095153 100644 --- a/plugins/base/src/main/kotlin/resolvers/local/LocationProvider.kt +++ b/plugins/base/src/main/kotlin/resolvers/local/LocationProvider.kt @@ -1,5 +1,6 @@ package org.jetbrains.dokka.base.resolvers.local +import org.jetbrains.dokka.DokkaException import org.jetbrains.dokka.links.DRI import org.jetbrains.dokka.model.DisplaySourceSet import org.jetbrains.dokka.pages.PageNode @@ -10,3 +11,11 @@ interface LocationProvider { fun pathToRoot(from: PageNode): String fun ancestors(node: PageNode): List<PageNode> } + +fun LocationProvider.resolveOrThrow(dri: DRI, sourceSets: Set<DisplaySourceSet>, context: PageNode? = null): String = + resolve(dri = dri, sourceSets = sourceSets, context = context) + ?: throw DokkaException("Cannot resolve path for $dri") + +fun LocationProvider.resolveOrThrow(node: PageNode, context: PageNode? = null, skipExtension: Boolean = false): String = + resolve(node = node, context = context, skipExtension = skipExtension) + ?: throw DokkaException("Cannot resolve path for ${node.name}") |