diff options
-rw-r--r-- | lib/markdown.jar | bin | 200024 -> 200967 bytes | |||
-rw-r--r-- | src/Formats/StructuredFormatService.kt | 2 | ||||
-rw-r--r-- | src/Kotlin/ContentBuilder.kt | 4 | ||||
-rw-r--r-- | src/Model/Content.kt | 1 | ||||
-rw-r--r-- | test/data/format/entity.html | 26 | ||||
-rw-r--r-- | test/data/format/entity.kt | 4 | ||||
-rw-r--r-- | test/src/format/HtmlFormatTest.kt | 7 |
7 files changed, 44 insertions, 0 deletions
diff --git a/lib/markdown.jar b/lib/markdown.jar Binary files differindex 5a7db1ed..643f33af 100644 --- a/lib/markdown.jar +++ b/lib/markdown.jar diff --git a/src/Formats/StructuredFormatService.kt b/src/Formats/StructuredFormatService.kt index cc551eb4..0e01db4d 100644 --- a/src/Formats/StructuredFormatService.kt +++ b/src/Formats/StructuredFormatService.kt @@ -32,6 +32,7 @@ public abstract class StructuredFormatService(locationService: LocationService, public abstract fun formatSymbol(text: String): String public abstract fun formatKeyword(text: String): String public abstract fun formatIdentifier(text: String, kind: IdentifierKind): String + public fun formatEntity(text: String): String = text 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 @@ -56,6 +57,7 @@ public abstract class StructuredFormatService(locationService: LocationService, is ContentKeyword -> append(formatKeyword(content.text)) is ContentIdentifier -> append(formatIdentifier(content.text, content.kind)) is ContentNonBreakingSpace -> append(formatNonBreakingSpace()) + is ContentEntity -> append(formatEntity(content.text)) is ContentStrong -> append(formatStrong(formatText(location, content.children))) is ContentStrikethrough -> append(formatStrikethrough(formatText(location, content.children))) is ContentCode -> append(formatCode(formatText(location, content.children))) diff --git a/src/Kotlin/ContentBuilder.kt b/src/Kotlin/ContentBuilder.kt index 8e75e473..cc519ee6 100644 --- a/src/Kotlin/ContentBuilder.kt +++ b/src/Kotlin/ContentBuilder.kt @@ -102,6 +102,10 @@ public fun buildContentTo(tree: MarkdownNode, target: ContentBlock, linkResolver parent.append(nodeStack.pop()) } + MarkdownTokenTypes.HTML_ENTITY -> { + parent.append(ContentEntity(node.text)) + } + MarkdownTokenTypes.TEXT, MarkdownTokenTypes.COLON, MarkdownTokenTypes.DOUBLE_QUOTE, diff --git a/src/Model/Content.kt b/src/Model/Content.kt index d9c3d139..b9d67d5b 100644 --- a/src/Model/Content.kt +++ b/src/Model/Content.kt @@ -37,6 +37,7 @@ public data class ContentText(val text: String) : ContentNode() public data class ContentKeyword(val text: String) : ContentNode() public data class ContentIdentifier(val text: String, val kind: IdentifierKind = IdentifierKind.Other) : ContentNode() public data class ContentSymbol(val text: String) : ContentNode() +public data class ContentEntity(val text: String) : ContentNode() public object ContentNonBreakingSpace: ContentNode() public class ContentParagraph() : ContentBlock() diff --git a/test/data/format/entity.html b/test/data/format/entity.html new file mode 100644 index 00000000..b9a1b89b --- /dev/null +++ b/test/data/format/entity.html @@ -0,0 +1,26 @@ +<HTML> +<HEAD> +<title>test / Bar</title> +</HEAD> +<BODY> +<a href="test/index">test</a> / <a href="test/-bar/index">Bar</a><br/> +<br/> +<h1>Bar</h1> +<code><span class="keyword">class </span><span class="identifier">Bar</span></code><br/> +<p>Copyright © JetBrains 2015</p> +<br/> +<br/> +<h3>Constructors</h3> +<table> +<tbody> +<tr> +<td> +<a href="test/-bar/-init-"><init></a></td> +<td> +<code><span class="identifier">Bar</span><span class="symbol">(</span><span class="symbol">)</span></code><p>Copyright © JetBrains 2015</p> +</td> +</tr> +</tbody> +</table> +</BODY> +</HTML> diff --git a/test/data/format/entity.kt b/test/data/format/entity.kt new file mode 100644 index 00000000..dc860d9e --- /dev/null +++ b/test/data/format/entity.kt @@ -0,0 +1,4 @@ +/** + * Copyright © JetBrains 2015 + */ +class Bar {} diff --git a/test/src/format/HtmlFormatTest.kt b/test/src/format/HtmlFormatTest.kt index f8afab8f..fb2df875 100644 --- a/test/src/format/HtmlFormatTest.kt +++ b/test/src/format/HtmlFormatTest.kt @@ -141,4 +141,11 @@ public class HtmlFormatTest { htmlService.appendNodes(tempLocation, output, model.members.single().members.filter { it.name == "Bar" }) } } + + Test fun entity() { + verifyOutput("test/data/format/entity.kt", ".html") { model, output -> + htmlService.appendNodes(tempLocation, output, model.members.single().members.filter { it.name == "Bar" }) + } + } } + |