summaryrefslogtreecommitdiff
path: root/src/compiler/scala/tools/nsc/doc/html/HtmlPage.scala
diff options
context:
space:
mode:
authorGilles Dubochet <gilles.dubochet@epfl.ch>2009-12-09 14:12:50 +0000
committerGilles Dubochet <gilles.dubochet@epfl.ch>2009-12-09 14:12:50 +0000
commita17785f8be385cb795f903ff3c9dbebd856c94a9 (patch)
treebb367b7a41ea55ca03a9d0ed51f1000cabd061b3 /src/compiler/scala/tools/nsc/doc/html/HtmlPage.scala
parent25d82e13f13684077de44bcfd6cf2433be9d40ae (diff)
downloadscala-a17785f8be385cb795f903ff3c9dbebd856c94a9.tar.gz
scala-a17785f8be385cb795f903ff3c9dbebd856c94a9.tar.bz2
scala-a17785f8be385cb795f903ff3c9dbebd856c94a9.zip
[scaladoc] Display of comments is improved.
Diffstat (limited to 'src/compiler/scala/tools/nsc/doc/html/HtmlPage.scala')
-rw-r--r--src/compiler/scala/tools/nsc/doc/html/HtmlPage.scala15
1 files changed, 12 insertions, 3 deletions
diff --git a/src/compiler/scala/tools/nsc/doc/html/HtmlPage.scala b/src/compiler/scala/tools/nsc/doc/html/HtmlPage.scala
index 90952c49d6..271f888bc5 100644
--- a/src/compiler/scala/tools/nsc/doc/html/HtmlPage.scala
+++ b/src/compiler/scala/tools/nsc/doc/html/HtmlPage.scala
@@ -14,7 +14,8 @@ import xml.{Unparsed, XML, NodeSeq}
import xml.dtd.{DocType, PublicID}
import scala.collection._
import scala.util.NameTransformer
-import java.io.File
+import java.nio.channels.Channels
+import java.io.{FileOutputStream, File}
/** An html page that is part of a Scaladoc site.
* @author David Bernard
@@ -54,7 +55,15 @@ abstract class HtmlPage { thisPage =>
</head>
{ body }
</html>
- XML.save(pageFile.getPath, html, site.encoding, xmlDecl = false, doctype = doctype)
+ val fos = new FileOutputStream(pageFile.getPath)
+ 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(xml.Xhtml.toXhtml(html))
+ }
+ finally { w.close() ; fos.close() }
+ //XML.save(pageFile.getPath, html, site.encoding, xmlDecl = false, doctype = doctype)
}
def templateToPath(tpl: TemplateEntity): List[String] = {
@@ -121,7 +130,7 @@ abstract class HtmlPage { thisPage =>
case Title(in, 3) => <h3>{ inlineToHtml(in) }</h3>
case Title(in, _) => <h4>{ inlineToHtml(in) }</h4>
case Paragraph(in) => <p>{ inlineToHtml(in) }</p>
- case Code(data) => <p><code>{ Unparsed(data) }</code></p>
+ case Code(data) => <pre>{ Unparsed(data) }</pre>
case UnorderedList(items) =>
<ul>{items map { i => <li>{ blockToHtml(i) }</li>}}</ul>
case OrderedList(items) =>