diff options
author | Donna Malayeri <lindydonna@gmail.com> | 2011-04-04 16:37:51 +0000 |
---|---|---|
committer | Donna Malayeri <lindydonna@gmail.com> | 2011-04-04 16:37:51 +0000 |
commit | edb78ae9dbfb502c6cb03aab08b1a15d5ba5678b (patch) | |
tree | a4c94224551a2ad7e14c0042810fcbf54d86f9b2 | |
parent | 7eccd78350a5df69a567596b3de5b4ba1ca60995 (diff) | |
download | scala-edb78ae9dbfb502c6cb03aab08b1a15d5ba5678b.tar.gz scala-edb78ae9dbfb502c6cb03aab08b1a15d5ba5678b.tar.bz2 scala-edb78ae9dbfb502c6cb03aab08b1a15d5ba5678b.zip |
[scaladoc] Make object/template name be a link ...
[scaladoc] Make object/template name be a link to the companion. Closes
#4411. Review by extempore to make sure the design makes sense.
-rw-r--r-- | src/compiler/scala/tools/nsc/doc/html/page/Template.scala | 31 |
1 files changed, 14 insertions, 17 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 021d894358..e2a5f7d1fd 100644 --- a/src/compiler/scala/tools/nsc/doc/html/page/Template.scala +++ b/src/compiler/scala/tools/nsc/doc/html/page/Template.scala @@ -54,10 +54,20 @@ class Template(tpl: DocTemplateEntity) extends HtmlPage { <p id="owner">{ templatesToHtml(tpl.inTemplate.toRoot.reverse.tail, xml.Text(".")) }</p> } - <div id="definition"> - <img src={ relativeLinkTo(List(docEntityKindToBigImage(tpl), "lib")) }/> - <h1>{ if (tpl.isRootPackage) "root package" else tpl.name }</h1> - </div> + { val templateName = if (tpl.isRootPackage) "root package" else tpl.name + val displayName = tpl.companion match { + case Some(companion) => + if (companion.visibility.isPublic && companion.inSource != None) + <a href={relativeLinkTo(companion)} title="go to companion">{ templateName }</a> + else templateName + case _ => + templateName + } + <div id="definition"> + <img src={ relativeLinkTo(List(docEntityKindToBigImage(tpl), "lib")) }/> + <h1>{ displayName }</h1> + </div> + } { signature(tpl, true) } { memberToCommentHtml(tpl, true) } @@ -275,19 +285,6 @@ class Template(tpl: DocTemplateEntity) extends HtmlPage { attributes: { fvs map { fv => { inlineToHtml(fv.text) ++ xml.Text(" ") } } } </div> } ++ - { tpl.companion match { - case Some(companion) if (isSelf && !isReduced) => - if (companion.visibility.isPublic && companion.inSource != None) { - <div class="block"> - go to: <a href={relativeLinkTo(companion)}>companion</a> - </div> - } else { - NodeSeq.Empty - } - case _ => - NodeSeq.Empty - } - } ++ { val inDefTpls = mbr.inDefinitionTemplates if ((inDefTpls.tail.isEmpty && (inDefTpls.head == mbr.inTemplate)) || isReduced) NodeSeq.Empty else { <div class="block"> |