markdown: privately import things and uptate clients
[nit.git] / src / nitdoc.nit
1 # This file is part of NIT ( http://www.nitlanguage.org ).
2 #
3 # Licensed under the Apache License, Version 2.0 (the "License");
4 # you may not use this file except in compliance with the License.
5 # You may obtain a copy of the License at
6 #
7 # http://www.apache.org/licenses/LICENSE-2.0
8 #
9 # Unless required by applicable law or agreed to in writing, software
10 # distributed under the License is distributed on an "AS IS" BASIS,
11 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 # See the License for the specific language governing permissions and
13 # limitations under the License.
14
15 # Documentation generator for the nit language.
16 # Generate API documentation in HTML format from nit source code.
17 module nitdoc
18
19 import modelbuilder
20 import doc
21
22 # process options
23 var toolcontext = new ToolContext
24 var ctx = new NitdocContext(toolcontext)
25 ctx.process_options(args)
26 var arguments = ctx.toolcontext.option_context.rest
27
28 # build model
29 var model = new Model
30 var mbuilder = new ModelBuilder(model, ctx.toolcontext)
31 var mmodules = mbuilder.parse(arguments)
32
33 if mmodules.is_empty then return
34 mbuilder.run_phases
35 var mainmodule: MModule
36 if mmodules.length == 1 then
37 mainmodule = mmodules.first
38 else
39 mainmodule = new MModule(model, null, "<main>", new Location(null, 0, 0, 0, 0))
40 mainmodule.is_fictive = true
41 mainmodule.set_imported_mmodules(mmodules)
42 end
43
44 # generate doc
45 var nitdoc = new Nitdoc(ctx, model, mainmodule)
46 nitdoc.generate
47