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 for mproperty
in model
.mproperties
do
158 if mproperty
.visibility
<= none_visibility
then continue
159 if mproperty
isa MAttribute then continue
160 content
.append
("\"{mproperty.name}\
": [")
161 for mpropdef
in mproperty
.mpropdefs
do
162 content
.append
("\{txt: \"{mpropdef.full_name}\", url
:\
"{mpropdef.url}\" \
},")
167 content.append(" \
};")
168 file.write(content.to_s)
175 abstract class NitdocPage
177 var dot_dir: nullable String
178 var source: nullable String
182 fun append(str: String) do html.append(str)
183 var html = new Buffer
186 append("<meta charset
='utf-8'/>")
187 append("<script
type='text/javascript' src
='scripts/jquery-1.7.1.min.js'></script
>")
188 append("<script
type='text/javascript' src
='quicksearch-list.js'></script
>")
189 append("<script
type='text/javascript' src
='scripts/js-facilities.js'></script
>")
190 append("<link rel
='stylesheet' href
='styles/main.css' type='text/css' media
='screen'/>")
197 append("<nav
class='main'>")
200 append("<li id
='liGitHub'>")
201 append("<a
class='btn' id
='logGitHub'>")
202 append("<img id
='imgGitHub' src
='resources/icons/github-icon.png' alt
='GitHub'/>")
204 append("<div
class='popover bottom'>")
205 append("<div
class='arrow'> 
;</div
>")
206 append("<div
class='githubTitle'>")
207 append("<h3
>Github Sign In</h3
>")
210 append("<label id
='lbloginGit'>Username</label>")
211 append("<input id
='loginGit' name
='login' type='text'/>")
212 append("<label id
='logginMessage'>Hello ")
213 append("<a id
='githubAccount'><strong id
='nickName'></strong
></a
>")
217 append("<label id
='lbpasswordGit'>Password</label>")
218 append("<input id
='passwordGit' name
='password' type='password'/>")
219 append("<div id
='listBranches'>")
220 append("<label id
='lbBranches'>Branch</label>")
221 append("<select
class='dropdown' id
='dropBranches' name
='dropBranches' tabindex
='1'></select
>")
225 append("<label id
='lbrepositoryGit'>Repository</label>")
226 append("<input id
='repositoryGit' name
='repository' type='text'/>")
229 append("<label id
='lbbranchGit'>Branch</label>")
230 append("<input id
='branchGit' name
='branch' type='text'/>")
233 append("<a id
='signIn'>Sign In</a
>")
242 fun content is abstract
245 append("<footer
>Nit standard library
. Version jenkins-component
=stdlib-19
.</footer
>")
248 # Generate a clickable graphviz image using a dot content
249 fun generate_dot(dot: String, name: String, alt: String) do
250 var output_dir = dot_dir
251 if output_dir == null then return
252 var file = new OFStream.open("{output_dir}/{name}.dot
")
255 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
; \
}")
256 append("<article
class='graph'>")
257 append("<img src
='{name}.png' usemap
='#{name}' style
='margin:auto' alt
='{alt}'/>")
259 var fmap = new IFStream.open("{output_dir}/{name}.map
")
260 append(fmap.read_all)
264 # Add a (source) link for a given location
265 fun show_source(l: Location): String
267 if source == null then
268 return "({l.file.filename.simplify_path})"
270 # THIS IS JUST UGLY ! (but there is no replace yet)
271 var x = source.split_with("%f
")
272 source = x.join(l.file.filename.simplify_path)
273 x = source.split_with("%l
")
274 source = x.join(l.line_start.to_s)
275 x = source.split_with("%L
")
276 source = x.join(l.line_end.to_s)
277 return " (<a href
=\
"{source.to_s}\">show code
</a
>)"
281 # Render the page as a html string
282 fun render: String do
283 append("<!DOCTYPE html
>")
289 append("<div
class='page'>")
297 # Save html page in the specified file
298 fun save(file: String) do
299 var out = new OFStream.open(file)
308 private var mbuilder: ModelBuilder
309 private var mmodules = new Array[MModule]
311 init(mbuilder: ModelBuilder, dot_dir: nullable String) do
312 self.mbuilder = mbuilder
313 self.dot_dir = dot_dir
315 var mmodules = new HashSet[MModule]
316 for mmodule in mbuilder.model.mmodules do
317 var owner = mmodule.public_owner
318 if owner != null then
321 mmodules.add(mmodule)
325 var sorter = new ComparableSorter[MModule]
326 self.mmodules.add_all(mmodules)
327 sorter.sort(self.mmodules)
332 append("<title
>Overview | Nit Standard Library</title
>")
336 append("<li
class='current'>Overview</li
>")
337 append("<li
><a href
='full-index.html'>Full Index</a
></li
>")
341 append("<div
class='content fullpage'>")
342 append("<h1
>Nit Standard Library</h1
>")
343 append("<article
class='overview'><p
>Documentation for the standard library of
Nit<br
/>Version jenkins-component
=stdlib-19
<br
/>Date: TODAY</p
></article
>")
344 append("<article
class='overview'>")
346 append("<h2
>Modules</h2
>")
348 for mmodule in mmodules do
349 var amodule = mbuilder.mmodule2nmodule[mmodule]
350 append("<li
>{mmodule.link(mbuilder)} 
;{amodule.short_comment}</li
>")
359 fun process_generate_dot do
361 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
")
362 for mmodule in mmodules do
363 op.append("\
"{mmodule.name}\"[URL=\
"{mmodule.url}\"];\n
")
364 for imported in mmodule.in_importation.direct_greaters do
365 if imported.direct_owner == null then
366 op.append("\
"{mmodule.name}\"->\
"{imported.name}\";\n
")
371 generate_dot(op.to_s, "dep
", "Modules hierarchy
")
375 # The full index page
376 class NitdocFullindex
379 private var nitdoc: Nitdoc
381 init(nitdoc: Nitdoc) do
388 append("<title
>Full Index | Nit Standard Library</title
>")
392 append("<li
><a href
='index.html'>Overview</a
></li
>")
393 append("<li
class='current'>Full Index</li
>")
397 append("<div
class='content fullpage'>")
398 append("<h1
>Full Index</h1
>")
405 # Add to content modules column
407 var sorter = new ComparableSorter[MModule]
408 var sorted = new Array[MModule]
409 for mmodule in nitdoc.modelbuilder.model.mmodule_importation_hierarchy do
413 append("<article
class='modules filterable'>")
414 append("<h2
>Modules</h2
>")
416 for mmodule in sorted do
417 append("<li
>{mmodule.link(nitdoc.modelbuilder)}</li
>")
423 # Add to content classes modules
424 fun classes_column do
425 var sorted = nitdoc.modelbuilder.model.mclasses
426 var sorter = new ComparableSorter[MClass]
428 append("<article
class='modules filterable'>")
429 append("<h2
>Classes</h2
>")
431 for mclass in sorted do
432 append("<li
>{mclass.link(nitdoc.modelbuilder)}</li
>")
438 # Insert the properties column of fullindex page
439 fun properties_column do
440 var sorted = nitdoc.modelbuilder.model.mproperties
441 var sorter = new ComparableSorter[MProperty]
443 append("<article
class='modules filterable'>")
444 append("<h2
>Properties</h2
>")
446 for mproperty in sorted do
447 if mproperty isa MAttribute then continue
448 append("<li
>{mproperty.intro.link(nitdoc.modelbuilder)} ({mproperty.intro.mclassdef.mclass.link(nitdoc.modelbuilder)})</li
>")
460 private var mmodule: MModule
461 private var mbuilder: ModelBuilder
463 init(mmodule: MModule, mbuilder: ModelBuilder, dot_dir: nullable String) do
464 self.mmodule = mmodule
465 self.mbuilder = mbuilder
466 self.dot_dir = dot_dir
471 var amodule = mbuilder.mmodule2nmodule[mmodule]
472 append("<title
>{mmodule.name} module | {amodule.short_comment}</title
>")
476 append("<li
><a href
='index.html'>Overview</a
></li
>")
477 append("<li
class='current'>{mmodule.name}</li
>")
478 append("<li
><a href
='full-index.html'>Full Index</a
></li
>")
483 append("<div
class='content'>")
484 append("<h1
>{mmodule.name}</h1
>")
485 append("<div
class='subtitle'>{mmodule.html_signature(mbuilder)}</div
>")
486 append(mmodule.html_full_comment(mbuilder))
493 fun process_generate_dot do
494 var name = "dep_
{mmodule.name}"
496 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
")
497 for m in mmodule.in_importation.poset do
498 var public_owner = m.public_owner
499 if public_owner == null then
502 op.append("\
"{m.name}\"[shape
=box
,margin
=0.03];\n
")
504 op.append("\
"{m.name}\"[URL=\
"{m.url}\"];\n
")
507 for imported in m.in_importation.direct_greaters do
508 if imported.public_owner == null then
509 op.append("\
"{public_owner.name}\"->\
"{imported.name}\";\n
")
514 generate_dot(op.to_s, name, "Dependency graph
for module {mmodule.name}")
518 var amodule = mbuilder.mmodule2nmodule[mmodule]
519 append("<div
class='menu'>")
521 append("<h3
>Module Hierarchy</h3
>")
522 var dependencies = new Array[MModule]
523 for dep in mmodule.in_importation.greaters do
524 if dep == mmodule or dep.public_owner != null then continue
525 dependencies.add(dep)
527 if dependencies.length > 0 then
528 append("<h4
>All dependencies
</h4
>")
529 display_module_list(dependencies)
531 var clients = new Array[MModule]
532 for dep in mmodule.in_importation.smallers do
533 if dep == mmodule or dep.public_owner != null then continue
536 if clients.length > 0 then
537 append("<h4
>All clients
</h4
>")
538 display_module_list(clients)
541 if mmodule.in_nesting.direct_greaters.length > 0 then
543 append("<h3
>Nested Modules</h3
>")
544 display_module_list(mmodule.in_nesting.direct_greaters.to_a)
550 private fun display_module_list(list: Array[MModule]) do
552 var sorter = new ComparableSorter[MModule]
554 for m in list do append("<li
>{m.link(mbuilder)}</li
>")
558 # display the class column
560 var amodule = mbuilder.mmodule2nmodule[mmodule]
561 var intro_mclasses = mmodule.intro_mclasses
562 var redef_mclasses = mmodule.redef_mclasses
563 var all_mclasses = new HashSet[MClass]
564 for m in mmodule.in_nesting.greaters do
565 all_mclasses.add_all(m.intro_mclasses)
566 all_mclasses.add_all(m.redef_mclasses)
568 all_mclasses.add_all(intro_mclasses)
569 all_mclasses.add_all(redef_mclasses)
571 var sorted = new Array[MClass]
572 sorted.add_all(all_mclasses)
573 var sorter = new ComparableSorter[MClass]
575 append("<div
class='module'>")
576 append("<article
class='classes filterable'>")
577 append("<h2
>Classes</h2
>")
580 if redef_mclasses.has(c) and c.intro_mmodule.public_owner != mmodule then
581 append("<li
class='redef'>")
582 append("<span title
='refined in this module'>R
</span
>")
584 append("<li
class='intro'>")
585 append("<span title
='introduced in this module'>I
</span
>")
587 append(c.link(mbuilder))
595 # display the property column
598 var amodule = mbuilder.mmodule2nmodule[mmodule]
599 var mpropdefs = new HashSet[MPropDef]
600 for m in mmodule.in_nesting.greaters do
601 for c in m.mclassdefs do mpropdefs.add_all(c.mpropdefs)
603 for c in mmodule.mclassdefs do mpropdefs.add_all(c.mpropdefs)
604 var sorted = mpropdefs.to_a
605 var sorter = new ComparableSorter[MPropDef]
607 # display properties in one column
608 append("<article
class='properties filterable'>")
609 append("<h2
>Properties</h2
>")
611 for mprop in sorted do
612 if mprop isa MAttributeDef then continue
613 if mprop.mproperty.visibility <= none_visibility then continue
614 append(mprop.html_list_item(mbuilder))
625 private var mclass: MClass
626 private var mbuilder: ModelBuilder
627 private var nitdoc: Nitdoc
628 private var vtypes = new HashSet[MVirtualTypeDef]
629 private var consts = new HashSet[MMethodDef]
630 private var meths = new HashSet[MMethodDef]
631 private var inherited = new HashSet[MPropDef]
633 init(mclass: MClass, nitdoc: Nitdoc, dot_dir: nullable String, source: nullable String) do
635 self.mbuilder = nitdoc.modelbuilder
637 self.dot_dir = dot_dir
640 for mclassdef in mclass.mclassdefs do
641 for mpropdef in mclassdef.mpropdefs do
642 if mpropdef.mproperty.visibility <= none_visibility then continue
643 if mpropdef isa MVirtualTypeDef then vtypes.add(mpropdef)
644 if mpropdef isa MMethodDef then
645 if mpropdef.mproperty.is_init then
653 # get inherited properties
654 for mprop in mclass.inherited_mproperties do
655 var mpropdef = mprop.intro
656 if mprop.visibility <= none_visibility then continue
657 if mpropdef isa MVirtualTypeDef then vtypes.add(mpropdef)
658 if mpropdef isa MMethodDef then
659 if mpropdef.mproperty.is_init then
665 inherited.add(mpropdef)
671 var nclass = mbuilder.mclassdef2nclassdef[mclass.intro]
672 if nclass isa AStdClassdef then
673 append("<title
>{mclass.name} class | {nclass.short_comment}</title
>")
675 append("<title
>{mclass.name} class</title
>")
680 append("<li
><a href
='index.html'>Overview</a
></li
>")
681 var public_owner = mclass.public_owner
682 if public_owner is null then
683 append("<li
>{mclass.intro_mmodule.link(mbuilder)}</li
>")
685 append("<li
>{public_owner.link(mbuilder)}</li
>")
687 append("<li
class='current'>{mclass.name}</li
>")
688 append("<li
><a href
='full-index.html'>Full Index</a
></li
>")
692 append("<div
class='menu'>")
696 append("<div
class='content'>")
701 fun properties_column do
702 var sorter = new ComparableSorter[MPropDef]
703 append("<nav
class='properties filterable'>")
704 append("<h3
>Properties</h3
>")
706 if vtypes.length > 0 then
707 var vts = new Array[MVirtualTypeDef]
710 append("<h4
>Virtual Types</h4
>")
713 append(mprop.html_sidebar_item(self))
718 if consts.length > 0 then
719 var cts = new Array[MMethodDef]
722 append("<h4
>Constructors</h4
>")
725 append(mprop.html_sidebar_item(self))
730 if meths.length > 0 then
731 var mts = new Array[MMethodDef]
734 append("<h4
>Methods</h4
>")
737 if mprop.mproperty.intro_mclassdef.mclass.name == "Object" then continue
738 append(mprop.html_sidebar_item(self))
745 fun inheritance_column do
746 var sorted = new Array[MClass]
747 var sorterp = new ComparableSorter[MClass]
749 append("<h3
>Inheritance</h3
>")
750 if mclass.ancestors.length > 1 then
751 sorted = mclass.ancestors.to_a
753 append("<h4
>Superclasses</h4
>")
756 if sup == mclass then continue
757 append("<li
>{sup.link(mbuilder)}</li
>")
762 if mclass.descendants.length <= 1 then
763 append("<h4
>No Known Subclasses</h4
>")
764 else if mclass.descendants.length <= 100 then
765 sorted = mclass.descendants.to_a
767 append("<h4
>Subclasses</h4
>")
770 if sub == mclass then continue
771 append("<li
>{sub.link(mbuilder)}</li
>")
774 else if mclass.children.length <= 100 then
775 sorted = mclass.children.to_a
777 append("<h4
>Direct Subclasses Only</h4
>")
780 if sub == mclass then continue
781 append("<li
>{sub.link(mbuilder)}</li
>")
785 append("<h4
>Too much
Subclasses to list
</h4
>")
792 append("<h1
>{mclass.html_signature}</h1
>")
793 append("<div
class='subtitle info'>{mclass.html_full_signature(mbuilder)}")
797 var nclass = mbuilder.mclassdef2nclassdef[mclass.intro]
798 append("<div style
=\
"float: right;\"><a id
=\
"lblDiffCommit\"></a
></div
>")
799 append("<section
class='description'>")
800 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
>")
804 var concern2meths = new ArrayMap[MModule, Array[MMethodDef]]
805 var sorted_meths = new Array[MMethodDef]
806 var sorted = new Array[MModule]
807 sorted_meths.add_all(meths)
808 nitdoc.mainmodule.linearize_mpropdefs(sorted_meths)
810 if inherited.has(meth) then continue
811 var mmodule = meth.mclassdef.mmodule
812 if not concern2meths.has_key(mmodule) then
814 concern2meths[mmodule] = new Array[MMethodDef]
816 concern2meths[mmodule].add(meth)
818 var sections = new ArrayMap[MModule, Array[MModule]]
819 for mmodule in concern2meths.keys do
820 var owner = mmodule.public_owner
821 if owner == null then owner = mmodule
822 if not sections.has_key(owner) then sections[owner] = new Array[MModule]
823 if owner != mmodule then sections[owner].add(mmodule)
825 append("<section
class='concerns'>")
826 append("<h2
class='section-header'>Concerns</h2
>")
828 for owner, mmodules in sections do
829 var nowner = mbuilder.mmodule2nmodule[owner]
831 if nowner.short_comment.is_empty then
832 append("<a href
=\
"#{owner.anchor}\">{owner.name}</a
>")
834 append("<a href
=\
"#{owner.anchor}\">{owner.name}</a
>: {nowner.short_comment}")
836 if not mmodules.is_empty then
838 for mmodule in mmodules do
839 var nmodule = mbuilder.mmodule2nmodule[mmodule]
840 if nmodule.short_comment.is_empty then
841 append("<li
><a href
=\
"#{mmodule.anchor}\">{mmodule.name}</a
></li
>")
843 append("<li
><a href
=\
"#{mmodule.anchor}\">{mmodule.name}</a
>: {nmodule.short_comment}</li
>")
853 var prop_sorter = new ComparableSorter[MPropDef]
854 var sorterprop = new ComparableSorter[MProperty]
855 var sorterc = new ComparableSorter[MClass]
856 var lmmodule = new List[MModule]
857 # virtual and formal types
858 var local_vtypes = new Array[MVirtualTypeDef]
859 for vt in vtypes do if not inherited.has(vt) then local_vtypes.add(vt)
860 if local_vtypes.length > 0 or mclass.arity > 0 then
861 append("<section
class='types'>")
862 append("<h2
>Formal and Virtual Types</h2
>")
864 if mclass.arity > 0 and nclass isa AStdClassdef then
865 for ft, bound in mclass.parameter_types do
866 append("<article id
='FT_{ft}'>")
867 append("<h3
class='signature'>{ft}: {bound.link(mbuilder)}</h3
>")
868 append("<div
class=\
"info\">formal generic
type</div
>")
873 prop_sorter.sort(local_vtypes)
874 for prop in local_vtypes do append(prop.html_full_desc(self))
878 var local_consts = new Array[MMethodDef]
879 for const in consts do if not inherited.has(const) then local_consts.add(const)
880 prop_sorter.sort(local_consts)
881 if local_consts.length > 0 then
882 append("<section
class='constructors'>")
883 append("<h2
class='section-header'>Constructors</h2
>")
884 for prop in local_consts do append(prop.html_full_desc(self))
888 if not concern2meths.is_empty then
889 append("<section
class='methods'>")
890 append("<h2
class='section-header'>Methods</h2
>")
891 for owner, mmodules in sections do
892 append("<a id
=\
"{owner.anchor}\"></a
>")
893 if owner != mclass.intro_mmodule and owner != mclass.public_owner then
894 var nowner = mbuilder.mmodule2nmodule[owner]
895 append("<h3
class=\
"concern-toplevel\">Methods refined
in {owner.link(mbuilder)}</h3
>")
896 if nowner.short_comment.is_empty then
897 append("<p
class=\
"concern-doc\">{owner.link(mbuilder)}</p
>")
899 append("<p
class=\
"concern-doc\">{owner.link(mbuilder)}: {nowner.short_comment}</p
>")
902 if concern2meths.has_key(owner) then
903 var mmethods = concern2meths[owner]
904 prop_sorter.sort(mmethods)
905 for prop in mmethods do append(prop.html_full_desc(self))
907 for mmodule in mmodules do
908 append("<a id
=\
"{mmodule.anchor}\"></a
>")
909 var nmodule = mbuilder.mmodule2nmodule[mmodule]
910 if mmodule != mclass.intro_mmodule and mmodule != mclass.public_owner then
911 if nmodule.short_comment.is_empty then
912 append("<p
class=\
"concern-doc\">{mmodule.link(mbuilder)}</p
>")
914 append("<p
class=\
"concern-doc\">{mmodule.link(mbuilder)}: {nmodule.short_comment}</p
>")
917 var mmethods = concern2meths[mmodule]
918 prop_sorter.sort(mmethods)
919 for prop in mmethods do append(prop.html_full_desc(self))
923 # inherited properties
924 if inherited.length > 0 then
925 var sorted_inherited = new Array[MPropDef]
926 sorted_inherited.add_all(inherited)
927 nitdoc.mainmodule.linearize_mpropdefs(sorted_inherited)
928 var classes = new ArrayMap[MClass, Array[MPropDef]]
929 for mmethod in sorted_inherited.reversed do
930 var mclass = mmethod.mclassdef.mclass
931 if not classes.has_key(mclass) then classes[mclass] = new Array[MPropDef]
932 classes[mclass].add(mmethod)
934 append("<h3
>Inherited Properties</h3
>")
935 for c, mmethods in classes do
936 prop_sorter.sort(mmethods)
937 append("<p
>Defined in {c.link(mbuilder)}: ")
938 for i in [0..mmethods.length[ do
939 var mmethod = mmethods[i]
940 append(mmethod.link(mbuilder))
941 if i <= mmethods.length - 1 then append(", ")
949 fun process_generate_dot do
950 var pe = nitdoc.class_hierarchy[mclass]
951 var cla = new HashSet[MClass]
952 var sm = new HashSet[MClass]
953 var sm2 = new HashSet[MClass]
955 while cla.length + sm.length < 10 and sm.length > 0 do
959 sm2.add_all(pe.poset[x].direct_smallers)
965 cla.add_all(pe.greaters)
968 var name = "dep_
{mclass.name}"
969 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
")
972 op.append("\
"{c.name}\"[shape
=box
,margin
=0.03];\n
")
974 op.append("\
"{c.name}\"[URL=\
"{c.url}\"];\n
")
976 for c2 in pe.poset[c].direct_greaters do
977 if not cla.has(c2) then continue
978 op.append("\
"{c.name}\"->\
"{c2.name}\";\n
")
980 if not pe.poset[c].direct_smallers.is_empty then
982 for c2 in pe.poset[c].direct_smallers do
983 if cla.has(c2) then others = false
986 op.append("\
"{c.name}...\"[label=\
"\"];\n
")
987 op.append("\
"{c.name}...\"->\
"{c.name}\"[style
=dotted
];\n
")
992 generate_dot(op.to_s, name, "Dependency graph
for class {mclass.name}")
1002 redef type OTHER: MModule
1003 redef fun <(other: OTHER): Bool do return self.name < other.name
1005 # Get the list of all methods in a module
1006 fun imported_methods: Set[MMethod] do
1007 var methods = new HashSet[MMethod]
1008 for mclass in imported_mclasses do
1009 for method in mclass.intro_methods do
1016 # Get the list aof all refined methods in a module
1017 fun redef_methods: Set[MMethod] do
1018 var methods = new HashSet[MMethod]
1019 for mclass in redef_mclasses do
1020 for method in mclass.intro_methods do
1027 # URL to nitdoc page
1029 var res = new Buffer
1030 res.append("module_
")
1031 var mowner = public_owner
1032 if mowner != null then
1033 res.append("{public_owner.name}_
")
1035 res.append("{self.name}.html
")
1039 # html anchor id to the module in a nitdoc page
1040 fun anchor: String do
1041 var res = new Buffer
1043 var mowner = public_owner
1044 if mowner != null then
1045 res.append("{public_owner.name}_
")
1047 res.append(self.name)
1051 # Return a link (html a tag) to the nitdoc module page
1052 fun link(mbuilder: ModelBuilder): String do
1053 return "<a href
='{url}' title
='{mbuilder.mmodule2nmodule[self].short_comment}'>{name}</a
>"
1056 # Return the module signature decorated with html
1057 fun html_signature(mbuilder: ModelBuilder): String do
1058 return "<span
>module {html_full_namespace(mbuilder)}</span
>"
1061 # Return the module full namespace decorated with html
1062 fun html_full_namespace(mbuilder: ModelBuilder): String do
1063 var res = new Buffer
1064 res.append("<span
>")
1065 var mowner = public_owner
1066 if mowner != null then
1067 res.append(public_owner.html_namespace(mbuilder))
1070 res.append(self.link(mbuilder))
1071 res.append("</span
>")
1075 # Return the module full namespace decorated with html
1076 fun html_namespace(mbuilder: ModelBuilder): String do
1077 var res = new Buffer
1078 res.append("<span
>")
1079 var mowner = public_owner
1080 if mowner != null then
1081 res.append(public_owner.html_namespace(mbuilder))
1083 res.append(self.link(mbuilder))
1085 res.append("</span
>")
1089 # Return the full comment of the module decorated with html
1090 fun html_full_comment(mbuilder: ModelBuilder): String do
1091 var res = new Buffer
1092 res.append("<div id
='description'>")
1093 res.append("<pre
class='text_label'>{mbuilder.mmodule2nmodule[self].comment}</pre
>")
1094 res.append("<textarea
class='edit' rows
='1' cols
='76' id
='fileContent'></textarea
>")
1095 res.append("<a id
='cancelBtn'>Cancel</a
>")
1096 res.append("<a id
='commitBtn'>Commit</a
>")
1097 res.append("<pre
class='text_label' id
='preSave' type='2'></pre
>")
1098 res.append("</div
>")
1105 redef type OTHER: MClass
1106 redef fun <(other: OTHER): Bool do return self.name < other.name
1108 # Return the module signature decorated with html
1109 fun html_full_signature(mbuilder: ModelBuilder): String do
1110 var res = new Buffer
1111 if visibility <= none_visibility then
1112 res.append("private ")
1113 else if visibility == protected_visibility then
1114 res.append("protected ")
1116 res.append("{kind} {html_namespace(mbuilder)}")
1120 # Add type parameters
1121 fun html_signature: String do
1123 return "{name}[{intro.parameter_names.join(", ")}]"
1129 # Return a link (html a tag) to the nitdoc class page
1130 fun link(mbuilder: ModelBuilder): String do
1131 if mbuilder.mclassdef2nclassdef.has_key(intro) then
1132 var nclass = mbuilder.mclassdef2nclassdef[intro]
1133 if nclass isa AStdClassdef then
1134 return "<a href
='{url}' title
=\
"{nclass.short_comment}\">{html_signature}</a
>"
1136 return "<a href
='{url}'>{html_signature}</a
>"
1139 return "<a href
='{url}'>{html_signature}</a
>"
1143 # Return the class namespace decorated with html
1144 fun html_namespace(mbuilder: ModelBuilder): String do
1145 var res = new Buffer
1146 res.append(intro_mmodule.html_namespace(mbuilder))
1147 res.append("::<span
>{self.link(mbuilder)}</span
>")
1152 return "class_
{public_owner}_
{c_name}.html
"
1155 # Escape name for html output
1156 redef fun name do return super.html_escape
1159 redef class MProperty
1161 redef type OTHER: MProperty
1162 redef fun <(other: OTHER): Bool do return self.name < other.name
1164 # Return the property namespace decorated with html
1165 fun html_namespace(mbuilder: ModelBuilder): String do
1166 return "{intro_mclassdef.mclass.html_namespace(mbuilder)}::<span
>{intro.link(mbuilder)}</span
>"
1169 # Escape name for html output
1170 redef fun name do return super.html_escape
1174 fun link(mbuilder: ModelBuilder): String is abstract
1177 redef class MClassType
1178 redef fun link(mbuilder) do return mclass.link(mbuilder)
1181 redef class MNullableType
1182 redef fun link(mbuilder) do return "nullable {mtype.link(mbuilder)}"
1185 redef class MGenericType
1186 redef fun link(mbuilder) do
1187 var res = new Buffer
1188 res.append("<a href
='{mclass.url}'>{mclass.name}</a
>[")
1189 for i in [0..arguments.length[ do
1190 res.append(arguments[i].link(mbuilder))
1191 if i < arguments.length - 1 then res.append(", ")
1198 redef class MParameterType
1199 redef fun link(mbuilder) do
1200 var name = mclass.intro.parameter_names[rank]
1201 return "<a href
='{mclass.url}#FT_{name}' title
='formal type'>{name}</a
>"
1205 redef class MVirtualType
1206 redef fun link(mbuilder) do return mproperty.intro.link(mbuilder)
1209 redef class MClassDef
1210 # Return the classdef namespace decorated with html
1211 fun html_namespace(mbuilder: ModelBuilder): String do
1212 var res = new Buffer
1213 res.append(mmodule.html_full_namespace(mbuilder))
1214 res.append("::<span
>{self.mclass.link(mbuilder)}</span
>")
1219 redef class MPropDef
1221 redef type OTHER: MPropDef
1222 redef fun <(other: OTHER): Bool do return self.mproperty.name < other.mproperty.name
1224 fun url: String do return "{mclassdef.mclass.url}#{anchor}"
1225 fun anchor
: String do return "PROP_{mclassdef.mclass.public_owner.name}_{c_name}"
1227 # Return a link (html a tag) to the nitdoc class page
1228 fun link
(mbuilder
: ModelBuilder): String do
1229 if mbuilder
.mpropdef2npropdef
.has_key
(self) then
1230 var nprop
= mbuilder
.mpropdef2npropdef
[self]
1231 return "<a href=\"{url}\
" title=\"{nprop.short_comment}\
">{mproperty.name}</a>"
1233 return "<a href=\"{url}\
">{mproperty.name}</a>"
1237 # Return a list item for the mpropdef
1238 fun html_list_item
(mbuilder
: ModelBuilder): String do
1239 var res
= new Buffer
1241 res
.append
("<li class='intro'>")
1242 res
.append
("<span title='introduction'>I</span> {link(mbuilder)} ({mclassdef.mclass.link(mbuilder)})")
1245 res
.append
("<li class='redef'>")
1246 res
.append
("<span title='redefinition'>R</span> {link(mbuilder)} ({mclassdef.mclass.link(mbuilder)})")
1252 # Return a list item for the mpropdef
1253 fun html_sidebar_item
(page
: NitdocClass): String do
1254 var res
= new Buffer
1255 if is_intro
and mclassdef
.mclass
== page
.mclass
then
1256 res
.append
("<li class='intro'>")
1257 res
.append
("<span title='Introduced'>I</span>")
1258 else if is_intro
and mclassdef
.mclass
!= page
.mclass
then
1259 res
.append
("<li class='inherit'>")
1260 res
.append
("<span title='Inherited'>H</span>")
1262 res
.append
("<li class='redef'>")
1263 res
.append
("<span title='Redefined'>R</span>")
1265 res
.append
(link
(page
.mbuilder
))
1270 fun html_full_desc
(page
: NitdocClass): String is abstract
1271 fun html_info
(page
: NitdocClass): String is abstract
1273 fun full_name
: String do
1274 return "{mclassdef.mclass.public_owner.name}::{mclassdef.mclass.name}::{mproperty.name}"
1278 redef class MMethodDef
1279 redef fun html_full_desc
(page
) do
1280 if not page
.mbuilder
.mpropdef2npropdef
.has_key
(self) then
1283 var res
= new Buffer
1284 var mprop
= mproperty
1285 var nprop
= page
.mbuilder
.mpropdef2npropdef
[self]
1286 var classes
= new Array[String]
1287 var is_redef
= mprop
.intro_mclassdef
.mclass
!= page
.mclass
1289 if mprop
.is_init
then classes
.add
("init")
1290 if is_redef
then classes
.add
("redef")
1291 if mprop
.visibility
== none_visibility
then
1292 classes
.add
("private")
1293 else if mprop
.visibility
== protected_visibility
then
1294 classes
.add
("protected")
1296 classes
.add
("public")
1298 res
.append
("<article class='{classes.join(" ")}' id='{anchor}'>")
1299 if nprop
isa AAttrPropdef then
1300 if nprop
.mreadpropdef
== self then
1301 res
.append
("<h3 class='signature'>{mprop.name}: {nprop.html_signature(page.mbuilder)}</h3>")
1303 res
.append
("<h3 class='signature'>{mprop.name}(value: {nprop.html_signature(page.mbuilder)})</h3>")
1306 var intro_nprop
= page
.mbuilder
.mpropdef2npropdef
[mprop
.intro
]
1307 res
.append
("<h3 class='signature'>{mprop.name}{intro_nprop.html_signature(page.mbuilder)}</h3>")
1309 res
.append
(html_info
(page
))
1310 res
.append
("<div class='description'>")
1311 if nprop
.comment
== "" then
1312 res
.append
("<a class=\"newComment\
" title=\"32\
" tag=\"\
">New Comment</a>")
1314 res
.append
("<pre class=\"text_label\
" title=\"\
" name=\"\
" tag=\"\
" type=\"1\
">{nprop.comment}</pre>")
1316 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>")
1318 res
.append
("<p class='info'>")
1319 page
.nitdoc
.mainmodule
.linearize_mpropdefs
(mprop
.mpropdefs
)
1320 var previous_defs
= new Array[MMethodDef]
1321 var next_defs
= new Array[MMethodDef]
1322 var self_passed
= false
1323 for def
in mprop
.mpropdefs
do
1328 if not self_passed
then
1329 if not page
.mclass
.ancestors
.has
(def
.mclassdef
.mclass
) then continue
1330 if def
.is_intro
then continue
1331 previous_defs
.add
(def
)
1333 if not page
.mclass
.descendants
.has
(def
.mclassdef
.mclass
) then continue
1337 res
.append
("defined by {mclassdef.mmodule.html_full_namespace(page.mbuilder)}")
1338 if not is_intro
then
1339 res
.append
(", introduced by {mprop.intro.mclassdef.mclass.link(page.mbuilder)}")
1341 if not previous_defs
.is_empty
then
1342 res
.append
(", inherited from ")
1343 for i
in [0..previous_defs
.length
[ do
1344 res
.append
(previous_defs
[i
].mclassdef
.mclass
.link
(page
.mbuilder
))
1345 if i
< previous_defs
.length
- 1 then res
.append
(", ")
1348 if not next_defs
.is_empty
then
1349 res
.append
(", redefined by ")
1350 for i
in [0..next_defs
.length
[ do
1351 res
.append
(next_defs
[i
].mclassdef
.mclass
.link
(page
.mbuilder
))
1352 if i
< next_defs
.length
- 1 then res
.append
(", ")
1356 res
.append
("</div>")
1357 res
.append
("</article>")
1361 redef fun html_info
(page
) do
1362 var res
= new Buffer
1363 res
.append
("<div class='info'>")
1364 if mproperty
.visibility
<= none_visibility
then
1365 res
.append
("private ")
1366 else if mproperty
.visibility
<= protected_visibility
then
1367 res
.append
("protected ")
1369 if mproperty
.intro_mclassdef
.mclass
!= page
.mclass
then res
.append
("redef ")
1370 res
.append
("fun {mproperty.html_namespace(page.mbuilder)}")
1371 res
.append
("</div>")
1372 res
.append
("<div style=\"float
: right
;\
"><a id=\"lblDiffCommit\
"></a></div>")
1377 redef class MVirtualTypeDef
1378 redef fun html_full_desc
(page
) do
1379 var res
= new Buffer
1380 var mprop
= mproperty
1381 var is_redef
= mprop
.intro_mclassdef
.mclass
!= page
.mclass
1382 var classes
= new Array[String]
1384 if is_redef
then classes
.add
("redef")
1385 if mprop
.visibility
== none_visibility
then
1386 classes
.add
("private")
1387 else if mprop
.visibility
== protected_visibility
then
1388 classes
.add
("protected")
1390 classes
.add
("public")
1392 res
.append
("<article class='{classes.join(" ")}' id='{anchor}'>")
1393 res
.append
("<h3 class='signature'>{mprop.name}: {bound.link(page.mbuilder)}</h3>")
1394 res
.append
(html_info
(page
))
1395 res
.append
("<div class='description'>")
1397 if page
.mbuilder
.mpropdef2npropdef
.has_key
(self) and page
.mbuilder
.mpropdef2npropdef
[self].comment
!= "" then
1398 var nprop
= page
.mbuilder
.mpropdef2npropdef
[self]
1399 res
.append
("<pre class=\"text_label\
" title=\"\
" name=\"\
" tag=\"\
" type=\"1\
">{nprop.comment}</pre>")
1401 res
.append
("<a class=\"newComment\
" title=\"32\
" tag=\"\
">New Comment</a>")
1403 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>")
1405 res
.append
("<p class='info'>")
1406 page
.nitdoc
.mainmodule
.linearize_mpropdefs
(mprop
.mpropdefs
)
1407 var previous_defs
= new Array[MVirtualTypeDef]
1408 var next_defs
= new Array[MVirtualTypeDef]
1409 var self_passed
= false
1410 for def
in mprop
.mpropdefs
do
1415 if not self_passed
then
1416 if not page
.mclass
.ancestors
.has
(def
.mclassdef
.mclass
) then continue
1417 if def
.is_intro
then continue
1418 previous_defs
.add
(def
)
1420 if not page
.mclass
.descendants
.has
(def
.mclassdef
.mclass
) then continue
1424 res
.append
("defined by {mclassdef.mmodule.html_full_namespace(page.mbuilder)}")
1425 if not is_intro
then
1426 res
.append
(", introduced by {mprop.intro.mclassdef.mclass.link(page.mbuilder)}")
1428 if not previous_defs
.is_empty
then
1429 res
.append
(", inherited from ")
1430 for i
in [0..previous_defs
.length
[ do
1431 res
.append
(previous_defs
[i
].mclassdef
.mclass
.link
(page
.mbuilder
))
1432 if i
< previous_defs
.length
- 1 then res
.append
(", ")
1435 if not next_defs
.is_empty
then
1436 res
.append
(", redefined by ")
1437 for i
in [0..next_defs
.length
[ do
1438 res
.append
(next_defs
[i
].mclassdef
.mclass
.link
(page
.mbuilder
))
1439 if i
< next_defs
.length
- 1 then res
.append
(", ")
1443 res
.append
("</div>")
1444 res
.append
("</article>")
1448 redef fun html_info
(page
) do
1449 var res
= new Buffer
1450 res
.append
("<div class='info'>")
1451 if mproperty
.intro_mclassdef
.mclass
!= page
.mclass
then res
.append
("redef ")
1452 res
.append
("type {mproperty.html_namespace(page.mbuilder)}")
1453 res
.append
("</div>")
1454 res
.append
("<div style=\"float
: right
;\
"><a id=\"lblDiffCommit\
"></a></div>")
1464 private fun comment
: String do
1465 var ret
= new Buffer
1466 if n_moduledecl
is null or n_moduledecl
.n_doc
is null then ret
1467 if n_moduledecl
.n_doc
is null then return ""
1468 for t
in n_moduledecl
.n_doc
.n_comment
do
1469 ret
.append
(t
.text
.substring_from
(1))
1471 return ret
.to_s
.html_escape
1474 private fun short_comment
: String do
1475 var ret
= new Buffer
1476 if n_moduledecl
!= null and n_moduledecl
.n_doc
!= null then
1477 ret
.append
(n_moduledecl
.n_doc
.n_comment
.first
.text
.substring_from
(2).replace
("\n", ""))
1479 return ret
.to_s
.html_escape
1483 redef class AStdClassdef
1484 private fun comment
: String do
1485 var ret
= new Buffer
1486 if n_doc
!= null then
1487 for t
in n_doc
.n_comment
do ret
.append
(t
.text
.substring_from
(1))
1489 return ret
.to_s
.html_escape
1492 private fun short_comment
: String do
1493 var ret
= new Buffer
1494 if n_doc
!= null then ret
.append
(n_doc
.n_comment
.first
.text
.substring_from
(2).replace
("\n", ""))
1495 return ret
.to_s
.html_escape
1499 redef class APropdef
1500 private fun short_comment
: String is abstract
1501 private fun html_signature
(mbuilder
: ModelBuilder): String is abstract
1502 private fun comment
: String is abstract
1505 redef class AAttrPropdef
1506 redef fun short_comment
do
1507 var ret
= new Buffer
1508 if n_doc
!= null then ret
.append
(n_doc
.n_comment
.first
.text
.substring_from
(2).replace
("\n", ""))
1509 return ret
.to_s
.html_escape
1512 redef private fun comment
: String do
1513 var ret
= new Buffer
1514 if n_doc
!= null then
1515 for t
in n_doc
.n_comment
do ret
.append
(t
.text
.substring_from
(1))
1517 return ret
.to_s
.html_escape
1520 redef fun html_signature
(mbuilder
) do
1521 if n_type
!= null then return n_type
.mtype
.link
(mbuilder
)
1526 redef class AMethPropdef
1527 redef fun short_comment
do
1528 var ret
= new Buffer
1529 if n_doc
!= null then ret
.append
(n_doc
.n_comment
.first
.text
.substring_from
(2).replace
("\n", ""))
1530 return ret
.to_s
.html_escape
1533 redef private fun comment
: String do
1534 var ret
= new Buffer
1535 if n_doc
!= null then
1536 for t
in n_doc
.n_comment
do ret
.append
(t
.text
.substring_from
(1))
1538 return ret
.to_s
.html_escape
1541 redef fun html_signature
(mbuilder
) do
1542 if n_signature
!= null then return n_signature
.to_html
(mbuilder
)
1547 redef class ATypePropdef
1548 redef fun short_comment
do
1549 var ret
= new Buffer
1550 if n_doc
!= null then ret
.append
(n_doc
.n_comment
.first
.text
.substring_from
(2).replace
("\n", ""))
1551 return ret
.to_s
.html_escape
1554 redef private fun comment
: String do
1555 var ret
= new Buffer
1556 if n_doc
!= null then
1557 for t
in n_doc
.n_comment
do ret
.append
(t
.text
.substring_from
(1))
1559 return ret
.to_s
.html_escape
1562 redef fun html_signature
(mbuilder
) do
1563 return mpropdef
.bound
.link
(mbuilder
)
1567 redef class ASignature
1568 fun to_html
(mbuilder
: ModelBuilder): String do
1570 var res
= new Buffer
1571 if not n_params
.is_empty
then
1573 for i
in [0..n_params
.length
[ do
1574 res
.append
(n_params
[i
].to_html
(mbuilder
))
1575 if i
< n_params
.length
- 1 then res
.append
(", ")
1579 if n_type
!= null and n_type
.mtype
.link
(mbuilder
) != "" then res
.append
(": {n_type.mtype.link(mbuilder)}")
1585 fun to_html
(mbuilder
: ModelBuilder): String do
1586 var ret
= "{n_id.text}"
1587 if n_type
!= null then
1588 ret
= "{ret}: {n_type.mtype.link(mbuilder)}"
1589 if n_dotdotdot
!= null then ret
= "{ret}..."
1595 # Create a tool context to handle options and paths
1596 var toolcontext
= new ToolContext
1598 # Here we launch the nit index
1599 var nitdoc
= new Nitdoc(toolcontext
)