From 4b61be354510cf88fed33860c987bd210502e91d Mon Sep 17 00:00:00 2001 From: Dmitry Jemerov Date: Thu, 26 Feb 2015 21:17:13 +0100 Subject: don't generate redundant links that lead to the same page with no anchor (e.g. receiver type in extension functions) --- src/Formats/StructuredFormatService.kt | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) (limited to 'src/Formats') diff --git a/src/Formats/StructuredFormatService.kt b/src/Formats/StructuredFormatService.kt index 70b2a3c1..dd23b7b3 100644 --- a/src/Formats/StructuredFormatService.kt +++ b/src/Formats/StructuredFormatService.kt @@ -61,11 +61,19 @@ public abstract class StructuredFormatService(locationService: LocationService, val node = content.node val linkTo = if (node != null) locationHref(location, node) else "#" val linkText = formatText(location, content.children) - append(formatLink(linkText, linkTo)) + if (linkTo == ".") { + append(linkText) + } else { + append(formatLink(linkText, linkTo)) + } } is ContentExternalLink -> { val linkText = formatText(location, content.children) - append(formatLink(linkText, content.href)) + if (content.href == ".") { + append(linkText) + } else { + append(formatLink(linkText, content.href)) + } } is ContentParagraph -> { appendParagraph(this, formatText(location, content.children)) -- cgit