]> source.dussan.org Git - sonarqube.git/commitdiff
SONAR-7010 Markdown engine generates wrong html tag for bold text
authorLaurent Mihalkovic <laurent.mihalkovic@gmail.com>
Mon, 1 Feb 2016 11:22:20 +0000 (12:22 +0100)
committerSimon Brandhof <simon.brandhof@sonarsource.com>
Thu, 25 Feb 2016 09:53:03 +0000 (10:53 +0100)
server/sonar-server/src/test/java/org/sonar/server/text/RubyTextServiceTest.java
server/sonar-server/src/test/resources/org/sonar/server/issue/ws/SearchActionMediumTest/issue_with_comments.json
server/sonar-server/src/test/resources/org/sonar/server/issue/ws/ShowActionTest/show_issue_with_comments.json
server/sonar-server/src/test/resources/org/sonar/server/rule/ws/SearchActionMediumTest/get_note_as_markdown_and_html.json
server/sonar-server/src/test/resources/org/sonar/server/rule/ws/SearchActionMediumTest/search_2_rules_fields.json
server/sonar-server/src/test/resources/org/sonar/server/rule/ws/ShowActionMediumTest/show_rule.json
sonar-markdown/src/main/java/org/sonar/markdown/HtmlEmphasisChannel.java
sonar-markdown/src/test/java/org/sonar/markdown/MarkdownTest.java

index 82c46dab8b21b0f9a205c03cf62cc58be9771c77..80d151efc860bc5cb173bbe1bc3e4971c7e6b0cf 100644 (file)
@@ -40,7 +40,7 @@ public class RubyTextServiceTest {
   @Test
   public void markdownToHtml() {
     String html = text.markdownToHtml("some *markdown*");
-    assertThat(html).isEqualTo("some <em>markdown</em>");
+    assertThat(html).isEqualTo("some <strong>markdown</strong>");
   }
 
   @Test
index 09515d61e50214bf029d4da9b7fdd008b0edf3aa..f88d1338b2778067d5ab96d8be07386f341fe7ca 100644 (file)
@@ -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"
index 8c143219aa25ce5f130187c99c5b1c73f20581f7..e6c86120a6ac5cda8c36a269d96737ad295ff6b8 100644 (file)
@@ -17,7 +17,7 @@
         "key": "COMMENT-ABCD",
         "userName": "John",
         "raw": "*My comment*",
-        "html": "<em>My comment</em>",
+        "html": "<strong>My comment</strong>",
         "createdAt": "2014-02-22T19:10:03+0100",
         "fCreatedAge": "9 days",
         "updatable": false
index b4a4ecd515345cc939cd72db4dc0d499a655e869..68a29b47e6552bcd4d81702079b5a61e21a7cb2d 100644 (file)
@@ -3,7 +3,7 @@
   "rules": [
     {
       "key": "xoo:x1",
-      "htmlNote": "this is <em>bold</em>",
+      "htmlNote": "this is <strong>bold</strong>",
       "mdNote": "this is *bold*"
     }
   ]}
index 0dcbe93c49f5f5ce6f592bc7e9cdebce72be90f0..6ae36b21898e1e5e8aa50852afc223bf120cacc4 100644 (file)
@@ -7,7 +7,7 @@
       "key": "xoo:x2",
       "name": "Rule x2",
       "mdDesc": "A *Xoo* rule",
-      "htmlDesc": "A <em>Xoo</em> rule"
+      "htmlDesc": "A <strong>Xoo</strong> rule"
     },
     {
       "key": "xoo:x1",
index a80d4e3fb397ab74730a6b2fdafdaa47a2403dea..8712b74c2b77612f2536dca17b9f4b538b966c64 100644 (file)
@@ -13,7 +13,7 @@
     "params": [
       {
         "key": "regex",
-        "htmlDesc": "Reg <em>exp</em>",
+        "htmlDesc": "Reg <strong>exp</strong>",
         "defaultValue": ".*"
       }
     ]
index d400800b9cd2d37eb893fe13e47d55cd612efeb6..6990608a49653474347afa3db6c5087c2c207095 100644 (file)
@@ -34,8 +34,8 @@ class HtmlEmphasisChannel extends RegexChannel<MarkdownOutput> {
 
   @Override
   protected void consume(CharSequence token, MarkdownOutput output) {
-    output.append("<em>");
+    output.append("<strong>");
     output.append(token.subSequence(1, token.length() - 1));
-    output.append("</em>");
+    output.append("</strong>");
   }
 }
index 8a538d08ed97277e3e0a9fa98680468a8f1ac194..314e924c0a06f27827d07c436386a1a35b756ce1 100644 (file)
@@ -101,14 +101,14 @@ public class MarkdownTest {
 
   @Test
   public void shouldEmphaseText() {
-    assertThat(Markdown.convertToHtml("This is *important*")).isEqualTo("This is <em>important</em>");
+    assertThat(Markdown.convertToHtml("This is *important*")).isEqualTo("This is <strong>important</strong>");
     assertThat(Markdown.convertToHtml("This should not be * \n emphase")).isEqualTo("This should not be * <br/> emphase");
-    assertThat(Markdown.convertToHtml("This is *very* very *important*")).isEqualTo("This is <em>very</em> very <em>important</em>");
+    assertThat(Markdown.convertToHtml("This is *very* very *important*")).isEqualTo("This is <strong>very</strong> very <strong>important</strong>");
     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("emphase<em>inside</em>word");
-    assertThat(Markdown.convertToHtml("*Emphase many words*")).isEqualTo("<em>Emphase many words</em>");
+    assertThat(Markdown.convertToHtml("emphase*inside*word")).isEqualTo("emphase<strong>inside</strong>word");
+    assertThat(Markdown.convertToHtml("*Emphase many words*")).isEqualTo("<strong>Emphase many words</strong>");
   }
 
   @Test