diff options
author | JustinPihony <justin.pihony@gmail.com> | 2015-02-12 21:22:18 -0500 |
---|---|---|
committer | JustinPihony <justin.pihony@gmail.com> | 2015-02-12 21:22:18 -0500 |
commit | c851a8d4bc432731242075c01f6f8ca500458e67 (patch) | |
tree | d72371331d90b3c0f2fbc967a9e6102f6a7c3e66 /src/scaladoc | |
parent | 41cee92bb516c6a9679773ebae88230c30ac67bd (diff) | |
download | scala-c851a8d4bc432731242075c01f6f8ca500458e67.tar.gz scala-c851a8d4bc432731242075c01f6f8ca500458e67.tar.bz2 scala-c851a8d4bc432731242075c01f6f8ca500458e67.zip |
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")) }/> }} |