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
}
fun sourceTargetAttribute(): String {
return if (isLinkToSourceRepo()) " target=\"_top\" class=\"repoSourceCode\"" else ""
}
fun sourceLink(): String {
val file = model.filePath(declarationDescriptor)
if (file != null) {
@@ -29,7 +29,7 @@ ${pkg.name}</FONT>
Extensions on ${klass.name}</H2>
<DL>
<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)}
</DL>
</PRE>
@@ -184,7 +184,7 @@ Class ${klass.simpleName}</H2>
<DL>
<DT><PRE><FONT SIZE="-1">""")
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()) {
print("""extends """)
for (bc in klass.baseClasses) {
@@ -128,7 +128,7 @@ abstract class PackageTemplateSupport(open val pkg: KPackage) : KDocTemplate() {
printTypeParameters(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)
print(": ")
print(link(function.returnType))
@@ -207,7 +207,7 @@ abstract class PackageTemplateSupport(open val pkg: KPackage) : KDocTemplate() {
}
*/
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))
//printParameters(property)
println("""</CODE>""")