delete the rest of KDoc
This commit is contained in:
@@ -94,7 +94,6 @@
|
||||
<module>tools/kotlin-maven-plugin-test</module>
|
||||
<module>tools/kotlin-js-tests</module>
|
||||
<module>tools/kotlin-js-tests-junit</module>
|
||||
<module>tools/kdoc</module>
|
||||
|
||||
<module>kunit</module>
|
||||
<module>kotlin-jdbc</module>
|
||||
|
||||
@@ -1 +0,0 @@
|
||||
target
|
||||
@@ -1,12 +0,0 @@
|
||||
import kotlin.modules.*
|
||||
|
||||
fun project() {
|
||||
module("apidocs") {
|
||||
classpath += "../../lib/junit-4.11.jar"
|
||||
|
||||
addSourceFiles("../../stdlib/src")
|
||||
addSourceFiles("../../kunit/src/main/kotlin")
|
||||
addSourceFiles("../../kotlin-jdbc/src/main/kotlin")
|
||||
//addSourceFiles("../kotlin-swing/src/main/kotlin")
|
||||
}
|
||||
}
|
||||
@@ -1,15 +0,0 @@
|
||||
import kotlin.modules.*
|
||||
|
||||
fun project() {
|
||||
module("kdoc") {
|
||||
classpath += "dist/kotlinc/lib/intellij-core.jar"
|
||||
classpath += "dist/kotlinc/lib/kotlin-compiler.jar"
|
||||
|
||||
// TODO its a bit sad we can't use patterns here...
|
||||
addClasspathEntry("dist/kotlinc/lib/pegdown-1.1.0.jar")
|
||||
addClasspathEntry("dist/kotlinc/lib/parboiled-core-1.0.2.jar")
|
||||
addClasspathEntry("dist/kotlinc/lib/parboiled-java-1.0.2.jar")
|
||||
|
||||
addSourceFiles("src/main/kotlin")
|
||||
}
|
||||
}
|
||||
@@ -1,100 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project
|
||||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"
|
||||
xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
|
||||
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
|
||||
<parent>
|
||||
<groupId>org.jetbrains.kotlin</groupId>
|
||||
<artifactId>kotlin-project</artifactId>
|
||||
<version>0.1-SNAPSHOT</version>
|
||||
<relativePath>../../pom.xml</relativePath>
|
||||
</parent>
|
||||
|
||||
<artifactId>kdoc</artifactId>
|
||||
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>org.pegdown</groupId>
|
||||
<artifactId>pegdown</artifactId>
|
||||
<version>${pegdown.version}</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>org.jetbrains.kotlin</groupId>
|
||||
<artifactId>kotlin-compiler</artifactId>
|
||||
<version>${project.version}</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>org.jetbrains.kotlin</groupId>
|
||||
<artifactId>kotlin-stdlib</artifactId>
|
||||
<version>${project.version}</version>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
|
||||
<build>
|
||||
<sourceDirectory>src/main/kotlin</sourceDirectory>
|
||||
<testSourceDirectory>src/test/kotlin</testSourceDirectory>
|
||||
|
||||
<resources>
|
||||
<resource>
|
||||
<directory>src/main/kotlin</directory>
|
||||
<includes>
|
||||
<include>**/*.css</include>
|
||||
</includes>
|
||||
</resource>
|
||||
</resources>
|
||||
|
||||
<plugins>
|
||||
<plugin>
|
||||
<groupId>org.jetbrains.kotlin</groupId>
|
||||
<artifactId>kotlin-maven-plugin</artifactId>
|
||||
<version>${project.version}</version>
|
||||
|
||||
<executions>
|
||||
<execution>
|
||||
<id>compile</id>
|
||||
<phase>compile</phase>
|
||||
<goals>
|
||||
<goal>compile</goal>
|
||||
</goals>
|
||||
</execution>
|
||||
|
||||
<execution>
|
||||
<id>test-compile</id>
|
||||
<phase>test-compile</phase>
|
||||
<goals>
|
||||
<goal>test-compile</goal>
|
||||
</goals>
|
||||
</execution>
|
||||
</executions>
|
||||
</plugin>
|
||||
|
||||
|
||||
<plugin>
|
||||
<artifactId>maven-surefire-plugin</artifactId>
|
||||
<version>${surefire-version}</version>
|
||||
<configuration>
|
||||
<forkMode>once</forkMode>
|
||||
<argLine>-Xmx500m -XX:MaxPermSize=250m</argLine>
|
||||
<useSystemClassLoader>false</useSystemClassLoader>
|
||||
<useManifestOnlyJar>false</useManifestOnlyJar>
|
||||
<failIfNoTests>false</failIfNoTests>
|
||||
<includes>
|
||||
<include>**/*Test.*</include>
|
||||
</includes>
|
||||
<excludes>
|
||||
<!-- TODO lets disable this failing test for now until things settle down -->
|
||||
<exclude>**/KDocTest.*</exclude>
|
||||
</excludes>
|
||||
<systemProperties>
|
||||
<project.version>${project.version}</project.version>
|
||||
</systemProperties>
|
||||
</configuration>
|
||||
</plugin>
|
||||
</plugins>
|
||||
</build>
|
||||
|
||||
</project>
|
||||
@@ -1,12 +0,0 @@
|
||||
package org.jetbrains.kotlin.doc
|
||||
|
||||
import java.io.File
|
||||
import org.jetbrains.kotlin.doc.model.KModel
|
||||
|
||||
/**
|
||||
* A simple plugin to KDoc to generate information from the model into a directory
|
||||
* which can be implemented using any kind of layout or format.
|
||||
*/
|
||||
trait Doclet {
|
||||
fun generate(model: KModel, outputDir: File): Unit
|
||||
}
|
||||
-67
@@ -1,67 +0,0 @@
|
||||
package org.jetbrains.kotlin.doc
|
||||
|
||||
import java.io.File
|
||||
import org.jetbrains.kotlin.doc.model.*
|
||||
import org.jetbrains.kotlin.doc.templates.*
|
||||
import org.jetbrains.kotlin.template.TextTemplate
|
||||
|
||||
/** Creates JavaDoc style HTML output from the model */
|
||||
class JavadocStyleHtmlDoclet() : Doclet {
|
||||
|
||||
override fun generate(model: KModel, outputDir: File): Unit {
|
||||
fun run(fileName: String, template: TextTemplate): Unit {
|
||||
val file = File(outputDir, fileName)
|
||||
file.getParentFile()?.mkdirs()
|
||||
|
||||
log("Generating $fileName")
|
||||
template.renderTo(file)
|
||||
}
|
||||
|
||||
fun generateExtensionFunctions(p: KPackage): Unit {
|
||||
val map = inheritedExtensionFunctions(p.functions)
|
||||
val pmap = inheritedExtensionProperties(p.properties)
|
||||
val classes = hashSetOf<KClass>()
|
||||
classes.addAll(map.keySet())
|
||||
classes.addAll(pmap.keySet())
|
||||
for (c in classes) {
|
||||
val functions = map.get(c).orEmpty()
|
||||
val properties = pmap.get(c).orEmpty()
|
||||
run("${p.nameAsPath}/${c.nameAsPath}-extensions.html",
|
||||
ClassExtensionsTemplate(model, p, c, functions, properties))
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
println("Generating kdoc to $outputDir excluding packages ${model.config.ignorePackages}")
|
||||
run("allclasses-frame.html", AllClassesFrameTemplate(model, " target=\"classFrame\""))
|
||||
run("allclasses-noframe.html", AllClassesFrameTemplate(model))
|
||||
// run("constant-values.html", ConstantValuesTemplate(model))
|
||||
// run("deprecated-list.html", DeprecatedListTemplate(model))
|
||||
run("help-doc.html", HelpDocTemplate(model))
|
||||
// run("index-all.html", IndexAllTemplate(model))
|
||||
run("index.html", IndexTemplate(model))
|
||||
run("overview-frame.html", OverviewFrameTemplate(model))
|
||||
run("overview-summary.html", OverviewSummaryTemplate(model))
|
||||
run("overview-tree.html", OverviewTreeTemplate(model))
|
||||
run("package-list", PackageListTemplate(model))
|
||||
run("search.xml", SearchXmlTemplate(model))
|
||||
// run("serialized-form.html", SerializedFormTemplate(model))
|
||||
for (p in model.packages) {
|
||||
run("${p.nameAsPath}/package-frame.html", PackageFrameTemplate(model, p))
|
||||
run("${p.nameAsPath}/package-summary.html", PackageSummaryTemplate(model, p))
|
||||
//run("${p.nameAsPath}/package-tree.html", PackageTreeTemplate(model, p))
|
||||
//run("${p.nameAsPath}/package-use.html", PackageUseTemplate(model, p))
|
||||
for (c in p.classes) {
|
||||
run("${c.nameAsPath}.html", ClassTemplate(model, p, c))
|
||||
}
|
||||
|
||||
generateExtensionFunctions(p)
|
||||
}
|
||||
}
|
||||
|
||||
protected fun log(text: String) {
|
||||
println(text)
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@@ -1,21 +0,0 @@
|
||||
package org.jetbrains.kotlin.doc
|
||||
|
||||
import java.io.File
|
||||
import org.jetbrains.kotlin.doc.highlighter2.Html2CompilerPlugin
|
||||
import org.jetbrains.kotlin.doc.model.*
|
||||
|
||||
/** Generates the Kotlin Documentation for the model */
|
||||
class KDoc(arguments: KDocArguments) : KModelCompilerPlugin(arguments) {
|
||||
|
||||
protected override fun processModel(model: KModel) {
|
||||
val outputDir = File(arguments.apply().docOutputDir)
|
||||
|
||||
// TODO allow this to be configured; maybe we use configuration on the KotlinModule
|
||||
// to define what doclets to use?
|
||||
val generator = JavadocStyleHtmlDoclet()
|
||||
generator.generate(model, outputDir)
|
||||
|
||||
val srcGenerator = Html2CompilerPlugin(arguments)
|
||||
srcGenerator.generate(model, outputDir)
|
||||
}
|
||||
}
|
||||
@@ -1,52 +0,0 @@
|
||||
package org.jetbrains.kotlin.doc
|
||||
|
||||
import java.io.PrintStream
|
||||
import org.jetbrains.kotlin.cli.common.CLICompiler
|
||||
import org.jetbrains.kotlin.cli.common.CLIConfigurationKeys
|
||||
import org.jetbrains.kotlin.cli.common.arguments.K2JVMCompilerArguments;
|
||||
import org.jetbrains.kotlin.cli.jvm.K2JVMCompiler
|
||||
import org.jetbrains.kotlin.config.CompilerConfiguration
|
||||
import org.jetbrains.kotlin.cli.common.messages.MessageCollector
|
||||
|
||||
/**
|
||||
* Main for running the KDocCompiler
|
||||
*/
|
||||
fun main(args: Array<String>): Unit {
|
||||
CLICompiler.doMain(KDocCompiler(), args);
|
||||
}
|
||||
|
||||
/**
|
||||
* A version of the [[K2JVMCompiler]] which includes the [[KDoc]] compiler plugin and allows
|
||||
* command line validation or for the configuration to be provided via [[KDocArguments]]
|
||||
*/
|
||||
class KDocCompiler() : K2JVMCompiler() {
|
||||
|
||||
protected override fun configureEnvironment(configuration : CompilerConfiguration, arguments : K2JVMCompilerArguments) {
|
||||
super.configureEnvironment(configuration, arguments)
|
||||
configuration.add(CLIConfigurationKeys.COMPILER_PLUGINS, KDoc(arguments as KDocArguments))
|
||||
|
||||
// Suppress all messages from the compiler, because KDoc is not a compiler
|
||||
configuration.put(CLIConfigurationKeys.MESSAGE_COLLECTOR_KEY, MessageCollector.NONE)
|
||||
}
|
||||
|
||||
protected override fun createArguments() : K2JVMCompilerArguments {
|
||||
return KDocArguments()
|
||||
}
|
||||
|
||||
protected override fun usage(target: PrintStream, extraHelp: Boolean) {
|
||||
target.println("Usage: KDocCompiler -d [<directory>|<jar>] [-stdlib <path to runtime.jar>] [<path>|-module <module file>] [-include-runtime]");
|
||||
}
|
||||
}
|
||||
|
||||
class KDocArguments() : K2JVMCompilerArguments() {
|
||||
|
||||
public var docConfig: KDocConfig = KDocConfig()
|
||||
|
||||
/**
|
||||
* Applies the command line arguments to the given KDoc configuration
|
||||
*/
|
||||
fun apply(): KDocConfig {
|
||||
// TODO...
|
||||
return docConfig
|
||||
}
|
||||
}
|
||||
@@ -1,123 +0,0 @@
|
||||
package org.jetbrains.kotlin.doc
|
||||
|
||||
import java.util.*
|
||||
import org.jetbrains.kotlin.doc.model.KPackage
|
||||
|
||||
/**
|
||||
* The configuration used with KDoc
|
||||
*/
|
||||
class KDocConfig() {
|
||||
|
||||
/**
|
||||
* Returns the directory to use to output the API docs
|
||||
*/
|
||||
public var docOutputDir: String = "target/site/apidocs"
|
||||
|
||||
/**
|
||||
* Returns the name of the documentation set
|
||||
*/
|
||||
public var title: String = "Documentation"
|
||||
|
||||
/**
|
||||
* Returns the version name of the documentation set
|
||||
*/
|
||||
public var version: String = "SNAPSHOT"
|
||||
|
||||
/**
|
||||
* Returns a map of the package prefix to the HTML URL for the root of the apidoc using javadoc/kdoc style
|
||||
* directory layouts so that this API doc report can link to external packages
|
||||
*/
|
||||
public val packagePrefixToUrls: MutableMap<String, String> = TreeMap<String, String>(LongestFirstStringComparator)
|
||||
|
||||
/**
|
||||
* Returns a Set of the package name prefixes to ignore from the KDoc report
|
||||
*/
|
||||
public val ignorePackages: MutableSet<String> = HashSet<String>()
|
||||
|
||||
/**
|
||||
* Returns true if a warning should be generated if there are no comments
|
||||
* on documented function or property
|
||||
*/
|
||||
public var warnNoComments: Boolean = true
|
||||
|
||||
/**
|
||||
* Returns the HTTP URL of the root directory of source code that we should link to
|
||||
*/
|
||||
public var sourceRootHref: String? = null
|
||||
|
||||
/**
|
||||
* The root project directory used to deduce relative file names when linking to source code
|
||||
*/
|
||||
public var projectRootDir: String? = null
|
||||
|
||||
/**
|
||||
* A map of package name to html or markdown files used to describe the package. If none is
|
||||
* specified we will look for a package.html or package.md file in the source tree
|
||||
*/
|
||||
public var packageDescriptionFiles: MutableMap<String,String> = HashMap<String,String>()
|
||||
|
||||
/**
|
||||
* A map of package name to summary text used in the package overviews
|
||||
*/
|
||||
public var packageSummaryText: MutableMap<String,String> = HashMap<String, String>()
|
||||
|
||||
/**
|
||||
* Returns true if protected functions and properties should be documented
|
||||
*/
|
||||
public var includeProtected: Boolean = true
|
||||
|
||||
init {
|
||||
// add some common defaults
|
||||
addPackageLink("http://docs.oracle.com/javase/6/docs/api/", "java", "org.w3c.dom", "org.xml.sax", "org.omg", "org.ietf.jgss")
|
||||
addPackageLink("http://kentbeck.github.com/junit/javadoc/latest/", "org.junit", "junit")
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns a set of all the package which have been warned that were missing an external URL
|
||||
*/
|
||||
private val mutableMissingPackageUrls: MutableSet<String> = TreeSet<String>()
|
||||
public val missingPackageUrls: Set<String> = mutableMissingPackageUrls
|
||||
|
||||
/**
|
||||
* Adds one or more package prefixes to the given javadoc URL
|
||||
*/
|
||||
fun addPackageLink(url: String, vararg packagePrefixes: String): Unit {
|
||||
for (p in packagePrefixes) {
|
||||
packagePrefixToUrls.put(p, url)
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Resolves a link to the given class name
|
||||
*/
|
||||
fun resolveLink(packageName: String, warn: Boolean = true): String {
|
||||
for (e in packagePrefixToUrls) {
|
||||
val p = e.key
|
||||
val url = e.value
|
||||
if (packageName.startsWith(p)) {
|
||||
return url
|
||||
}
|
||||
}
|
||||
if (warn && mutableMissingPackageUrls.add(packageName)) {
|
||||
println("Warning: could not find external link to package: $packageName")
|
||||
}
|
||||
return ""
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns true if the package should be included in the report
|
||||
*/
|
||||
fun includePackage(pkg: KPackage): Boolean {
|
||||
return !ignorePackages.any{ pkg.name.startsWith(it) }
|
||||
}
|
||||
}
|
||||
|
||||
private object LongestFirstStringComparator : Comparator<String> {
|
||||
override fun compare(o1: String, o2: String): Int {
|
||||
return compareValuesBy<String>(o1, o2, { it.length() }, { it })
|
||||
}
|
||||
|
||||
override fun equals(other: Any?): Boolean {
|
||||
return other is LongestFirstStringComparator
|
||||
}
|
||||
}
|
||||
@@ -1,10 +0,0 @@
|
||||
package org.jetbrains.kotlin.doc
|
||||
|
||||
|
||||
object names {
|
||||
|
||||
val htmlSourceDirName = "src-html"
|
||||
|
||||
fun lineNumberLinkHref(lineNumber: Int) = "L$lineNumber"
|
||||
|
||||
}
|
||||
@@ -1,15 +0,0 @@
|
||||
package org.jetbrains.kotlin.doc
|
||||
|
||||
import java.util.HashMap
|
||||
|
||||
fun <A, K, V> List<A>.toHashMap(f: (A) -> Pair<K, V>): Map<K, V> {
|
||||
val r = HashMap<K, V>()
|
||||
for (item in this) {
|
||||
val entry = f(item)
|
||||
r.put(entry.first, entry.second)
|
||||
}
|
||||
return r
|
||||
}
|
||||
|
||||
|
||||
fun <K, V> List<V>.toHashMapMappingToKey(f: (V) -> K): Map<K, V> = toHashMap { v -> Pair(f(v), v) }
|
||||
-15
@@ -1,15 +0,0 @@
|
||||
package org.jetbrains.kotlin.doc.highlighter
|
||||
|
||||
import org.jetbrains.kotlin.cli.common.CompilerPlugin
|
||||
import org.jetbrains.kotlin.cli.common.CompilerPluginContext
|
||||
|
||||
/**
|
||||
*/
|
||||
class HtmlCompilerPlugin : CompilerPlugin {
|
||||
public override fun processFiles(context: CompilerPluginContext) {
|
||||
val files = context.getFiles()
|
||||
for (file in files) {
|
||||
file.accept(HtmlKotlinVisitor())
|
||||
}
|
||||
}
|
||||
}
|
||||
-57
@@ -1,57 +0,0 @@
|
||||
package org.jetbrains.kotlin.doc.highlighter
|
||||
|
||||
import com.intellij.psi.PsiComment
|
||||
import com.intellij.psi.PsiElement
|
||||
import com.intellij.psi.PsiFile
|
||||
import com.intellij.psi.PsiWhiteSpace
|
||||
import org.jetbrains.kotlin.psi.*
|
||||
|
||||
class HtmlKotlinVisitor: JetTreeVisitor<StringBuilder>() {
|
||||
|
||||
override fun visitFile(file: PsiFile?) {
|
||||
if (file is JetFile) {
|
||||
visitJetFile(file, StringBuilder())
|
||||
}
|
||||
}
|
||||
|
||||
override fun visitJetFile(file: JetFile, data: StringBuilder?): Void? {
|
||||
println("============ Jet File ${file.getName()}")
|
||||
acceptChildren(file, data)
|
||||
return null
|
||||
}
|
||||
|
||||
override fun visitClass(klass: JetClass, data: StringBuilder?): Void? {
|
||||
println("============ class $klass")
|
||||
acceptChildren(klass, data)
|
||||
return null
|
||||
}
|
||||
|
||||
override fun visitClassBody(classBody: JetClassBody, data: StringBuilder?): Void? {
|
||||
println("============ class body $classBody data $data")
|
||||
return super.visitClassBody(classBody, data)
|
||||
}
|
||||
|
||||
override fun visitFunctionType(type: JetFunctionType, data: StringBuilder?): Void? {
|
||||
println("======================= function Type $type")
|
||||
return super.visitFunctionType(type, data)
|
||||
}
|
||||
|
||||
protected fun accept(child: PsiElement?, data: StringBuilder?): Unit {
|
||||
if (child is JetElement) {
|
||||
child.accept(this, data)
|
||||
} else {
|
||||
if (child is PsiComment || child is PsiWhiteSpace) {
|
||||
// ignore
|
||||
} else {
|
||||
println("------- Child $child of type ${child?.javaClass}")
|
||||
}
|
||||
child?.accept(this)
|
||||
}
|
||||
}
|
||||
|
||||
protected fun acceptChildren(element: PsiElement, data: StringBuilder?): Unit {
|
||||
for (child in element.getChildren()) {
|
||||
accept(child, data)
|
||||
}
|
||||
}
|
||||
}
|
||||
-131
@@ -1,131 +0,0 @@
|
||||
package org.jetbrains.kotlin.doc.highlighter
|
||||
|
||||
import java.util.HashMap
|
||||
import kotlin.template.HtmlFormatter
|
||||
import com.intellij.psi.*
|
||||
import com.intellij.psi.tree.IElementType
|
||||
import com.intellij.psi.tree.TokenSet
|
||||
import org.jetbrains.kotlin.lexer.*
|
||||
|
||||
fun main(args: Array<String>) {
|
||||
val tool = SyntaxHighlighter()
|
||||
val answer = tool.highlight(""" val x = listOf(1, 2, 3)
|
||||
println("hello")""")
|
||||
println(answer)
|
||||
}
|
||||
|
||||
/**
|
||||
* Syntax highlights Kotlin code
|
||||
*/
|
||||
class SyntaxHighlighter() {
|
||||
var formatter: HtmlFormatter = HtmlFormatter()
|
||||
val styleMap = createStyleMap()
|
||||
|
||||
/** Highlights the given kotlin code as HTML */
|
||||
fun highlight(code: String): String {
|
||||
try {
|
||||
val builder = StringBuilder()
|
||||
builder.append(
|
||||
"<div class=\"code panel\" style=\"border-width: 1px\">" +
|
||||
"<div class=\"codeContent panelContent\">" +
|
||||
"<div class=\"container\">"
|
||||
)
|
||||
|
||||
// lets add the leading whitespace first
|
||||
var idx = 0
|
||||
while (Character.isWhitespace(code[idx])) {
|
||||
idx++
|
||||
}
|
||||
if (idx > 0) {
|
||||
val space = code.substring(0, idx)
|
||||
builder.append("""<code class="jet whitespace">$space</code>""")
|
||||
}
|
||||
val lexer = JetLexer()
|
||||
lexer.start(code)
|
||||
while (true) {
|
||||
lexer.advance()
|
||||
val token = lexer.getTokenType()
|
||||
if (token == null) break
|
||||
val tokenText = lexer.getTokenSequence().toString().replace("\n", "\r\n")
|
||||
var style: String? = null
|
||||
if (token is JetKeywordToken) {
|
||||
style = "keyword"
|
||||
} else if (token == JetTokens.IDENTIFIER) {
|
||||
for (softKeyword in JetTokens.SOFT_KEYWORDS.getTypes()) {
|
||||
if (softKeyword is JetKeywordToken) {
|
||||
if (softKeyword.getValue() == tokenText) {
|
||||
style = "softkeyword"
|
||||
break
|
||||
}
|
||||
}
|
||||
}
|
||||
style = if (style == null) "plain" else style
|
||||
} else if (styleMap.containsKey(token)) {
|
||||
style = styleMap.get(token)
|
||||
if (style == null) {
|
||||
println("Warning: No style for token $token")
|
||||
}
|
||||
} else {
|
||||
style = "plain"
|
||||
}
|
||||
builder.append("""<code class="jet $style">""")
|
||||
formatter.format(builder, tokenText)
|
||||
builder.append("</code>")
|
||||
}
|
||||
|
||||
builder.append("</div>")
|
||||
builder.append("</div>")
|
||||
builder.append("</div>")
|
||||
return builder.toString()
|
||||
} catch (e: Exception) {
|
||||
println("Warning: failed to parse code $e")
|
||||
val builder = StringBuilder()
|
||||
builder.append("""<div class="jet herror">Jet highlighter error ["${e.javaClass.getSimpleName()}"]: """)
|
||||
formatter.format(builder, e.getMessage())
|
||||
builder.append("<br/>")
|
||||
builder.append("Original text:")
|
||||
builder.append("<pre>")
|
||||
formatter.format(builder, code)
|
||||
builder.append("</pre>")
|
||||
builder.append("</div>")
|
||||
return builder.toString()
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
protected fun createStyleMap(): Map<IElementType?, String> {
|
||||
val styleMap = HashMap<IElementType?, String>()
|
||||
|
||||
fun putAll(tokenSet: TokenSet?, style: String): Unit {
|
||||
if (tokenSet != null) {
|
||||
for (token in tokenSet.getTypes()) {
|
||||
styleMap.put(token, style)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
styleMap.put(JetTokens.BLOCK_COMMENT, "jet-comment")
|
||||
styleMap.put(JetTokens.DOC_COMMENT, "jet-comment")
|
||||
styleMap.put(JetTokens.EOL_COMMENT, "jet-comment")
|
||||
styleMap.put(JetTokens.WHITE_SPACE, "whitespace")
|
||||
styleMap.put(JetTokens.INTEGER_LITERAL, "number")
|
||||
styleMap.put(JetTokens.FLOAT_LITERAL, "number")
|
||||
styleMap.put(JetTokens.OPEN_QUOTE, "string")
|
||||
styleMap.put(JetTokens.REGULAR_STRING_PART, "string")
|
||||
styleMap.put(JetTokens.ESCAPE_SEQUENCE, "escape")
|
||||
styleMap.put(JetTokens.LONG_TEMPLATE_ENTRY_START, "escape")
|
||||
styleMap.put(JetTokens.LONG_TEMPLATE_ENTRY_END, "escape")
|
||||
styleMap.put(JetTokens.SHORT_TEMPLATE_ENTRY_START, "escape")
|
||||
styleMap.put(JetTokens.ESCAPE_SEQUENCE, "escape")
|
||||
styleMap.put(JetTokens.CLOSING_QUOTE, "string")
|
||||
styleMap.put(JetTokens.CHARACTER_LITERAL, "string")
|
||||
styleMap.put(JetTokens.FIELD_IDENTIFIER, "field")
|
||||
styleMap.put(TokenType.BAD_CHARACTER, "bad")
|
||||
putAll(JetTokens.STRINGS, "string")
|
||||
putAll(JetTokens.MODIFIER_KEYWORDS, "softkeyword")
|
||||
putAll(JetTokens.SOFT_KEYWORDS, "softkeyword")
|
||||
putAll(JetTokens.COMMENTS, "jet-comment")
|
||||
putAll(JetTokens.OPERATIONS, "operation")
|
||||
return styleMap
|
||||
}
|
||||
}
|
||||
-128
@@ -1,128 +0,0 @@
|
||||
package org.jetbrains.kotlin.doc.highlighter2
|
||||
|
||||
import java.io.File
|
||||
import com.intellij.openapi.vfs.local.CoreLocalVirtualFile
|
||||
import com.intellij.psi.PsiElement
|
||||
import com.intellij.psi.PsiFile
|
||||
import com.intellij.psi.impl.source.tree.LeafPsiElement
|
||||
import org.jetbrains.kotlin.lexer.JetTokens
|
||||
import org.jetbrains.kotlin.doc.*
|
||||
import org.jetbrains.kotlin.doc.model.KModel
|
||||
import org.jetbrains.kotlin.doc.model.SourceInfo
|
||||
import org.jetbrains.kotlin.template.HtmlTemplate
|
||||
import org.jetbrains.kotlin.template.escapeHtml
|
||||
|
||||
class Html2CompilerPlugin(private val compilerArguments: KDocArguments) : Doclet {
|
||||
|
||||
private val docOutputRoot: File
|
||||
init {
|
||||
val docOutputDir = compilerArguments.docConfig.docOutputDir
|
||||
if (docOutputDir.isEmpty()) {
|
||||
throw IllegalArgumentException("empty doc output dir")
|
||||
}
|
||||
docOutputRoot = File(docOutputDir)
|
||||
}
|
||||
|
||||
private val srcOutputRoot = File(docOutputRoot, names.htmlSourceDirName)
|
||||
|
||||
private val sourceDirs: List<File> =
|
||||
compilerArguments.freeArgs.orEmpty().map { path -> File(path).getCanonicalFile() }
|
||||
|
||||
private val sourceDirPaths: List<String> = sourceDirs.map { d -> d.getPath() }
|
||||
|
||||
private fun fileToWrite(psiFile: PsiFile): String {
|
||||
val file = File((psiFile.getVirtualFile() as CoreLocalVirtualFile).getPath()!!).getCanonicalFile()
|
||||
val filePath = file.getPath()
|
||||
for (sourceDirPath in sourceDirPaths) {
|
||||
if (filePath.startsWith(sourceDirPath) && filePath.length() > sourceDirPath.length()) {
|
||||
val relativePath = filePath.substring(sourceDirPath.length() + 1)
|
||||
return relativePath
|
||||
}
|
||||
}
|
||||
throw Exception("$file is not a child of any source roots $sourceDirPaths")
|
||||
}
|
||||
|
||||
override fun generate(model: KModel, outputDir: File) {
|
||||
srcOutputRoot.mkdirs()
|
||||
|
||||
val css = javaClass<Html2CompilerPlugin>().getClassLoader()!!.getResourceAsStream(
|
||||
"org/jetbrains/kotlin/doc/highlighter2/hightlight.css")!!
|
||||
|
||||
File(srcOutputRoot, "highlight.css").write { outputStream -> css.copyTo(outputStream) }
|
||||
|
||||
for (sourceInfo in model.sourcesInfo) {
|
||||
processFile(sourceInfo)
|
||||
}
|
||||
}
|
||||
|
||||
private fun processFile(sourceInfo: SourceInfo) {
|
||||
val psiFile = sourceInfo.psi
|
||||
val htmlPath = sourceInfo.htmlPath
|
||||
val htmlFile = File(srcOutputRoot, htmlPath)
|
||||
|
||||
println("Generating $htmlFile")
|
||||
htmlFile.getParentFile()!!.mkdirs()
|
||||
|
||||
// see http://maven.apache.org/jxr/xref/index.html
|
||||
|
||||
val template = object : HtmlTemplate() {
|
||||
override fun render() {
|
||||
html {
|
||||
head {
|
||||
title("${psiFile.getName()} xref")
|
||||
linkCssStylesheet("highlight.css")
|
||||
}
|
||||
body {
|
||||
table(style = "white-space: pre; font-size: 10pt; font-family: Monaco, monospace") {
|
||||
tr {
|
||||
td(style = "margin-right: 1.5em; text-align: right") {
|
||||
val text = psiFile.getText()!!
|
||||
val lineCount =
|
||||
text.count { c -> c == '\n' } + (if (text.endsWith('\n')) 0 else 1)
|
||||
|
||||
for (i in 1..lineCount) {
|
||||
val label = "$i"
|
||||
a(name = "$label", href = "#$label") {
|
||||
print(i)
|
||||
}
|
||||
println()
|
||||
}
|
||||
}
|
||||
|
||||
td {
|
||||
fun classForPsi(psi: PsiElement): String? = when (psi) {
|
||||
is LeafPsiElement -> {
|
||||
val elementType = psi.getElementType()
|
||||
if (elementType == JetTokens.WHITE_SPACE)
|
||||
null
|
||||
else if (elementType == JetTokens.DOC_COMMENT)
|
||||
"hl-comment"
|
||||
else if (JetTokens.KEYWORDS.contains(elementType))
|
||||
"hl-keyword"
|
||||
else
|
||||
// TODO
|
||||
elementType.toString()
|
||||
}
|
||||
// TODO
|
||||
else -> psi.javaClass.getName()
|
||||
}
|
||||
|
||||
for (t in splitPsi(psiFile)) {
|
||||
val text = t.first
|
||||
val psi = t.second
|
||||
span(className = classForPsi(psi)) {
|
||||
print(text.escapeHtml())
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
template.renderTo(htmlFile)
|
||||
}
|
||||
|
||||
}
|
||||
-7
@@ -1,7 +0,0 @@
|
||||
.hl-comment {
|
||||
color: #808080;
|
||||
}
|
||||
|
||||
.hl-keyword {
|
||||
color: #000080;
|
||||
}
|
||||
@@ -1,7 +0,0 @@
|
||||
package org.jetbrains.kotlin.doc.highlighter2
|
||||
|
||||
import java.io.File
|
||||
import java.io.FileOutputStream
|
||||
|
||||
fun File.write(callback: (FileOutputStream) -> Unit) =
|
||||
FileOutputStream(this).use<FileOutputStream, Unit>(callback)
|
||||
-40
@@ -1,40 +0,0 @@
|
||||
package org.jetbrains.kotlin.doc.highlighter2
|
||||
|
||||
import com.intellij.psi.PsiElement
|
||||
|
||||
private fun PsiElement.getTextChildRelativeOffset() =
|
||||
getTextRange()!!.getStartOffset() - getParent()!!.getTextRange()!!.getStartOffset()
|
||||
|
||||
private fun PsiElement.getAllChildren(): List<PsiElement> {
|
||||
val r = arrayListOf<PsiElement>()
|
||||
var child = getFirstChild()
|
||||
while (child != null) {
|
||||
r.add(child!!)
|
||||
child = child!!.getNextSibling()
|
||||
}
|
||||
return r
|
||||
}
|
||||
|
||||
private fun splitPsiImpl(psi: PsiElement, listBuilder: MutableList<Pair<String, PsiElement>>) {
|
||||
var lastPos = 0
|
||||
for (child in psi.getAllChildren()) {
|
||||
if (child.getTextChildRelativeOffset() > lastPos) {
|
||||
val text = psi.getText()!!.substring(lastPos, child.getTextChildRelativeOffset())
|
||||
listBuilder.add(Pair(text, psi))
|
||||
}
|
||||
splitPsiImpl(child, listBuilder)
|
||||
lastPos = child.getTextChildRelativeOffset() + child.getTextRange()!!.getLength()
|
||||
}
|
||||
if (lastPos < psi.getTextRange()!!.getLength()) {
|
||||
val text = psi.getText()!!.substring(lastPos)
|
||||
listBuilder.add(Pair(text, psi))
|
||||
}
|
||||
}
|
||||
|
||||
fun splitPsi(psi: PsiElement): List<Pair<String, PsiElement>> {
|
||||
val listBuilder = arrayListOf<Pair<String, PsiElement>>()
|
||||
splitPsiImpl(psi, listBuilder)
|
||||
return listBuilder
|
||||
}
|
||||
|
||||
|
||||
-24
@@ -1,24 +0,0 @@
|
||||
package org.jetbrains.kotlin.doc.model
|
||||
|
||||
import java.io.File
|
||||
import org.jetbrains.kotlin.cli.common.CompilerPlugin
|
||||
import org.jetbrains.kotlin.cli.common.CompilerPluginContext
|
||||
import org.jetbrains.kotlin.doc.KDocArguments
|
||||
|
||||
/** Base class for any compiler plugin which needs to process a KModel */
|
||||
abstract class KModelCompilerPlugin(
|
||||
// TODO: fix compiler and make protected
|
||||
val arguments: KDocArguments)
|
||||
: CompilerPlugin
|
||||
{
|
||||
public override fun processFiles(context: CompilerPluginContext) {
|
||||
val bindingContext = context.getContext()
|
||||
val sources = context.getFiles()
|
||||
val sourceDirs: List<File> = arguments.freeArgs.orEmpty().map { path -> File(path) }
|
||||
val model = KModel(bindingContext, arguments.apply(), sourceDirs, sources.requireNoNulls())
|
||||
|
||||
processModel(model)
|
||||
}
|
||||
|
||||
protected abstract fun processModel(model: KModel): Unit
|
||||
}
|
||||
File diff suppressed because it is too large
Load Diff
Vendored
-40
@@ -1,40 +0,0 @@
|
||||
package org.jetbrains.kotlin.doc.templates
|
||||
|
||||
import org.jetbrains.kotlin.doc.model.KModel
|
||||
|
||||
class AllClassesFrameTemplate(val model: KModel, val classAttributes: String = "") : KDocTemplate() {
|
||||
override fun render() {
|
||||
println("""<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
|
||||
<!--NewPage-->
|
||||
<HTML>
|
||||
<HEAD>
|
||||
$generatedComment
|
||||
<META http-equiv="Content-Type"
|
||||
content="text/html; charset=UTF-8">
|
||||
<TITLE>
|
||||
All Classes (${model.title})</TITLE>
|
||||
|
||||
<META NAME="date" CONTENT="2012-01-09">
|
||||
<LINK REL ="stylesheet" TYPE="text/css" HREF="stylesheet.css" TITLE="Style">
|
||||
</HEAD>
|
||||
|
||||
<BODY BGCOLOR="white">
|
||||
<FONT size="+1" CLASS="FrameHeadingFont">
|
||||
<B>All Classes</B></FONT>
|
||||
<BR>
|
||||
|
||||
<TABLE BORDER="0" WIDTH="100%" SUMMARY="">
|
||||
<TR>
|
||||
<TD NOWRAP><FONT CLASS="FrameItemFont">""")
|
||||
for (c in model.classes) {
|
||||
println("""<A HREF="${c.nameAsPath}.html" title="class in ${c.packageName}"$classAttributes>${c.simpleName}</A>
|
||||
<BR>""")
|
||||
}
|
||||
println("""</FONT></TD>
|
||||
</TR>
|
||||
</TABLE>
|
||||
</BODY>
|
||||
</HTML>
|
||||
""")
|
||||
}
|
||||
}
|
||||
Vendored
-49
@@ -1,49 +0,0 @@
|
||||
package org.jetbrains.kotlin.doc.templates
|
||||
|
||||
import java.util.*
|
||||
import org.jetbrains.kotlin.doc.model.KClass
|
||||
import org.jetbrains.kotlin.doc.model.KFunction
|
||||
import org.jetbrains.kotlin.doc.model.KModel
|
||||
import org.jetbrains.kotlin.doc.model.KPackage
|
||||
import org.jetbrains.kotlin.doc.model.KProperty
|
||||
|
||||
class ClassExtensionsTemplate(m: KModel, p: KPackage, k: KClass,
|
||||
val functions: Collection<KFunction>, val properties: Collection<KProperty>) : ClassTemplate(m, p, k) {
|
||||
|
||||
protected override fun relativePrefix(): String = "${pkg.nameAsRelativePath}${klass.pkg.nameAsRelativePath}"
|
||||
|
||||
override fun pageTitle(): String = "${klass.name} Extensions fom ${pkg.name} (${model.title})"
|
||||
|
||||
override fun printBody(): Unit {
|
||||
println("""<HR>
|
||||
<!-- ======== START OF CLASS EXTENSIONS DATA ======== -->
|
||||
<H2>
|
||||
<FONT SIZE="-1">
|
||||
${pkg.name}</FONT>
|
||||
<BR>
|
||||
Extensions on ${klass.name}</H2>
|
||||
<DL>
|
||||
<DT>
|
||||
extension functions on class <A HREF="${sourceHref(klass)}"${klass.sourceTargetAttribute()}><B>${klass.name}</B></A><DT>
|
||||
from package ${link(pkg)}
|
||||
</DL>
|
||||
</PRE>
|
||||
|
||||
<P>""")
|
||||
printPropertySummary(properties)
|
||||
printFunctionSummary(functions)
|
||||
printFunctionDetail(functions)
|
||||
println("""<!-- ========= END OF CLASS EXTENSIONS DATA ========= -->
|
||||
<HR>
|
||||
""")
|
||||
}
|
||||
|
||||
override fun href(f: KFunction): String {
|
||||
return if (f.extensionClass != null) "#${f.link}" else super.href(f)
|
||||
}
|
||||
|
||||
override fun href(f: KProperty): String {
|
||||
return if (f.extensionClass != null) "#${f.link}" else super.href(f)
|
||||
}
|
||||
|
||||
}
|
||||
-257
@@ -1,257 +0,0 @@
|
||||
package org.jetbrains.kotlin.doc.templates
|
||||
|
||||
import org.jetbrains.kotlin.doc.model.KClass
|
||||
import org.jetbrains.kotlin.doc.model.KModel
|
||||
import org.jetbrains.kotlin.doc.model.KPackage
|
||||
|
||||
open class ClassTemplate(open val model: KModel, pkg: KPackage, open val klass: KClass) : PackageTemplateSupport(pkg) {
|
||||
|
||||
open fun pageTitle(): String = "${klass.name} (${model.title})"
|
||||
|
||||
override fun render() {
|
||||
println("""<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
|
||||
<!--NewPage-->
|
||||
<HTML>
|
||||
<HEAD>
|
||||
$generatedComment
|
||||
<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
|
||||
<TITLE>
|
||||
${pageTitle()}
|
||||
</TITLE>
|
||||
|
||||
<META NAME="date" CONTENT="2012-01-09">
|
||||
<META NAME="date" CONTENT="2012-01-09">
|
||||
${stylesheets()}
|
||||
|
||||
<SCRIPT type="text/javascript">
|
||||
function windowTitle()
|
||||
{
|
||||
if (location.href.indexOf('is-external=true') == -1) {
|
||||
parent.document.title="${klass.name} (${model.title})";
|
||||
}
|
||||
}
|
||||
</SCRIPT>
|
||||
<NOSCRIPT>
|
||||
</NOSCRIPT>
|
||||
|
||||
</HEAD>
|
||||
|
||||
<BODY BGCOLOR="white" onload="windowTitle();">
|
||||
<HR>
|
||||
|
||||
|
||||
<!-- ========= START OF TOP NAVBAR ======= -->
|
||||
<A NAME="navbar_top"><!-- --></A>
|
||||
<A HREF="#skip-navbar_top" title="Skip navigation links"></A>
|
||||
<TABLE BORDER="0" WIDTH="100%" CELLPADDING="1" CELLSPACING="0" SUMMARY="">
|
||||
<TR>
|
||||
<TD COLSPAN=2 BGCOLOR="#EEEEFF" CLASS="NavBarCell1">
|
||||
<A NAME="navbar_top_firstrow"><!-- --></A>
|
||||
<TABLE BORDER="0" CELLPADDING="0" CELLSPACING="3" SUMMARY="">
|
||||
<TR ALIGN="center" VALIGN="top">
|
||||
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="${pkg.nameAsRelativePath}overview-summary.html"><FONT CLASS="NavBarFont1"><B>Overview</B></FONT></A> </TD>
|
||||
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="package-summary.html"><FONT CLASS="NavBarFont1"><B>Package</B></FONT></A> </TD>
|
||||
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1Rev"> <FONT CLASS="NavBarFont1Rev"><B>Class</B></FONT> </TD>
|
||||
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="class-use/${klass.simpleName}.html"><FONT CLASS="NavBarFont1"><B>Use</B></FONT></A> </TD>
|
||||
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="package-tree.html"><FONT CLASS="NavBarFont1"><B>Tree</B></FONT></A> </TD>
|
||||
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="${pkg.nameAsRelativePath}deprecated-list.html"><FONT CLASS="NavBarFont1"><B>Deprecated</B></FONT></A> </TD>
|
||||
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="${pkg.nameAsRelativePath}index-all.html"><FONT CLASS="NavBarFont1"><B>Index</B></FONT></A> </TD>
|
||||
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="${pkg.nameAsRelativePath}help-doc.html"><FONT CLASS="NavBarFont1"><B>Help</B></FONT></A> </TD>
|
||||
${searchBox()}
|
||||
</TR>
|
||||
</TABLE>
|
||||
</TD>
|
||||
<TD ALIGN="right" VALIGN="top" ROWSPAN=3><EM>
|
||||
</EM>
|
||||
</TD>
|
||||
</TR>
|
||||
|
||||
<TR>
|
||||
""")
|
||||
|
||||
printPrevNextClass()
|
||||
println("""<TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2">
|
||||
<A HREF="${relativePrefix()}index.html" target="_top"><B>FRAMES</B></A>
|
||||
<A HREF="${klass.simpleName}.html" target="_top"><B>NO FRAMES</B></A>
|
||||
<SCRIPT type="text/javascript">
|
||||
<!--
|
||||
if(window==top) {
|
||||
document.writeln('<A HREF="${relativePrefix()}allclasses-noframe.html"><B>All Classes</B></A>');
|
||||
}
|
||||
//-->
|
||||
</SCRIPT>
|
||||
<NOSCRIPT>
|
||||
<A HREF="${relativePrefix()}allclasses-noframe.html"><B>All Classes</B></A>
|
||||
</NOSCRIPT>
|
||||
|
||||
|
||||
</FONT></TD>
|
||||
</TR>
|
||||
<TR>
|
||||
<TD VALIGN="top" CLASS="NavBarCell3"><FONT SIZE="-2">
|
||||
SUMMARY: <A HREF="#nested_class_summary">NESTED</A> | PROPERTY | CONSTR | <A HREF="#method_summary">FUNCTION</A></FONT></TD>
|
||||
<TD VALIGN="top" CLASS="NavBarCell3"><FONT SIZE="-2">
|
||||
DETAIL: PROPERTY | CONSTR | <A HREF="#method_detail">FUNCTION</A></FONT></TD>
|
||||
</TR>
|
||||
</TABLE>
|
||||
<A NAME="skip-navbar_top"></A>
|
||||
<!-- ========= END OF TOP NAVBAR ========= -->
|
||||
""")
|
||||
|
||||
printBody()
|
||||
|
||||
println("""<!-- ======= START OF BOTTOM NAVBAR ====== -->
|
||||
<A NAME="navbar_bottom"><!-- --></A>
|
||||
<A HREF="#skip-navbar_bottom" title="Skip navigation links"></A>
|
||||
<TABLE BORDER="0" WIDTH="100%" CELLPADDING="1" CELLSPACING="0" SUMMARY="">
|
||||
<TR>
|
||||
<TD COLSPAN=2 BGCOLOR="#EEEEFF" CLASS="NavBarCell1">
|
||||
<A NAME="navbar_bottom_firstrow"><!-- --></A>
|
||||
<TABLE BORDER="0" CELLPADDING="0" CELLSPACING="3" SUMMARY="">
|
||||
<TR ALIGN="center" VALIGN="top">
|
||||
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="${pkg.nameAsRelativePath}overview-summary.html"><FONT CLASS="NavBarFont1"><B>Overview</B></FONT></A> </TD>
|
||||
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="package-summary.html"><FONT CLASS="NavBarFont1"><B>Package</B></FONT></A> </TD>
|
||||
<TD BGCOLOR="#FFFFFF" CLASS="NavBarCell1Rev"> <FONT CLASS="NavBarFont1Rev"><B>Class</B></FONT> </TD>
|
||||
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="class-use/${klass.simpleName}.html"><FONT CLASS="NavBarFont1"><B>Use</B></FONT></A> </TD>
|
||||
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="package-tree.html"><FONT CLASS="NavBarFont1"><B>Tree</B></FONT></A> </TD>
|
||||
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="${pkg.nameAsRelativePath}deprecated-list.html"><FONT CLASS="NavBarFont1"><B>Deprecated</B></FONT></A> </TD>
|
||||
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="${pkg.nameAsRelativePath}index-all.html"><FONT CLASS="NavBarFont1"><B>Index</B></FONT></A> </TD>
|
||||
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="${pkg.nameAsRelativePath}help-doc.html"><FONT CLASS="NavBarFont1"><B>Help</B></FONT></A> </TD>
|
||||
</TR>
|
||||
</TABLE>
|
||||
</TD>
|
||||
<TD ALIGN="right" VALIGN="top" ROWSPAN=3><EM>
|
||||
</EM>
|
||||
</TD>
|
||||
</TR>
|
||||
|
||||
<TR>""")
|
||||
printPrevNextClass()
|
||||
println("""<TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2">
|
||||
<A HREF="${relativePrefix()}index.html" target="_top"><B>FRAMES</B></A>
|
||||
<A HREF="${klass.simpleName}.html" target="_top"><B>NO FRAMES</B></A>
|
||||
<SCRIPT type="text/javascript">
|
||||
<!--
|
||||
if(window==top) {
|
||||
document.writeln('<A HREF="${pkg.nameAsRelativePath}allclasses-noframe.html"><B>All Classes</B></A>');
|
||||
}
|
||||
//-->
|
||||
</SCRIPT>
|
||||
<NOSCRIPT>${pkg.nameAsRelativePath}allclasses-noframe.html"><B>All Classes</B></A>
|
||||
</NOSCRIPT>
|
||||
|
||||
|
||||
</FONT></TD>
|
||||
</TR>
|
||||
<TR>
|
||||
<TD VALIGN="top" CLASS="NavBarCell3"><FONT SIZE="-2">
|
||||
SUMMARY: <A HREF="#nested_class_summary">NESTED</A> | PROPERTY | CONSTR | <A HREF="#method_summary">FUNCTION</A></FONT></TD>
|
||||
<TD VALIGN="top" CLASS="NavBarCell3"><FONT SIZE="-2">
|
||||
DETAIL: PROPERTY | CONSTR | <A HREF="#method_detail">FUNCTION</A></FONT></TD>
|
||||
</TR>
|
||||
</TABLE>
|
||||
<A NAME="skip-navbar_bottom"></A>
|
||||
<!-- ======== END OF BOTTOM NAVBAR ======= -->
|
||||
|
||||
<HR>
|
||||
Copyright © 2010-2012. All Rights Reserved.
|
||||
</BODY>
|
||||
</HTML>""")
|
||||
}
|
||||
|
||||
open fun printBody(): Unit {
|
||||
println("""<HR>
|
||||
<!-- ======== START OF CLASS DATA ======== -->
|
||||
<H2>
|
||||
<FONT SIZE="-1">
|
||||
${pkg.name}</FONT>
|
||||
<BR>
|
||||
Class ${klass.simpleName}</H2>
|
||||
<PRE>""")
|
||||
|
||||
for (bc in klass.baseClasses) {
|
||||
println(link(bc, true))
|
||||
}
|
||||
println(""" <IMG SRC="${pkg.nameAsRelativePath}resources/inherit.gif" ALT="extended by "><B>${klass.name}</B>
|
||||
</PRE>
|
||||
<HR>
|
||||
<DL>
|
||||
<DT><PRE><FONT SIZE="-1">""")
|
||||
printAnnotations(klass.annotations)
|
||||
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) {
|
||||
println(link(bc))
|
||||
}
|
||||
}
|
||||
println("""</DL>
|
||||
</PRE>
|
||||
|
||||
<P>""")
|
||||
println(klass.detailedDescription(this))
|
||||
if (klass.since.length() > 0 || klass.authors.size() > 0) {
|
||||
println("""<P>
|
||||
<DL>""")
|
||||
if (klass.since.length() > 0) {
|
||||
println("""<DT><B>Since:</B></DT>
|
||||
<DD>${klass.since}</DD>""")
|
||||
}
|
||||
for (author in klass.authors) {
|
||||
println("""<DT><B>Author:</B></DT>
|
||||
<DD>${author}</DD>""")
|
||||
}
|
||||
println("""</DL>""")
|
||||
}
|
||||
|
||||
println("""<HR>
|
||||
|
||||
<P>""")
|
||||
val nestedClasses = klass.nestedClasses
|
||||
if (!nestedClasses.isEmpty()) {
|
||||
println("""<!-- ======== NESTED CLASS SUMMARY ======== -->
|
||||
|
||||
<A NAME="nested_class_summary"><!-- --></A>
|
||||
<TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY="">
|
||||
<TR BGCOLOR="#CCCCFF" CLASS="TableHeadingColor">
|
||||
<TH ALIGN="left" COLSPAN="2"><FONT SIZE="+2">
|
||||
<B>Nested Class Summary</B></FONT></TH>
|
||||
</TR>""")
|
||||
for (nc in nestedClasses) {
|
||||
println("""<TR BGCOLOR="white" CLASS="TableRowColor">
|
||||
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
|
||||
<CODE>static class</CODE></FONT></TD>
|
||||
<TD><CODE><B><A HREF="${pkg.nameAsRelativePath}${nc.nameAsPath}.html" title="class in ${nc.packageName}">${klass.simpleName}.${nc.simpleName}</A></B></CODE>
|
||||
<BR>
|
||||
${nc.description(this)}
|
||||
</TD>""")
|
||||
}
|
||||
println("""</TR>
|
||||
</TABLE>
|
||||
""")
|
||||
}
|
||||
|
||||
printPropertySummary(klass.properties)
|
||||
printFunctionSummary(klass.functions)
|
||||
printFunctionDetail(klass.functions)
|
||||
|
||||
println("""<!-- ========= END OF CLASS DATA ========= -->
|
||||
<HR>
|
||||
""")
|
||||
}
|
||||
|
||||
open fun printPrevNextClass(): Unit {
|
||||
println("""<TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2">""")
|
||||
val prev = pkg.previous(klass)
|
||||
if (prev != null) {
|
||||
println(""" <A HREF="${pkg.nameAsRelativePath}${prev.nameAsPath}.html" title="class in ${prev.packageName}"><B>PREV CLASS</B></A> """)
|
||||
|
||||
}
|
||||
val next = pkg.next(klass)
|
||||
if (next != null) {
|
||||
println(""" <A HREF="${pkg.nameAsRelativePath}${next.nameAsPath}.html" title="class in ${next.packageName}"><B>NEXT CLASS</B></A>""")
|
||||
}
|
||||
println("""</FONT></TD>""")
|
||||
}
|
||||
|
||||
}
|
||||
-232
@@ -1,232 +0,0 @@
|
||||
package org.jetbrains.kotlin.doc.templates
|
||||
|
||||
import org.jetbrains.kotlin.doc.model.KModel
|
||||
|
||||
class HelpDocTemplate(val model: KModel) : KDocTemplate() {
|
||||
override fun render() {
|
||||
println("""<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Frameset//EN" "http://www.w3.org/TR/html4/frameset.dtd">
|
||||
<!--NewPage-->
|
||||
<HTML>
|
||||
<HEAD>
|
||||
$generatedComment
|
||||
<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
|
||||
<TITLE>
|
||||
API Help (${model.title})
|
||||
</TITLE>
|
||||
|
||||
<META NAME="date" CONTENT="2012-01-09">
|
||||
|
||||
<LINK REL ="stylesheet" TYPE="text/css" HREF="stylesheet.css" TITLE="Style">
|
||||
|
||||
<SCRIPT type="text/javascript">
|
||||
function windowTitle()
|
||||
{
|
||||
if (location.href.indexOf('is-external=true') == -1) {
|
||||
parent.document.title="API Help (${model.title})";
|
||||
}
|
||||
}
|
||||
</SCRIPT>
|
||||
<NOSCRIPT>
|
||||
</NOSCRIPT>
|
||||
|
||||
</HEAD>
|
||||
|
||||
<BODY BGCOLOR="white" onload="windowTitle();">
|
||||
<HR>
|
||||
|
||||
|
||||
<!-- ========= START OF TOP NAVBAR ======= -->
|
||||
<A NAME="navbar_top"><!-- --></A>
|
||||
<A HREF="#skip-navbar_top" title="Skip navigation links"></A>
|
||||
<TABLE BORDER="0" WIDTH="100%" CELLPADDING="1" CELLSPACING="0" SUMMARY="">
|
||||
<TR>
|
||||
<TD COLSPAN=2 BGCOLOR="#EEEEFF" CLASS="NavBarCell1">
|
||||
<A NAME="navbar_top_firstrow"><!-- --></A>
|
||||
<TABLE BORDER="0" CELLPADDING="0" CELLSPACING="3" SUMMARY="">
|
||||
<TR ALIGN="center" VALIGN="top">
|
||||
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="overview-summary.html"><FONT CLASS="NavBarFont1"><B>Overview</B></FONT></A> </TD>
|
||||
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <FONT CLASS="NavBarFont1">Package</FONT> </TD>
|
||||
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <FONT CLASS="NavBarFont1">Class</FONT> </TD>
|
||||
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <FONT CLASS="NavBarFont1">Use</FONT> </TD>
|
||||
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="overview-tree.html"><FONT CLASS="NavBarFont1"><B>Tree</B></FONT></A> </TD>
|
||||
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="deprecated-list.html"><FONT CLASS="NavBarFont1"><B>Deprecated</B></FONT></A> </TD>
|
||||
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="index-all.html"><FONT CLASS="NavBarFont1"><B>Index</B></FONT></A> </TD>
|
||||
<TD BGCOLOR="#FFFFFF" CLASS="NavBarCell1Rev"> <FONT CLASS="NavBarFont1Rev"><B>Help</B></FONT> </TD>
|
||||
</TR>
|
||||
</TABLE>
|
||||
</TD>
|
||||
<TD ALIGN="right" VALIGN="top" ROWSPAN=3><EM>
|
||||
</EM>
|
||||
</TD>
|
||||
</TR>
|
||||
|
||||
<TR>
|
||||
<TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2">
|
||||
PREV
|
||||
NEXT</FONT></TD>
|
||||
<TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2">
|
||||
<A HREF="index.html?help-doc.html" target="_top"><B>FRAMES</B></A>
|
||||
<A HREF="help-doc.html" target="_top"><B>NO FRAMES</B></A>
|
||||
<SCRIPT type="text/javascript">
|
||||
<!--
|
||||
if(window==top) {
|
||||
document.writeln('<A HREF="allclasses-noframe.html"><B>All Classes</B></A>');
|
||||
}
|
||||
//-->
|
||||
</SCRIPT>
|
||||
<NOSCRIPT>
|
||||
<A HREF="allclasses-noframe.html"><B>All Classes</B></A>
|
||||
</NOSCRIPT>
|
||||
|
||||
|
||||
</FONT></TD>
|
||||
</TR>
|
||||
</TABLE>
|
||||
<A NAME="skip-navbar_top"></A>
|
||||
<!-- ========= END OF TOP NAVBAR ========= -->
|
||||
|
||||
<HR>
|
||||
<CENTER>
|
||||
<H1>
|
||||
How This API Document Is Organized</H1>
|
||||
</CENTER>
|
||||
This API (Application Programming Interface) document has pages corresponding to the items in the navigation bar, described as follows.<H3>
|
||||
Overview</H3>
|
||||
<BLOCKQUOTE>
|
||||
|
||||
<P>
|
||||
The <A HREF="overview-summary.html">Overview</A> page is the front page of this API document and provides a list of all packages with a summary for each. This page can also contain an overall description of the set of packages.</BLOCKQUOTE>
|
||||
<H3>
|
||||
Package</H3>
|
||||
<BLOCKQUOTE>
|
||||
|
||||
<P>
|
||||
Each package has a page that contains a list of its classes and interfaces, with a summary for each. This page can contain four categories:<UL>
|
||||
<LI>Interfaces (italic)<LI>Classes<LI>Enums<LI>Exceptions<LI>Errors<LI>Annotation Types</UL>
|
||||
</BLOCKQUOTE>
|
||||
<H3>
|
||||
Class/Interface</H3>
|
||||
<BLOCKQUOTE>
|
||||
|
||||
<P>
|
||||
Each class, interface, nested class and nested interface has its own separate page. Each of these pages has three sections consisting of a class/interface description, summary tables, and detailed member descriptions:<UL>
|
||||
<LI>Class inheritance diagram<LI>Direct Subclasses<LI>All Known Subinterfaces<LI>All Known Implementing Classes<LI>Class/interface declaration<LI>Class/interface description
|
||||
<P>
|
||||
<LI>Nested Class Summary<LI>Field Summary<LI>Constructor Summary<LI>Method Summary
|
||||
<P>
|
||||
<LI>Field Detail<LI>Constructor Detail<LI>Method Detail</UL>
|
||||
Each summary entry contains the first sentence from the detailed description for that item. The summary entries are alphabetical, while the detailed descriptions are in the order they appear in the source code. This preserves the logical groupings established by the programmer.</BLOCKQUOTE>
|
||||
</BLOCKQUOTE>
|
||||
<H3>
|
||||
Annotation Type</H3>
|
||||
<BLOCKQUOTE>
|
||||
|
||||
<P>
|
||||
Each annotation type has its own separate page with the following sections:<UL>
|
||||
<LI>Annotation Type declaration<LI>Annotation Type description<LI>Required Element Summary<LI>Optional Element Summary<LI>Element Detail</UL>
|
||||
</BLOCKQUOTE>
|
||||
</BLOCKQUOTE>
|
||||
<H3>
|
||||
Enum</H3>
|
||||
<BLOCKQUOTE>
|
||||
|
||||
<P>
|
||||
Each enum has its own separate page with the following sections:<UL>
|
||||
<LI>Enum declaration<LI>Enum description<LI>Enum Constant Summary<LI>Enum Constant Detail</UL>
|
||||
</BLOCKQUOTE>
|
||||
<H3>
|
||||
Use</H3>
|
||||
<BLOCKQUOTE>
|
||||
Each documented package, class and interface has its own Use page. This page describes what packages, classes, methods, constructors and fields use any part of the given class or package. Given a class or interface A, its Use page includes subclasses of A, fields declared as A, methods that return A, and methods and constructors with parameters of type A. You can access this page by first going to the package, class or interface, then clicking on the "Use" link in the navigation bar.</BLOCKQUOTE>
|
||||
<H3>
|
||||
Tree (Class Hierarchy)</H3>
|
||||
<BLOCKQUOTE>
|
||||
There is a <A HREF="overview-tree.html">Class Hierarchy</A> page for all packages, plus a hierarchy for each package. Each hierarchy page contains a list of classes and a list of interfaces. The classes are organized by inheritance structure starting with <code>java.lang.Object</code>. The interfaces do not inherit from <code>java.lang.Object</code>.<UL>
|
||||
<LI>When viewing the Overview page, clicking on "Tree" displays the hierarchy for all packages.<LI>When viewing a particular package, class or interface page, clicking "Tree" displays the hierarchy for only that package.</UL>
|
||||
</BLOCKQUOTE>
|
||||
<H3>
|
||||
Deprecated API</H3>
|
||||
<BLOCKQUOTE>
|
||||
The <A HREF="deprecated-list.html">Deprecated API</A> page lists all of the API that have been deprecated. A deprecated API is not recommended for use, generally due to improvements, and a replacement API is usually given. Deprecated APIs may be removed in future implementations.</BLOCKQUOTE>
|
||||
<H3>
|
||||
Index</H3>
|
||||
<BLOCKQUOTE>
|
||||
The <A HREF="index-all.html">Index</A> contains an alphabetic list of all classes, interfaces, constructors, methods, and fields.</BLOCKQUOTE>
|
||||
<H3>
|
||||
Prev/Next</H3>
|
||||
These links take you to the next or previous class, interface, package, or related page.<H3>
|
||||
Frames/No Frames</H3>
|
||||
These links show and hide the HTML frames. All pages are available with or without frames.
|
||||
<P>
|
||||
<H3>
|
||||
Serialized Form</H3>
|
||||
Each serializable or externalizable class has a description of its serialization fields and methods. This information is of interest to re-implementors, not to developers using the API. While there is no link in the navigation bar, you can get to this information by going to any serialized class and clicking "Serialized Form" in the "See also" section of the class description.
|
||||
<P>
|
||||
<H3>
|
||||
Constant Field Values</H3>
|
||||
The <a href="constant-values.html">Constant Field Values</a> page lists the static final fields and their values.
|
||||
<P>
|
||||
<FONT SIZE="-1">
|
||||
<EM>
|
||||
This help file applies to API documentation generated using the standard doclet.</EM>
|
||||
</FONT>
|
||||
<BR>
|
||||
<HR>
|
||||
|
||||
|
||||
<!-- ======= START OF BOTTOM NAVBAR ====== -->
|
||||
<A NAME="navbar_bottom"><!-- --></A>
|
||||
<A HREF="#skip-navbar_bottom" title="Skip navigation links"></A>
|
||||
<TABLE BORDER="0" WIDTH="100%" CELLPADDING="1" CELLSPACING="0" SUMMARY="">
|
||||
<TR>
|
||||
<TD COLSPAN=2 BGCOLOR="#EEEEFF" CLASS="NavBarCell1">
|
||||
<A NAME="navbar_bottom_firstrow"><!-- --></A>
|
||||
<TABLE BORDER="0" CELLPADDING="0" CELLSPACING="3" SUMMARY="">
|
||||
<TR ALIGN="center" VALIGN="top">
|
||||
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="overview-summary.html"><FONT CLASS="NavBarFont1"><B>Overview</B></FONT></A> </TD>
|
||||
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <FONT CLASS="NavBarFont1">Package</FONT> </TD>
|
||||
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <FONT CLASS="NavBarFont1">Class</FONT> </TD>
|
||||
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <FONT CLASS="NavBarFont1">Use</FONT> </TD>
|
||||
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="overview-tree.html"><FONT CLASS="NavBarFont1"><B>Tree</B></FONT></A> </TD>
|
||||
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="deprecated-list.html"><FONT CLASS="NavBarFont1"><B>Deprecated</B></FONT></A> </TD>
|
||||
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="index-all.html"><FONT CLASS="NavBarFont1"><B>Index</B></FONT></A> </TD>
|
||||
<TD BGCOLOR="#FFFFFF" CLASS="NavBarCell1Rev"> <FONT CLASS="NavBarFont1Rev"><B>Help</B></FONT> </TD>
|
||||
</TR>
|
||||
</TABLE>
|
||||
</TD>
|
||||
<TD ALIGN="right" VALIGN="top" ROWSPAN=3><EM>
|
||||
</EM>
|
||||
</TD>
|
||||
</TR>
|
||||
|
||||
<TR>
|
||||
<TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2">
|
||||
PREV
|
||||
NEXT</FONT></TD>
|
||||
<TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2">
|
||||
<A HREF="index.html?help-doc.html" target="_top"><B>FRAMES</B></A>
|
||||
<A HREF="help-doc.html" target="_top"><B>NO FRAMES</B></A>
|
||||
<SCRIPT type="text/javascript">
|
||||
<!--
|
||||
if(window==top) {
|
||||
document.writeln('<A HREF="allclasses-noframe.html"><B>All Classes</B></A>');
|
||||
}
|
||||
//-->
|
||||
</SCRIPT>
|
||||
<NOSCRIPT>
|
||||
<A HREF="allclasses-noframe.html"><B>All Classes</B></A>
|
||||
</NOSCRIPT>
|
||||
|
||||
|
||||
</FONT></TD>
|
||||
</TR>
|
||||
</TABLE>
|
||||
<A NAME="skip-navbar_bottom"></A>
|
||||
<!-- ======== END OF BOTTOM NAVBAR ======= -->
|
||||
|
||||
<HR>
|
||||
Copyright © 2012. All Rights Reserved.
|
||||
</BODY>
|
||||
</HTML>""")
|
||||
}
|
||||
}
|
||||
-49
@@ -1,49 +0,0 @@
|
||||
package org.jetbrains.kotlin.doc.templates
|
||||
|
||||
import org.jetbrains.kotlin.doc.model.KModel
|
||||
|
||||
class IndexTemplate(val model: KModel) : KDocTemplate() {
|
||||
override fun render() {
|
||||
print("""<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Frameset//EN" "http://www.w3.org/TR/html4/frameset.dtd">
|
||||
<!--NewPage-->
|
||||
<HTML>
|
||||
<HEAD>
|
||||
$generatedComment
|
||||
<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
|
||||
<TITLE>
|
||||
${model.title}
|
||||
</TITLE>
|
||||
<SCRIPT type="text/javascript">
|
||||
targetPage = "" + window.location.search;
|
||||
if (targetPage != "" && targetPage != "undefined")
|
||||
targetPage = targetPage.substring(1);
|
||||
if (targetPage.indexOf(":") != -1)
|
||||
targetPage = "undefined";
|
||||
function loadFrames() {
|
||||
if (targetPage != "" && targetPage != "undefined")
|
||||
top.classFrame.location = top.targetPage;
|
||||
}
|
||||
</SCRIPT>
|
||||
<NOSCRIPT>
|
||||
</NOSCRIPT>
|
||||
</HEAD>
|
||||
<FRAMESET cols="20%,80%" title="" onLoad="top.loadFrames()">
|
||||
<FRAMESET rows="30%,70%" title="" onLoad="top.loadFrames()">
|
||||
<FRAME src="overview-frame.html" name="packageListFrame" title="All Packages">
|
||||
<FRAME src="allclasses-frame.html" name="packageFrame" title="All classes and interfaces (except non-static nested types)">
|
||||
</FRAMESET>
|
||||
<FRAME src="overview-summary.html" name="classFrame" title="Package, class and interface descriptions" scrolling="yes">
|
||||
<NOFRAMES>
|
||||
<H2>
|
||||
Frame Alert</H2>
|
||||
|
||||
<P>
|
||||
This document is designed to be viewed using the frames feature. If you see this message, you are using a non-frame-capable web client.
|
||||
<BR>
|
||||
Link to<A HREF="overview-summary.html">Non-frame version.</A>
|
||||
</NOFRAMES>
|
||||
</FRAMESET>
|
||||
</HTML>
|
||||
""")
|
||||
}
|
||||
}
|
||||
-183
@@ -1,183 +0,0 @@
|
||||
package org.jetbrains.kotlin.doc.templates
|
||||
|
||||
import org.jetbrains.kotlin.doc.*
|
||||
import org.jetbrains.kotlin.doc.model.KAnnotation
|
||||
import org.jetbrains.kotlin.doc.model.KClass
|
||||
import org.jetbrains.kotlin.doc.model.KFunction
|
||||
import org.jetbrains.kotlin.doc.model.KPackage
|
||||
import org.jetbrains.kotlin.doc.model.KProperty
|
||||
import org.jetbrains.kotlin.doc.model.KType
|
||||
import org.jetbrains.kotlin.template.TextTemplate
|
||||
|
||||
abstract class KDocTemplate() : TextTemplate() {
|
||||
// TODO: use same timestamp for all pages
|
||||
protected val generatedComment: String = "<!-- Generated by kdoc on ${java.util.Date()} -->"
|
||||
|
||||
open fun rootHref(pkg: KPackage): String {
|
||||
return if (!pkg.useExternalLink)
|
||||
relativePrefix()
|
||||
else
|
||||
pkg.model.config.resolveLink(pkg.name)
|
||||
}
|
||||
|
||||
open fun href(p: KPackage): String
|
||||
= "${rootHref(p)}${p.nameAsPath}/package-summary.html"
|
||||
|
||||
open fun href(c: KClass): String {
|
||||
val postfix = if (!c.pkg.useExternalLink) "" else "?is-external=true"
|
||||
return "${rootHref(c.pkg)}${c.nameAsPath}.html$postfix"
|
||||
}
|
||||
|
||||
open fun href(f: KFunction): String {
|
||||
return if (f.owner is KClass) {
|
||||
"${href(f.owner)}#${f.link}"
|
||||
} else {
|
||||
"package-summary.html#${f.link}"
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Generates a link to a package level property
|
||||
*/
|
||||
open fun href(pkg: KPackage, p: KProperty): String {
|
||||
return "${href(pkg)}#${p.link}"
|
||||
}
|
||||
|
||||
open fun href(f: KProperty): String {
|
||||
return if (f.owner is KClass) {
|
||||
"${href(f.owner)}#${f.link}"
|
||||
} else {
|
||||
"package-summary.html#${f.link}"
|
||||
}
|
||||
}
|
||||
|
||||
open fun extensionsHref(pkg: KPackage, c: KClass): String {
|
||||
// is inside the pkg so no need to use it...
|
||||
return "${c.nameAsPath}-extensions.html"
|
||||
}
|
||||
|
||||
open fun extensionsHref(pkg: KPackage, c: KClass, f: KFunction): String {
|
||||
return "${extensionsHref(pkg, c)}#${f.link}"
|
||||
}
|
||||
|
||||
open fun extensionsHref(pkg: KPackage, c: KClass, f: KProperty): String {
|
||||
return "${extensionsHref(pkg, c)}#${f.link}"
|
||||
}
|
||||
|
||||
open fun sourceHref(klass: KClass): String {
|
||||
if (klass.isLinkToSourceRepo()) {
|
||||
return klass.sourceLink()
|
||||
} else {
|
||||
val pkg = klass.pkg
|
||||
return if (klass.sourceInfo != null) {
|
||||
"${pkg.nameAsRelativePath}${names.htmlSourceDirName}/${klass.sourceInfo.htmlPath}.html#${names.lineNumberLinkHref(klass.sourceLine)}"
|
||||
} else {
|
||||
href(klass)
|
||||
}
|
||||
}
|
||||
}
|
||||
open fun sourceHref(f: KFunction): String {
|
||||
if (f.isLinkToSourceRepo()) {
|
||||
return f.sourceLink()
|
||||
} else {
|
||||
val owner = f.owner
|
||||
return if (owner is KClass) {
|
||||
val pkg = owner.pkg
|
||||
if (owner.sourceInfo != null) {
|
||||
"${rootHref(pkg)}${names.htmlSourceDirName}/${owner.sourceInfo.htmlPath}.html#${names.lineNumberLinkHref(f.sourceLine)}"
|
||||
} else {
|
||||
href(f)
|
||||
}
|
||||
} else if (owner is KPackage) {
|
||||
if (!owner.useExternalLink) {
|
||||
// TODO how to find the function in a package???
|
||||
"${rootHref(owner)}${names.htmlSourceDirName}/package.html#${names.lineNumberLinkHref(f.sourceLine)}"
|
||||
} else {
|
||||
href(owner)
|
||||
}
|
||||
} else href(f)
|
||||
}
|
||||
}
|
||||
|
||||
open fun sourceHref(f: KProperty): String {
|
||||
if (f.isLinkToSourceRepo()) {
|
||||
return f.sourceLink()
|
||||
} else {
|
||||
val owner = f.owner
|
||||
return if (owner is KClass) {
|
||||
val pkg = owner.pkg
|
||||
if (owner.sourceInfo != null) {
|
||||
"${rootHref(pkg)}${names.htmlSourceDirName}/${owner.sourceInfo.htmlPath}#${names.lineNumberLinkHref(f.sourceLine)}"
|
||||
} else {
|
||||
href(f)
|
||||
}
|
||||
} else if (owner is KPackage) {
|
||||
if (!owner.useExternalLink) {
|
||||
// TODO how to find the function in a package???
|
||||
"${rootHref(owner)}${names.htmlSourceDirName}/package.html#${names.lineNumberLinkHref(f.sourceLine)}"
|
||||
} else {
|
||||
href(owner)
|
||||
}
|
||||
} else href(f)
|
||||
}
|
||||
}
|
||||
|
||||
open fun link(c: KClass, fullName: Boolean = false): String {
|
||||
val prefix = if (c.isAnnotation()) "@" else ""
|
||||
val name = if (fullName) c.name else c.simpleName
|
||||
return "<A HREF=\"${href(c)}\" title=\"${c.kind} in ${c.packageName}\">$prefix$name</A>"
|
||||
}
|
||||
|
||||
open fun link(t: KType, fullName: Boolean = false): String {
|
||||
val c = t.klass
|
||||
val arguments = t.arguments
|
||||
return if (c != null) {
|
||||
val prefix = if (c.isAnnotation()) "@" else ""
|
||||
val cname = c.name
|
||||
if (cname.startsWith("kotlin.Function") && arguments.isNotEmpty()) {
|
||||
val rt = arguments.last()
|
||||
// TODO use drop()
|
||||
val rest = arguments.dropLast(1)
|
||||
"${typeArguments(rest, "(", ")", "()")} <A HREF=\"${href(c)}\" title=\"${c.kind} in ${c.packageName}\">-></a> ${link(rt)}"
|
||||
} else {
|
||||
val name = if (fullName) cname else c.simpleName
|
||||
"<A HREF=\"${href(c)}\" title=\"${c.kind} in ${c.packageName}\">$prefix$name</A>${typeArguments(arguments)}"
|
||||
}
|
||||
} else {
|
||||
"${t.name}${typeArguments(arguments)}"
|
||||
}
|
||||
}
|
||||
|
||||
open fun typeArguments(arguments: List<KType>, prefix: String = "<", postfix: String = ">", empty: String = ""): String {
|
||||
val text = arguments.map<KType, String>() { link(it) }.joinToString(", ")
|
||||
return if (text.length() == 0) empty else "$prefix$text$postfix"
|
||||
}
|
||||
|
||||
open fun link(p: KPackage): String {
|
||||
return "<A HREF=\"${href(p)}\" title=\"package ${p.name}}\">${p.name}</A>"
|
||||
}
|
||||
|
||||
open fun link(a: KAnnotation): String {
|
||||
val c = a.klass
|
||||
return "<A HREF=\"${href(c)}\" title=\"annotation in ${c.packageName}\">@${c.simpleName}</A>"
|
||||
}
|
||||
|
||||
fun searchBox(): String =
|
||||
""" <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1" ALIGN="right">
|
||||
<label for="searchBox">Search: </label>
|
||||
<input id="searchBox" class="ui-autocomplete-input" autocomplete="off" role="textbox" aria-autocomplete="list" aria-haspopup="true" size="50" data-url="${relativePrefix()}search.xml">
|
||||
</TD>"""
|
||||
|
||||
|
||||
fun stylesheets(): String {
|
||||
return """<LINK REL="stylesheet" TYPE="text/css" HREF="${relativePrefix()}stylesheet.css" TITLE="Style">
|
||||
<LINK REL="stylesheet" TYPE="text/css" HREF="${relativePrefix()}jquery-ui.css" TITLE="Style">
|
||||
<LINK REL="stylesheet" TYPE="text/css" HREF="${relativePrefix()}kotlin.css" TITLE="Style">
|
||||
<script type="text/javascript" src="${relativePrefix()}js/jquery.js"></script>
|
||||
<script type="text/javascript" src="${relativePrefix()}js/jquery-ui.js"></script>
|
||||
<script type="text/javascript" src="${relativePrefix()}js/apidoc.js"></script>
|
||||
"""
|
||||
}
|
||||
|
||||
protected open fun relativePrefix(): String = ""
|
||||
}
|
||||
Vendored
-51
@@ -1,51 +0,0 @@
|
||||
package org.jetbrains.kotlin.doc.templates
|
||||
|
||||
import org.jetbrains.kotlin.doc.model.KModel
|
||||
|
||||
class OverviewFrameTemplate(val model: KModel) : KDocTemplate() {
|
||||
override fun render() {
|
||||
println("""<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
|
||||
<!--NewPage-->
|
||||
<HTML>
|
||||
<HEAD>
|
||||
$generatedComment
|
||||
<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
|
||||
<TITLE>
|
||||
Overview List (${model.title})
|
||||
</TITLE>
|
||||
|
||||
<META NAME="date" CONTENT="2012-01-09">
|
||||
<LINK REL ="stylesheet" TYPE="text/css" HREF="stylesheet.css" TITLE="Style">
|
||||
</HEAD>
|
||||
|
||||
<BODY BGCOLOR="white">
|
||||
|
||||
<TABLE BORDER="0" WIDTH="100%" SUMMARY="">
|
||||
<TR>
|
||||
<TH ALIGN="left" NOWRAP><FONT size="+1" CLASS="FrameTitleFont">
|
||||
<B></B></FONT></TH>
|
||||
</TR>
|
||||
</TABLE>
|
||||
|
||||
<TABLE BORDER="0" WIDTH="100%" SUMMARY="">
|
||||
<TR>
|
||||
<TD NOWRAP><FONT CLASS="FrameItemFont"><A HREF="allclasses-frame.html" target="packageFrame">All Classes</A></FONT>
|
||||
<P>
|
||||
<FONT size="+1" CLASS="FrameHeadingFont">
|
||||
Packages</FONT>
|
||||
<BR>""")
|
||||
for (p in model.packages) {
|
||||
println("""<FONT CLASS="FrameItemFont"><A HREF="${p.nameAsPath}/package-frame.html" target="packageFrame">${p.name}</A></FONT>
|
||||
<BR>""")
|
||||
}
|
||||
println("""</TD>
|
||||
</TR>
|
||||
</TABLE>
|
||||
|
||||
<P>
|
||||
|
||||
</BODY>
|
||||
</HTML>
|
||||
""")
|
||||
}
|
||||
}
|
||||
Vendored
-168
@@ -1,168 +0,0 @@
|
||||
package org.jetbrains.kotlin.doc.templates
|
||||
|
||||
import org.jetbrains.kotlin.doc.model.KModel
|
||||
|
||||
class OverviewSummaryTemplate(val model: KModel) : KDocTemplate() {
|
||||
override fun render() {
|
||||
println("""<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Frameset//EN" "http://www.w3.org/TR/html4/frameset.dtd">
|
||||
<!--NewPage-->
|
||||
<HTML>
|
||||
<HEAD>
|
||||
$generatedComment
|
||||
<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
|
||||
<TITLE>
|
||||
Overview (${model.title})
|
||||
</TITLE>
|
||||
|
||||
<META NAME="date" CONTENT="2012-01-09">
|
||||
|
||||
${stylesheets()}
|
||||
|
||||
<SCRIPT type="text/javascript">
|
||||
function windowTitle()
|
||||
{
|
||||
if (location.href.indexOf('is-external=true') == -1) {
|
||||
parent.document.title="Overview (${model.title})";
|
||||
}
|
||||
}
|
||||
</SCRIPT>
|
||||
<NOSCRIPT>
|
||||
</NOSCRIPT>
|
||||
|
||||
</HEAD>
|
||||
|
||||
<BODY BGCOLOR="white" onload="windowTitle();">
|
||||
<HR>
|
||||
|
||||
|
||||
<!-- ========= START OF TOP NAVBAR ======= -->
|
||||
<A NAME="navbar_top"><!-- --></A>
|
||||
<A HREF="#skip-navbar_top" title="Skip navigation links"></A>
|
||||
<TABLE BORDER="0" WIDTH="100%" CELLPADDING="1" CELLSPACING="0" SUMMARY="">
|
||||
<TR>
|
||||
<TD COLSPAN=2 BGCOLOR="#EEEEFF" CLASS="NavBarCell1">
|
||||
<A NAME="navbar_top_firstrow"><!-- --></A>
|
||||
<TABLE BORDER="0" CELLPADDING="0" CELLSPACING="3" SUMMARY="">
|
||||
<TR ALIGN="center" VALIGN="top">
|
||||
<TD BGCOLOR="#FFFFFF" CLASS="NavBarCell1Rev"> <FONT CLASS="NavBarFont1Rev"><B>Overview</B></FONT> </TD>
|
||||
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <FONT CLASS="NavBarFont1">Package</FONT> </TD>
|
||||
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <FONT CLASS="NavBarFont1">Class</FONT> </TD>
|
||||
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <FONT CLASS="NavBarFont1">Use</FONT> </TD>
|
||||
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="overview-tree.html"><FONT CLASS="NavBarFont1"><B>Tree</B></FONT></A> </TD>
|
||||
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="deprecated-list.html"><FONT CLASS="NavBarFont1"><B>Deprecated</B></FONT></A> </TD>
|
||||
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="index-all.html"><FONT CLASS="NavBarFont1"><B>Index</B></FONT></A> </TD>
|
||||
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="help-doc.html"><FONT CLASS="NavBarFont1"><B>Help</B></FONT></A> </TD>
|
||||
${searchBox()}
|
||||
</TR>
|
||||
</TABLE>
|
||||
</TD>
|
||||
<TD ALIGN="right" VALIGN="top" ROWSPAN=3><EM>
|
||||
</EM>
|
||||
</TD>
|
||||
</TR>
|
||||
|
||||
<TR>
|
||||
<TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2">
|
||||
PREV
|
||||
NEXT</FONT></TD>
|
||||
<TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2">
|
||||
<A HREF="index.html?overview-summary.html" target="_top"><B>FRAMES</B></A>
|
||||
<A HREF="overview-summary.html" target="_top"><B>NO FRAMES</B></A>
|
||||
<SCRIPT type="text/javascript">
|
||||
<!--
|
||||
if(window==top) {
|
||||
document.writeln('<A HREF="allclasses-noframe.html"><B>All Classes</B></A>');
|
||||
}
|
||||
//-->
|
||||
</SCRIPT>
|
||||
<NOSCRIPT>
|
||||
<A HREF="allclasses-noframe.html"><B>All Classes</B></A>
|
||||
</NOSCRIPT>
|
||||
|
||||
|
||||
</FONT></TD>
|
||||
</TR>
|
||||
</TABLE>
|
||||
<A NAME="skip-navbar_top"></A>
|
||||
<!-- ========= END OF TOP NAVBAR ========= -->
|
||||
|
||||
<HR>
|
||||
<CENTER>
|
||||
<H1>
|
||||
${model.title}
|
||||
</H1>
|
||||
</CENTER>
|
||||
|
||||
<TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY="">
|
||||
<TR BGCOLOR="#CCCCFF" CLASS="TableHeadingColor">
|
||||
<TH ALIGN="left" COLSPAN="2"><FONT SIZE="+2">
|
||||
<B>Packages</B></FONT></TH>
|
||||
</TR>""")
|
||||
for (p in model.packages) {
|
||||
println("""<TR BGCOLOR="white" CLASS="TableRowColor">
|
||||
<TD WIDTH="20%"><B><A HREF="${p.nameAsPath}/package-summary.html">${p.name}</A></B></TD>
|
||||
<TD>${p.description(this)}</TD>
|
||||
</TR>""")
|
||||
}
|
||||
println("""</TABLE>
|
||||
|
||||
<P>
|
||||
<HR>
|
||||
|
||||
|
||||
<!-- ======= START OF BOTTOM NAVBAR ====== -->
|
||||
<A NAME="navbar_bottom"><!-- --></A>
|
||||
<A HREF="#skip-navbar_bottom" title="Skip navigation links"></A>
|
||||
<TABLE BORDER="0" WIDTH="100%" CELLPADDING="1" CELLSPACING="0" SUMMARY="">
|
||||
<TR>
|
||||
<TD COLSPAN=2 BGCOLOR="#EEEEFF" CLASS="NavBarCell1">
|
||||
<A NAME="navbar_bottom_firstrow"><!-- --></A>
|
||||
<TABLE BORDER="0" CELLPADDING="0" CELLSPACING="3" SUMMARY="">
|
||||
<TR ALIGN="center" VALIGN="top">
|
||||
<TD BGCOLOR="#FFFFFF" CLASS="NavBarCell1Rev"> <FONT CLASS="NavBarFont1Rev"><B>Overview</B></FONT> </TD>
|
||||
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <FONT CLASS="NavBarFont1">Package</FONT> </TD>
|
||||
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <FONT CLASS="NavBarFont1">Class</FONT> </TD>
|
||||
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <FONT CLASS="NavBarFont1">Use</FONT> </TD>
|
||||
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="overview-tree.html"><FONT CLASS="NavBarFont1"><B>Tree</B></FONT></A> </TD>
|
||||
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="deprecated-list.html"><FONT CLASS="NavBarFont1"><B>Deprecated</B></FONT></A> </TD>
|
||||
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="index-all.html"><FONT CLASS="NavBarFont1"><B>Index</B></FONT></A> </TD>
|
||||
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="help-doc.html"><FONT CLASS="NavBarFont1"><B>Help</B></FONT></A> </TD>
|
||||
</TR>
|
||||
</TABLE>
|
||||
</TD>
|
||||
<TD ALIGN="right" VALIGN="top" ROWSPAN=3><EM>
|
||||
</EM>
|
||||
</TD>
|
||||
</TR>
|
||||
|
||||
<TR>
|
||||
<TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2">
|
||||
PREV
|
||||
NEXT</FONT></TD>
|
||||
<TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2">
|
||||
<A HREF="index.html?overview-summary.html" target="_top"><B>FRAMES</B></A>
|
||||
<A HREF="overview-summary.html" target="_top"><B>NO FRAMES</B></A>
|
||||
<SCRIPT type="text/javascript">
|
||||
<!--
|
||||
if(window==top) {
|
||||
document.writeln('<A HREF="allclasses-noframe.html"><B>All Classes</B></A>');
|
||||
}
|
||||
//-->
|
||||
</SCRIPT>
|
||||
<NOSCRIPT>
|
||||
<A HREF="allclasses-noframe.html"><B>All Classes</B></A>
|
||||
</NOSCRIPT>
|
||||
|
||||
|
||||
</FONT></TD>
|
||||
</TR>
|
||||
</TABLE>
|
||||
<A NAME="skip-navbar_bottom"></A>
|
||||
<!-- ======== END OF BOTTOM NAVBAR ======= -->
|
||||
|
||||
<HR>
|
||||
Copyright © 2010-2012. All Rights Reserved.
|
||||
</BODY>
|
||||
</HTML>""")
|
||||
}
|
||||
}
|
||||
Vendored
-190
@@ -1,190 +0,0 @@
|
||||
package org.jetbrains.kotlin.doc.templates
|
||||
|
||||
import org.jetbrains.kotlin.doc.model.KModel
|
||||
|
||||
class OverviewTreeTemplate(val model: KModel) : KDocTemplate() {
|
||||
override fun render() {
|
||||
println("""<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Frameset//EN" "http://www.w3.org/TR/html4/frameset.dtd">
|
||||
<!--NewPage-->
|
||||
<HTML>
|
||||
<HEAD>
|
||||
$generatedComment
|
||||
<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
|
||||
<TITLE>
|
||||
Class Hierarchy (${model.title})
|
||||
</TITLE>
|
||||
|
||||
<META NAME="date" CONTENT="2012-01-09">
|
||||
|
||||
${stylesheets()}
|
||||
|
||||
<SCRIPT type="text/javascript">
|
||||
function windowTitle()
|
||||
{
|
||||
if (location.href.indexOf('is-external=true') == -1) {
|
||||
parent.document.title="Class Hierarchy (${model.title})";
|
||||
}
|
||||
}
|
||||
</SCRIPT>
|
||||
<NOSCRIPT>
|
||||
</NOSCRIPT>
|
||||
|
||||
</HEAD>
|
||||
|
||||
<BODY BGCOLOR="white" onload="windowTitle();">
|
||||
<HR>
|
||||
|
||||
|
||||
<!-- ========= START OF TOP NAVBAR ======= -->
|
||||
<A NAME="navbar_top"><!-- --></A>
|
||||
<A HREF="#skip-navbar_top" title="Skip navigation links"></A>
|
||||
<TABLE BORDER="0" WIDTH="100%" CELLPADDING="1" CELLSPACING="0" SUMMARY="">
|
||||
<TR>
|
||||
<TD COLSPAN=2 BGCOLOR="#EEEEFF" CLASS="NavBarCell1">
|
||||
<A NAME="navbar_top_firstrow"><!-- --></A>
|
||||
<TABLE BORDER="0" CELLPADDING="0" CELLSPACING="3" SUMMARY="">
|
||||
<TR ALIGN="center" VALIGN="top">
|
||||
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="overview-summary.html"><FONT CLASS="NavBarFont1"><B>Overview</B></FONT></A> </TD>
|
||||
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <FONT CLASS="NavBarFont1">Package</FONT> </TD>
|
||||
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <FONT CLASS="NavBarFont1">Class</FONT> </TD>
|
||||
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <FONT CLASS="NavBarFont1">Use</FONT> </TD>
|
||||
<TD BGCOLOR="#FFFFFF" CLASS="NavBarCell1Rev"> <FONT CLASS="NavBarFont1Rev"><B>Tree</B></FONT> </TD>
|
||||
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="deprecated-list.html"><FONT CLASS="NavBarFont1"><B>Deprecated</B></FONT></A> </TD>
|
||||
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="index-all.html"><FONT CLASS="NavBarFont1"><B>Index</B></FONT></A> </TD>
|
||||
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="help-doc.html"><FONT CLASS="NavBarFont1"><B>Help</B></FONT></A> </TD>
|
||||
${searchBox()}
|
||||
</TR>
|
||||
</TABLE>
|
||||
</TD>
|
||||
<TD ALIGN="right" VALIGN="top" ROWSPAN=3><EM>
|
||||
</EM>
|
||||
</TD>
|
||||
</TR>
|
||||
|
||||
<TR>
|
||||
<TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2">
|
||||
PREV
|
||||
NEXT</FONT></TD>
|
||||
<TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2">
|
||||
<A HREF="index.html?overview-tree.html" target="_top"><B>FRAMES</B></A>
|
||||
<A HREF="overview-tree.html" target="_top"><B>NO FRAMES</B></A>
|
||||
<SCRIPT type="text/javascript">
|
||||
<!--
|
||||
if(window==top) {
|
||||
document.writeln('<A HREF="allclasses-noframe.html"><B>All Classes</B></A>');
|
||||
}
|
||||
//-->
|
||||
</SCRIPT>
|
||||
<NOSCRIPT>
|
||||
<A HREF="allclasses-noframe.html"><B>All Classes</B></A>
|
||||
</NOSCRIPT>
|
||||
|
||||
|
||||
</FONT></TD>
|
||||
</TR>
|
||||
</TABLE>
|
||||
<A NAME="skip-navbar_top"></A>
|
||||
<!-- ========= END OF TOP NAVBAR ========= -->
|
||||
|
||||
<HR>
|
||||
<CENTER>
|
||||
<H2>
|
||||
Hierarchy For All Packages</H2>
|
||||
</CENTER>
|
||||
<DL>
|
||||
<DT><B>Package Hierarchies:</B><DD>""")
|
||||
|
||||
var first = true
|
||||
for (p in model.packages) {
|
||||
if (first) {
|
||||
first = false
|
||||
} else {
|
||||
print(""",
|
||||
<A HREF="${p.nameAsPath}/package-tree.html">${p.nameAsPath}</A>""")
|
||||
}
|
||||
}
|
||||
println("""</DL>
|
||||
<HR>
|
||||
<H2>
|
||||
Class Hierarchy
|
||||
</H2>""")
|
||||
|
||||
// TODO walk the hierarchy...
|
||||
/*
|
||||
<UL>
|
||||
<LI TYPE="circle">java.util.<A HREF="http://download.oracle.com/javase/1.5.0/docs/api/java/util/AbstractQueue.html?is-external=true" title="class or interface in java.util"><B>AbstractQueue</B></A><E> (implements java.util.<A HREF="http://download.oracle.com/javase/1.5.0/docs/api/java/util/Queue.html?is-external=true" title="class or interface in java.util">Queue</A><E>)
|
||||
<UL>
|
||||
*/
|
||||
|
||||
println("""<H2>
|
||||
Interface Hierarchy
|
||||
</H2>""")
|
||||
|
||||
// TODO
|
||||
println("""<H2>
|
||||
Annotation Type Hierarchy
|
||||
</H2>""")
|
||||
|
||||
// TODO
|
||||
println("""<H2>
|
||||
Enum Hierarchy
|
||||
</H2>
|
||||
<HR>
|
||||
|
||||
|
||||
<!-- ======= START OF BOTTOM NAVBAR ====== -->
|
||||
<A NAME="navbar_bottom"><!-- --></A>
|
||||
<A HREF="#skip-navbar_bottom" title="Skip navigation links"></A>
|
||||
<TABLE BORDER="0" WIDTH="100%" CELLPADDING="1" CELLSPACING="0" SUMMARY="">
|
||||
<TR>
|
||||
<TD COLSPAN=2 BGCOLOR="#EEEEFF" CLASS="NavBarCell1">
|
||||
<A NAME="navbar_bottom_firstrow"><!-- --></A>
|
||||
<TABLE BORDER="0" CELLPADDING="0" CELLSPACING="3" SUMMARY="">
|
||||
<TR ALIGN="center" VALIGN="top">
|
||||
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="overview-summary.html"><FONT CLASS="NavBarFont1"><B>Overview</B></FONT></A> </TD>
|
||||
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <FONT CLASS="NavBarFont1">Package</FONT> </TD>
|
||||
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <FONT CLASS="NavBarFont1">Class</FONT> </TD>
|
||||
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <FONT CLASS="NavBarFont1">Use</FONT> </TD>
|
||||
<TD BGCOLOR="#FFFFFF" CLASS="NavBarCell1Rev"> <FONT CLASS="NavBarFont1Rev"><B>Tree</B></FONT> </TD>
|
||||
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="deprecated-list.html"><FONT CLASS="NavBarFont1"><B>Deprecated</B></FONT></A> </TD>
|
||||
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="index-all.html"><FONT CLASS="NavBarFont1"><B>Index</B></FONT></A> </TD>
|
||||
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="help-doc.html"><FONT CLASS="NavBarFont1"><B>Help</B></FONT></A> </TD>
|
||||
</TR>
|
||||
</TABLE>
|
||||
</TD>
|
||||
<TD ALIGN="right" VALIGN="top" ROWSPAN=3><EM>
|
||||
</EM>
|
||||
</TD>
|
||||
</TR>
|
||||
|
||||
<TR>
|
||||
<TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2">
|
||||
PREV
|
||||
NEXT</FONT></TD>
|
||||
<TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2">
|
||||
<A HREF="index.html?overview-tree.html" target="_top"><B>FRAMES</B></A>
|
||||
<A HREF="overview-tree.html" target="_top"><B>NO FRAMES</B></A>
|
||||
<SCRIPT type="text/javascript">
|
||||
<!--
|
||||
if(window==top) {
|
||||
document.writeln('<A HREF="allclasses-noframe.html"><B>All Classes</B></A>');
|
||||
}
|
||||
//-->
|
||||
</SCRIPT>
|
||||
<NOSCRIPT>
|
||||
<A HREF="allclasses-noframe.html"><B>All Classes</B></A>
|
||||
</NOSCRIPT>
|
||||
|
||||
|
||||
</FONT></TD>
|
||||
</TR>
|
||||
</TABLE>
|
||||
<A NAME="skip-navbar_bottom"></A>
|
||||
<!-- ======== END OF BOTTOM NAVBAR ======= -->
|
||||
|
||||
<HR>
|
||||
Copyright © 2010-2012. All Rights Reserved.
|
||||
</BODY>
|
||||
</HTML>""")
|
||||
}
|
||||
}
|
||||
Vendored
-118
@@ -1,118 +0,0 @@
|
||||
package org.jetbrains.kotlin.doc.templates
|
||||
|
||||
import org.jetbrains.kotlin.doc.model.KModel
|
||||
import org.jetbrains.kotlin.doc.model.KPackage
|
||||
import org.jetbrains.kotlin.doc.model.extensionFunctions
|
||||
import org.jetbrains.kotlin.doc.model.filterDuplicateNames
|
||||
|
||||
class PackageFrameTemplate(val model: KModel, p: KPackage) : PackageTemplateSupport(p) {
|
||||
override fun render() {
|
||||
println("""<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
|
||||
<!--NewPage-->
|
||||
<HTML>
|
||||
<HEAD>
|
||||
$generatedComment
|
||||
<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
|
||||
<TITLE>
|
||||
${pkg.name} (${model.title})
|
||||
</TITLE>
|
||||
|
||||
<META NAME="date" CONTENT="2012-01-09">
|
||||
${stylesheets()}
|
||||
|
||||
</HEAD>
|
||||
|
||||
<BODY BGCOLOR="white">
|
||||
<FONT size="+1" CLASS="FrameTitleFont">
|
||||
<A HREF="${pkg.nameAsRelativePath}${pkg.nameAsPath}/package-summary.html" target="classFrame">${pkg.name}</A></FONT>""")
|
||||
|
||||
printClasses("trait", "Traits")
|
||||
printClasses("class", "Classes")
|
||||
printClasses("enum", "Enums")
|
||||
printClasses("annotation", "Annotations")
|
||||
printClasses("exception", "Exceptions")
|
||||
printPackageProperties()
|
||||
printFunctions()
|
||||
printExtensionFunctions()
|
||||
|
||||
println("""</BODY>
|
||||
</HTML>""")
|
||||
}
|
||||
|
||||
protected fun printClasses(kind: String, description: String): Unit {
|
||||
val classes = pkg.classes.filter{ it.kind == kind }
|
||||
if (! classes.isEmpty()) {
|
||||
println("""<TABLE BORDER="0" WIDTH="100%" SUMMARY="">
|
||||
<TR>
|
||||
<TD NOWRAP><FONT size="+1" CLASS="FrameHeadingFont">""")
|
||||
print(description)
|
||||
println("""</FONT>
|
||||
<FONT CLASS="FrameItemFont">
|
||||
<BR>""")
|
||||
for (c in classes) {
|
||||
val formatted = if (kind == "interface") "<I>${c.simpleName}</I>" else c.simpleName
|
||||
println("""<A HREF="${c.simpleName}.html" title="$kind in ${pkg.name}" target="classFrame">$formatted</A>
|
||||
<BR>""")
|
||||
}
|
||||
println("""</TR>
|
||||
</TABLE>""")
|
||||
}
|
||||
}
|
||||
|
||||
protected fun printFunctions(): Unit {
|
||||
val functions = filterDuplicateNames(pkg.packageFunctions())
|
||||
if (! functions.isEmpty()) {
|
||||
println("""<TABLE BORDER="0" WIDTH="100%" SUMMARY="">
|
||||
<TR>
|
||||
<TD NOWRAP><FONT size="+1" CLASS="FrameHeadingFont">Functions</FONT>
|
||||
<FONT CLASS="FrameItemFont">
|
||||
<BR>""")
|
||||
|
||||
var lastName = ""
|
||||
for (c in functions) {
|
||||
// only show the first function with a given name
|
||||
if (c.name != lastName) {
|
||||
println("""<A HREF="${href(c)}" title="function in ${pkg.name}" target="classFrame"><I>${c.name}</I></A>
|
||||
<BR>""")
|
||||
}
|
||||
lastName = c.name
|
||||
}
|
||||
println("""</TR>
|
||||
</TABLE>""")
|
||||
}
|
||||
}
|
||||
|
||||
protected fun printExtensionFunctions(): Unit {
|
||||
val map = extensionFunctions(pkg.functions)
|
||||
if (!map.isEmpty()) {
|
||||
println("""<TABLE BORDER="0" WIDTH="100%" SUMMARY="">
|
||||
<TR>
|
||||
<TD NOWRAP><FONT size="+1" CLASS="FrameHeadingFont">Extensions</FONT>
|
||||
<FONT CLASS="FrameItemFont">
|
||||
<BR>""")
|
||||
for (e in map) {
|
||||
val c = e.key
|
||||
println("""<A HREF="${extensionsHref(pkg, c)}" title="extensions functions on class ${c.name} from ${pkg.name}" target="classFrame"><I>${c.name}</I></A>
|
||||
<BR>""")
|
||||
}
|
||||
println("""</TR>
|
||||
</TABLE>""")
|
||||
}
|
||||
}
|
||||
protected fun printPackageProperties(): Unit {
|
||||
val list = pkg.packageProperties()
|
||||
if (list.isNotEmpty()) {
|
||||
println("""<TABLE BORDER="0" WIDTH="100%" SUMMARY="">
|
||||
<TR>
|
||||
<TD NOWRAP><FONT size="+1" CLASS="FrameHeadingFont">Properties</FONT>
|
||||
<FONT CLASS="FrameItemFont">
|
||||
<BR>""")
|
||||
for (c in list) {
|
||||
println("""<A HREF="${href(pkg, c)}" title="property from ${pkg.name}" target="classFrame"><I>${c.name}</I></A>
|
||||
<BR>""")
|
||||
}
|
||||
println("""</TR>
|
||||
</TABLE>""")
|
||||
}
|
||||
}
|
||||
}
|
||||
Vendored
-11
@@ -1,11 +0,0 @@
|
||||
package org.jetbrains.kotlin.doc.templates
|
||||
|
||||
import org.jetbrains.kotlin.doc.model.KModel
|
||||
|
||||
class PackageListTemplate(val model: KModel) : KDocTemplate() {
|
||||
override fun render() {
|
||||
for (p in model.packages) {
|
||||
println(p.name)
|
||||
}
|
||||
}
|
||||
}
|
||||
Vendored
-304
@@ -1,304 +0,0 @@
|
||||
package org.jetbrains.kotlin.doc.templates
|
||||
|
||||
import org.jetbrains.kotlin.doc.model.KModel
|
||||
import org.jetbrains.kotlin.doc.model.KPackage
|
||||
import org.jetbrains.kotlin.doc.model.filterDuplicateNames
|
||||
import org.jetbrains.kotlin.doc.model.inheritedExtensionFunctions
|
||||
|
||||
class PackageSummaryTemplate(val model: KModel, pkg: KPackage) : PackageTemplateSupport(pkg) {
|
||||
override fun render() {
|
||||
println("""<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
|
||||
<!--NewPage-->
|
||||
<HTML>
|
||||
<HEAD>
|
||||
$generatedComment
|
||||
<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
|
||||
<TITLE>
|
||||
${pkg.name} (${model.title})
|
||||
</TITLE>
|
||||
|
||||
<META NAME="date" CONTENT="2012-01-09">
|
||||
<META NAME="date" CONTENT="2012-01-09">
|
||||
${stylesheets()}
|
||||
|
||||
<SCRIPT type="text/javascript">
|
||||
function windowTitle()
|
||||
{
|
||||
if (location.href.indexOf('is-external=true') == -1) {
|
||||
parent.document.title="${pkg.name} (${model.title})";
|
||||
}
|
||||
}
|
||||
</SCRIPT>
|
||||
<NOSCRIPT>
|
||||
</NOSCRIPT>
|
||||
|
||||
</HEAD>
|
||||
|
||||
<BODY BGCOLOR="white" onload="windowTitle();">
|
||||
<HR>
|
||||
|
||||
|
||||
<!-- ========= START OF TOP NAVBAR ======= -->
|
||||
<A NAME="navbar_top"><!-- --></A>
|
||||
<A HREF="#skip-navbar_top" title="Skip navigation links"></A>
|
||||
<TABLE BORDER="0" WIDTH="100%" CELLPADDING="1" CELLSPACING="0" SUMMARY="">
|
||||
<TR>
|
||||
<TD COLSPAN=2 BGCOLOR="#EEEEFF" CLASS="NavBarCell1">
|
||||
<A NAME="navbar_top_firstrow"><!-- --></A>
|
||||
<TABLE BORDER="0" CELLPADDING="0" CELLSPACING="3" SUMMARY="">
|
||||
<TR ALIGN="center" VALIGN="top">
|
||||
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="${pkg.nameAsRelativePath}overview-summary.html"><FONT CLASS="NavBarFont1"><B>Overview</B></FONT></A> </TD>
|
||||
<TD BGCOLOR="#FFFFFF" CLASS="NavBarCell1Rev"> <FONT CLASS="NavBarFont1Rev"><B>Package</B></FONT> </TD>
|
||||
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <FONT CLASS="NavBarFont1">Class</FONT> </TD>
|
||||
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="package-use.html"><FONT CLASS="NavBarFont1"><B>Use</B></FONT></A> </TD>
|
||||
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="package-tree.html"><FONT CLASS="NavBarFont1"><B>Tree</B></FONT></A> </TD>
|
||||
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="${pkg.nameAsRelativePath}deprecated-list.html"><FONT CLASS="NavBarFont1"><B>Deprecated</B></FONT></A> </TD>
|
||||
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="${pkg.nameAsRelativePath}index-all.html"><FONT CLASS="NavBarFont1"><B>Index</B></FONT></A> </TD>
|
||||
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="${pkg.nameAsRelativePath}help-doc.html"><FONT CLASS="NavBarFont1"><B>Help</B></FONT></A> </TD>
|
||||
${searchBox()}
|
||||
</TR>
|
||||
</TABLE>
|
||||
</TD>
|
||||
<TD ALIGN="right" VALIGN="top" ROWSPAN=3><EM>
|
||||
</EM>
|
||||
</TD>
|
||||
</TR>
|
||||
|
||||
<TR>""")
|
||||
|
||||
printNextPrevPackages()
|
||||
println("""<TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2">
|
||||
<A HREF="${relativePrefix()}index.html" target="_top"><B>FRAMES</B></A>
|
||||
<A HREF="package-summary.html" target="_top"><B>NO FRAMES</B></A>
|
||||
<SCRIPT type="text/javascript">
|
||||
<!--
|
||||
if(window==top) {
|
||||
document.writeln('<A HREF="${relativePrefix()}allclasses-noframe.html"><B>All Classes</B></A>');
|
||||
}
|
||||
//-->
|
||||
</SCRIPT>
|
||||
<NOSCRIPT>
|
||||
<A HREF="${relativePrefix()}allclasses-noframe.html"><B>All Classes</B></A>
|
||||
</NOSCRIPT>
|
||||
|
||||
|
||||
</FONT></TD>
|
||||
</TR>
|
||||
</TABLE>
|
||||
<A NAME="skip-navbar_top"></A>
|
||||
<!-- ========= END OF TOP NAVBAR ========= -->
|
||||
|
||||
<HR>
|
||||
<FONT SIZE="-1">""")
|
||||
|
||||
for (a in pkg.annotations) {
|
||||
val url = a.url
|
||||
if (url != null) {
|
||||
println("""<A HREF="$url?is-external=true" title="class or interface in ${a.packageName}">@${a.simpleName}</A>""")
|
||||
}
|
||||
}
|
||||
println("""</FONT><H2>
|
||||
Package ${pkg.name}
|
||||
</H2>
|
||||
${pkg.description(this)}
|
||||
<P>
|
||||
<B>See:</B>
|
||||
<BR>
|
||||
<A HREF="#package_description"><B>Description</B></A>
|
||||
<P>
|
||||
""")
|
||||
|
||||
printClasses("trait", "Traits")
|
||||
printClasses("class", "Classes")
|
||||
printClasses("enum", "Enums")
|
||||
printClasses("annotation", "Annotations")
|
||||
printClasses("exception", "Exceptions")
|
||||
|
||||
printPropertySummary(pkg.packageProperties())
|
||||
printFunctionSummary(pkg.packageFunctions())
|
||||
|
||||
printExtensionFunctions()
|
||||
|
||||
println("""<A NAME="package_description"><!-- --></A><H2>
|
||||
Package ${pkg.name} Description
|
||||
</H2>
|
||||
|
||||
<P>
|
||||
${pkg.detailedDescription(this)}
|
||||
|
||||
<h2>Contents</h2>
|
||||
|
||||
""")
|
||||
|
||||
for ((group, list) in pkg.groupClassMap()) {
|
||||
println(""" <h3>$group</h3>
|
||||
|
||||
<ul>""")
|
||||
for (c in list) {
|
||||
println(""" <li><A HREF="${pkg.nameAsRelativePath}${c.nameAsPath}.html" title="class in ${pkg.name}"><CODE>${c.simpleName}</CODE></A>""")
|
||||
}
|
||||
println("""
|
||||
</ul>""")
|
||||
}
|
||||
println("""<P>""")
|
||||
|
||||
printFunctionDetail(pkg.packageFunctions())
|
||||
|
||||
println("""
|
||||
|
||||
<P>
|
||||
<DL>
|
||||
</DL>
|
||||
<HR>
|
||||
|
||||
|
||||
<!-- ======= START OF BOTTOM NAVBAR ====== -->
|
||||
<A NAME="navbar_bottom"><!-- --></A>
|
||||
<A HREF="#skip-navbar_bottom" title="Skip navigation links"></A>
|
||||
<TABLE BORDER="0" WIDTH="100%" CELLPADDING="1" CELLSPACING="0" SUMMARY="">
|
||||
<TR>
|
||||
<TD COLSPAN=2 BGCOLOR="#EEEEFF" CLASS="NavBarCell1">
|
||||
<A NAME="navbar_bottom_firstrow"><!-- --></A>
|
||||
<TABLE BORDER="0" CELLPADDING="0" CELLSPACING="3" SUMMARY="">
|
||||
<TR ALIGN="center" VALIGN="top">
|
||||
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="${pkg.nameAsRelativePath}overview-summary.html"><FONT CLASS="NavBarFont1"><B>Overview</B></FONT></A> </TD>
|
||||
<TD BGCOLOR="#FFFFFF" CLASS="NavBarCell1Rev"> <FONT CLASS="NavBarFont1Rev"><B>Package</B></FONT> </TD>
|
||||
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <FONT CLASS="NavBarFont1">Class</FONT> </TD>
|
||||
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="package-use.html"><FONT CLASS="NavBarFont1"><B>Use</B></FONT></A> </TD>
|
||||
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="package-tree.html"><FONT CLASS="NavBarFont1"><B>Tree</B></FONT></A> </TD>
|
||||
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="${pkg.nameAsRelativePath}deprecated-list.html"><FONT CLASS="NavBarFont1"><B>Deprecated</B></FONT></A> </TD>
|
||||
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="${pkg.nameAsRelativePath}index-all.html"><FONT CLASS="NavBarFont1"><B>Index</B></FONT></A> </TD>
|
||||
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="${pkg.nameAsRelativePath}help-doc.html"><FONT CLASS="NavBarFont1"><B>Help</B></FONT></A> </TD>
|
||||
</TR>
|
||||
</TABLE>
|
||||
</TD>
|
||||
<TD ALIGN="right" VALIGN="top" ROWSPAN=3><EM>
|
||||
</EM>
|
||||
</TD>
|
||||
</TR>
|
||||
|
||||
<TR>""")
|
||||
|
||||
printNextPrevPackages()
|
||||
|
||||
println("""<TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2">
|
||||
<A HREF="${relativePrefix()}index.html" target="_top"><B>FRAMES</B></A>
|
||||
<A HREF="package-summary.html" target="_top"><B>NO FRAMES</B></A>
|
||||
<SCRIPT type="text/javascript">
|
||||
<!--
|
||||
if(window==top) {
|
||||
document.writeln('<A HREF="${pkg.nameAsRelativePath}allclasses-noframe.html"><B>All Classes</B></A>');
|
||||
}
|
||||
//-->
|
||||
</SCRIPT>
|
||||
<NOSCRIPT>
|
||||
<A HREF="${pkg.nameAsRelativePath}allclasses-noframe.html"><B>All Classes</B></A>
|
||||
</NOSCRIPT>
|
||||
|
||||
|
||||
</FONT></TD>
|
||||
</TR>
|
||||
</TABLE>
|
||||
<A NAME="skip-navbar_bottom"></A>
|
||||
<!-- ======== END OF BOTTOM NAVBAR ======= -->
|
||||
|
||||
<HR>
|
||||
Copyright © 2010-2012. All Rights Reserved.
|
||||
</BODY>
|
||||
</HTML>""")
|
||||
}
|
||||
|
||||
|
||||
protected fun printClasses(kind: String, description: String): Unit {
|
||||
val classes = pkg.classes.filter{ it.kind == kind }
|
||||
if (! classes.isEmpty()) {
|
||||
print("""<TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY="">
|
||||
<TR BGCOLOR="#CCCCFF" CLASS="TableHeadingColor">
|
||||
<TH ALIGN="left" COLSPAN="2"><FONT SIZE="+2">
|
||||
<B>$description Summary</B></FONT></TH>
|
||||
</TR>""")
|
||||
|
||||
for (c in classes) {
|
||||
println("""<TR BGCOLOR="white" CLASS="TableRowColor">
|
||||
<TD WIDTH="15%"><B><A HREF="${pkg.nameAsRelativePath}${c.nameAsPath}.html" title="$kind in ${pkg.name}">${c.simpleName}</A></B></TD>
|
||||
<TD>${c.description(this)}</TD>
|
||||
</TR>""")
|
||||
}
|
||||
println("""</TABLE>
|
||||
|
||||
|
||||
<P>
|
||||
""")
|
||||
}
|
||||
}
|
||||
|
||||
// TODO delete
|
||||
protected fun printFunctions(): Unit {
|
||||
val functions = pkg.functions.filter{ it.extensionClass == null }
|
||||
if (! functions.isEmpty()) {
|
||||
print("""<TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY="">
|
||||
<TR BGCOLOR="#CCCCFF" CLASS="TableHeadingColor">
|
||||
<TH ALIGN="left" COLSPAN="2"><FONT SIZE="+2">
|
||||
<B>Functions Summary</B></FONT></TH>
|
||||
</TR>""")
|
||||
|
||||
for (f in functions) {
|
||||
println("""<TR BGCOLOR="white" CLASS="TableRowColor">
|
||||
<TD WIDTH="15%"><B><A HREF="${href(f)}" title="function in ${pkg.name}">${f.name}</A></B></TD>
|
||||
<TD>${f.description(this)}</TD>
|
||||
</TR>""")
|
||||
}
|
||||
println("""</TABLE>
|
||||
|
||||
|
||||
<P>
|
||||
""")
|
||||
}
|
||||
}
|
||||
|
||||
protected fun printExtensionFunctions(): Unit {
|
||||
val map = inheritedExtensionFunctions(pkg.functions)
|
||||
if (! map.isEmpty()) {
|
||||
print("""<TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY="">
|
||||
<TR BGCOLOR="#CCCCFF" CLASS="TableHeadingColor">
|
||||
<TH ALIGN="left" COLSPAN="2"><FONT SIZE="+2">
|
||||
<B>Extensions Summary</B></FONT></TH>
|
||||
</TR>""")
|
||||
|
||||
for ((c, list) in map) {
|
||||
println("""<TR BGCOLOR="white" CLASS="TableRowColor">
|
||||
<TD WIDTH="15%"><B><A HREF="${extensionsHref(pkg, c)}" title="extensions on ${pkg.name}">${c.name}</A></B></TD>
|
||||
<TD>""")
|
||||
for (f in filterDuplicateNames(list)) {
|
||||
println("""<A HREF="${extensionsHref(pkg, c, f)}">${f.name}<A> """)
|
||||
}
|
||||
println("""</TD>
|
||||
</TR>""")
|
||||
}
|
||||
println("""</TABLE>
|
||||
|
||||
|
||||
<P>
|
||||
""")
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
protected fun printNextPrevPackages(): Unit {
|
||||
println("""<TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2">""")
|
||||
val prev = model.previous(pkg)
|
||||
if (prev != null) {
|
||||
println(""" <A HREF="${prev.nameAsRelativePath}${prev.nameAsPath}/package-summary.html"><B>PREV PACKAGE</B></A> """)
|
||||
} else {
|
||||
println(""" PREV PACKAGE """ )
|
||||
}
|
||||
val next = model.next(pkg)
|
||||
if (next != null) {
|
||||
println(""" <A HREF="${next.nameAsRelativePath}${next.nameAsPath}/package-summary.html"><B>NEXT PACKAGE</B></A>""")
|
||||
} else {
|
||||
println(""" NEXT PACKAGE""" )
|
||||
}
|
||||
println("""</FONT></TD>""")
|
||||
|
||||
}
|
||||
}
|
||||
Vendored
-279
@@ -1,279 +0,0 @@
|
||||
package org.jetbrains.kotlin.doc.templates
|
||||
|
||||
import java.util.*
|
||||
import org.jetbrains.kotlin.doc.model.KAnnotation
|
||||
import org.jetbrains.kotlin.doc.model.KFunction
|
||||
import org.jetbrains.kotlin.doc.model.KPackage
|
||||
import org.jetbrains.kotlin.doc.model.KProperty
|
||||
|
||||
abstract class PackageTemplateSupport(open val pkg: KPackage) : KDocTemplate() {
|
||||
|
||||
protected override fun relativePrefix(): String = pkg.nameAsRelativePath
|
||||
|
||||
val funKeyword = keyword("fun")
|
||||
val valKeyword = keyword("val")
|
||||
val varKeyword = keyword("var")
|
||||
|
||||
protected fun keyword(name: String): String = "<B>$name</B>"
|
||||
|
||||
fun printFunctionSummary(functions: Collection<KFunction>): Unit {
|
||||
if (functions.isNotEmpty()) {
|
||||
println("""<!-- ========== FUNCTION SUMMARY =========== -->
|
||||
|
||||
<A NAME="method_summary"><!-- --></A>
|
||||
<TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY="">
|
||||
<TR BGCOLOR="#CCCCFF" CLASS="TableHeadingColor">
|
||||
<TH ALIGN="left" COLSPAN="2"><FONT SIZE="+2">
|
||||
<B>Function Summary</B></FONT></TH>
|
||||
</TR>""")
|
||||
|
||||
for (f in functions) {
|
||||
printFunctionSummary(f)
|
||||
}
|
||||
println("""</TABLE>
|
||||
|
||||
<P>
|
||||
""")
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
fun printFunctionSummary(function: KFunction): Unit {
|
||||
val deprecated = if (function.deprecated) "<B>Deprecated.</B>" else ""
|
||||
print("""<TR BGCOLOR="white" CLASS="TableRowColor">
|
||||
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
|
||||
<CODE>""")
|
||||
if (!function.typeParameters.isEmpty()) {
|
||||
println("""<TABLE BORDER="0" CELLPADDING="0" CELLSPACING="0" SUMMARY="">
|
||||
<TR ALIGN="right" VALIGN="">
|
||||
<TD NOWRAP><FONT SIZE="-1">
|
||||
<CODE>""")
|
||||
print("$funKeyword ")
|
||||
printTypeParameters(function)
|
||||
printReceiverType(function, "<BR>")
|
||||
println("""</CODE></FONT></TD>
|
||||
</TR>
|
||||
</TABLE>""")
|
||||
} else {
|
||||
print(funKeyword)
|
||||
printReceiverType(function)
|
||||
}
|
||||
// print receiver type
|
||||
println("""</CODE></FONT></TD>""")
|
||||
print("""<TD><CODE><B><A HREF="${href(function)}">${function.name}</A></B>""")
|
||||
printParameters(function)
|
||||
print(": ")
|
||||
print(link(function.returnType))
|
||||
println("""</CODE>""")
|
||||
println("")
|
||||
if (true) {
|
||||
println("""<BR>""")
|
||||
println("""${function.description(this)}""")
|
||||
} else {
|
||||
println("""<BR>""")
|
||||
println(""" ${deprecated} ${function.detailedDescription(this)}</TD>""")
|
||||
}
|
||||
println("""</TD>""")
|
||||
println("""</TR>""")
|
||||
}
|
||||
|
||||
|
||||
fun printReceiverType(function: KFunction, prefix: String = " ", postfix: String = "", none: String = ""): Unit {
|
||||
val receiverType = function.receiverType
|
||||
if (receiverType != null) {
|
||||
print(prefix)
|
||||
print(link(receiverType))
|
||||
print(postfix)
|
||||
} else {
|
||||
print(none)
|
||||
}
|
||||
}
|
||||
|
||||
fun printFunctionDetail(functions: Collection<KFunction>): Unit {
|
||||
if (functions.isNotEmpty()) {
|
||||
println("""
|
||||
|
||||
<!-- ============ FUNCTION DETAIL ========== -->
|
||||
|
||||
<A NAME="method_detail"><!-- --></A>
|
||||
<TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY="">
|
||||
<TR BGCOLOR="#CCCCFF" CLASS="TableHeadingColor">
|
||||
<TH ALIGN="left" COLSPAN="1"><FONT SIZE="+2">
|
||||
<B>Function Detail</B></FONT></TH>
|
||||
</TR>
|
||||
</TABLE>
|
||||
""")
|
||||
|
||||
for (f in functions) {
|
||||
printFunctionDetail(f)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
fun printFunctionDetail(function: KFunction): Unit {
|
||||
println("""<div class="doc-member function">""")
|
||||
println("""<div class="source-detail"><a href="${sourceHref(function)}"${function.sourceTargetAttribute()}>source</a></div>""")
|
||||
|
||||
println("""<A NAME="${function.name}{${function.parameterTypeText}}"><!-- --></A><A NAME="${function.link}"><!-- --></A><H3>""")
|
||||
println("""${function.name}</H3>""")
|
||||
println("""<PRE>""")
|
||||
println("""<FONT SIZE="-1">""")
|
||||
printAnnotations(function.annotations)
|
||||
print("""</FONT>${function.modifiers.joinToString(" ")} $funKeyword""")
|
||||
|
||||
printTypeParameters(function, " ")
|
||||
printReceiverType(function, " ", ".", " ")
|
||||
print("""<B>${function.name}</B>""")
|
||||
printParameters(function)
|
||||
print(": ")
|
||||
print(link(function.returnType))
|
||||
|
||||
val exlist = function.exceptions
|
||||
var first = true
|
||||
if (!exlist.isEmpty()) {
|
||||
println(""" throws """);
|
||||
for (ex in exlist) {
|
||||
if (first) first = false else print(", ")
|
||||
print(link(ex))
|
||||
}
|
||||
}
|
||||
println("""</PRE>""")
|
||||
|
||||
println(function.detailedDescription(this))
|
||||
/* TODO
|
||||
println("""<DL>
|
||||
<DD><B>Deprecated.</B> TODO text
|
||||
<P>
|
||||
<DD><b>Deprecated.</b>
|
||||
<P>
|
||||
<DD>
|
||||
<DL>
|
||||
<DT><B>Throws:</B>
|
||||
<DD><CODE>${link(ex}</CODE><DT><B>Since:</B></DT>
|
||||
<DD>${since}</DD>
|
||||
</DL>
|
||||
</DD>
|
||||
</DL>
|
||||
*/
|
||||
println("""</div>""")
|
||||
}
|
||||
|
||||
fun printPropertySummary(properties: Collection<KProperty>): Unit {
|
||||
if (properties.isNotEmpty()) {
|
||||
println("""<!-- ========== PROPERTY SUMMARY =========== -->
|
||||
|
||||
<A NAME="method_summary"><!-- --></A>
|
||||
<TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY="">
|
||||
<TR BGCOLOR="#CCCCFF" CLASS="TableHeadingColor">
|
||||
<TH ALIGN="left" COLSPAN="2"><FONT SIZE="+2">
|
||||
<B>Property Summary</B></FONT></TH>
|
||||
</TR>""")
|
||||
|
||||
for (f in properties) {
|
||||
printPropertySummary(f)
|
||||
}
|
||||
println("""</TABLE>
|
||||
|
||||
<P>
|
||||
""")
|
||||
}
|
||||
}
|
||||
|
||||
fun printPropertySummary(property: KProperty): Unit {
|
||||
val deprecated = if (property.deprecated) "<B>Deprecated.</B>" else ""
|
||||
print("""<TR BGCOLOR="white" CLASS="TableRowColor">
|
||||
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
|
||||
<CODE>""")
|
||||
print(if (property.isVar()) varKeyword else valKeyword)
|
||||
/*
|
||||
if (!property.typeParameters.isEmpty()) {
|
||||
println("""<TABLE BORDER="0" CELLPADDING="0" CELLSPACING="0" SUMMARY="">
|
||||
<TR ALIGN="right" VALIGN="">
|
||||
<TD NOWRAP><FONT SIZE="-1">
|
||||
<CODE>""")
|
||||
printTypeParameters(property)
|
||||
println("""<BR>""")
|
||||
print(link(property.returnType))
|
||||
println("""</CODE></FONT></TD>
|
||||
</TR>
|
||||
</TABLE>""")
|
||||
} else {
|
||||
print(link(property.returnType))
|
||||
}
|
||||
*/
|
||||
println("""</CODE></FONT></TD>""")
|
||||
print("""<TD>
|
||||
<div class="doc-member property">
|
||||
<div class="source-detail"><a HREF="${sourceHref(property)}"${property.sourceTargetAttribute()}>source</a></div>
|
||||
<CODE><B>${property.name}</B>: """)
|
||||
print(link(property.returnType))
|
||||
//printParameters(property)
|
||||
println("""</CODE>""")
|
||||
println("""""")
|
||||
println("""<BR>""")
|
||||
println(""" ${deprecated} ${property.detailedDescription(this)}
|
||||
</div></TD>""")
|
||||
println("""</TR>""")
|
||||
}
|
||||
|
||||
fun printTypeParameters(method: KFunction, separator: String = ""): Unit {
|
||||
val typeParameters = method.typeParameters
|
||||
if (!typeParameters.isEmpty()) {
|
||||
print(separator)
|
||||
print("<")
|
||||
var separator = ""
|
||||
for (t in typeParameters) {
|
||||
print(separator)
|
||||
separator = ", "
|
||||
print(t.name)
|
||||
val elist = t.extends
|
||||
if (!elist.isEmpty()) {
|
||||
print(" extends ")
|
||||
var esep = ""
|
||||
for (e in elist) {
|
||||
print(esep)
|
||||
esep = " & "
|
||||
print(link(e))
|
||||
}
|
||||
}
|
||||
}
|
||||
print(">")
|
||||
}
|
||||
}
|
||||
|
||||
fun printParameters(method: KFunction): Unit {
|
||||
print("(")
|
||||
var first = true
|
||||
var defaultValue = false
|
||||
for (p in method.parameters) {
|
||||
if (!p.hasDefaultValue() && defaultValue) {
|
||||
print("]")
|
||||
defaultValue = false
|
||||
}
|
||||
if (first) first = false else print(", ")
|
||||
if (p.hasDefaultValue() && !defaultValue) {
|
||||
print(" [")
|
||||
defaultValue = true
|
||||
}
|
||||
val pType = if (p.isVarArg()) {
|
||||
print("vararg ")
|
||||
p.varArgType()!!
|
||||
} else {
|
||||
p.aType
|
||||
}
|
||||
print("${p.name}: ")
|
||||
print(link(pType))
|
||||
}
|
||||
if (defaultValue) {
|
||||
print("]")
|
||||
}
|
||||
print(")")
|
||||
}
|
||||
|
||||
|
||||
fun printAnnotations(annotations: Collection<KAnnotation>): Unit {
|
||||
for (a in annotations) {
|
||||
println(link(a))
|
||||
}
|
||||
}
|
||||
}
|
||||
Vendored
-64
@@ -1,64 +0,0 @@
|
||||
package org.jetbrains.kotlin.doc.templates
|
||||
|
||||
import java.util.*
|
||||
import org.jetbrains.kotlin.doc.model.*
|
||||
|
||||
class SearchXmlTemplate(val model: KModel): KDocTemplate() {
|
||||
|
||||
class Search(val name: String, val href: String, val kind: String) {
|
||||
override fun toString() = "Search($name, $href, $kind)"
|
||||
}
|
||||
|
||||
override fun render() {
|
||||
val map = TreeMap<String, Search>()
|
||||
|
||||
fun add(name: String, href: String, kind: String): Unit {
|
||||
val search = Search(name, href, kind)
|
||||
if (!map.containsKey(name)) {
|
||||
map.put(name, search)
|
||||
}
|
||||
}
|
||||
|
||||
fun add(owner: KClass, c: KFunction, href: String): Unit {
|
||||
add("${c.name}() [${owner.name}]", href, "fun")
|
||||
}
|
||||
|
||||
fun add(owner: KClass, c: KProperty, href: String): Unit {
|
||||
add("${c.name} [${owner.name}]", href, c.kind())
|
||||
}
|
||||
|
||||
for (c in model.classes) {
|
||||
add("${c.simpleName} [${c.pkg.name}]", "${c.nameAsPath}.html", c.kind)
|
||||
|
||||
c.functions.forEach { add(c, it, href(it)) }
|
||||
c.properties.forEach { add(c, it, href(it)) }
|
||||
}
|
||||
|
||||
for (p in model.packages) {
|
||||
val fmap = inheritedExtensionFunctions(p.functions)
|
||||
val pmap = inheritedExtensionProperties(p.properties)
|
||||
val classes = hashSetOf<KClass>()
|
||||
classes.addAll(fmap.keySet())
|
||||
classes.addAll(pmap.keySet())
|
||||
for (c in classes) {
|
||||
val functions = fmap.get(c).orEmpty()
|
||||
val properties = pmap.get(c).orEmpty()
|
||||
|
||||
functions.forEach { add(c, it, p.nameAsPath + "/" + extensionsHref(p, c, it)) }
|
||||
properties.forEach { add(c, it, p.nameAsPath + "/" + extensionsHref(p, c, it)) }
|
||||
}
|
||||
}
|
||||
|
||||
println("""<?xml version="1.0" encoding="UTF-8"?>
|
||||
<searches>""")
|
||||
for (s in map.values()) {
|
||||
println("""<search>
|
||||
<href>${s.href}</href>
|
||||
<name>${s.name}</name>
|
||||
<kind>${s.kind}</kind>
|
||||
</search>""")
|
||||
}
|
||||
println("""</searches>""")
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,84 +0,0 @@
|
||||
package org.jetbrains.kotlin.template
|
||||
|
||||
abstract class HtmlTemplate() : TextTemplate() {
|
||||
|
||||
fun tag(
|
||||
tagName: String,
|
||||
style: String? = null,
|
||||
className: String? = null,
|
||||
attributes: List<Pair<String, String>> = listOf(),
|
||||
content: () -> Unit) {
|
||||
val allAttributes = arrayListOf<Pair<String, String>>()
|
||||
if (style != null)
|
||||
allAttributes.add(Pair("style", style))
|
||||
if (className != null)
|
||||
allAttributes.add(Pair("class", className))
|
||||
|
||||
allAttributes.addAll(attributes)
|
||||
|
||||
print(
|
||||
if (allAttributes.isEmpty()) {
|
||||
"<$tagName>"
|
||||
}
|
||||
else {
|
||||
// TODO: escape values
|
||||
"<$tagName ${allAttributes.map { t -> "${t.first}='${t.second.escapeHtml()}'" }.joinToString(" ")}>"
|
||||
}
|
||||
)
|
||||
content()
|
||||
print("</$tagName>")
|
||||
}
|
||||
|
||||
fun text(text: String) {
|
||||
print(text.escapeHtml())
|
||||
}
|
||||
|
||||
fun tag(tagName: String, content: String) =
|
||||
tag(tagName) {
|
||||
text(content)
|
||||
}
|
||||
|
||||
fun html(content: () -> Unit) {
|
||||
println("<!DOCTYPE html>")
|
||||
tag(tagName = "html", content = content)
|
||||
}
|
||||
|
||||
fun head(content: () -> Unit) =
|
||||
tag(tagName = "head", content = content)
|
||||
|
||||
fun linkCssStylesheet(href: String) =
|
||||
tag(
|
||||
tagName = "link",
|
||||
attributes = listOf(Pair("rel", "stylesheet"), Pair("type", "text/css"), Pair("href", href))) {}
|
||||
|
||||
fun body(style: String? = null, className: String? = null, content: () -> Unit) =
|
||||
tag(tagName = "body", style = style, className = className, content = content)
|
||||
|
||||
fun table(style: String? = null, className: String? = null, content: () -> Unit) =
|
||||
tag(tagName = "table", style = style, className = className, content = content)
|
||||
|
||||
fun tr(style: String? = null, className: String? = null, content: () -> Unit) =
|
||||
tag(tagName = "tr", style = style, className = className, content = content)
|
||||
|
||||
fun td(style: String? = null, className: String? = null, content: () -> Unit) =
|
||||
tag(tagName = "td", style = style, className = className, content = content)
|
||||
|
||||
fun title(title: String) =
|
||||
tag("title", title)
|
||||
|
||||
fun div(style: String? = null, className: String? = null, content: () -> Unit) =
|
||||
tag(tagName = "div", style = style, className = className, content = content)
|
||||
|
||||
fun span(style: String? = null, className: String? = null, content: () -> Unit) =
|
||||
tag(tagName = "span", style = style, className = className, content = content)
|
||||
|
||||
fun a(href: String? = null, name: String? = null, content: () -> Unit) {
|
||||
val attributes = arrayListOf<Pair<String, String>>()
|
||||
if (href != null)
|
||||
attributes.add(Pair("href", href))
|
||||
if (name != null)
|
||||
attributes.add(Pair("name", name))
|
||||
tag(tagName = "a", attributes = attributes, content = content)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,111 +0,0 @@
|
||||
package org.jetbrains.kotlin.template
|
||||
|
||||
import java.io.File
|
||||
import java.io.FileWriter
|
||||
import java.io.OutputStream
|
||||
import java.io.OutputStreamWriter
|
||||
import java.io.StringWriter
|
||||
import java.io.Writer
|
||||
|
||||
/**
|
||||
* Represents a generic API to templates which should be usable
|
||||
* in JavaScript in a browser or on the server side stand alone or in a web app etc.
|
||||
*
|
||||
* To make things easier to implement in JS this package won't refer to any java.io or servlet
|
||||
* stuff
|
||||
*/
|
||||
trait Template {
|
||||
|
||||
/** Renders the template to the output printer */
|
||||
fun render(): Unit
|
||||
}
|
||||
|
||||
/**
|
||||
* Represents the output of a template which is a stream of objects
|
||||
* usually strings which then write to some underlying output stream
|
||||
* such as a java.io.Writer on the server side.
|
||||
*
|
||||
* We abstract away java.io.* APIs here to make the JS implementation simpler
|
||||
*/
|
||||
trait Printer {
|
||||
fun print(value: Any?): Unit
|
||||
//fun print(text: String): Unit
|
||||
|
||||
}
|
||||
|
||||
|
||||
class NullPrinter() : Printer {
|
||||
override fun print(value: Any?) {
|
||||
throw UnsupportedOperationException("No Printer defined on the Template")
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Base class for template implementations to hold any helpful behaviour
|
||||
*/
|
||||
abstract class TemplateSupport : Template {
|
||||
}
|
||||
|
||||
val newline: String = System.getProperty("line.separator") ?: "\n"
|
||||
|
||||
/**
|
||||
* Base class for templates generating text output
|
||||
* by printing values to some underlying Printer which
|
||||
* will typically output to a String, File, stream etc.
|
||||
*/
|
||||
abstract class TextTemplate() : TemplateSupport(), Printer {
|
||||
public var printer: Printer = NullPrinter()
|
||||
|
||||
fun String.plus(): Unit {
|
||||
printer.print(this)
|
||||
}
|
||||
|
||||
override fun print(value: Any?) = printer.print(value)
|
||||
|
||||
fun println(value: Any?) {
|
||||
print(value)
|
||||
print(newline)
|
||||
}
|
||||
|
||||
fun println() = println("")
|
||||
|
||||
fun renderToText(): String {
|
||||
val buffer = StringWriter()
|
||||
renderTo(buffer)
|
||||
return buffer.toString()
|
||||
}
|
||||
|
||||
fun renderTo(writer: Writer): Unit {
|
||||
this.printer = WriterPrinter(writer)
|
||||
this.render()
|
||||
}
|
||||
|
||||
fun renderTo(os: OutputStream): Unit {
|
||||
// TODO compiler error
|
||||
//OutputStreamWriter(os).forEach{ renderTo(it) }
|
||||
val s = OutputStreamWriter(os)
|
||||
renderTo(s)
|
||||
s.close()
|
||||
}
|
||||
|
||||
fun renderTo(file: File): Unit {
|
||||
// TODO compiler error
|
||||
//FileWriter(file).forEach{ s -> renderTo(s) }
|
||||
val s = FileWriter(file)
|
||||
renderTo(s)
|
||||
s.close()
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* A Printer implementation which uses a Writer
|
||||
*/
|
||||
class WriterPrinter(val writer: Writer) : Printer {
|
||||
|
||||
override fun print(value: Any?) {
|
||||
// TODO should be using a formatter to do the conversion
|
||||
writer.write(value.toString())
|
||||
}
|
||||
}
|
||||
@@ -1,8 +0,0 @@
|
||||
package org.jetbrains.kotlin.template
|
||||
|
||||
fun String.escapeHtml() =
|
||||
this
|
||||
.replace("&", "&")
|
||||
.replace("\"", """)
|
||||
.replace("<", "<")
|
||||
.replace(">", ">")
|
||||
@@ -1,30 +0,0 @@
|
||||
package test.kotlin.kdoc
|
||||
|
||||
import java.io.File
|
||||
import kotlin.test.assertTrue
|
||||
import org.jetbrains.kotlin.cli.jvm.K2JVMCompiler
|
||||
import org.jetbrains.kotlin.doc.highlighter.HtmlCompilerPlugin
|
||||
import org.junit.Test
|
||||
|
||||
class HtmlVisitorTest {
|
||||
Test fun generateHtmlFromSource() {
|
||||
val src = "src/test/sample"
|
||||
var dir = File(".")
|
||||
if (!File(dir, src).exists()) {
|
||||
dir = File("kdoc")
|
||||
assertTrue(File(dir, src).exists(), "Cannot find file $src")
|
||||
}
|
||||
val srcDir = File(dir, src)
|
||||
val outDir = File(dir, "target/htmldocs")
|
||||
println("Generating source HTML to $outDir")
|
||||
|
||||
val compiler = K2JVMCompiler()
|
||||
compiler.getCompilerPlugins().add(HtmlCompilerPlugin())
|
||||
compiler.exec(
|
||||
System.out,
|
||||
"-kotlin-home", "../../../dist/kotlinc",
|
||||
"-d", File(dir, "target/classes-htmldocs").toString(),
|
||||
srcDir.toString()
|
||||
)
|
||||
}
|
||||
}
|
||||
@@ -1,50 +0,0 @@
|
||||
package test.kotlin.kdoc
|
||||
|
||||
import java.io.File
|
||||
import java.io.IOException
|
||||
import org.jetbrains.kotlin.cli.common.ExitCode
|
||||
import org.jetbrains.kotlin.doc.KDocCompiler
|
||||
import org.junit.Assert
|
||||
import org.junit.Test
|
||||
|
||||
fun File.rmrf() {
|
||||
val children = listFiles()
|
||||
if (children != null) {
|
||||
for (child in children) {
|
||||
child.rmrf()
|
||||
}
|
||||
}
|
||||
delete()
|
||||
if (exists()) {
|
||||
throw IOException("failed to delete $this")
|
||||
}
|
||||
}
|
||||
|
||||
fun File.mkdirsProperly() {
|
||||
mkdirs()
|
||||
if (!exists())
|
||||
throw IOException("failed to crete directory $this")
|
||||
if (!isDirectory()) {
|
||||
throw IOException("cannot create directory $this because it exists and it is not a directory")
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
class KDocSampleTest {
|
||||
@Test
|
||||
fun generateKDocForSample() {
|
||||
val compiler = KDocCompiler()
|
||||
|
||||
val classesOutputDir = File("target/classes-sample")
|
||||
classesOutputDir.rmrf()
|
||||
classesOutputDir.mkdirsProperly()
|
||||
|
||||
val exitCode = compiler.exec(
|
||||
System.err,
|
||||
"-kotlin-home", "../../../dist/kotlinc",
|
||||
"-d", classesOutputDir.getPath(),
|
||||
"src/test/sample"
|
||||
)
|
||||
Assert.assertEquals(ExitCode.OK, exitCode)
|
||||
}
|
||||
}
|
||||
@@ -1,33 +0,0 @@
|
||||
package test.kotlin.kdoc
|
||||
|
||||
import java.io.File
|
||||
import kotlin.test.assertTrue
|
||||
import org.jetbrains.kotlin.cli.common.ExitCode
|
||||
import org.jetbrains.kotlin.doc.KDocCompiler
|
||||
import org.junit.Assert
|
||||
import org.junit.Test
|
||||
|
||||
class KDocTest {
|
||||
Test fun generateKDocForStandardLibrary() {
|
||||
var moduleName = "ApiDocsModule.kt"
|
||||
var dir = "."
|
||||
if (!File(moduleName).exists()) {
|
||||
dir = "kdoc"
|
||||
moduleName = dir + "/" + moduleName
|
||||
assertTrue(File(moduleName).exists(), "Cannot find file $moduleName")
|
||||
}
|
||||
val outDir = File(dir, "target/apidocs")
|
||||
println("Generating library KDocs to $outDir")
|
||||
|
||||
val compiler = KDocCompiler()
|
||||
val r = compiler.exec(
|
||||
System.out,
|
||||
"-kotlin-home", "../../../dist/kotlinc",
|
||||
"-d", "target/classes-stdlib",
|
||||
"-no-stdlib",
|
||||
"-classpath", "../runtime/target/kotlin-runtime-0.1-SNAPSHOT.jar${File.pathSeparator}../../lib/junit-4.11.jar",
|
||||
"../../stdlib/src", "../../kunit/src/main/kotlin", "../../kotlin-jdbc/src/main/kotlin"
|
||||
)
|
||||
Assert.assertEquals(ExitCode.OK, r)
|
||||
}
|
||||
}
|
||||
@@ -1,58 +0,0 @@
|
||||
package test.kotlin
|
||||
|
||||
import org.jetbrains.kotlin.cli.jvm.config.*
|
||||
import org.jetbrains.kotlin.cli.jvm.compiler.KotlinCoreEnvironment
|
||||
import org.jetbrains.kotlin.cli.jvm.compiler.EnvironmentConfigFiles
|
||||
import org.jetbrains.kotlin.config.CompilerConfiguration
|
||||
import com.intellij.openapi.Disposable
|
||||
import com.intellij.openapi.util.Disposer
|
||||
import com.intellij.openapi.vfs.CharsetToolkit
|
||||
import com.intellij.psi.PsiFileFactory
|
||||
import com.intellij.psi.impl.PsiFileFactoryImpl
|
||||
import com.intellij.testFramework.LightVirtualFile
|
||||
import org.jetbrains.kotlin.psi.JetFile
|
||||
import org.jetbrains.kotlin.idea.JetLanguage
|
||||
import org.jetbrains.kotlin.utils.PathUtil
|
||||
import org.jetbrains.kotlin.doc.highlighter2.splitPsi
|
||||
import org.junit.After
|
||||
import org.junit.Assert
|
||||
import org.junit.Before
|
||||
import org.junit.Test
|
||||
|
||||
class PsiUtilsTest {
|
||||
|
||||
val rootDisposable = object : Disposable {
|
||||
override fun dispose() {
|
||||
}
|
||||
}
|
||||
|
||||
private var environment: KotlinCoreEnvironment? = null
|
||||
|
||||
@Before
|
||||
fun before() {
|
||||
System.setProperty("java.awt.headless", "true")
|
||||
|
||||
val configuration = CompilerConfiguration()
|
||||
configuration.addJvmClasspathRoots(PathUtil.getJdkClassesRoots())
|
||||
environment = KotlinCoreEnvironment.createForTests(rootDisposable, configuration, EnvironmentConfigFiles.JVM_CONFIG_FILES)
|
||||
}
|
||||
|
||||
@After
|
||||
fun after() {
|
||||
Disposer.dispose(rootDisposable)
|
||||
}
|
||||
|
||||
private fun createFile(content: String): JetFile {
|
||||
val virtualFile = LightVirtualFile("file.kt", JetLanguage.INSTANCE, content);
|
||||
virtualFile.setCharset(CharsetToolkit.UTF8_CHARSET);
|
||||
return (PsiFileFactory.getInstance(environment!!.project) as PsiFileFactoryImpl)
|
||||
.trySetupPsiForFile(virtualFile, JetLanguage.INSTANCE, true, false) as JetFile
|
||||
}
|
||||
|
||||
@Test
|
||||
fun splitPsi() {
|
||||
val file = createFile("class Foo")
|
||||
val items: List<String> = splitPsi(file).map { t -> t.first }
|
||||
Assert.assertEquals(listOf("class", " ", "Foo"), items)
|
||||
}
|
||||
}
|
||||
@@ -1,49 +0,0 @@
|
||||
package test.pegdown
|
||||
|
||||
import junit.framework.TestCase
|
||||
import org.pegdown.*
|
||||
import org.pegdown.LinkRenderer.Rendering
|
||||
import org.pegdown.ast.*
|
||||
|
||||
class PegdownTest() : TestCase() {
|
||||
var markdownProcessor = PegDownProcessor(Extensions.ALL)
|
||||
var linkRenderer = CustomLinkRenderer()
|
||||
|
||||
fun testPegDown() {
|
||||
val markups = listOf(
|
||||
"hello **there **",
|
||||
"a [[WikiLink]] blah",
|
||||
"a [[WikiLink someText]] blah",
|
||||
"a [[SomeClass.property]] blah",
|
||||
"a [[SomeClass.method()]] blah",
|
||||
"a [Link](somewhere) blah")
|
||||
|
||||
for (text in markups) {
|
||||
val answer = markdownProcessor.markdownToHtml(text, linkRenderer)!!
|
||||
println("$text = $answer")
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
class CustomLinkRenderer : LinkRenderer() {
|
||||
override fun render(node: WikiLinkNode?): Rendering? {
|
||||
println("LinkRenderer.render(WikiLinkNode): $node")
|
||||
return super.render(node)
|
||||
}
|
||||
|
||||
override fun render(node: RefLinkNode?, url: String?, title: String?, text: String?): Rendering? {
|
||||
println("LinkRenderer.render(RefLinkNode): $node url: $url title: $title text: $text")
|
||||
return super.render(node, url, title, text)
|
||||
}
|
||||
|
||||
override fun render(node: AutoLinkNode?): Rendering? {
|
||||
println("LinkRenderer.render(AutoLinkNode): $node")
|
||||
return super.render(node)
|
||||
}
|
||||
|
||||
override fun render(node: ExpLinkNode?, text: String?): Rendering? {
|
||||
println("LinkRenderer.render(ExpLinkNode): $node text: $text")
|
||||
return super.render(node, text)
|
||||
}
|
||||
}
|
||||
@@ -1,41 +0,0 @@
|
||||
package test.kotlin.template
|
||||
|
||||
import java.util.*
|
||||
import junit.framework.Assert.*
|
||||
import junit.framework.TestCase
|
||||
import org.jetbrains.kotlin.template.*
|
||||
|
||||
class EmailTemplate(var name: String = "James", var time: Date = Date()) : TextTemplate() {
|
||||
override fun render() {
|
||||
print("Hello there $name and how are you? Today is $time. Kotlin rocks")
|
||||
}
|
||||
}
|
||||
|
||||
class MoreDryTemplate(var name: String = "James", var time: Date = Date()) : TextTemplate() {
|
||||
override fun render() {
|
||||
+"Hey there $name and how are you? Today is $time. Kotlin rocks"
|
||||
}
|
||||
}
|
||||
|
||||
class TemplateCoreTest() : TestCase() {
|
||||
fun testDefaultValues() {
|
||||
val text = EmailTemplate().renderToText()
|
||||
assertTrue(
|
||||
text.startsWith("Hello there James")
|
||||
)
|
||||
}
|
||||
|
||||
fun testDifferentValues() {
|
||||
val text = EmailTemplate("Andrey").renderToText()
|
||||
assertTrue(
|
||||
text.startsWith("Hello there Andrey")
|
||||
)
|
||||
}
|
||||
|
||||
fun testMoreDryTemplate() {
|
||||
val text = MoreDryTemplate("Alex").renderToText()
|
||||
assertTrue(
|
||||
text.startsWith("Hey there Alex")
|
||||
)
|
||||
}
|
||||
}
|
||||
@@ -1,8 +0,0 @@
|
||||
package sample
|
||||
|
||||
/** A Comment */
|
||||
public class Person(val name: String, val city: String) {
|
||||
override fun toString(): String = "Person($name, $city)"
|
||||
|
||||
public fun hello(): String = "Hello $name"
|
||||
}
|
||||
Reference in New Issue
Block a user