aboutsummaryrefslogtreecommitdiff
path: root/src/Formats
diff options
context:
space:
mode:
Diffstat (limited to 'src/Formats')
-rw-r--r--src/Formats/HtmlFormatService.kt2
-rw-r--r--src/Formats/KotlinWebsiteFormatService.kt11
-rw-r--r--src/Formats/MarkdownFormatService.kt2
-rw-r--r--src/Formats/StructuredFormatService.kt4
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)))