1 # This file is part of NIT ( http://www.nitlanguage.org ).
3 # Copyright 2008 Jean Privat <jean@pryen.org>
5 # Licensed under the Apache License, Version 2.0 (the "License");
6 # you may not use this file except in compliance with the License.
7 # You may obtain a copy of the License at
9 # http://www.apache.org/licenses/LICENSE-2.0
11 # Unless required by applicable law or agreed to in writing, software
12 # distributed under the License is distributed on an "AS IS" BASIS,
13 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 # See the License for the specific language governing permissions and
15 # limitations under the License.
20 import abstract_compiler
23 private var toolcontext
: ToolContext
24 private var model
: Model
25 private var modelbuilder
: ModelBuilder
26 private var mainmodule
: MModule
27 private var class_hierarchy
: POSet[MClass]
28 private var arguments
: Array[String]
29 private var output_dir
: nullable String
30 private var dot_dir
: nullable String
31 private var share_dir
: nullable String
32 private var source
: nullable String
34 private var opt_dir
= new OptionString("Directory where doc is generated", "-d", "--dir")
35 private var opt_source
= new OptionString("What link for source (%f for filename, %l for first line, %L for last line)", "--source")
36 private var opt_sharedir
= new OptionString("Directory containing the nitdoc files", "--sharedir")
37 private var opt_nodot
= new OptionBool("Do not generate graphes with graphiviz", "--no-dot")
39 init(toolcontext
: ToolContext) do
40 # We need a model to collect stufs
41 self.toolcontext
= toolcontext
42 self.arguments
= toolcontext
.option_context
.rest
43 toolcontext
.option_context
.options
.clear
44 toolcontext
.option_context
.add_option
(opt_dir
)
45 toolcontext
.option_context
.add_option
(opt_source
)
46 toolcontext
.option_context
.add_option
(opt_sharedir
)
47 toolcontext
.option_context
.add_option
(opt_nodot
)
48 toolcontext
.process_options
51 if arguments
.length
< 1 then
52 toolcontext
.option_context
.usage
57 modelbuilder
= new ModelBuilder(model
, toolcontext
)
59 # Here we load an process std modules
60 var mmodules
= modelbuilder
.parse_and_build
([arguments
.first
])
61 if mmodules
.is_empty
then return
62 modelbuilder
.full_propdef_semantic_analysis
63 assert mmodules
.length
== 1
64 self.mainmodule
= mmodules
.first
65 self.class_hierarchy
= mainmodule
.flatten_mclass_hierarchy
68 private fun process_options
do
69 if not opt_dir
.value
is null then
70 output_dir
= opt_dir
.value
74 if not opt_sharedir
.value
is null then
75 share_dir
= opt_sharedir
.value
77 var dir
= "NIT_DIR".environ
79 dir
= "{sys.program_name.dirname}/../share/nitdoc"
81 dir
= "{dir}/share/nitdoc"
84 if share_dir
is null then
85 print
"Error: Cannot locate nitdoc share files. Uses --sharedir or envvar NIT_DIR"
88 dir
= "{share_dir.to_s}/scripts/js-facilities.js"
89 if share_dir
is null then
90 print
"Error: Invalid nitdoc share files. Check --sharedir or envvar NIT_DIR"
94 if not opt_source
.value
is null then
97 source
= opt_source
.value
102 if arguments
.length
== 1 then
103 # Create destination dir if it's necessary
104 if not output_dir
.file_exists
then output_dir
.mkdir
105 sys
.system
("cp -r {share_dir.to_s}/* {output_dir.to_s}/")
107 if not opt_nodot
.value
then self.dot_dir
= output_dir
.to_s
117 var overviewpage
= new NitdocOverview(modelbuilder
, dot_dir
)
118 overviewpage
.save
("{output_dir.to_s}/index.html")
122 var fullindex
= new NitdocFullindex(self)
123 fullindex
.save
("{output_dir.to_s}/full-index.html")
127 for mmodule
in model
.mmodules
do
128 var modulepage
= new NitdocModule(mmodule
, modelbuilder
, dot_dir
)
129 modulepage
.save
("{output_dir.to_s}/{mmodule.url}")
134 for mclass
in modelbuilder
.model
.mclasses
do
135 var classpage
= new NitdocClass(mclass
, self, dot_dir
, source
)
136 classpage
.save
("{output_dir.to_s}/{mclass.url}")
140 # Generate QuickSearch file
141 fun quicksearch_list
do
142 var file
= new OFStream.open
("{output_dir.to_s}/quicksearch-list.js")
143 var content
= new Buffer
144 content
.append
("var entries = \{ ")
146 for mmodule
in model
.mmodules
do
147 content
.append
("\"{mmodule.name}\
": [")
148 content
.append
("\{txt: \"{mmodule.name}\", url
:\
"{mmodule.url}\" \
},")
151 for mclass in model.mclasses do
152 if mclass.visibility <= none_visibility then continue
153 content.append("\
"{mclass.name}\": [")
154 content.append("\
{txt: \"{mclass.name}\
", url:\"{mclass.url}\
" \},")
157 var name2mprops
= new HashMap[String, Set[MPropDef]]
158 for mproperty
in model
.mproperties
do
159 if mproperty
.visibility
<= none_visibility
then continue
160 if mproperty
isa MAttribute then continue
161 if not name2mprops
.has_key
(mproperty
.name
) then name2mprops
[mproperty
.name
] = new HashSet[MPropDef]
162 name2mprops
[mproperty
.name
].add_all
(mproperty
.mpropdefs
)
164 for mproperty
, mpropdefs
in name2mprops
do
165 content
.append
("\"{mproperty}\
": [")
166 for mpropdef
in mpropdefs
do
167 content
.append
("\{txt: \"{mpropdef.full_name}\", url
:\
"{mpropdef.url}\" \
},")
172 content.append(" \
};")
173 file.write(content.to_s)
180 abstract class NitdocPage
182 var dot_dir: nullable String
183 var source: nullable String
187 fun append(str: String) do html.append(str)
188 var html = new Buffer
191 append("<meta charset
='utf-8'/>")
192 append("<script
type='text/javascript' src
='scripts/jquery-1.7.1.min.js'></script
>")
193 append("<script
type='text/javascript' src
='quicksearch-list.js'></script
>")
194 append("<script
type='text/javascript' src
='scripts/js-facilities.js'></script
>")
195 append("<link rel
='stylesheet' href
='styles/main.css' type='text/css' media
='screen'/>")
202 append("<nav
class='main'>")
205 append("<li id
='liGitHub'>")
206 append("<a
class='btn' id
='logGitHub'>")
207 append("<img id
='imgGitHub' src
='resources/icons/github-icon.png' alt
='GitHub'/>")
209 append("<div
class='popover bottom'>")
210 append("<div
class='arrow'> 
;</div
>")
211 append("<div
class='githubTitle'>")
212 append("<h3
>Github Sign In</h3
>")
215 append("<label id
='lbloginGit'>Username</label>")
216 append("<input id
='loginGit' name
='login' type='text'/>")
217 append("<label id
='logginMessage'>Hello ")
218 append("<a id
='githubAccount'><strong id
='nickName'></strong
></a
>")
222 append("<label id
='lbpasswordGit'>Password</label>")
223 append("<input id
='passwordGit' name
='password' type='password'/>")
224 append("<div id
='listBranches'>")
225 append("<label id
='lbBranches'>Branch</label>")
226 append("<select
class='dropdown' id
='dropBranches' name
='dropBranches' tabindex
='1'></select
>")
230 append("<label id
='lbrepositoryGit'>Repository</label>")
231 append("<input id
='repositoryGit' name
='repository' type='text'/>")
234 append("<label id
='lbbranchGit'>Branch</label>")
235 append("<input id
='branchGit' name
='branch' type='text'/>")
238 append("<a id
='signIn'>Sign In</a
>")
247 fun content is abstract
250 append("<footer
>Nit standard library
. Version jenkins-component
=stdlib-19
.</footer
>")
253 # Generate a clickable graphviz image using a dot content
254 fun generate_dot(dot: String, name: String, alt: String) do
255 var output_dir = dot_dir
256 if output_dir == null then return
257 var file = new OFStream.open("{output_dir}/{name}.dot
")
260 sys.system("\
{ test -f {output_dir}/{name}.png
&& test
-f
{output_dir}/{name}.s
.dot
&& diff
{output_dir}/{name}.dot
{output_dir}/{name}.s
.dot
>/dev
/null 2>&1 ; \
} || \
{ cp {output_dir}/{name}.dot
{output_dir}/{name}.s
.dot
&& dot
-Tpng -o
{output_dir}/{name}.png
-Tcmapx -o
{output_dir}/{name}.map
{output_dir}/{name}.s
.dot
; \
}")
261 append("<article
class='graph'>")
262 append("<img src
='{name}.png' usemap
='#{name}' style
='margin:auto' alt
='{alt}'/>")
264 var fmap = new IFStream.open("{output_dir}/{name}.map
")
265 append(fmap.read_all)
269 # Add a (source) link for a given location
270 fun show_source(l: Location): String
272 if source == null then
273 return "({l.file.filename.simplify_path})"
275 # THIS IS JUST UGLY ! (but there is no replace yet)
276 var x = source.split_with("%f
")
277 source = x.join(l.file.filename.simplify_path)
278 x = source.split_with("%l
")
279 source = x.join(l.line_start.to_s)
280 x = source.split_with("%L
")
281 source = x.join(l.line_end.to_s)
282 return " (<a href
=\
"{source.to_s}\">show code
</a
>)"
286 # Render the page as a html string
287 fun render: String do
288 append("<!DOCTYPE html
>")
294 append("<div
class='page'>")
302 # Save html page in the specified file
303 fun save(file: String) do
304 var out = new OFStream.open(file)
313 private var mbuilder: ModelBuilder
314 private var mmodules = new Array[MModule]
316 init(mbuilder: ModelBuilder, dot_dir: nullable String) do
317 self.mbuilder = mbuilder
318 self.dot_dir = dot_dir
320 var mmodules = new HashSet[MModule]
321 for mmodule in mbuilder.model.mmodules do
322 var owner = mmodule.public_owner
323 if owner != null then
326 mmodules.add(mmodule)
330 var sorter = new ComparableSorter[MModule]
331 self.mmodules.add_all(mmodules)
332 sorter.sort(self.mmodules)
337 append("<title
>Overview | Nit Standard Library</title
>")
341 append("<li
class='current'>Overview</li
>")
342 append("<li
><a href
='full-index.html'>Full Index</a
></li
>")
346 append("<div
class='content fullpage'>")
347 append("<h1
>Nit Standard Library</h1
>")
348 append("<article
class='overview'><p
>Documentation for the standard library of
Nit<br
/>Version jenkins-component
=stdlib-19
<br
/>Date: TODAY</p
></article
>")
349 append("<article
class='overview'>")
351 append("<h2
>Modules</h2
>")
353 for mmodule in mmodules do
354 var amodule = mbuilder.mmodule2nmodule[mmodule]
355 append("<li
>{mmodule.link(mbuilder)} 
;{amodule.short_comment}</li
>")
364 fun process_generate_dot do
366 op.append("digraph dep \
{ rankdir
=BT; node
[shape
=none
,margin
=0,width
=0,height
=0,fontsize
=10]; edge
[dir
=none
,color
=gray
]; ranksep
=0.2; nodesep
=0.1;\n
")
367 for mmodule in mmodules do
368 op.append("\
"{mmodule.name}\"[URL=\
"{mmodule.url}\"];\n
")
369 for imported in mmodule.in_importation.direct_greaters do
370 if imported.direct_owner == null then
371 op.append("\
"{mmodule.name}\"->\
"{imported.name}\";\n
")
376 generate_dot(op.to_s, "dep
", "Modules hierarchy
")
380 # The full index page
381 class NitdocFullindex
384 private var nitdoc: Nitdoc
386 init(nitdoc: Nitdoc) do
393 append("<title
>Full Index | Nit Standard Library</title
>")
397 append("<li
><a href
='index.html'>Overview</a
></li
>")
398 append("<li
class='current'>Full Index</li
>")
402 append("<div
class='content fullpage'>")
403 append("<h1
>Full Index</h1
>")
410 # Add to content modules column
412 var sorter = new ComparableSorter[MModule]
413 var sorted = new Array[MModule]
414 for mmodule in nitdoc.modelbuilder.model.mmodule_importation_hierarchy do
418 append("<article
class='modules filterable'>")
419 append("<h2
>Modules</h2
>")
421 for mmodule in sorted do
422 append("<li
>{mmodule.link(nitdoc.modelbuilder)}</li
>")
428 # Add to content classes modules
429 fun classes_column do
430 var sorted = nitdoc.modelbuilder.model.mclasses
431 var sorter = new ComparableSorter[MClass]
433 append("<article
class='modules filterable'>")
434 append("<h2
>Classes</h2
>")
436 for mclass in sorted do
437 append("<li
>{mclass.link(nitdoc.modelbuilder)}</li
>")
443 # Insert the properties column of fullindex page
444 fun properties_column do
445 var sorted = nitdoc.modelbuilder.model.mproperties
446 var sorter = new ComparableSorter[MProperty]
448 append("<article
class='modules filterable'>")
449 append("<h2
>Properties</h2
>")
451 for mproperty in sorted do
452 if mproperty isa MAttribute then continue
453 append("<li
>{mproperty.intro.link(nitdoc.modelbuilder)} ({mproperty.intro.mclassdef.mclass.link(nitdoc.modelbuilder)})</li
>")
465 private var mmodule: MModule
466 private var mbuilder: ModelBuilder
468 init(mmodule: MModule, mbuilder: ModelBuilder, dot_dir: nullable String) do
469 self.mmodule = mmodule
470 self.mbuilder = mbuilder
471 self.dot_dir = dot_dir
476 var amodule = mbuilder.mmodule2nmodule[mmodule]
477 append("<title
>{mmodule.name} module | {amodule.short_comment}</title
>")
481 append("<li
><a href
='index.html'>Overview</a
></li
>")
482 append("<li
class='current'>{mmodule.name}</li
>")
483 append("<li
><a href
='full-index.html'>Full Index</a
></li
>")
488 append("<div
class='content'>")
489 append("<h1
>{mmodule.name}</h1
>")
490 append("<div
class='subtitle'>{mmodule.html_signature(mbuilder)}</div
>")
491 append(mmodule.html_full_comment(mbuilder))
498 fun process_generate_dot do
499 var name = "dep_
{mmodule.name}"
501 op.append("digraph
{name} \
{ rankdir
=BT; node
[shape
=none
,margin
=0,width
=0,height
=0,fontsize
=10]; edge
[dir
=none
,color
=gray
]; ranksep
=0.2; nodesep
=0.1;\n
")
502 for m in mmodule.in_importation.poset do
503 var public_owner = m.public_owner
504 if public_owner == null then
507 op.append("\
"{m.name}\"[shape
=box
,margin
=0.03];\n
")
509 op.append("\
"{m.name}\"[URL=\
"{m.url}\"];\n
")
512 for imported in m.in_importation.direct_greaters do
513 if imported.public_owner == null then
514 op.append("\
"{public_owner.name}\"->\
"{imported.name}\";\n
")
519 generate_dot(op.to_s, name, "Dependency graph
for module {mmodule.name}")
523 var amodule = mbuilder.mmodule2nmodule[mmodule]
524 append("<div
class='menu'>")
526 append("<h3
>Module Hierarchy</h3
>")
527 var dependencies = new Array[MModule]
528 for dep in mmodule.in_importation.greaters do
529 if dep == mmodule or dep.public_owner != null then continue
530 dependencies.add(dep)
532 if dependencies.length > 0 then
533 append("<h4
>All dependencies
</h4
>")
534 display_module_list(dependencies)
536 var clients = new Array[MModule]
537 for dep in mmodule.in_importation.smallers do
538 if dep == mmodule or dep.public_owner != null then continue
541 if clients.length > 0 then
542 append("<h4
>All clients
</h4
>")
543 display_module_list(clients)
546 if mmodule.in_nesting.direct_greaters.length > 0 then
548 append("<h3
>Nested Modules</h3
>")
549 display_module_list(mmodule.in_nesting.direct_greaters.to_a)
555 private fun display_module_list(list: Array[MModule]) do
557 var sorter = new ComparableSorter[MModule]
559 for m in list do append("<li
>{m.link(mbuilder)}</li
>")
563 # display the class column
565 var amodule = mbuilder.mmodule2nmodule[mmodule]
566 var intro_mclasses = mmodule.intro_mclasses
567 var redef_mclasses = mmodule.redef_mclasses
568 var all_mclasses = new HashSet[MClass]
569 for m in mmodule.in_nesting.greaters do
570 all_mclasses.add_all(m.intro_mclasses)
571 all_mclasses.add_all(m.redef_mclasses)
573 all_mclasses.add_all(intro_mclasses)
574 all_mclasses.add_all(redef_mclasses)
576 var sorted = new Array[MClass]
577 sorted.add_all(all_mclasses)
578 var sorter = new ComparableSorter[MClass]
580 append("<div
class='module'>")
581 append("<article
class='classes filterable'>")
582 append("<h2
>Classes</h2
>")
585 if redef_mclasses.has(c) and c.intro_mmodule.public_owner != mmodule then
586 append("<li
class='redef'>")
587 append("<span title
='refined in this module'>R
</span
>")
589 append("<li
class='intro'>")
590 append("<span title
='introduced in this module'>I
</span
>")
592 append(c.link(mbuilder))
600 # display the property column
603 var amodule = mbuilder.mmodule2nmodule[mmodule]
604 var mpropdefs = new HashSet[MPropDef]
605 for m in mmodule.in_nesting.greaters do
606 for c in m.mclassdefs do mpropdefs.add_all(c.mpropdefs)
608 for c in mmodule.mclassdefs do mpropdefs.add_all(c.mpropdefs)
609 var sorted = mpropdefs.to_a
610 var sorter = new ComparableSorter[MPropDef]
612 # display properties in one column
613 append("<article
class='properties filterable'>")
614 append("<h2
>Properties</h2
>")
616 for mprop in sorted do
617 if mprop isa MAttributeDef then continue
618 if mprop.mproperty.visibility <= none_visibility then continue
619 append(mprop.html_list_item(mbuilder))
630 private var mclass: MClass
631 private var mbuilder: ModelBuilder
632 private var nitdoc: Nitdoc
633 private var vtypes = new HashSet[MVirtualTypeDef]
634 private var consts = new HashSet[MMethodDef]
635 private var meths = new HashSet[MMethodDef]
636 private var inherited = new HashSet[MPropDef]
638 init(mclass: MClass, nitdoc: Nitdoc, dot_dir: nullable String, source: nullable String) do
640 self.mbuilder = nitdoc.modelbuilder
642 self.dot_dir = dot_dir
645 for mclassdef in mclass.mclassdefs do
646 for mpropdef in mclassdef.mpropdefs do
647 if mpropdef.mproperty.visibility <= none_visibility then continue
648 if mpropdef isa MVirtualTypeDef then vtypes.add(mpropdef)
649 if mpropdef isa MMethodDef then
650 if mpropdef.mproperty.is_init then
658 # get inherited properties
659 for mprop in mclass.inherited_mproperties do
660 var mpropdef = mprop.intro
661 if mprop.visibility <= none_visibility then continue
662 if mpropdef isa MVirtualTypeDef then vtypes.add(mpropdef)
663 if mpropdef isa MMethodDef then
664 if mpropdef.mproperty.is_init then
670 inherited.add(mpropdef)
676 var nclass = mbuilder.mclassdef2nclassdef[mclass.intro]
677 if nclass isa AStdClassdef then
678 append("<title
>{mclass.name} class | {nclass.short_comment}</title
>")
680 append("<title
>{mclass.name} class</title
>")
685 append("<li
><a href
='index.html'>Overview</a
></li
>")
686 var public_owner = mclass.public_owner
687 if public_owner is null then
688 append("<li
>{mclass.intro_mmodule.link(mbuilder)}</li
>")
690 append("<li
>{public_owner.link(mbuilder)}</li
>")
692 append("<li
class='current'>{mclass.name}</li
>")
693 append("<li
><a href
='full-index.html'>Full Index</a
></li
>")
697 append("<div
class='menu'>")
701 append("<div
class='content'>")
706 fun properties_column do
707 var sorter = new ComparableSorter[MPropDef]
708 append("<nav
class='properties filterable'>")
709 append("<h3
>Properties</h3
>")
711 if vtypes.length > 0 then
712 var vts = new Array[MVirtualTypeDef]
715 append("<h4
>Virtual Types</h4
>")
718 append(mprop.html_sidebar_item(self))
723 if consts.length > 0 then
724 var cts = new Array[MMethodDef]
727 append("<h4
>Constructors</h4
>")
730 append(mprop.html_sidebar_item(self))
735 if meths.length > 0 then
736 var mts = new Array[MMethodDef]
739 append("<h4
>Methods</h4
>")
742 if mprop.mproperty.intro_mclassdef.mclass.name == "Object" then continue
743 append(mprop.html_sidebar_item(self))
750 fun inheritance_column do
751 var sorted = new Array[MClass]
752 var sorterp = new ComparableSorter[MClass]
754 append("<h3
>Inheritance</h3
>")
755 if mclass.ancestors.length > 1 then
756 sorted = mclass.ancestors.to_a
758 append("<h4
>Superclasses</h4
>")
761 if sup == mclass then continue
762 append("<li
>{sup.link(mbuilder)}</li
>")
767 if mclass.descendants.length <= 1 then
768 append("<h4
>No Known Subclasses</h4
>")
769 else if mclass.descendants.length <= 100 then
770 sorted = mclass.descendants.to_a
772 append("<h4
>Subclasses</h4
>")
775 if sub == mclass then continue
776 append("<li
>{sub.link(mbuilder)}</li
>")
779 else if mclass.children.length <= 100 then
780 sorted = mclass.children.to_a
782 append("<h4
>Direct Subclasses Only</h4
>")
785 if sub == mclass then continue
786 append("<li
>{sub.link(mbuilder)}</li
>")
790 append("<h4
>Too much
Subclasses to list
</h4
>")
797 append("<h1
>{mclass.html_signature}</h1
>")
798 append("<div
class='subtitle info'>{mclass.html_full_signature(mbuilder)}")
802 var nclass = mbuilder.mclassdef2nclassdef[mclass.intro]
803 append("<div style
=\
"float: right;\"><a id
=\
"lblDiffCommit\"></a
></div
>")
804 append("<section
class='description'>")
805 if nclass isa AStdClassdef and not nclass.comment.is_empty then append("<pre
class=\
"text_label\" title
=\
"122\" name
=\
"\" tag
=\
"{mclass.mclassdefs.first.location.to_s}\" type=\
"2\">{nclass.comment}</pre
><textarea id
=\
"fileContent\" class=\
"edit\" cols
=\
"76\" rows
=\
"1\" style
=\
"display: none;\"></textarea
><a id
=\
"cancelBtn\" style
=\
"display: none;\">Cancel</a
><a id
=\
"commitBtn\" style
=\
"display: none;\">Commit</a
><pre id
=\
"preSave\" class=\
"text_label\" type=\
"2\"></pre
>")
809 var concern2meths = new ArrayMap[MModule, Array[MMethodDef]]
810 var sorted_meths = new Array[MMethodDef]
811 var sorted = new Array[MModule]
812 sorted_meths.add_all(meths)
813 nitdoc.mainmodule.linearize_mpropdefs(sorted_meths)
815 if inherited.has(meth) then continue
816 var mmodule = meth.mclassdef.mmodule
817 if not concern2meths.has_key(mmodule) then
819 concern2meths[mmodule] = new Array[MMethodDef]
821 concern2meths[mmodule].add(meth)
823 var sections = new ArrayMap[MModule, Array[MModule]]
824 for mmodule in concern2meths.keys do
825 var owner = mmodule.public_owner
826 if owner == null then owner = mmodule
827 if not sections.has_key(owner) then sections[owner] = new Array[MModule]
828 if owner != mmodule then sections[owner].add(mmodule)
830 append("<section
class='concerns'>")
831 append("<h2
class='section-header'>Concerns</h2
>")
833 for owner, mmodules in sections do
834 var nowner = mbuilder.mmodule2nmodule[owner]
836 if nowner.short_comment.is_empty then
837 append("<a href
=\
"#{owner.anchor}\">{owner.name}</a
>")
839 append("<a href
=\
"#{owner.anchor}\">{owner.name}</a
>: {nowner.short_comment}")
841 if not mmodules.is_empty then
843 for mmodule in mmodules do
844 var nmodule = mbuilder.mmodule2nmodule[mmodule]
845 if nmodule.short_comment.is_empty then
846 append("<li
><a href
=\
"#{mmodule.anchor}\">{mmodule.name}</a
></li
>")
848 append("<li
><a href
=\
"#{mmodule.anchor}\">{mmodule.name}</a
>: {nmodule.short_comment}</li
>")
858 var prop_sorter = new ComparableSorter[MPropDef]
859 var sorterprop = new ComparableSorter[MProperty]
860 var sorterc = new ComparableSorter[MClass]
861 var lmmodule = new List[MModule]
862 # virtual and formal types
863 var local_vtypes = new Array[MVirtualTypeDef]
864 for vt in vtypes do if not inherited.has(vt) then local_vtypes.add(vt)
865 if local_vtypes.length > 0 or mclass.arity > 0 then
866 append("<section
class='types'>")
867 append("<h2
>Formal and Virtual Types</h2
>")
869 if mclass.arity > 0 and nclass isa AStdClassdef then
870 for ft, bound in mclass.parameter_types do
871 append("<article id
='FT_{ft}'>")
872 append("<h3
class='signature'>{ft}: {bound.link(mbuilder)}</h3
>")
873 append("<div
class=\
"info\">formal generic
type</div
>")
878 prop_sorter.sort(local_vtypes)
879 for prop in local_vtypes do append(prop.html_full_desc(self))
883 var local_consts = new Array[MMethodDef]
884 for const in consts do if not inherited.has(const) then local_consts.add(const)
885 prop_sorter.sort(local_consts)
886 if local_consts.length > 0 then
887 append("<section
class='constructors'>")
888 append("<h2
class='section-header'>Constructors</h2
>")
889 for prop in local_consts do append(prop.html_full_desc(self))
893 if not concern2meths.is_empty then
894 append("<section
class='methods'>")
895 append("<h2
class='section-header'>Methods</h2
>")
896 for owner, mmodules in sections do
897 append("<a id
=\
"{owner.anchor}\"></a
>")
898 if owner != mclass.intro_mmodule and owner != mclass.public_owner then
899 var nowner = mbuilder.mmodule2nmodule[owner]
900 append("<h3
class=\
"concern-toplevel\">Methods refined
in {owner.link(mbuilder)}</h3
>")
901 if nowner.short_comment.is_empty then
902 append("<p
class=\
"concern-doc\">{owner.link(mbuilder)}</p
>")
904 append("<p
class=\
"concern-doc\">{owner.link(mbuilder)}: {nowner.short_comment}</p
>")
907 if concern2meths.has_key(owner) then
908 var mmethods = concern2meths[owner]
909 prop_sorter.sort(mmethods)
910 for prop in mmethods do append(prop.html_full_desc(self))
912 for mmodule in mmodules do
913 append("<a id
=\
"{mmodule.anchor}\"></a
>")
914 var nmodule = mbuilder.mmodule2nmodule[mmodule]
915 if mmodule != mclass.intro_mmodule and mmodule != mclass.public_owner then
916 if nmodule.short_comment.is_empty then
917 append("<p
class=\
"concern-doc\">{mmodule.link(mbuilder)}</p
>")
919 append("<p
class=\
"concern-doc\">{mmodule.link(mbuilder)}: {nmodule.short_comment}</p
>")
922 var mmethods = concern2meths[mmodule]
923 prop_sorter.sort(mmethods)
924 for prop in mmethods do append(prop.html_full_desc(self))
928 # inherited properties
929 if inherited.length > 0 then
930 var sorted_inherited = new Array[MPropDef]
931 sorted_inherited.add_all(inherited)
932 nitdoc.mainmodule.linearize_mpropdefs(sorted_inherited)
933 var classes = new ArrayMap[MClass, Array[MPropDef]]
934 for mmethod in sorted_inherited.reversed do
935 var mclass = mmethod.mclassdef.mclass
936 if not classes.has_key(mclass) then classes[mclass] = new Array[MPropDef]
937 classes[mclass].add(mmethod)
939 append("<h3
>Inherited Properties</h3
>")
940 for c, mmethods in classes do
941 prop_sorter.sort(mmethods)
942 append("<p
>Defined in {c.link(mbuilder)}: ")
943 for i in [0..mmethods.length[ do
944 var mmethod = mmethods[i]
945 append(mmethod.link(mbuilder))
946 if i <= mmethods.length - 1 then append(", ")
954 fun process_generate_dot do
955 var pe = nitdoc.class_hierarchy[mclass]
956 var cla = new HashSet[MClass]
957 var sm = new HashSet[MClass]
958 var sm2 = new HashSet[MClass]
960 while cla.length + sm.length < 10 and sm.length > 0 do
964 sm2.add_all(pe.poset[x].direct_smallers)
970 cla.add_all(pe.greaters)
973 var name = "dep_
{mclass.name}"
974 op.append("digraph
{name} \
{ rankdir
=BT; node
[shape
=none
,margin
=0,width
=0,height
=0,fontsize
=10]; edge
[dir
=none
,color
=gray
]; ranksep
=0.2; nodesep
=0.1;\n
")
977 op.append("\
"{c.name}\"[shape
=box
,margin
=0.03];\n
")
979 op.append("\
"{c.name}\"[URL=\
"{c.url}\"];\n
")
981 for c2 in pe.poset[c].direct_greaters do
982 if not cla.has(c2) then continue
983 op.append("\
"{c.name}\"->\
"{c2.name}\";\n
")
985 if not pe.poset[c].direct_smallers.is_empty then
987 for c2 in pe.poset[c].direct_smallers do
988 if cla.has(c2) then others = false
991 op.append("\
"{c.name}...\"[label=\
"\"];\n
")
992 op.append("\
"{c.name}...\"->\
"{c.name}\"[style
=dotted
];\n
")
997 generate_dot(op.to_s, name, "Dependency graph
for class {mclass.name}")
1007 redef type OTHER: MModule
1008 redef fun <(other: OTHER): Bool do return self.name < other.name
1010 # Get the list of all methods in a module
1011 fun imported_methods: Set[MMethod] do
1012 var methods = new HashSet[MMethod]
1013 for mclass in imported_mclasses do
1014 for method in mclass.intro_methods do
1021 # Get the list aof all refined methods in a module
1022 fun redef_methods: Set[MMethod] do
1023 var methods = new HashSet[MMethod]
1024 for mclass in redef_mclasses do
1025 for method in mclass.intro_methods do
1032 # URL to nitdoc page
1034 var res = new Buffer
1035 res.append("module_
")
1036 var mowner = public_owner
1037 if mowner != null then
1038 res.append("{public_owner.name}_
")
1040 res.append("{self.name}.html
")
1044 # html anchor id to the module in a nitdoc page
1045 fun anchor: String do
1046 var res = new Buffer
1048 var mowner = public_owner
1049 if mowner != null then
1050 res.append("{public_owner.name}_
")
1052 res.append(self.name)
1056 # Return a link (html a tag) to the nitdoc module page
1057 fun link(mbuilder: ModelBuilder): String do
1058 return "<a href
='{url}' title
='{mbuilder.mmodule2nmodule[self].short_comment}'>{name}</a
>"
1061 # Return the module signature decorated with html
1062 fun html_signature(mbuilder: ModelBuilder): String do
1063 return "<span
>module {html_full_namespace(mbuilder)}</span
>"
1066 # Return the module full namespace decorated with html
1067 fun html_full_namespace(mbuilder: ModelBuilder): String do
1068 var res = new Buffer
1069 res.append("<span
>")
1070 var mowner = public_owner
1071 if mowner != null then
1072 res.append(public_owner.html_namespace(mbuilder))
1075 res.append(self.link(mbuilder))
1076 res.append("</span
>")
1080 # Return the module full namespace decorated with html
1081 fun html_namespace(mbuilder: ModelBuilder): String do
1082 var res = new Buffer
1083 res.append("<span
>")
1084 var mowner = public_owner
1085 if mowner != null then
1086 res.append(public_owner.html_namespace(mbuilder))
1088 res.append(self.link(mbuilder))
1090 res.append("</span
>")
1094 # Return the full comment of the module decorated with html
1095 fun html_full_comment(mbuilder: ModelBuilder): String do
1096 var res = new Buffer
1097 res.append("<div id
='description'>")
1098 res.append("<pre
class='text_label'>{mbuilder.mmodule2nmodule[self].comment}</pre
>")
1099 res.append("<textarea
class='edit' rows
='1' cols
='76' id
='fileContent'></textarea
>")
1100 res.append("<a id
='cancelBtn'>Cancel</a
>")
1101 res.append("<a id
='commitBtn'>Commit</a
>")
1102 res.append("<pre
class='text_label' id
='preSave' type='2'></pre
>")
1103 res.append("</div
>")
1110 redef type OTHER: MClass
1111 redef fun <(other: OTHER): Bool do return self.name < other.name
1113 # Return the module signature decorated with html
1114 fun html_full_signature(mbuilder: ModelBuilder): String do
1115 var res = new Buffer
1116 if visibility <= none_visibility then
1117 res.append("private ")
1118 else if visibility == protected_visibility then
1119 res.append("protected ")
1121 res.append("{kind} {html_namespace(mbuilder)}")
1125 # Add type parameters
1126 fun html_signature: String do
1128 return "{name}[{intro.parameter_names.join(", ")}]"
1134 # Return a link (html a tag) to the nitdoc class page
1135 fun link(mbuilder: ModelBuilder): String do
1136 if mbuilder.mclassdef2nclassdef.has_key(intro) then
1137 var nclass = mbuilder.mclassdef2nclassdef[intro]
1138 if nclass isa AStdClassdef then
1139 return "<a href
='{url}' title
=\
"{nclass.short_comment}\">{html_signature}</a
>"
1141 return "<a href
='{url}'>{html_signature}</a
>"
1144 return "<a href
='{url}'>{html_signature}</a
>"
1148 # Return the class namespace decorated with html
1149 fun html_namespace(mbuilder: ModelBuilder): String do
1150 var res = new Buffer
1151 res.append(intro_mmodule.html_namespace(mbuilder))
1152 res.append("::<span
>{self.link(mbuilder)}</span
>")
1157 return "class_
{public_owner}_
{c_name}.html
"
1160 # Escape name for html output
1161 redef fun name do return super.html_escape
1164 redef class MProperty
1166 redef type OTHER: MProperty
1167 redef fun <(other: OTHER): Bool do return self.name < other.name
1169 # Return the property namespace decorated with html
1170 fun html_namespace(mbuilder: ModelBuilder): String do
1171 return "{intro_mclassdef.mclass.html_namespace(mbuilder)}::<span
>{intro.link(mbuilder)}</span
>"
1174 # Escape name for html output
1175 redef fun name do return super.html_escape
1179 fun link(mbuilder: ModelBuilder): String is abstract
1182 redef class MClassType
1183 redef fun link(mbuilder) do return mclass.link(mbuilder)
1186 redef class MNullableType
1187 redef fun link(mbuilder) do return "nullable {mtype.link(mbuilder)}"
1190 redef class MGenericType
1191 redef fun link(mbuilder) do
1192 var res = new Buffer
1193 res.append("<a href
='{mclass.url}'>{mclass.name}</a
>[")
1194 for i in [0..arguments.length[ do
1195 res.append(arguments[i].link(mbuilder))
1196 if i < arguments.length - 1 then res.append(", ")
1203 redef class MParameterType
1204 redef fun link(mbuilder) do
1205 var name = mclass.intro.parameter_names[rank]
1206 return "<a href
='{mclass.url}#FT_{name}' title
='formal type'>{name}</a
>"
1210 redef class MVirtualType
1211 redef fun link(mbuilder) do return mproperty.intro.link(mbuilder)
1214 redef class MClassDef
1215 # Return the classdef namespace decorated with html
1216 fun html_namespace(mbuilder: ModelBuilder): String do
1217 var res = new Buffer
1218 res.append(mmodule.html_full_namespace(mbuilder))
1219 res.append("::<span
>{self.mclass.link(mbuilder)}</span
>")
1224 redef class MPropDef
1226 redef type OTHER: MPropDef
1227 redef fun <(other: OTHER): Bool do return self.mproperty.name < other.mproperty.name
1229 fun url: String do return "{mclassdef.mclass.url}#{anchor}"
1230 fun anchor
: String do return "PROP_{mclassdef.mclass.public_owner.name}_{c_name}"
1232 # Return a link (html a tag) to the nitdoc class page
1233 fun link
(mbuilder
: ModelBuilder): String do
1234 if mbuilder
.mpropdef2npropdef
.has_key
(self) then
1235 var nprop
= mbuilder
.mpropdef2npropdef
[self]
1236 return "<a href=\"{url}\
" title=\"{nprop.short_comment}\
">{mproperty.name}</a>"
1238 return "<a href=\"{url}\
">{mproperty.name}</a>"
1242 # Return a list item for the mpropdef
1243 fun html_list_item
(mbuilder
: ModelBuilder): String do
1244 var res
= new Buffer
1246 res
.append
("<li class='intro'>")
1247 res
.append
("<span title='introduction'>I</span> {link(mbuilder)} ({mclassdef.mclass.link(mbuilder)})")
1250 res
.append
("<li class='redef'>")
1251 res
.append
("<span title='redefinition'>R</span> {link(mbuilder)} ({mclassdef.mclass.link(mbuilder)})")
1257 # Return a list item for the mpropdef
1258 fun html_sidebar_item
(page
: NitdocClass): String do
1259 var res
= new Buffer
1260 if is_intro
and mclassdef
.mclass
== page
.mclass
then
1261 res
.append
("<li class='intro'>")
1262 res
.append
("<span title='Introduced'>I</span>")
1263 else if is_intro
and mclassdef
.mclass
!= page
.mclass
then
1264 res
.append
("<li class='inherit'>")
1265 res
.append
("<span title='Inherited'>H</span>")
1267 res
.append
("<li class='redef'>")
1268 res
.append
("<span title='Redefined'>R</span>")
1270 res
.append
(link
(page
.mbuilder
))
1275 fun html_full_desc
(page
: NitdocClass): String is abstract
1276 fun html_info
(page
: NitdocClass): String is abstract
1278 fun full_name
: String do
1279 return "{mclassdef.mclass.public_owner.name}::{mclassdef.mclass.name}::{mproperty.name}"
1283 redef class MMethodDef
1284 redef fun html_full_desc
(page
) do
1285 if not page
.mbuilder
.mpropdef2npropdef
.has_key
(self) then
1288 var res
= new Buffer
1289 var mprop
= mproperty
1290 var nprop
= page
.mbuilder
.mpropdef2npropdef
[self]
1291 var classes
= new Array[String]
1292 var is_redef
= mprop
.intro_mclassdef
.mclass
!= page
.mclass
1294 if mprop
.is_init
then classes
.add
("init")
1295 if is_redef
then classes
.add
("redef")
1296 if mprop
.visibility
== none_visibility
then
1297 classes
.add
("private")
1298 else if mprop
.visibility
== protected_visibility
then
1299 classes
.add
("protected")
1301 classes
.add
("public")
1303 res
.append
("<article class='{classes.join(" ")}' id='{anchor}'>")
1304 if nprop
isa AAttrPropdef then
1305 if nprop
.mreadpropdef
== self then
1306 res
.append
("<h3 class='signature'>{mprop.name}: {nprop.html_signature(page.mbuilder)}</h3>")
1308 res
.append
("<h3 class='signature'>{mprop.name}(value: {nprop.html_signature(page.mbuilder)})</h3>")
1311 var intro_nprop
= page
.mbuilder
.mpropdef2npropdef
[mprop
.intro
]
1312 res
.append
("<h3 class='signature'>{mprop.name}{intro_nprop.html_signature(page.mbuilder)}</h3>")
1314 res
.append
(html_info
(page
))
1315 res
.append
("<div class='description'>")
1316 if nprop
.comment
== "" then
1317 res
.append
("<a class=\"newComment\
" title=\"32\
" tag=\"\
">New Comment</a>")
1319 res
.append
("<pre class=\"text_label\
" title=\"\
" name=\"\
" tag=\"\
" type=\"1\
">{nprop.comment}</pre>")
1321 res
.append
("<textarea id=\"fileContent\
" class=\"edit\
" cols=\"76\
" rows=\"1\
" style=\"display
: none
;\
"></textarea><a id=\"cancelBtn\
" style=\"display
: none
;\
">Cancel</a><a id=\"commitBtn\
" style=\"display
: none
;\
">Commit</a><pre id=\"preSave\
" class=\"text_label\
" type=\"2\
"></pre>")
1323 res
.append
("<p class='info'>")
1324 page
.nitdoc
.mainmodule
.linearize_mpropdefs
(mprop
.mpropdefs
)
1325 var previous_defs
= new Array[MMethodDef]
1326 var next_defs
= new Array[MMethodDef]
1327 var self_passed
= false
1328 for def
in mprop
.mpropdefs
do
1333 if not self_passed
then
1334 if not page
.mclass
.ancestors
.has
(def
.mclassdef
.mclass
) then continue
1335 if def
.is_intro
then continue
1336 previous_defs
.add
(def
)
1338 if not page
.mclass
.descendants
.has
(def
.mclassdef
.mclass
) then continue
1342 res
.append
("defined by {mclassdef.mmodule.html_full_namespace(page.mbuilder)}")
1343 if not is_intro
then
1344 res
.append
(", introduced by {mprop.intro.mclassdef.mclass.link(page.mbuilder)}")
1346 if not previous_defs
.is_empty
then
1347 res
.append
(", inherited from ")
1348 for i
in [0..previous_defs
.length
[ do
1349 res
.append
(previous_defs
[i
].mclassdef
.mclass
.link
(page
.mbuilder
))
1350 if i
< previous_defs
.length
- 1 then res
.append
(", ")
1353 if not next_defs
.is_empty
then
1354 res
.append
(", redefined by ")
1355 for i
in [0..next_defs
.length
[ do
1356 res
.append
(next_defs
[i
].mclassdef
.mclass
.link
(page
.mbuilder
))
1357 if i
< next_defs
.length
- 1 then res
.append
(", ")
1361 res
.append
("</div>")
1362 res
.append
("</article>")
1366 redef fun html_info
(page
) do
1367 var res
= new Buffer
1368 res
.append
("<div class='info'>")
1369 if mproperty
.visibility
<= none_visibility
then
1370 res
.append
("private ")
1371 else if mproperty
.visibility
<= protected_visibility
then
1372 res
.append
("protected ")
1374 if mproperty
.intro_mclassdef
.mclass
!= page
.mclass
then res
.append
("redef ")
1375 res
.append
("fun {mproperty.html_namespace(page.mbuilder)}")
1376 res
.append
("</div>")
1377 res
.append
("<div style=\"float
: right
;\
"><a id=\"lblDiffCommit\
"></a></div>")
1382 redef class MVirtualTypeDef
1383 redef fun html_full_desc
(page
) do
1384 var res
= new Buffer
1385 var mprop
= mproperty
1386 var is_redef
= mprop
.intro_mclassdef
.mclass
!= page
.mclass
1387 var classes
= new Array[String]
1389 if is_redef
then classes
.add
("redef")
1390 if mprop
.visibility
== none_visibility
then
1391 classes
.add
("private")
1392 else if mprop
.visibility
== protected_visibility
then
1393 classes
.add
("protected")
1395 classes
.add
("public")
1397 res
.append
("<article class='{classes.join(" ")}' id='{anchor}'>")
1398 res
.append
("<h3 class='signature'>{mprop.name}: {bound.link(page.mbuilder)}</h3>")
1399 res
.append
(html_info
(page
))
1400 res
.append
("<div class='description'>")
1402 if page
.mbuilder
.mpropdef2npropdef
.has_key
(self) and page
.mbuilder
.mpropdef2npropdef
[self].comment
!= "" then
1403 var nprop
= page
.mbuilder
.mpropdef2npropdef
[self]
1404 res
.append
("<pre class=\"text_label\
" title=\"\
" name=\"\
" tag=\"\
" type=\"1\
">{nprop.comment}</pre>")
1406 res
.append
("<a class=\"newComment\
" title=\"32\
" tag=\"\
">New Comment</a>")
1408 res
.append
("<textarea id=\"fileContent\
" class=\"edit\
" cols=\"76\
" rows=\"1\
" style=\"display
: none
;\
"></textarea><a id=\"cancelBtn\
" style=\"display
: none
;\
">Cancel</a><a id=\"commitBtn\
" style=\"display
: none
;\
">Commit</a><pre id=\"preSave\
" class=\"text_label\
" type=\"2\
"></pre>")
1410 res
.append
("<p class='info'>")
1411 page
.nitdoc
.mainmodule
.linearize_mpropdefs
(mprop
.mpropdefs
)
1412 var previous_defs
= new Array[MVirtualTypeDef]
1413 var next_defs
= new Array[MVirtualTypeDef]
1414 var self_passed
= false
1415 for def
in mprop
.mpropdefs
do
1420 if not self_passed
then
1421 if not page
.mclass
.ancestors
.has
(def
.mclassdef
.mclass
) then continue
1422 if def
.is_intro
then continue
1423 previous_defs
.add
(def
)
1425 if not page
.mclass
.descendants
.has
(def
.mclassdef
.mclass
) then continue
1429 res
.append
("defined by {mclassdef.mmodule.html_full_namespace(page.mbuilder)}")
1430 if not is_intro
then
1431 res
.append
(", introduced by {mprop.intro.mclassdef.mclass.link(page.mbuilder)}")
1433 if not previous_defs
.is_empty
then
1434 res
.append
(", inherited from ")
1435 for i
in [0..previous_defs
.length
[ do
1436 res
.append
(previous_defs
[i
].mclassdef
.mclass
.link
(page
.mbuilder
))
1437 if i
< previous_defs
.length
- 1 then res
.append
(", ")
1440 if not next_defs
.is_empty
then
1441 res
.append
(", redefined by ")
1442 for i
in [0..next_defs
.length
[ do
1443 res
.append
(next_defs
[i
].mclassdef
.mclass
.link
(page
.mbuilder
))
1444 if i
< next_defs
.length
- 1 then res
.append
(", ")
1448 res
.append
("</div>")
1449 res
.append
("</article>")
1453 redef fun html_info
(page
) do
1454 var res
= new Buffer
1455 res
.append
("<div class='info'>")
1456 if mproperty
.intro_mclassdef
.mclass
!= page
.mclass
then res
.append
("redef ")
1457 res
.append
("type {mproperty.html_namespace(page.mbuilder)}")
1458 res
.append
("</div>")
1459 res
.append
("<div style=\"float
: right
;\
"><a id=\"lblDiffCommit\
"></a></div>")
1469 private fun comment
: String do
1470 var ret
= new Buffer
1471 if n_moduledecl
is null or n_moduledecl
.n_doc
is null then ret
1472 if n_moduledecl
.n_doc
is null then return ""
1473 for t
in n_moduledecl
.n_doc
.n_comment
do
1474 ret
.append
(t
.text
.substring_from
(1))
1476 return ret
.to_s
.html_escape
1479 private fun short_comment
: String do
1480 var ret
= new Buffer
1481 if n_moduledecl
!= null and n_moduledecl
.n_doc
!= null then
1482 ret
.append
(n_moduledecl
.n_doc
.n_comment
.first
.text
.substring_from
(2).replace
("\n", ""))
1484 return ret
.to_s
.html_escape
1488 redef class AStdClassdef
1489 private fun comment
: String do
1490 var ret
= new Buffer
1491 if n_doc
!= null then
1492 for t
in n_doc
.n_comment
do ret
.append
(t
.text
.substring_from
(1))
1494 return ret
.to_s
.html_escape
1497 private fun short_comment
: String do
1498 var ret
= new Buffer
1499 if n_doc
!= null then ret
.append
(n_doc
.n_comment
.first
.text
.substring_from
(2).replace
("\n", ""))
1500 return ret
.to_s
.html_escape
1504 redef class APropdef
1505 private fun short_comment
: String is abstract
1506 private fun html_signature
(mbuilder
: ModelBuilder): String is abstract
1507 private fun comment
: String is abstract
1510 redef class AAttrPropdef
1511 redef fun short_comment
do
1512 var ret
= new Buffer
1513 if n_doc
!= null then ret
.append
(n_doc
.n_comment
.first
.text
.substring_from
(2).replace
("\n", ""))
1514 return ret
.to_s
.html_escape
1517 redef private fun comment
: String do
1518 var ret
= new Buffer
1519 if n_doc
!= null then
1520 for t
in n_doc
.n_comment
do ret
.append
(t
.text
.substring_from
(1))
1522 return ret
.to_s
.html_escape
1525 redef fun html_signature
(mbuilder
) do
1526 if n_type
!= null then return n_type
.mtype
.link
(mbuilder
)
1531 redef class AMethPropdef
1532 redef fun short_comment
do
1533 var ret
= new Buffer
1534 if n_doc
!= null then ret
.append
(n_doc
.n_comment
.first
.text
.substring_from
(2).replace
("\n", ""))
1535 return ret
.to_s
.html_escape
1538 redef private fun comment
: String do
1539 var ret
= new Buffer
1540 if n_doc
!= null then
1541 for t
in n_doc
.n_comment
do ret
.append
(t
.text
.substring_from
(1))
1543 return ret
.to_s
.html_escape
1546 redef fun html_signature
(mbuilder
) do
1547 if n_signature
!= null then return n_signature
.to_html
(mbuilder
)
1552 redef class ATypePropdef
1553 redef fun short_comment
do
1554 var ret
= new Buffer
1555 if n_doc
!= null then ret
.append
(n_doc
.n_comment
.first
.text
.substring_from
(2).replace
("\n", ""))
1556 return ret
.to_s
.html_escape
1559 redef private fun comment
: String do
1560 var ret
= new Buffer
1561 if n_doc
!= null then
1562 for t
in n_doc
.n_comment
do ret
.append
(t
.text
.substring_from
(1))
1564 return ret
.to_s
.html_escape
1567 redef fun html_signature
(mbuilder
) do
1568 return mpropdef
.bound
.link
(mbuilder
)
1572 redef class ASignature
1573 fun to_html
(mbuilder
: ModelBuilder): String do
1575 var res
= new Buffer
1576 if not n_params
.is_empty
then
1578 for i
in [0..n_params
.length
[ do
1579 res
.append
(n_params
[i
].to_html
(mbuilder
))
1580 if i
< n_params
.length
- 1 then res
.append
(", ")
1584 if n_type
!= null and n_type
.mtype
.link
(mbuilder
) != "" then res
.append
(": {n_type.mtype.link(mbuilder)}")
1590 fun to_html
(mbuilder
: ModelBuilder): String do
1591 var ret
= "{n_id.text}"
1592 if n_type
!= null then
1593 ret
= "{ret}: {n_type.mtype.link(mbuilder)}"
1594 if n_dotdotdot
!= null then ret
= "{ret}..."
1600 # Create a tool context to handle options and paths
1601 var toolcontext
= new ToolContext
1603 # Here we launch the nit index
1604 var nitdoc
= new Nitdoc(toolcontext
)