From 732f8aac1eb6b2c137fdf81d9d670a30d0f8b9ea Mon Sep 17 00:00:00 2001 From: Andrey Tyrin Date: Wed, 10 Aug 2022 17:43:33 +0300 Subject: Support Var html tag for Javadoc (#2617) Fixes #2358 --- plugins/base/src/main/kotlin/renderers/html/HtmlRenderer.kt | 1 + .../main/kotlin/transformers/pages/comments/DocTagToContentConverter.kt | 1 + plugins/base/src/main/kotlin/translators/psi/parsers/JavadocParser.kt | 1 + 3 files changed, 3 insertions(+) (limited to 'plugins/base/src/main/kotlin') diff --git a/plugins/base/src/main/kotlin/renderers/html/HtmlRenderer.kt b/plugins/base/src/main/kotlin/renderers/html/HtmlRenderer.kt index 53645f06..55afef80 100644 --- a/plugins/base/src/main/kotlin/renderers/html/HtmlRenderer.kt +++ b/plugins/base/src/main/kotlin/renderers/html/HtmlRenderer.kt @@ -777,6 +777,7 @@ open class HtmlRenderer( TextStyle.Italic -> i { body() } TextStyle.Strikethrough -> strike { body() } TextStyle.Strong -> strong { body() } + TextStyle.Var -> htmlVar { body() } is TokenStyle -> span("token " + styleToApply.toString().toLowerCase()) { body() } else -> body() } diff --git a/plugins/base/src/main/kotlin/transformers/pages/comments/DocTagToContentConverter.kt b/plugins/base/src/main/kotlin/transformers/pages/comments/DocTagToContentConverter.kt index b46a7679..1c447e9e 100644 --- a/plugins/base/src/main/kotlin/transformers/pages/comments/DocTagToContentConverter.kt +++ b/plugins/base/src/main/kotlin/transformers/pages/comments/DocTagToContentConverter.kt @@ -254,6 +254,7 @@ open class DocTagToContentConverter : CommentsToContentConverter { extra = extras ) ) + is Var -> buildChildren(docTag, setOf(TextStyle.Var)) else -> buildChildren(docTag) } diff --git a/plugins/base/src/main/kotlin/translators/psi/parsers/JavadocParser.kt b/plugins/base/src/main/kotlin/translators/psi/parsers/JavadocParser.kt index ce0d2ff3..7dc8e3a0 100644 --- a/plugins/base/src/main/kotlin/translators/psi/parsers/JavadocParser.kt +++ b/plugins/base/src/main/kotlin/translators/psi/parsers/JavadocParser.kt @@ -424,6 +424,7 @@ class JavadocParser( "h1" -> ifChildrenPresent { H1(children) } "h2" -> ifChildrenPresent { H2(children) } "h3" -> ifChildrenPresent { H3(children) } + "var" -> ifChildrenPresent { Var(children) } else -> listOf(Text(body = element.ownText())) } } -- cgit