From f84684ee02a8990726fcb62a454b3788d5fe5f16 Mon Sep 17 00:00:00 2001 From: Gilles Dubochet Date: Wed, 24 Feb 2010 15:51:10 +0000 Subject: [scaladoc] Preliminary support for links and li... [scaladoc] Preliminary support for links and lists in wiki syntax, as well as printing of lists. Fix to display of "inherits" classes. Contributed by Pedro Furlanetto, no review. Member names in signature are more contrasted and are aligned. --- src/compiler/scala/tools/nsc/doc/html/HtmlPage.scala | 18 +++++++++++++++--- 1 file changed, 15 insertions(+), 3 deletions(-) (limited to 'src/compiler/scala/tools/nsc/doc/html/HtmlPage.scala') diff --git a/src/compiler/scala/tools/nsc/doc/html/HtmlPage.scala b/src/compiler/scala/tools/nsc/doc/html/HtmlPage.scala index ee2f491e9e..520bcb9a36 100644 --- a/src/compiler/scala/tools/nsc/doc/html/HtmlPage.scala +++ b/src/compiler/scala/tools/nsc/doc/html/HtmlPage.scala @@ -132,15 +132,27 @@ abstract class HtmlPage { thisPage => case Paragraph(in) =>

{ inlineToHtml(in) }

case Code(data) =>
{ Unparsed(data) }
case UnorderedList(items) => - + case OrderedList(items) => -
    {items map { i =>
  1. { blockToHtml(i) }
  2. }}
+
    { listItemsToHtml(items) }
case DefinitionList(items) =>
{items map { case (t, d) =>
{ inlineToHtml(t) }
{ blockToHtml(d) }
} }
case HorizontalRule() =>
} + def listItemsToHtml(items: Seq[Block]) = + items.foldLeft(xml.NodeSeq.Empty){ (xmlList, item) => + item match { + case OrderedList(_) | UnorderedList(_) => // html requires sub ULs to be put into the last LI + xmlList.init ++
  • { xmlList.last.child ++ blockToHtml(item) }
  • + case Paragraph(inline) => + xmlList :+
  • { inlineToHtml(inline) }
  • // LIs are blocks, no need to use Ps + case block => + xmlList :+
  • { blockToHtml(block) }
  • + } + } + def inlineToHtml(inl: Inline): NodeSeq = inl match { //case URLLink(url, text) => {if(text.isEmpty)url else inlineSeqsToXml(text)} case Chain(items) => items flatMap (inlineToHtml(_)) @@ -149,7 +161,7 @@ abstract class HtmlPage { thisPage => case Underline(in) => { inlineToHtml(in) } case Superscript(in) => { inlineToHtml(in) } case Subscript(in) => { inlineToHtml(in) } - case Link(raw) => Unparsed(raw)//error("link not supported") // TODO + case Link(raw,title) => { title.getOrElse(raw) } // TODO link to target case Monospace(text) => { Unparsed(text) } case Text(text) => Unparsed(text) } -- cgit v1.2.3