summaryrefslogtreecommitdiff
path: root/src/compiler/scala/tools/nsc/doc/html/HtmlPage.scala
diff options
context:
space:
mode:
authormichelou <michelou@epfl.ch>2011-07-15 21:38:03 +0000
committermichelou <michelou@epfl.ch>2011-07-15 21:38:03 +0000
commit2621ee63285808785159a3c24c9e5a5a723b8b9c (patch)
tree15d5a0863a7759f7c2178e1c9d29402fc9cd6fb8 /src/compiler/scala/tools/nsc/doc/html/HtmlPage.scala
parenta4fb15861b271c41fba8382f3b55024b5fdc8155 (diff)
downloadscala-2621ee63285808785159a3c24c9e5a5a723b8b9c.tar.gz
scala-2621ee63285808785159a3c24c9e5a5a723b8b9c.tar.bz2
scala-2621ee63285808785159a3c24c9e5a5a723b8b9c.zip
scaladoc fixes and improvements
Changes to scaladoc include: - fixed transformation of Code(text) into HTML tag <code> - added tool tips for deprecated entities (classes, methods) using the 'title' attribute - added syntax highlighting of Scala source code in generated <pre> blocks (CSS colors are defined in lib/template.css) Here are several examples of highlighted Scala code: scala.App scala.Application scala.Enumeration scala.Function1 scala.Function2 scala.native scala.Option scala.Proxy scala.specialized scala.throws scala.unchecked scala.actors.Actor scala.annotation.deprecatedName scala.annotation.elidable scala.annotation.switch scala.collection.DefaultMap scala.collection.JavaConversions scala.collection.JavaConverters scala.collection.LinearSeqLike scala.collection.MapLike scala.collection.SetLike scala.collection.TraversableLike scala.collection.immutable.NumericRange scala.collection.immutable.Range scala.collection.immutable.Stream scala.collection.mutable.BufferLike scala.concurrent.pilib scala.io.Position scala.reflect.BeanProperty scala.reflect.Manifest scala.testing.Benchmark scala.util.DynamicVariable scala.util.control.Breaks scala.util.control.ControlThrowable scala.util.control.Exception scala.util.control.TailCalls scala.util.logging.Logged scala.util.parsing.combinator.testing.Tester scala.util.parsing.json.JSON scala.util.regexp.WordExp scala.xml.factory.LoggedNodeFactory scala.xml.parsing.ConstructingParser
Diffstat (limited to 'src/compiler/scala/tools/nsc/doc/html/HtmlPage.scala')
-rw-r--r--src/compiler/scala/tools/nsc/doc/html/HtmlPage.scala28
1 files changed, 15 insertions, 13 deletions
diff --git a/src/compiler/scala/tools/nsc/doc/html/HtmlPage.scala b/src/compiler/scala/tools/nsc/doc/html/HtmlPage.scala
index cfa846b097..44a1728c05 100644
--- a/src/compiler/scala/tools/nsc/doc/html/HtmlPage.scala
+++ b/src/compiler/scala/tools/nsc/doc/html/HtmlPage.scala
@@ -29,7 +29,7 @@ abstract class HtmlPage extends Page { thisPage =>
/** The body of this page. */
def body: NodeSeq
- def writeFor(site: HtmlFactory): Unit = {
+ def writeFor(site: HtmlFactory) {
val doctype =
DocType("html", PublicID("-//W3C//DTD XHTML 1.1//EN", "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd"), Nil)
val html =
@@ -45,7 +45,7 @@ abstract class HtmlPage extends Page { thisPage =>
val w = Channels.newWriter(fos.getChannel, site.encoding)
try {
w.write("<?xml version='1.0' encoding='" + site.encoding + "'?>\n")
- w.write( doctype.toString + "\n")
+ w.write(doctype.toString + "\n")
w.write(xml.Xhtml.toXhtml(html))
}
finally {
@@ -73,7 +73,8 @@ abstract class HtmlPage extends Page { thisPage =>
case Title(in, 3) => <h5>{ inlineToHtml(in) }</h5>
case Title(in, _) => <h6>{ inlineToHtml(in) }</h6>
case Paragraph(in) => <p>{ inlineToHtml(in) }</p>
- case Code(data) => <pre>{ xml.Text(data) }</pre>
+ case Code(data) =>
+ <pre>{ SyntaxHigh(data) }</pre> //<pre>{ xml.Text(data) }</pre>
case UnorderedList(items) =>
<ul>{ listItemsToHtml(items) }</ul>
case OrderedList(items, listStyle) =>
@@ -105,7 +106,7 @@ abstract class HtmlPage extends Page { thisPage =>
case Subscript(in) => <sub>{ inlineToHtml(in) }</sub>
case Link(raw, title) => <a href={ raw }>{ inlineToHtml(title) }</a>
case EntityLink(entity) => templateToHtml(entity)
- case Monospace(text) => <code>{ xml.Text(text) }</code>
+ case Monospace(in) => <code>{ inlineToHtml(in) }</code>
case Text(text) => xml.Text(text)
case Summary(in) => inlineToHtml(in)
case HtmlTag(tag) => xml.Unparsed(tag)
@@ -172,13 +173,14 @@ abstract class HtmlPage extends Page { thisPage =>
/** Returns the _big image name corresponding to the DocTemplate Entity (upper left icon) */
def docEntityKindToBigImage(ety: DocTemplateEntity) =
- if (ety.isTrait && !ety.companion.isEmpty && ety.companion.get.visibility.isPublic && ety.companion.get.inSource != None) "trait_to_object_big.png"
- else if (ety.isTrait) "trait_big.png"
- else if (ety.isClass && !ety.companion.isEmpty && ety.companion.get.visibility.isPublic && ety.companion.get.inSource != None) "class_to_object_big.png"
- else if (ety.isClass) "class_big.png"
- else if (ety.isObject && !ety.companion.isEmpty && ety.companion.get.visibility.isPublic && ety.companion.get.inSource != None && ety.companion.get.isClass) "object_to_class_big.png"
- else if (ety.isObject && !ety.companion.isEmpty && ety.companion.get.visibility.isPublic && ety.companion.get.inSource != None && ety.companion.get.isTrait) "object_to_trait_big.png"
- else if (ety.isObject) "object_big.png"
- else if (ety.isPackage) "package_big.png"
- else "class_big.png" // FIXME: an entity *should* fall into one of the above categories, but AnyRef is somehow not
+ if (ety.isTrait && !ety.companion.isEmpty && ety.companion.get.visibility.isPublic && ety.companion.get.inSource != None) "trait_to_object_big.png"
+ else if (ety.isTrait) "trait_big.png"
+ else if (ety.isClass && !ety.companion.isEmpty && ety.companion.get.visibility.isPublic && ety.companion.get.inSource != None) "class_to_object_big.png"
+ else if (ety.isClass) "class_big.png"
+ else if (ety.isObject && !ety.companion.isEmpty && ety.companion.get.visibility.isPublic && ety.companion.get.inSource != None && ety.companion.get.isClass) "object_to_class_big.png"
+ else if (ety.isObject && !ety.companion.isEmpty && ety.companion.get.visibility.isPublic && ety.companion.get.inSource != None && ety.companion.get.isTrait) "object_to_trait_big.png"
+ else if (ety.isObject) "object_big.png"
+ else if (ety.isPackage) "package_big.png"
+ else "class_big.png" // FIXME: an entity *should* fall into one of the above categories, but AnyRef is somehow not
+
}