first spike of a search box in kdoc for quick navigation
This commit is contained in:
+1
@@ -72,6 +72,7 @@ class JavadocStyleHtmlDoclet() : Doclet {
|
||||
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))
|
||||
|
||||
@@ -101,7 +101,7 @@ class KDocConfig() {
|
||||
}
|
||||
}
|
||||
}
|
||||
if (missingPackageUrls.add(packageName)) {
|
||||
if (warn && missingPackageUrls.add(packageName)) {
|
||||
println("Warning: could not find external link to package: $packageName")
|
||||
}
|
||||
return ""
|
||||
|
||||
+1
@@ -64,6 +64,7 @@ function windowTitle()
|
||||
<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>
|
||||
|
||||
+17
@@ -157,5 +157,22 @@ abstract class KDocTemplate() : TextTemplate() {
|
||||
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" 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
+2
-1
@@ -21,7 +21,7 @@ Overview (${model.title})
|
||||
|
||||
<META NAME="date" CONTENT="2012-01-09">
|
||||
|
||||
<LINK REL ="stylesheet" TYPE="text/css" HREF="stylesheet.css" TITLE="Style">
|
||||
${stylesheets()}
|
||||
|
||||
<SCRIPT type="text/javascript">
|
||||
function windowTitle()
|
||||
@@ -57,6 +57,7 @@ function windowTitle()
|
||||
<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>
|
||||
|
||||
Vendored
+2
-1
@@ -21,7 +21,7 @@ Class Hierarchy (${model.title})
|
||||
|
||||
<META NAME="date" CONTENT="2012-01-09">
|
||||
|
||||
<LINK REL ="stylesheet" TYPE="text/css" HREF="stylesheet.css" TITLE="Style">
|
||||
${stylesheets()}
|
||||
|
||||
<SCRIPT type="text/javascript">
|
||||
function windowTitle()
|
||||
@@ -57,6 +57,7 @@ function windowTitle()
|
||||
<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>
|
||||
|
||||
Vendored
+1
@@ -62,6 +62,7 @@ function windowTitle()
|
||||
<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>
|
||||
|
||||
Vendored
-8
@@ -284,12 +284,4 @@ abstract class PackageTemplateSupport(open val pkg: KPackage) : KDocTemplate() {
|
||||
println(link(a))
|
||||
}
|
||||
}
|
||||
|
||||
fun stylesheets(): String {
|
||||
return """<LINK REL="stylesheet" TYPE="text/css" HREF="${relativePrefix()}stylesheet.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/apidoc.js"></script>
|
||||
"""
|
||||
}
|
||||
}
|
||||
Vendored
+23
@@ -0,0 +1,23 @@
|
||||
package org.jetbrains.kotlin.doc.templates
|
||||
|
||||
import kotlin.*
|
||||
import org.jetbrains.kotlin.template.*
|
||||
import kotlin.io.*
|
||||
import kotlin.util.*
|
||||
import java.util.*
|
||||
import org.jetbrains.kotlin.doc.model.KModel
|
||||
|
||||
class SearchXmlTemplate(val model: KModel) : KDocTemplate() {
|
||||
override fun render() {
|
||||
println("""<?xml version="1.0" encoding="UTF-8"?>
|
||||
<searches>""")
|
||||
for (c in model.classes) {
|
||||
println("""<search>
|
||||
<href>${c.nameAsPath}.html</href>
|
||||
<name>${c.name}</name>
|
||||
<kind>${c.kind}</kind>
|
||||
</search>""")
|
||||
}
|
||||
println("""</searches>""")
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user