summaryrefslogtreecommitdiff
path: root/src/compiler/scala/tools/nsc/doc/html/HtmlPage.scala
diff options
context:
space:
mode:
authorGilles Dubochet <gilles.dubochet@epfl.ch>2009-11-26 14:13:15 +0000
committerGilles Dubochet <gilles.dubochet@epfl.ch>2009-11-26 14:13:15 +0000
commit6f70a9f61c3e4e540dd4a6d1afebe3578501a8dd (patch)
tree43f416d168ec750f6926e4b2904ed5d5e6fe867a /src/compiler/scala/tools/nsc/doc/html/HtmlPage.scala
parent7aa5ecea0baf51289fa27e0edf6f9d3eed07aa8d (diff)
downloadscala-6f70a9f61c3e4e540dd4a6d1afebe3578501a8dd.tar.gz
scala-6f70a9f61c3e4e540dd4a6d1afebe3578501a8dd.tar.bz2
scala-6f70a9f61c3e4e540dd4a6d1afebe3578501a8dd.zip
Fixed some Scaladoc issues: dangerous character...
Fixed some Scaladoc issues: dangerous characters in file names are encoded, each owner template is a link, type bounds are printed as "<:" and ">:".
Diffstat (limited to 'src/compiler/scala/tools/nsc/doc/html/HtmlPage.scala')
-rw-r--r--src/compiler/scala/tools/nsc/doc/html/HtmlPage.scala18
1 files changed, 12 insertions, 6 deletions
diff --git a/src/compiler/scala/tools/nsc/doc/html/HtmlPage.scala b/src/compiler/scala/tools/nsc/doc/html/HtmlPage.scala
index 8773c0f2c0..48073f8e59 100644
--- a/src/compiler/scala/tools/nsc/doc/html/HtmlPage.scala
+++ b/src/compiler/scala/tools/nsc/doc/html/HtmlPage.scala
@@ -10,9 +10,11 @@ package html
import model._
import comment._
-import java.io.File
-import scala.xml.dtd.{DocType, PublicID}
import xml.{Unparsed, XML, NodeSeq}
+import xml.dtd.{DocType, PublicID}
+import scala.collection._
+import scala.util.NameTransformer
+import java.io.File
/** An html page that is part of a Scaladoc site.
* @author David Bernard
@@ -37,7 +39,7 @@ abstract class HtmlPage { thisPage =>
* also defined by the generator.
* @param generator The generator that is writing this page. */
def writeFor(site: SiteFactory): Unit = {
- val pageFile = new File(site.siteRoot, thisPage.path.reverse.mkString("/"))
+ val pageFile = new File(site.siteRoot, absoluteLinkTo(thisPage.path))
val pageFolder = pageFile.getParentFile
if (!pageFolder.exists) pageFolder.mkdirs()
val doctype =
@@ -56,16 +58,16 @@ abstract class HtmlPage { thisPage =>
}
def templateToPath(tpl: TemplateEntity): List[String] = {
+ def doName(tpl: TemplateEntity): String =
+ NameTransformer.encode(tpl.name) + (if (tpl.isObject) "$" else "")
def downPacks(pack: Package): List[String] =
- if (pack.isRootPackage) Nil else (pack.name :: downPacks(pack.inTemplate))
+ if (pack.isRootPackage) Nil else (doName(pack) :: downPacks(pack.inTemplate))
def downInner(nme: String, tpl: TemplateEntity): (String, Package) = {
tpl.inTemplate match {
case inPkg: Package => (nme + ".html", inPkg)
case inTpl => downInner(doName(inTpl) + "$" + nme, inTpl)
}
}
- def doName(tpl: TemplateEntity): String =
- tpl.name + (if (tpl.isObject) "$" else "")
val (file, pack) =
tpl match {
case p: Package => ("package.html", p)
@@ -97,6 +99,10 @@ abstract class HtmlPage { thisPage =>
relativize(thisPage.path.reverse, destPath.reverse).mkString("/")
}
+ def absoluteLinkTo(destPath: List[String]): String = {
+ destPath.reverse.mkString("/")
+ }
+
/** Transforms an optional comment into an styled HTML tree representing its body if it is defined, or into an empty
* node sequence if it is not. */
def commentToHtml(comment: Option[Comment]): NodeSeq =