diff options
| author | Dmitry Jemerov <yole@jetbrains.com> | 2015-02-26 21:34:27 +0100 |
|---|---|---|
| committer | Dmitry Jemerov <yole@jetbrains.com> | 2015-02-26 21:34:27 +0100 |
| commit | 4494fd064900fc9ddd9766eed581980c2e360e96 (patch) | |
| tree | 7f953cc7b8d7d99bb7d64de495303d31b2ec39eb /src/Formats | |
| parent | 4b61be354510cf88fed33860c987bd210502e91d (diff) | |
| download | dokka-4494fd064900fc9ddd9766eed581980c2e360e96.tar.gz dokka-4494fd064900fc9ddd9766eed581980c2e360e96.tar.bz2 dokka-4494fd064900fc9ddd9766eed581980c2e360e96.zip | |
allow applying different styles to different kinds of identifiers
Diffstat (limited to 'src/Formats')
| -rw-r--r-- | src/Formats/HtmlFormatService.kt | 2 | ||||
| -rw-r--r-- | src/Formats/KotlinWebsiteFormatService.kt | 11 | ||||
| -rw-r--r-- | src/Formats/MarkdownFormatService.kt | 2 | ||||
| -rw-r--r-- | src/Formats/StructuredFormatService.kt | 4 |
4 files changed, 12 insertions, 7 deletions
diff --git a/src/Formats/HtmlFormatService.kt b/src/Formats/HtmlFormatService.kt index a3cea96a..fee21738 100644 --- a/src/Formats/HtmlFormatService.kt +++ b/src/Formats/HtmlFormatService.kt @@ -18,7 +18,7 @@ public open class HtmlFormatService(locationService: LocationService, return "<span class=\"keyword\">${formatText(text)}</span>" } - override fun formatIdentifier(text: String): String { + override fun formatIdentifier(text: String, kind: IdentifierKind): String { return "<span class=\"identifier\">${formatText(text)}</span>" } diff --git a/src/Formats/KotlinWebsiteFormatService.kt b/src/Formats/KotlinWebsiteFormatService.kt index a009132b..01df0501 100644 --- a/src/Formats/KotlinWebsiteFormatService.kt +++ b/src/Formats/KotlinWebsiteFormatService.kt @@ -81,7 +81,12 @@ public class KotlinWebsiteFormatService(locationService: LocationService, return "<span class=\"keyword\">${formatText(text)}</span>" } - override fun formatIdentifier(text: String): String { - return "<span class=\"identifier\">${formatText(text)}</span>" + override fun formatIdentifier(text: String, kind: IdentifierKind): String { + return "<span class=\"${identifierClassName(kind)}\">${formatText(text)}</span>" } -}
\ No newline at end of file + + private fun identifierClassName(kind: IdentifierKind) = when(kind) { + IdentifierKind.ParameterName -> "parameterName" + else -> "identifier" + } +} diff --git a/src/Formats/MarkdownFormatService.kt b/src/Formats/MarkdownFormatService.kt index c3f4f469..cc7d7170 100644 --- a/src/Formats/MarkdownFormatService.kt +++ b/src/Formats/MarkdownFormatService.kt @@ -19,7 +19,7 @@ public open class MarkdownFormatService(locationService: LocationService, override fun formatKeyword(text: String): String { return text.htmlEscape() } - override fun formatIdentifier(text: String): String { + override fun formatIdentifier(text: String, kind: IdentifierKind): String { return text.htmlEscape() } diff --git a/src/Formats/StructuredFormatService.kt b/src/Formats/StructuredFormatService.kt index dd23b7b3..be647e49 100644 --- a/src/Formats/StructuredFormatService.kt +++ b/src/Formats/StructuredFormatService.kt @@ -26,7 +26,7 @@ public abstract class StructuredFormatService(locationService: LocationService, public abstract fun formatText(text: String): String public abstract fun formatSymbol(text: String): String public abstract fun formatKeyword(text: String): String - public abstract fun formatIdentifier(text: String): String + public abstract fun formatIdentifier(text: String, kind: IdentifierKind): String public abstract fun formatLink(text: String, href: String): String public open fun formatLink(link: FormatLink): String = formatLink(formatText(link.text), link.href) public abstract fun formatStrong(text: String): String @@ -48,7 +48,7 @@ public abstract class StructuredFormatService(locationService: LocationService, is ContentText -> append(formatText(content.text)) is ContentSymbol -> append(formatSymbol(content.text)) is ContentKeyword -> append(formatKeyword(content.text)) - is ContentIdentifier -> append(formatIdentifier(content.text)) + is ContentIdentifier -> append(formatIdentifier(content.text, content.kind)) is ContentNonBreakingSpace -> append(formatNonBreakingSpace()) is ContentStrong -> append(formatStrong(formatText(location, content.children))) is ContentStrikethrough -> append(formatStrikethrough(formatText(location, content.children))) |
