From c77edc44c2da1249fd4d61347e9013c969125571 Mon Sep 17 00:00:00 2001 From: Simon Ochsenreither Date: Wed, 15 May 2013 01:06:50 +0200 Subject: SI-6503 Fix scaladoc output to generate valid HTML5 I checked the generated HTML with the validators provided by http://validator.w3.org/ and http://html5.validator.nu/ to verify that all issues have been fixed. Changes: - Adapt doctype - Remove processing instructions - Add alt attributes to image tags Before that, the output tried to be XHTML 1.1, but failed validation as attested by both validators mentioned above, making it more likely to trigger the quirks modes in browsers. --- src/scaladoc/scala/tools/nsc/doc/html/HtmlPage.scala | 6 +----- src/scaladoc/scala/tools/nsc/doc/html/page/Index.scala | 8 ++++---- 2 files changed, 5 insertions(+), 9 deletions(-) (limited to 'src') diff --git a/src/scaladoc/scala/tools/nsc/doc/html/HtmlPage.scala b/src/scaladoc/scala/tools/nsc/doc/html/HtmlPage.scala index 159e16375c..f6373e9e97 100644 --- a/src/scaladoc/scala/tools/nsc/doc/html/HtmlPage.scala +++ b/src/scaladoc/scala/tools/nsc/doc/html/HtmlPage.scala @@ -42,8 +42,7 @@ abstract class HtmlPage extends Page { thisPage => def body: NodeSeq 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 doctype = DocType("html") val html = @@ -57,7 +56,6 @@ abstract class HtmlPage extends Page { thisPage => writeFile(site) { (w: Writer) => - w.write("\n") w.write(doctype.toString + "\n") w.write(xml.Xhtml.toXhtml(html)) } @@ -67,8 +65,6 @@ abstract class HtmlPage extends Page { thisPage => // we're only interested in the body, as this will go into the diff _.write(body.text) } - - //XML.save(pageFile.getPath, html, site.encoding, xmlDecl = false, doctype = doctype) } /** Transforms an optional comment into an styled HTML tree representing its body if it is defined, or into an empty diff --git a/src/scaladoc/scala/tools/nsc/doc/html/page/Index.scala b/src/scaladoc/scala/tools/nsc/doc/html/page/Index.scala index c034647320..ce3a5eb1fc 100644 --- a/src/scaladoc/scala/tools/nsc/doc/html/page/Index.scala +++ b/src/scaladoc/scala/tools/nsc/doc/html/page/Index.scala @@ -35,10 +35,10 @@ class Index(universe: doc.Universe, val index: doc.Index) extends HtmlPage { val body =
- - - - + class icon + trait icon + trait icon + trait icon
{ browser }
-- cgit v1.2.3