1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
|
/* NSC -- new Scala compiler
* Copyright 2005-2006 LAMP/EPFL
* @author Sean McDirmid
*/
// $Id$
package scala.tools.nsc.doc
import java.io.StringReader
import org.xml.sax.InputSource
import scala.collection.immutable._
import scala.xml._
object DocUtil {
def dquote(str: String): NodeSeq =
DQUOTE :: Text(str) :: DQUOTE :: Nil
def load(str: String): NodeSeq = {
val xmlStr = str.replaceAll("<", "<").replaceAll(">",">")
.replaceAll("&", "&").replaceAll(""", "\"")
val xmlSrc = new InputSource(new StringReader(xmlStr))
XML.load(xmlSrc)
}
object DQUOTE extends SpecialNode {
def toString(sb: StringBuffer) = {
sb.append("\""); sb
}
def label = "#PCDATA"
}
def br(nodes: NodeSeq): NodeSeq = {
val x = <br/>;
nodes.concat(x)
}
trait UrlContext {
def relative: String
def aref(href0: String, target: String, text: String): NodeSeq = {
val href = Utility.escape(href0)
if (target != null && target.indexOf('<') != -1) throw new Error(target)
val t0 = Text(text)
if (target != null)
<a href={(relative + href)} target={(target)}>{t0}</a>;
else
<a href={(relative + href)}>{t0}</a>;
}
val header =
<meta http-equiv="content-type" content="text/html; charset=iso-8859-1"/>
<meta name="generator" content="scaladoc (2.1.0)"/>
<link rel="stylesheet" type="text/css" href={ relative + "style.css" }/>
<script type="text/javascript" src={relative + "script.js"}></script>;
def body0(hasBody: Boolean, nodes: NodeSeq): NodeSeq =
if (!hasBody) nodes else <body>{nodes}</body>;
val dtype = "<!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.0 Strict//EN\" \"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd\">";
def page(title: String, body: NodeSeq, hasBody: Boolean): NodeSeq =
<html>
<head><title>{Text(title)}</title>
{header}
</head>
{body0(hasBody, body)}
</html>
} // UrlContext
def div0(title: String): NodeSeq =
<div class="doctitle-larger">{Text(title)}</div>;
def merge[T](ts0: TreeSet[T], ts1: TreeSet[T]): TreeSet[T] = {
var ts = ts0
for (val t <- ts1.toList) ts = ts + t
ts
}
def merge[T,S <: Ordered[S]](ts0: ListMap[T,TreeSet[S]], ts1: ListMap[T,TreeSet[S]]):
ListMap[T,TreeSet[S]] = {
var ts = ts0
for (val t <- ts1.elements) {
if (!ts.contains(t._1))
ts = ts.update(t._1, new TreeSet[S]);
ts = ts.update(t._1, merge(ts(t._1), t._2));
}
ts
}
}
|