include a target and css style for external source links in the doc

This commit is contained in:
James Strachan
2012-04-13 15:43:44 +01:00
parent 7b1ae33df3
commit 2df5c9886f
4 changed files with 8 additions and 4 deletions
@@ -761,6 +761,10 @@ abstract class KAnnotated(val model: KModel, val declarationDescriptor: Declarat
return model.config.sourceRootHref != null return model.config.sourceRootHref != null
} }
fun sourceTargetAttribute(): String {
return if (isLinkToSourceRepo()) " target=\"_top\" class=\"repoSourceCode\"" else ""
}
fun sourceLink(): String { fun sourceLink(): String {
val file = model.filePath(declarationDescriptor) val file = model.filePath(declarationDescriptor)
if (file != null) { if (file != null) {
@@ -29,7 +29,7 @@ ${pkg.name}</FONT>
Extensions on ${klass.name}</H2> Extensions on ${klass.name}</H2>
<DL> <DL>
<DT> <DT>
extension functions on class <A HREF="${sourceHref(klass)}"><B>${klass.name}</B></A><DT> extension functions on class <A HREF="${sourceHref(klass)}"${klass.sourceTargetAttribute()}><B>${klass.name}</B></A><DT>
from package ${link(pkg)} from package ${link(pkg)}
</DL> </DL>
</PRE> </PRE>
@@ -184,7 +184,7 @@ Class ${klass.simpleName}</H2>
<DL> <DL>
<DT><PRE><FONT SIZE="-1">""") <DT><PRE><FONT SIZE="-1">""")
printAnnotations(klass.annotations) printAnnotations(klass.annotations)
print("""</FONT>${klass.visibility} ${klass.kindCode} <A HREF="${sourceHref(klass)}"><B>${klass.simpleName}</B></A><DT>""") print("""</FONT>${klass.visibility} ${klass.kindCode} <A HREF="${sourceHref(klass)}"${klass.sourceTargetAttribute()}><B>${klass.simpleName}</B></A><DT>""")
if (!klass.baseClasses.isEmpty()) { if (!klass.baseClasses.isEmpty()) {
print("""extends """) print("""extends """)
for (bc in klass.baseClasses) { for (bc in klass.baseClasses) {
@@ -128,7 +128,7 @@ abstract class PackageTemplateSupport(open val pkg: KPackage) : KDocTemplate() {
printTypeParameters(function, " ") printTypeParameters(function, " ")
printReceiverType(function, " ", ".", " ") printReceiverType(function, " ", ".", " ")
print("""<A HREF="${sourceHref(function)}"><B>${function.name}</B></A>""") print("""<A HREF="${sourceHref(function)}"${function.sourceTargetAttribute()}><B>${function.name}</B></A>""")
printParameters(function) printParameters(function)
print(": ") print(": ")
print(link(function.returnType)) print(link(function.returnType))
@@ -207,7 +207,7 @@ abstract class PackageTemplateSupport(open val pkg: KPackage) : KDocTemplate() {
} }
*/ */
println("""</CODE></FONT></TD>""") println("""</CODE></FONT></TD>""")
print("""<TD><CODE><B><A HREF="${sourceHref(property)}">${property.name}</A></B>: """) print("""<TD><CODE><B><A HREF="${sourceHref(property)}"${property.sourceTargetAttribute()}>${property.name}</A></B>: """)
print(link(property.returnType)) print(link(property.returnType))
//printParameters(property) //printParameters(property)
println("""</CODE>""") println("""</CODE>""")