From 6146fa8b996a7d74f58ce1c926c114bc54bda0d1 Mon Sep 17 00:00:00 2001 From: Dmitry Jemerov Date: Wed, 14 Jan 2015 18:46:36 +0100 Subject: generate source links in the documentation --- src/Formats/StructuredFormatService.kt | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'src/Formats') diff --git a/src/Formats/StructuredFormatService.kt b/src/Formats/StructuredFormatService.kt index bfb69d1d..458fda35 100644 --- a/src/Formats/StructuredFormatService.kt +++ b/src/Formats/StructuredFormatService.kt @@ -121,6 +121,7 @@ public abstract class StructuredFormatService(val locationService: LocationServi appendBlockCode(to, formatText(location, languageService.render(it))) it.appendOverrides(to) it.appendDeprecation(to) + it.appendSourceLink(to) } appendLine(to, summary) appendLine(to) @@ -148,6 +149,13 @@ public abstract class StructuredFormatService(val locationService: LocationServi } } + private fun DocumentationNode.appendSourceLink(to: StringBuilder) { + val sourceUrl = details(DocumentationNode.Kind.SourceUrl).firstOrNull() + if (sourceUrl != null) { + appendLine(to, formatLink("Source", sourceUrl.name)) + } + } + fun appendLocation(location: Location, to: StringBuilder, nodes: Iterable) { val breakdownByName = nodes.groupBy { node -> node.name } for ((name, items) in breakdownByName) { -- cgit