{
val (src, alt) = docEntityKindToBigImage(tpl)
tpl.companion match {
case Some(companion) if (companion.visibility.isPublic && companion.inSource != None) =>
case _ =>
}}
{ owner }
{
tpl.groupDescription(group) match {
case Some(body) =>
{ bodyToHtml(body) }
case _ => NodeSeq.Empty
}
}
)
}
{
if (Set("epfl", "EPFL").contains(tpl.universe.settings.docfooter.value))
else
}
}
def memberToHtml(mbr: MemberEntity, inTpl: DocTemplateEntity): NodeSeq = {
// Sometimes it's same, do we need signatureCompat still?
val sig = if (mbr.signature == mbr.signatureCompat) {
} else {
}
val memberComment = memberToCommentHtml(mbr, inTpl, isSelf = false)
}
def memberToCommentHtml(mbr: MemberEntity, inTpl: DocTemplateEntity, isSelf: Boolean): NodeSeq = {
mbr match {
case dte: DocTemplateEntity if isSelf =>
// comment of class itself
case _ =>
// comment of non-class member or non-documentented inner class
val commentBody = memberToCommentBodyHtml(mbr, inTpl, isSelf = false)
if (commentBody.isEmpty)
NodeSeq.Empty
else {
val shortComment = memberToShortCommentHtml(mbr, isSelf)
val longComment = memberToUseCaseCommentHtml(mbr, isSelf) ++ memberToCommentBodyHtml(mbr, inTpl, isSelf)
val includedLongComment = if (shortComment.text.trim == longComment.text.trim)
NodeSeq.Empty
else
def memberToCommentBodyHtml(mbr: MemberEntity, inTpl: DocTemplateEntity, isSelf: Boolean, isReduced: Boolean = false): NodeSeq = {
val s = universe.settings
val memberComment =
if (mbr.comment.isEmpty) NodeSeq.Empty
else
{ commentToHtml(mbr.comment) }
val authorComment =
if (! s.docAuthor || mbr.comment.isEmpty ||
mbr.comment.isDefined && mbr.comment.get.authors.isEmpty) NodeSeq.Empty
else
{if (mbr.comment.get.authors.size > 1)
Authors:
else
Author:
}
{ mbr.comment.get.authors map bodyToHtml}
val paramComments = {
val prs: List[ParameterEntity] = mbr match {
case cls: Class => cls.typeParams ::: cls.valueParams.flatten
case trt: Trait => trt.typeParams
case dfe: Def => dfe.typeParams ::: dfe.valueParams.flatten
case ctr: Constructor => ctr.valueParams.flatten
case _ => Nil
}
def paramCommentToHtml(prs: List[ParameterEntity], comment: Comment): NodeSeq = prs match {
case (tp: TypeParam) :: rest =>
val paramEntry: NodeSeq = {
{ tp.name }
{ bodyToHtml(comment.typeParams(tp.name)) }
}
paramEntry ++ paramCommentToHtml(rest, comment)
case (vp: ValueParam) :: rest =>
val paramEntry: NodeSeq = {
{ vp.name }
{ bodyToHtml(comment.valueParams(vp.name)) }
}
paramEntry ++ paramCommentToHtml(rest, comment)
case _ =>
NodeSeq.Empty
}
mbr.comment.fold(NodeSeq.Empty) { comment =>
val cmtedPrs = prs filter {
case tp: TypeParam => comment.typeParams isDefinedAt tp.name
case vp: ValueParam => comment.valueParams isDefinedAt vp.name
}
if (cmtedPrs.isEmpty && comment.result.isEmpty) NodeSeq.Empty
else {
{
paramCommentToHtml(cmtedPrs, comment) ++ (
comment.result match {
case None => NodeSeq.Empty
case Some(cmt) =>
returns
{ bodyToHtml(cmt) }
})
}
}
}
}
val implicitInformation = mbr.byConversion match {
case Some(conv) =>
Implicit information
++
{
val targetType = typeToHtml(conv.targetType, hasLinks = true)
val conversionMethod = conv.convertorMethod match {
case Left(member) => Text(member.name)
case Right(name) => Text(name)
}
// strip off the package object endings, they make things harder to follow
val conversionOwnerQualifiedNane = conv.convertorOwner.qualifiedName.stripSuffix(".package")
val conversionOwner = templateToHtml(conv.convertorOwner, conversionOwnerQualifiedNane)
val constraintText = conv.constraints match {
case Nil =>
NodeSeq.Empty
case List(constraint) =>
scala.xml.Text("This conversion will take place only if ") ++ constraintToHtml(constraint) ++ scala.xml.Text(".")
case List(constraint1, constraint2) =>
scala.xml.Text("This conversion will take place only if ") ++ constraintToHtml(constraint1) ++
scala.xml.Text(" and at the same time ") ++ constraintToHtml(constraint2) ++ scala.xml.Text(".")
case constraints =>
++ "This conversion will take place only if all of the following constraints are met:" ++ ++ {
var index = 0
constraints map { constraint => scala.xml.Text({ index += 1; index } + ". ") ++ constraintToHtml(constraint) ++ }
}
}
This member is added by an implicit conversion from { typeToHtml(inTpl.resultType, hasLinks = true) } to
{ targetType } performed by method { conversionMethod } in { conversionOwner }.
{ constraintText }
} ++ {
if (mbr.isShadowedOrAmbiguousImplicit) {
// These are the members that are shadowing or ambiguating the current implicit
// see ImplicitMemberShadowing trait for more information
val shadowingSuggestion = {
val params = mbr match {
case d: Def => d.valueParams map (_ map (_ name) mkString("(", ", ", ")")) mkString
case _ => "" // no parameters
}
++ scala.xml.Text("To access this member you can use a ") ++
type ascription ++ scala.xml.Text(":") ++
++
}
val shadowingWarning: NodeSeq =
if (mbr.isShadowedImplicit)
scala.xml.Text("This implicitly inherited member is shadowed by one or more members in this " +
"class.") ++ shadowingSuggestion
else if (mbr.isAmbiguousImplicit)
scala.xml.Text("This implicitly inherited member is ambiguous. One or more implicitly " +
"inherited members have similar signatures, so calling this member may produce an ambiguous " +
"implicit conversion compiler error.") ++ shadowingSuggestion
else NodeSeq.Empty
Shadowing
++
{ shadowingWarning }
} else NodeSeq.Empty
}
case _ =>
NodeSeq.Empty
}
// --- start attributes block vals
val attributes: NodeSeq = {
val fvs: List[comment.Paragraph] = visibility(mbr).toList
if (fvs.isEmpty || isReduced) NodeSeq.Empty
else {
case _ => NodeSeq.Empty
}
val annotations: NodeSeq = {
// A list of annotations which don't show their arguments, e. g. because they are shown separately.
val annotationsWithHiddenArguments = List("deprecated", "Deprecated", "migration")
def showArguments(annotation: Annotation) =
!(annotationsWithHiddenArguments.contains(annotation.qualifiedName))
if (!mbr.annotations.isEmpty) {
case _ => NodeSeq.Empty
}
val deprecation: NodeSeq =
mbr.deprecation match {
case Some(deprecation) if !isReduced =>
Deprecated
{ bodyToHtml(deprecation) }
case _ => NodeSeq.Empty
}
val migration: NodeSeq =
mbr.migration match {
case Some(migration) if !isReduced =>
Migration
{ bodyToHtml(migration) }
case _ => NodeSeq.Empty
}
val mainComment: NodeSeq = mbr.comment match {
case Some(comment) if (! isReduced) =>
def orEmpty[T](it: Iterable[T])(gen: =>NodeSeq): NodeSeq =
if (it.isEmpty) NodeSeq.Empty else gen
val example =
orEmpty(comment.example) {
Example{ if (comment.example.length > 1) "s" else ""}:
{
val exampleXml: List[NodeSeq] = for (ex <- comment.example) yield
{ bodyToHtml(ex) }
exampleXml.reduceLeft(_ ++ Text(", ") ++ _)
}
}
val version: NodeSeq =
orEmpty(comment.version) {
case _ => NodeSeq.Empty
}
val subclasses = mbr match {
case dtpl: DocTemplateEntity if isSelf && !isReduced =>
val subs: Set[DocTemplateEntity] = HashSet.empty
def transitive(dtpl: DocTemplateEntity) {
for (sub <- dtpl.directSubClasses if !(subs contains sub)) {
subs add sub
transitive(sub)
}
}
transitive(dtpl)
if (subs.nonEmpty)