summaryrefslogtreecommitdiff
path: root/src/manual/scala/man1/scaladoc.scala
blob: ab17e14c28a4e207df353092724801940ae4026e (plain) (blame)
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
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
/* NSC -- new Scala compiler
 * Copyright 2005-2010 LAMP/EPFL
 * @author Stephane Micheloud
 */
//$Id$

package scala.man1

object scaladoc extends Command {
  import _root_.scala.tools.docutil.ManPage._

  protected def cn = new Error().getStackTrace()(0).getClassName()

  val scalaLink = Link("Scala 2", "http://scala-lang.org/")

  val name = Section("NAME",

    MBold(command) & " " & NDash & " Documentation generator for the " &
    scalaLink & " language")

  val synopsis = Section("SYNOPSIS",

    CmdLine(" [ " & Argument("options") & " ] " & Argument("source files")))

  val parameters = Section("PARAMETERS",

    DefinitionList(
      Definition(
        Mono(Argument("options")),
        "Command line options. See " & Link(Bold("OPTIONS"), "#options") &
        " below."),
      Definition(
        Mono(Argument("source files")),
        "One or more source files to be compiled (such as " &
        Mono("MyClass.scala") & ").")))

  val description = Section("DESCRIPTION",

    "The " & MBold(command) & " tool reads class and object definitions, " &
    "written in the " & scalaLink & " programming language, and generates " &
    "their API as HTML files.",

    "By default, the generator puts each HTML file in the same directory as " &
    "its source file. You can specify a separate destination directory with " &
    CmdOption("d") & "(see " & Link(Bold("OPTIONS"), "#options") & ", below).",

    // tags are defined in class "scala.tools.nsc.doc.DocGenerator"
    "Supported tag comments are:",

    BulletList(
      Mono("@author"), Mono("@deprecated"),
      Mono("@exception") & " (two arguments)",
      Mono("@param") & " (two arguments)", Mono("@pre"),
      Mono("@return"), Mono("@see"), Mono("@since"),
      Mono("@throws") & " (two arguments)",
      Mono("@todo"), Mono("@version")),

    "See also online document \"" & Link("How to Write Doc Comments for the Javadoc Tool",
    "http://java.sun.com/j2se/javadoc/writingdoccomments/") & "\" from Sun.")

  val options = Section("OPTIONS",

    "The generator has a set of standard options that are supported on the " &
    "current development environment and will be supported in future releases.",

    Section("Standard Options",
      DefinitionList(
        Definition(
          CmdOption("d", Argument("directory")),
          "Specify where to place generated class files."),
        Definition(
          CmdOption("access:<access>"),
          "Show only public, protected/public (default) or all classes " &
          "and members (" & Mono("public") & ",protected,private)"),
        Definition(
          CmdOption("windowtitle", Argument("windowtitle")),
          "Specify window title of generated HTML documentation"),
        Definition(
          CmdOption("doctitle", Argument("doctitle")),
          "Include title for the overview page"),
        Definition(
          CmdOption("stylesheetfile", Argument("stylesheetfile")),
          "File to change style of the generated documentation"),
        Definition(
          CmdOption("header", Argument("pageheader")),
          "Include header text for each page"),
        Definition(
          CmdOption("footer", Argument("pagefooter")),
          "Include footer text for each page"),
        Definition(
          CmdOption("top", Argument("pagetop")),
          "Include top text for each page"),
        Definition(
          CmdOption("bottom", Argument("pagebottom")),
          "Include bottom text for each page"),
        Definition(
          CmdOption("version"),
          "Print product version and exit."),
        Definition(
          /*CmdOption("?") & "| " &*/ CmdOption("help"),
          "Print a synopsis of standard options."))))

  val examples = Section("EXAMPLES",

    DefinitionList(
      Definition(
        "Generate documentation for a Scala program",
        CmdLine("HelloWorld.scala")),
      Definition(
        "Generation documentation for a Scala program to the destination " &
        "directory " & Bold("classes"),
        CmdLine(CmdOption("d", "api") & "HelloWorld.scala")),
      Definition(
        "Generate documentation for all Scala files found in the source " &
        "directory " & Bold("src") & " to the destination directory " &
        Bold("api"),
        CmdLine(CmdOption("d", "api") & "src/*.scala"))))

  val exitStatus = Section("EXIT STATUS",

    MBold(command) & " returns a zero exist status if it succeeds to process " &
    "the specified input files. Non zero is returned in case of failure.")

  val seeAlso = Section("SEE ALSO",

    Link(Bold("fsc") & "(1)", "fsc.html") & ", " &
    Link(Bold("sbaz") & "(1)", "sbaz.html") & ", " &
    Link(Bold("scala") & "(1)", "scala.html") & ", " &
    Link(Bold("scalac") & "(1)", "scalac.html") & ", " &
    Link(Bold("scalap") & "(1)", "scalap.html"))

  def manpage = new Document {
    title = command
    date = "May 1, 2007"
    author = "Stephane Micheloud"
    version = "0.4"
    sections = List(
      name,
      synopsis,
      parameters,
      description,
      options,
      examples,
      exitStatus,
      authors,
      bugs,
      copyright,
      seeAlso)
  }
}