From acd25f57320ad4279c442871b693aa7b86b6bcdf Mon Sep 17 00:00:00 2001 From: Kato Kazuyoshi Date: Wed, 6 Jul 2011 15:13:30 +0000 Subject: Add a test for #4421 and clean up a little. --- .../scala/tools/nsc/doc/html/page/Template.scala | 16 ++++++++-------- test/scaladoc/resources/SI_4421.scala | 7 +++++++ test/scaladoc/scala/html/HtmlFactoryTest.scala | 10 ++++++++++ 3 files changed, 25 insertions(+), 8 deletions(-) create mode 100644 test/scaladoc/resources/SI_4421.scala diff --git a/src/compiler/scala/tools/nsc/doc/html/page/Template.scala b/src/compiler/scala/tools/nsc/doc/html/page/Template.scala index f296a932f4..61a445e2a3 100644 --- a/src/compiler/scala/tools/nsc/doc/html/page/Template.scala +++ b/src/compiler/scala/tools/nsc/doc/html/page/Template.scala @@ -382,9 +382,9 @@ class Template(tpl: DocTemplateEntity) extends HtmlPage { } val mainComment: Seq[scala.xml.Node] = mbr.comment match { - case Some(comment) => + case Some(comment) if (! isReduced) => val example = - if(!comment.example.isEmpty && !isReduced) + if(!comment.example.isEmpty)
Example{ if (comment.example.length > 1) "s" else ""}:
    { val exampleXml: List[scala.xml.NodeSeq] = @@ -396,19 +396,19 @@ class Template(tpl: DocTemplateEntity) extends HtmlPage { else NodeSeq.Empty val version: Seq[scala.xml.Node] = - if(!comment.version.isEmpty && !isReduced) { + if(!comment.version.isEmpty) {
    Version
    { for(body <- comment.version.toList) yield {bodyToHtml(body)} }
    } else NodeSeq.Empty val sinceVersion: Seq[scala.xml.Node] = - if(!comment.since.isEmpty && !isReduced) { + if(!comment.since.isEmpty) {
    Since
    { for(body <- comment.since.toList) yield {bodyToHtml(body)} }
    } else NodeSeq.Empty val note: Seq[scala.xml.Node] = - if(!comment.note.isEmpty && !isReduced) { + if(!comment.note.isEmpty) {
    Note
    { val noteXml: List[scala.xml.NodeSeq] = (for(note <- comment.note ) yield {bodyToHtml(note)} ) @@ -417,7 +417,7 @@ class Template(tpl: DocTemplateEntity) extends HtmlPage { } else NodeSeq.Empty val seeAlso: Seq[scala.xml.Node] = - if(!comment.see.isEmpty && !isReduced) { + if(!comment.see.isEmpty) {
    See also
    { val seeXml:List[scala.xml.NodeSeq]=(for(see <- comment.see ) yield {bodyToHtml(see)} ) @@ -426,7 +426,7 @@ class Template(tpl: DocTemplateEntity) extends HtmlPage { } else NodeSeq.Empty val exceptions: Seq[scala.xml.Node] = - if(!comment.throws.isEmpty && !isReduced) { + if(!comment.throws.isEmpty) {
    Exceptions thrown
    { val exceptionsXml: Iterable[scala.xml.NodeSeq] = (for(exception <- comment.throws ) yield {Text(exception._1) ++ bodyToHtml(exception._2)} ) @@ -436,7 +436,7 @@ class Template(tpl: DocTemplateEntity) extends HtmlPage { example ++ version ++ sinceVersion ++ exceptions ++ note ++ seeAlso - case None => NodeSeq.Empty + case _ => NodeSeq.Empty } // end attributes block vals --- diff --git a/test/scaladoc/resources/SI_4421.scala b/test/scaladoc/resources/SI_4421.scala new file mode 100644 index 0000000000..7ae2c796eb --- /dev/null +++ b/test/scaladoc/resources/SI_4421.scala @@ -0,0 +1,7 @@ +abstract class test +/** + * TestA class + * @example 2.0 + * @todo do something better than finding scaladoc bugs + * @note blah blah */ +class SI_4421 extends test diff --git a/test/scaladoc/scala/html/HtmlFactoryTest.scala b/test/scaladoc/scala/html/HtmlFactoryTest.scala index c85429e353..ffb93b8930 100644 --- a/test/scaladoc/scala/html/HtmlFactoryTest.scala +++ b/test/scaladoc/scala/html/HtmlFactoryTest.scala @@ -313,4 +313,14 @@ object Test extends Properties("HtmlFactory") { case _ => false } } + + property("SI-4421") = { + createTemplate("SI_4421.scala") match { + case node: scala.xml.Node => { + val html = node.toString + html.contains(">Example:") && html.contains(">Note<") + } + case _ => false + } + } } -- cgit v1.2.3