diff options
author | Freddy Mallet <freddy.mallet@gmail.com> | 2011-04-27 23:58:01 +0200 |
---|---|---|
committer | Freddy Mallet <freddy.mallet@gmail.com> | 2011-04-27 23:58:01 +0200 |
commit | ffdc8908a25b4f5e071c1797d0bf7b40a9f9d8d5 (patch) | |
tree | e04f1b70573262b55883a6953975c7e95f2e4ddd /sonar-markdown/src | |
parent | f4e12a9527a48da48784dce1345f1014509c19e9 (diff) | |
download | sonarqube-ffdc8908a25b4f5e071c1797d0bf7b40a9f9d8d5.tar.gz sonarqube-ffdc8908a25b4f5e071c1797d0bf7b40a9f9d8d5.zip |
SONAR-2384 append target='_blank' when building an hyperlink
Diffstat (limited to 'sonar-markdown/src')
-rw-r--r-- | sonar-markdown/src/main/java/org/sonar/markdown/HtmlUrlChannel.java | 2 | ||||
-rw-r--r-- | sonar-markdown/src/test/java/org/sonar/markdown/MarkdownEngineTest.java | 8 |
2 files changed, 6 insertions, 4 deletions
diff --git a/sonar-markdown/src/main/java/org/sonar/markdown/HtmlUrlChannel.java b/sonar-markdown/src/main/java/org/sonar/markdown/HtmlUrlChannel.java index 2158c428f00..5a8522399ea 100644 --- a/sonar-markdown/src/main/java/org/sonar/markdown/HtmlUrlChannel.java +++ b/sonar-markdown/src/main/java/org/sonar/markdown/HtmlUrlChannel.java @@ -33,6 +33,6 @@ class HtmlUrlChannel extends RegexChannel<MarkdownOutput> { @Override protected void consume(CharSequence token, MarkdownOutput output) { - output.append("<a href=\"" + token + "\">" + token + "</a>"); + output.append("<a href=\"" + token + "\" target=\"_blank\">" + token + "</a>"); } } 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 123c64c9360..b1979254828 100644 --- a/sonar-markdown/src/test/java/org/sonar/markdown/MarkdownEngineTest.java +++ b/sonar-markdown/src/test/java/org/sonar/markdown/MarkdownEngineTest.java @@ -28,17 +28,19 @@ public class MarkdownEngineTest { @Test public void shouldDecorateUrl() { - assertThat(MarkdownEngine.convertToHtml("http://google.com"), is("<a href=\"http://google.com\">http://google.com</a>")); + assertThat(MarkdownEngine.convertToHtml("http://google.com"), + is("<a href=\"http://google.com\" target=\"_blank\">http://google.com</a>")); } @Test public void shouldDecorateEndOfLine() { assertThat(MarkdownEngine.convertToHtml("1\r2\r\n3\n"), is("1<br/>2<br/>3<br/>")); } - + @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\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>")); } |