aboutsummaryrefslogtreecommitdiffstats
path: root/sonar-markdown/src
diff options
context:
space:
mode:
authorFreddy Mallet <freddy.mallet@gmail.com>2011-04-26 16:21:59 +0200
committerFreddy Mallet <freddy.mallet@gmail.com>2011-04-26 16:21:59 +0200
commitcb7d0ffc0a45a23674064a956414763372dba86d (patch)
tree249f5d1b19fc8318db077da628c67b23d77ef4ea /sonar-markdown/src
parent43888ce6c210e5502bf8bb52e5762906aa50c70c (diff)
downloadsonarqube-cb7d0ffc0a45a23674064a956414763372dba86d.tar.gz
sonarqube-cb7d0ffc0a45a23674064a956414763372dba86d.zip
SONAR-2384 Fix a bug on HtmlListChannel which was due to CodeBuffer.length() method and make the HtmlEmphasisChannel handle sentence
Diffstat (limited to 'sonar-markdown/src')
-rw-r--r--sonar-markdown/src/main/java/org/sonar/markdown/HtmlEmphasisChannel.java2
-rw-r--r--sonar-markdown/src/test/java/org/sonar/markdown/MarkdownEngineTest.java6
2 files changed, 3 insertions, 5 deletions
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 392a37aa345..d59b3f3adb2 100644
--- a/sonar-markdown/src/main/java/org/sonar/markdown/HtmlEmphasisChannel.java
+++ b/sonar-markdown/src/main/java/org/sonar/markdown/HtmlEmphasisChannel.java
@@ -29,7 +29,7 @@ import org.sonar.channel.RegexChannel;
class HtmlEmphasisChannel extends RegexChannel<MarkdownOutput> {
public HtmlEmphasisChannel() {
- super("\\*[^\n\r\\*\\s]++\\*");
+ super("\\*[^\\s\\*][^\n\r]+?[^\\s\\*]\\*");
}
@Override
diff --git a/sonar-markdown/src/test/java/org/sonar/markdown/MarkdownEngineTest.java b/sonar-markdown/src/test/java/org/sonar/markdown/MarkdownEngineTest.java
index 9579828af9b..cf4a0f1b726 100644
--- a/sonar-markdown/src/test/java/org/sonar/markdown/MarkdownEngineTest.java
+++ b/sonar-markdown/src/test/java/org/sonar/markdown/MarkdownEngineTest.java
@@ -39,6 +39,7 @@ public class MarkdownEngineTest {
@Test
public void shouldDecorateList() {
assertThat(MarkdownEngine.convertToHtml(" * one\r* two\r\n* three\n * \n *five"), is("<ul><li>one</li>\r<li>two</li>\r\n<li>three</li>\n<li> </li>\n</ul> *five"));
+ assertThat(MarkdownEngine.convertToHtml(" * one\r* two"), is("<ul><li>one</li>\r<li>two</li></ul>"));
}
@Test
@@ -56,10 +57,7 @@ public class MarkdownEngineTest {
assertThat(MarkdownEngine.convertToHtml("Not *emphase * because of whitespace"), is("Not *emphase * because of whitespace"));
assertThat(MarkdownEngine.convertToHtml("Not * emphase* because of whitespace"), is("Not * emphase* because of whitespace"));
assertThat(MarkdownEngine.convertToHtml("emphase*inside*word"), is("emphase<em>inside</em>word"));
-
- // not supported yet
- // assertThat(MarkdownEngine.convertToHtml("\\*surrounded by literal asterisks\\*"), is("\\*surrounded by literal asterisks\\*"));
-
+ assertThat(MarkdownEngine.convertToHtml("*Emphase many words*"), is("<em>Emphase many words</em>"));
}
@Test