From c7d852558302c5c4abc2eadacf42d51d5050c7f2 Mon Sep 17 00:00:00 2001 From: Vlad Ureche Date: Tue, 20 Mar 2012 01:20:52 +0100 Subject: Adapted indentation in scaladoc code blocks and fixed a pesky crash in the syntax highlighting caused by invalid chars (0x0E) in MarkupParser.scala. --- test/scaladoc/resources/code-indent.scala | 37 ++++++++++++++++++++++++++ test/scaladoc/scala/html/HtmlFactoryTest.scala | 19 ++++++++++++- 2 files changed, 55 insertions(+), 1 deletion(-) create mode 100644 test/scaladoc/resources/code-indent.scala (limited to 'test') diff --git a/test/scaladoc/resources/code-indent.scala b/test/scaladoc/resources/code-indent.scala new file mode 100644 index 0000000000..88946ffc7f --- /dev/null +++ b/test/scaladoc/resources/code-indent.scala @@ -0,0 +1,37 @@ +/** + * This is an example of indented comments: + * {{{ + * a typicial indented + * comment on multiple + * comment lines + * }}} + * {{{ one liner }}} + * {{{ two lines, one useful + * }}} + * {{{ + * line1 + * line2 + * line3 + * line4}}} + * {{{ + * a ragged example + * a (condition) + * the t h e n branch + * an alternative + * the e l s e branch + * }}} + * NB: Trailing spaces are necessary for this test! + * {{{ + * l1 + * + * l2 + * + * l3 + * + * l4 + * + * l5 + * }}} + + */ +class C diff --git a/test/scaladoc/scala/html/HtmlFactoryTest.scala b/test/scaladoc/scala/html/HtmlFactoryTest.scala index d46a9581b9..818230238d 100644 --- a/test/scaladoc/scala/html/HtmlFactoryTest.scala +++ b/test/scaladoc/scala/html/HtmlFactoryTest.scala @@ -580,7 +580,24 @@ object Test extends Properties("HtmlFactory") { """, true) ) } - + + property("Indentation normalization for code blocks") = { + val files = createTemplates("code-indent.scala") + + files("C.html") match { + case node: scala.xml.Node => { + val s = node.toString + s.contains("
a typicial indented\ncomment on multiple\ncomment lines
") && + s.contains("
one liner
") && + s.contains("
two lines, one useful
") && + s.contains("
line1\nline2\nline3\nline4
") && + s.contains("
a ragged example\na (condition)\n  the t h e n branch\nan alternative\n  the e l s e branch
") && + s.contains("
l1\n\nl2\n\nl3\n\nl4\n\nl5
") + } + case _ => false + } + } + { val files = createTemplates("basic.scala") //println(files) -- cgit v1.2.3