Skip to content

Commit

Permalink
Changing <code> to <pre>
Browse files Browse the repository at this point in the history
  • Loading branch information
leocwolter committed May 7, 2012
1 parent 24bc3dd commit 3692dc0
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
Expand Up @@ -5,7 +5,7 @@
public class CodeTag implements Tag {

public String parse(String content, String options) {
return "<code class=\"" + detectLanguage(options) + "\">\n"+ content + "\n</code>";
return "<pre class=\"" + detectLanguage(options) + "\">\n"+ content + "\n</pre>";
}

private String detectLanguage(String options) {
Expand Down
Expand Up @@ -24,7 +24,7 @@ public void setUp() {
public void plainJavaCode() throws Exception {
String options = "java";
String output = new CodeTag().parse(code, options);
Assert.assertEquals("<code class=\"java\">\n" + code + "\n</code>", output);
Assert.assertEquals("<pre class=\"java\">\n" + code + "\n</pre>", output);
}

@Test
Expand All @@ -33,7 +33,7 @@ public void plainRubyCode() throws Exception {
String rubyCode = "@name = \"Gabriel\"\n" +
"puts \"Hello, \" + name";
String output = new CodeTag().parse(rubyCode, options);
Assert.assertEquals("<code class=\"ruby\">\n" + rubyCode + "\n</code>", output);
Assert.assertEquals("<pre class=\"ruby\">\n" + rubyCode + "\n</pre>", output);
}

@Test
Expand All @@ -42,7 +42,7 @@ public void noLanguageDefinedIsTreatedAsText() throws Exception {
String noParticularLanguage = "Some text explaining some new bizarre\n" +
"syntax in a very code alike way";
String output = new CodeTag().parse(noParticularLanguage, options);
Assert.assertEquals("<code class=\"text\">\n"
+ noParticularLanguage + "\n</code>", output);
Assert.assertEquals("<pre class=\"text\">\n"
+ noParticularLanguage + "\n</pre>", output);
}
}

0 comments on commit 3692dc0

Please sign in to comment.