summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKato Kazuyoshi <kato.kazuyoshi@gmail.com>2011-07-06 15:13:30 +0000
committerKato Kazuyoshi <kato.kazuyoshi@gmail.com>2011-07-06 15:13:30 +0000
commitacd25f57320ad4279c442871b693aa7b86b6bcdf (patch)
treec04c97d458dbb86ae88cdc690cd543c9bfc929df
parent302f9fb68afd6fb88373e41ebf219ba55f07a463 (diff)
downloadscala-acd25f57320ad4279c442871b693aa7b86b6bcdf.tar.gz
scala-acd25f57320ad4279c442871b693aa7b86b6bcdf.tar.bz2
scala-acd25f57320ad4279c442871b693aa7b86b6bcdf.zip
Add a test for #4421 and clean up a little.
-rw-r--r--src/compiler/scala/tools/nsc/doc/html/page/Template.scala16
-rw-r--r--test/scaladoc/resources/SI_4421.scala7
-rw-r--r--test/scaladoc/scala/html/HtmlFactoryTest.scala10
3 files changed, 25 insertions, 8 deletions
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)
<div class="block">Example{ if (comment.example.length > 1) "s" else ""}:
<ol>{
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) {
<dt>Version</dt>
<dd>{ for(body <- comment.version.toList) yield {bodyToHtml(body)} }</dd>
} else NodeSeq.Empty
val sinceVersion: Seq[scala.xml.Node] =
- if(!comment.since.isEmpty && !isReduced) {
+ if(!comment.since.isEmpty) {
<dt>Since</dt>
<dd>{ for(body <- comment.since.toList) yield {bodyToHtml(body)} }</dd>
} else NodeSeq.Empty
val note: Seq[scala.xml.Node] =
- if(!comment.note.isEmpty && !isReduced) {
+ if(!comment.note.isEmpty) {
<dt>Note</dt>
<dd>{
val noteXml: List[scala.xml.NodeSeq] = (for(note <- comment.note ) yield <span class="cmt">{bodyToHtml(note)}</span> )
@@ -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) {
<dt>See also</dt>
<dd>{
val seeXml:List[scala.xml.NodeSeq]=(for(see <- comment.see ) yield <span class="cmt">{bodyToHtml(see)}</span> )
@@ -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) {
<dt>Exceptions thrown</dt>
<dd>{
val exceptionsXml: Iterable[scala.xml.NodeSeq] = (for(exception <- comment.throws ) yield <span class="cmt">{Text(exception._1) ++ bodyToHtml(exception._2)}</span> )
@@ -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
+ }
+ }
}