diff options
author | Adriaan Moors <adriaan.moors@typesafe.com> | 2015-02-18 17:25:48 -0800 |
---|---|---|
committer | Adriaan Moors <adriaan.moors@typesafe.com> | 2015-02-18 17:25:48 -0800 |
commit | 42626365fd4972d6578a251c264b4622ed4ba1a4 (patch) | |
tree | 1cb88f667076fca40ccfdef4d6029b40dceed9bc /src/scaladoc | |
parent | 9a3ea24596c9a929ad821bf18bb1bd73e569bc0a (diff) | |
parent | c851a8d4bc432731242075c01f6f8ca500458e67 (diff) | |
download | scala-42626365fd4972d6578a251c264b4622ed4ba1a4.tar.gz scala-42626365fd4972d6578a251c264b4622ed4ba1a4.tar.bz2 scala-42626365fd4972d6578a251c264b4622ed4ba1a4.zip |
Merge pull request #4326 from JustinPihony/ticket/9148
SI-9148: Appends companion type to link tooltips
Diffstat (limited to 'src/scaladoc')
-rw-r--r-- | src/scaladoc/scala/tools/nsc/doc/html/HtmlPage.scala | 14 | ||||
-rw-r--r-- | src/scaladoc/scala/tools/nsc/doc/html/page/Template.scala | 4 |
2 files changed, 15 insertions, 3 deletions
diff --git a/src/scaladoc/scala/tools/nsc/doc/html/HtmlPage.scala b/src/scaladoc/scala/tools/nsc/doc/html/HtmlPage.scala index 3738e79ffe..ce75749859 100644 --- a/src/scaladoc/scala/tools/nsc/doc/html/HtmlPage.scala +++ b/src/scaladoc/scala/tools/nsc/doc/html/HtmlPage.scala @@ -227,6 +227,18 @@ abstract class HtmlPage extends Page { thisPage => <img src={ relativeLinkTo(List("permalink.png", "lib")) } /> </a> </span> + + def docEntityKindToCompanionTitle(ety: DocTemplateEntity, baseString: String = "See companion") = + ety.companion match{ + case Some(companion) => + s"$baseString${ + if(companion.isObject) " object" + else if(companion.isTrait) " trait" + else if(companion.isClass) " class" + else "" + }" + case None => baseString + } def companionAndPackage(tpl: DocTemplateEntity): Elem = <span class="morelinks">{ @@ -238,7 +250,7 @@ abstract class HtmlPage extends Page { thisPage => else s"class ${companionTpl.name}" <div> Related Docs: - <a href={relativeLinkTo(tpl.companion.get)} title="See companion">{objClassTrait}</a> + <a href={relativeLinkTo(tpl.companion.get)} title={docEntityKindToCompanionTitle(tpl)}>{objClassTrait}</a> | {templateToHtml(tpl.inTemplate, s"package ${tpl.inTemplate.name}")} </div> case None => diff --git a/src/scaladoc/scala/tools/nsc/doc/html/page/Template.scala b/src/scaladoc/scala/tools/nsc/doc/html/page/Template.scala index eda52c5fbf..e10c54a414 100644 --- a/src/scaladoc/scala/tools/nsc/doc/html/page/Template.scala +++ b/src/scaladoc/scala/tools/nsc/doc/html/page/Template.scala @@ -89,7 +89,7 @@ class Template(universe: doc.Universe, generator: DiagramGenerator, tpl: DocTemp 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> + <a href={relativeLinkTo(companion)} title={docEntityKindToCompanionTitle(tpl)}>{ templateName }</a> case _ => templateName } @@ -105,7 +105,7 @@ class Template(universe: doc.Universe, generator: DiagramGenerator, tpl: DocTemp { tpl.companion match { case Some(companion) if (companion.visibility.isPublic && companion.inSource != None) => - <a href={relativeLinkTo(companion)} title="Go to companion"><img src={ relativeLinkTo(List(docEntityKindToBigImage(tpl), "lib")) }/></a> + <a href={relativeLinkTo(companion)} title={docEntityKindToCompanionTitle(tpl)}><img src={ relativeLinkTo(List(docEntityKindToBigImage(tpl), "lib")) }/></a> case _ => <img src={ relativeLinkTo(List(docEntityKindToBigImage(tpl), "lib")) }/> }} |