From d4c6dff219bdf98411f1cb9422aa2c1bfd83abb2 Mon Sep 17 00:00:00 2001 From: Laurent Mihalkovic Date: Mon, 1 Feb 2016 12:22:20 +0100 Subject: [PATCH] SONAR-7010 Markdown engine generates wrong html tag for bold text --- .../java/org/sonar/server/text/RubyTextServiceTest.java | 2 +- .../ws/SearchActionMediumTest/issue_with_comments.json | 2 +- .../issue/ws/ShowActionTest/show_issue_with_comments.json | 2 +- .../get_note_as_markdown_and_html.json | 2 +- .../ws/SearchActionMediumTest/search_2_rules_fields.json | 2 +- .../server/rule/ws/ShowActionMediumTest/show_rule.json | 2 +- .../main/java/org/sonar/markdown/HtmlEmphasisChannel.java | 4 ++-- .../src/test/java/org/sonar/markdown/MarkdownTest.java | 8 ++++---- 8 files changed, 12 insertions(+), 12 deletions(-) diff --git a/server/sonar-server/src/test/java/org/sonar/server/text/RubyTextServiceTest.java b/server/sonar-server/src/test/java/org/sonar/server/text/RubyTextServiceTest.java index 82c46dab8b2..80d151efc86 100644 --- a/server/sonar-server/src/test/java/org/sonar/server/text/RubyTextServiceTest.java +++ b/server/sonar-server/src/test/java/org/sonar/server/text/RubyTextServiceTest.java @@ -40,7 +40,7 @@ public class RubyTextServiceTest { @Test public void markdownToHtml() { String html = text.markdownToHtml("some *markdown*"); - assertThat(html).isEqualTo("some markdown"); + assertThat(html).isEqualTo("some markdown"); } @Test diff --git a/server/sonar-server/src/test/resources/org/sonar/server/issue/ws/SearchActionMediumTest/issue_with_comments.json b/server/sonar-server/src/test/resources/org/sonar/server/issue/ws/SearchActionMediumTest/issue_with_comments.json index 09515d61e50..f88d1338b27 100644 --- a/server/sonar-server/src/test/resources/org/sonar/server/issue/ws/SearchActionMediumTest/issue_with_comments.json +++ b/server/sonar-server/src/test/resources/org/sonar/server/issue/ws/SearchActionMediumTest/issue_with_comments.json @@ -8,7 +8,7 @@ { "key": "COMMENT-ABCD", "login": "john", - "htmlText": "\u003cem\u003eMy comment\u003c/em\u003e", + "htmlText": "\u003cstrong\u003eMy comment\u003c/strong\u003e", "markdown": "*My comment*", "updatable": true, "createdAt": "2014-09-09T12:00:00+0000" diff --git a/server/sonar-server/src/test/resources/org/sonar/server/issue/ws/ShowActionTest/show_issue_with_comments.json b/server/sonar-server/src/test/resources/org/sonar/server/issue/ws/ShowActionTest/show_issue_with_comments.json index 8c143219aa2..e6c86120a6a 100644 --- a/server/sonar-server/src/test/resources/org/sonar/server/issue/ws/ShowActionTest/show_issue_with_comments.json +++ b/server/sonar-server/src/test/resources/org/sonar/server/issue/ws/ShowActionTest/show_issue_with_comments.json @@ -17,7 +17,7 @@ "key": "COMMENT-ABCD", "userName": "John", "raw": "*My comment*", - "html": "My comment", + "html": "My comment", "createdAt": "2014-02-22T19:10:03+0100", "fCreatedAge": "9 days", "updatable": false diff --git a/server/sonar-server/src/test/resources/org/sonar/server/rule/ws/SearchActionMediumTest/get_note_as_markdown_and_html.json b/server/sonar-server/src/test/resources/org/sonar/server/rule/ws/SearchActionMediumTest/get_note_as_markdown_and_html.json index b4a4ecd5153..68a29b47e65 100644 --- a/server/sonar-server/src/test/resources/org/sonar/server/rule/ws/SearchActionMediumTest/get_note_as_markdown_and_html.json +++ b/server/sonar-server/src/test/resources/org/sonar/server/rule/ws/SearchActionMediumTest/get_note_as_markdown_and_html.json @@ -3,7 +3,7 @@ "rules": [ { "key": "xoo:x1", - "htmlNote": "this is bold", + "htmlNote": "this is bold", "mdNote": "this is *bold*" } ]} diff --git a/server/sonar-server/src/test/resources/org/sonar/server/rule/ws/SearchActionMediumTest/search_2_rules_fields.json b/server/sonar-server/src/test/resources/org/sonar/server/rule/ws/SearchActionMediumTest/search_2_rules_fields.json index 0dcbe93c49f..6ae36b21898 100644 --- a/server/sonar-server/src/test/resources/org/sonar/server/rule/ws/SearchActionMediumTest/search_2_rules_fields.json +++ b/server/sonar-server/src/test/resources/org/sonar/server/rule/ws/SearchActionMediumTest/search_2_rules_fields.json @@ -7,7 +7,7 @@ "key": "xoo:x2", "name": "Rule x2", "mdDesc": "A *Xoo* rule", - "htmlDesc": "A Xoo rule" + "htmlDesc": "A Xoo rule" }, { "key": "xoo:x1", diff --git a/server/sonar-server/src/test/resources/org/sonar/server/rule/ws/ShowActionMediumTest/show_rule.json b/server/sonar-server/src/test/resources/org/sonar/server/rule/ws/ShowActionMediumTest/show_rule.json index a80d4e3fb39..8712b74c2b7 100644 --- a/server/sonar-server/src/test/resources/org/sonar/server/rule/ws/ShowActionMediumTest/show_rule.json +++ b/server/sonar-server/src/test/resources/org/sonar/server/rule/ws/ShowActionMediumTest/show_rule.json @@ -13,7 +13,7 @@ "params": [ { "key": "regex", - "htmlDesc": "Reg exp", + "htmlDesc": "Reg exp", "defaultValue": ".*" } ] diff --git a/sonar-markdown/src/main/java/org/sonar/markdown/HtmlEmphasisChannel.java b/sonar-markdown/src/main/java/org/sonar/markdown/HtmlEmphasisChannel.java index d400800b9cd..6990608a496 100644 --- a/sonar-markdown/src/main/java/org/sonar/markdown/HtmlEmphasisChannel.java +++ b/sonar-markdown/src/main/java/org/sonar/markdown/HtmlEmphasisChannel.java @@ -34,8 +34,8 @@ class HtmlEmphasisChannel extends RegexChannel { @Override protected void consume(CharSequence token, MarkdownOutput output) { - output.append(""); + output.append(""); output.append(token.subSequence(1, token.length() - 1)); - output.append(""); + output.append(""); } } diff --git a/sonar-markdown/src/test/java/org/sonar/markdown/MarkdownTest.java b/sonar-markdown/src/test/java/org/sonar/markdown/MarkdownTest.java index 8a538d08ed9..314e924c0a0 100644 --- a/sonar-markdown/src/test/java/org/sonar/markdown/MarkdownTest.java +++ b/sonar-markdown/src/test/java/org/sonar/markdown/MarkdownTest.java @@ -101,14 +101,14 @@ public class MarkdownTest { @Test public void shouldEmphaseText() { - assertThat(Markdown.convertToHtml("This is *important*")).isEqualTo("This is important"); + assertThat(Markdown.convertToHtml("This is *important*")).isEqualTo("This is important"); assertThat(Markdown.convertToHtml("This should not be * \n emphase")).isEqualTo("This should not be *
emphase"); - assertThat(Markdown.convertToHtml("This is *very* very *important*")).isEqualTo("This is very very important"); + assertThat(Markdown.convertToHtml("This is *very* very *important*")).isEqualTo("This is very very important"); assertThat(Markdown.convertToHtml("Not * emphase * because of whitespaces")).isEqualTo("Not * emphase * because of whitespaces"); assertThat(Markdown.convertToHtml("Not *emphase * because of whitespace")).isEqualTo("Not *emphase * because of whitespace"); assertThat(Markdown.convertToHtml("Not * emphase* because of whitespace")).isEqualTo("Not * emphase* because of whitespace"); - assertThat(Markdown.convertToHtml("emphase*inside*word")).isEqualTo("emphaseinsideword"); - assertThat(Markdown.convertToHtml("*Emphase many words*")).isEqualTo("Emphase many words"); + assertThat(Markdown.convertToHtml("emphase*inside*word")).isEqualTo("emphaseinsideword"); + assertThat(Markdown.convertToHtml("*Emphase many words*")).isEqualTo("Emphase many words"); } @Test -- 2.39.5