aboutsummaryrefslogtreecommitdiff
path: root/src/Formats
diff options
context:
space:
mode:
authorIlya Ryzhenkov <orangy@jetbrains.com>2014-10-03 22:51:44 +0400
committerIlya Ryzhenkov <orangy@jetbrains.com>2014-10-03 22:51:44 +0400
commit71cd87e239ba4ba846eb5da04e45a451b8a840cb (patch)
treea95a0c385c72b0ba20b2b775a460cc87bc51531c /src/Formats
parentb642b7c35e63729303094483dc2d176ec5ce7a7d (diff)
downloaddokka-71cd87e239ba4ba846eb5da04e45a451b8a840cb.tar.gz
dokka-71cd87e239ba4ba846eb5da04e45a451b8a840cb.tar.bz2
dokka-71cd87e239ba4ba846eb5da04e45a451b8a840cb.zip
Resolve links in docs.
Diffstat (limited to 'src/Formats')
-rw-r--r--src/Formats/HtmlFormatService.kt4
-rw-r--r--src/Formats/MarkdownFormatService.kt6
-rw-r--r--src/Formats/StructuredFormatService.kt5
3 files changed, 14 insertions, 1 deletions
diff --git a/src/Formats/HtmlFormatService.kt b/src/Formats/HtmlFormatService.kt
index 06b41518..20cd4f83 100644
--- a/src/Formats/HtmlFormatService.kt
+++ b/src/Formats/HtmlFormatService.kt
@@ -81,6 +81,10 @@ public open class HtmlFormatService(locationService: LocationService,
return "<a href=\"${location.path}\">${text}</a>"
}
+ override fun formatLink(text: String, href: String): String {
+ return "<a href=\"${href}\">${text}</a>"
+ }
+
override fun formatBold(text: String): String {
return "<b>${text}</b>"
}
diff --git a/src/Formats/MarkdownFormatService.kt b/src/Formats/MarkdownFormatService.kt
index cb1d713c..bbe0d7be 100644
--- a/src/Formats/MarkdownFormatService.kt
+++ b/src/Formats/MarkdownFormatService.kt
@@ -35,7 +35,11 @@ public open class MarkdownFormatService(locationService: LocationService,
}
override public fun formatLink(text: String, location: Location): String {
- return "[${text}](${location.path})"
+ return "[$text](${location.path})"
+ }
+
+ override fun formatLink(text: String, href: String): String {
+ return "[$text]($href)"
}
override public fun appendLine(to: StringBuilder) {
diff --git a/src/Formats/StructuredFormatService.kt b/src/Formats/StructuredFormatService.kt
index b974dcf8..df11b835 100644
--- a/src/Formats/StructuredFormatService.kt
+++ b/src/Formats/StructuredFormatService.kt
@@ -25,6 +25,7 @@ public abstract class StructuredFormatService(val locationService: LocationServi
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 abstract fun formatBold(text: String): String
public abstract fun formatCode(code: String): String
@@ -47,6 +48,10 @@ public abstract class StructuredFormatService(val locationService: LocationServi
val linkText = formatText(location, content.children)
append(formatLink(linkText, linkTo))
}
+ is ContentExternalLink -> {
+ val linkText = formatText(location, content.children)
+ append(formatLink(linkText, content.href))
+ }
else -> append(formatText(location, content.children))
}
}.toString()