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
22 # The NitdocContext contains all the knowledge used for doc generation
26 private var model
: Model
27 private var mbuilder
: ModelBuilder
28 private var mainmodule
: MModule
29 private var class_hierarchy
: POSet[MClass]
30 private var arguments
: Array[String]
31 private var output_dir
: nullable String
32 private var dot_dir
: nullable String
33 private var share_dir
: nullable String
34 private var source
: nullable String
35 private var min_visibility
: MVisibility
37 private var opt_dir
= new OptionString("Directory where doc is generated", "-d", "--dir")
38 private var opt_source
= new OptionString("What link for source (%f for filename, %l for first line, %L for last line)", "--source")
39 private var opt_sharedir
= new OptionString("Directory containing the nitdoc files", "--sharedir")
40 private var opt_nodot
= new OptionBool("Do not generate graphes with graphiviz", "--no-dot")
41 private var opt_private
: OptionBool = new OptionBool("Generate the private API", "--private")
43 private var opt_custom_title
: OptionString = new OptionString("Title displayed in the top of the Overview page and as suffix of all page names", "--custom-title")
44 private var opt_custom_menu_items
: OptionString = new OptionString("Items displayed in menu before the 'Overview' item (Each item must be enclosed in 'li' tags)", "--custom-menu-items")
45 private var opt_custom_overview_text
: OptionString = new OptionString("Text displayed as introduction of Overview page before the modules list", "--custom-overview-text")
46 private var opt_custom_footer_text
: OptionString = new OptionString("Text displayed as footer of all pages", "--custom-footer-text")
50 self.arguments
= option_context
.rest
51 option_context
.options
.clear
52 option_context
.add_option
(opt_dir
)
53 option_context
.add_option
(opt_source
)
54 option_context
.add_option
(opt_sharedir
)
55 option_context
.add_option
(opt_nodot
)
56 option_context
.add_option
(opt_private
)
57 option_context
.add_option
(opt_custom_title
)
58 option_context
.add_option
(opt_custom_footer_text
)
59 option_context
.add_option
(opt_custom_overview_text
)
60 option_context
.add_option
(opt_custom_menu_items
)
63 if arguments
.length
< 1 then
69 mbuilder
= new ModelBuilder(model
, self)
70 # Here we load an process all modules passed on the command line
71 var mmodules
= mbuilder
.parse_and_build
(arguments
)
72 mbuilder
.full_propdef_semantic_analysis
73 if mmodules
.is_empty
then return
75 if mmodules
.length
== 1 then
76 mainmodule
= mmodules
.first
78 # We need a main module, so we build it by importing all modules
79 mainmodule
= new MModule(model
, null, "<main>", new Location(null, 0, 0, 0, 0))
80 mainmodule
.set_imported_mmodules
(mmodules
)
82 self.class_hierarchy
= mainmodule
.flatten_mclass_hierarchy
85 redef fun process_options
do
87 if not opt_dir
.value
is null then
88 output_dir
= opt_dir
.value
92 if not opt_sharedir
.value
is null then
93 share_dir
= opt_sharedir
.value
95 var dir
= "NIT_DIR".environ
97 dir
= "{sys.program_name.dirname}/../share/nitdoc"
99 dir
= "{dir}/share/nitdoc"
102 if share_dir
is null then
103 print
"Error: Cannot locate nitdoc share files. Uses --sharedir or envvar NIT_DIR"
106 dir
= "{share_dir.to_s}/scripts/js-facilities.js"
107 if share_dir
is null then
108 print
"Error: Invalid nitdoc share files. Check --sharedir or envvar NIT_DIR"
112 if opt_private
.value
then
113 min_visibility
= none_visibility
115 min_visibility
= protected_visibility
118 source
= opt_source
.value
121 fun generate_nitdoc
do
122 # Create destination dir if it's necessary
123 if not output_dir
.file_exists
then output_dir
.mkdir
124 sys
.system
("cp -r {share_dir.to_s}/* {output_dir.to_s}/")
126 if not opt_nodot
.value
then self.dot_dir
= output_dir
.to_s
134 private fun overview
do
135 var overviewpage
= new NitdocOverview(self, dot_dir
)
136 overviewpage
.save
("{output_dir.to_s}/index.html")
139 private fun fullindex
do
140 var fullindex
= new NitdocFullindex(self)
141 fullindex
.save
("{output_dir.to_s}/full-index.html")
144 private fun modules
do
145 for mmodule
in model
.mmodules
do
146 if mmodule
.name
== "<main>" then continue
147 var modulepage
= new NitdocModule(mmodule
, self, dot_dir
)
148 modulepage
.save
("{output_dir.to_s}/{mmodule.url}")
152 private fun classes
do
153 for mclass
in mbuilder
.model
.mclasses
do
154 var classpage
= new NitdocClass(mclass
, self, dot_dir
, source
)
155 classpage
.save
("{output_dir.to_s}/{mclass.url}")
159 private fun quicksearch_list
do
160 var file
= new OFStream.open
("{output_dir.to_s}/quicksearch-list.js")
161 var content
= new Buffer
162 content
.append
("var entries = \{ ")
164 for mmodule
in model
.mmodules
do
165 content
.append
("\"{mmodule.name}\
": [")
166 content
.append
("\{txt: \"{mmodule.name}\", url
:\
"{mmodule.url}\" \
},")
169 for mclass in model.mclasses do
170 if mclass.visibility < min_visibility then continue
171 content.append("\
"{mclass.name}\": [")
172 content.append("\
{txt: \"{mclass.name}\
", url:\"{mclass.url}\
" \},")
175 var name2mprops
= new HashMap[String, Set[MPropDef]]
176 for mproperty
in model
.mproperties
do
177 if mproperty
.visibility
< min_visibility
then continue
178 if mproperty
isa MAttribute then continue
179 if not name2mprops
.has_key
(mproperty
.name
) then name2mprops
[mproperty
.name
] = new HashSet[MPropDef]
180 name2mprops
[mproperty
.name
].add_all
(mproperty
.mpropdefs
)
182 for mproperty
, mpropdefs
in name2mprops
do
183 content
.append
("\"{mproperty}\
": [")
184 for mpropdef
in mpropdefs
do
185 content
.append
("\{txt: \"{mpropdef.full_name}\", url
:\
"{mpropdef.url}\" \
},")
190 content.append(" \
};")
191 file.write(content.to_s)
198 abstract class NitdocPage
201 var dot_dir: nullable String
202 var source: nullable String
203 var ctx: NitdocContext
205 init(ctx: NitdocContext) do
210 protected fun head do
211 append("<meta charset
='utf-8'/>")
212 append("<script
type='text/javascript' src
='scripts/jquery-1.7.1.min.js'></script
>")
213 append("<script
type='text/javascript' src
='quicksearch-list.js'></script
>")
214 append("<script
type='text/javascript' src
='scripts/js-facilities.js'></script
>")
215 append("<link rel
='stylesheet' href
='styles/main.css' type='text/css' media
='screen'/>")
217 if ctx.opt_custom_title.value != null then
218 title = " | {ctx.opt_custom_title.value.to_s}"
220 append("<title
>{self.title}{title}</title
>")
223 protected fun menu do
224 if ctx.opt_custom_menu_items.value != null then
225 append(ctx.opt_custom_menu_items.value.to_s)
229 protected fun title: String is abstract
231 protected fun header do
233 append("<nav
class='main'>")
236 append("<li id
='liGitHub'>")
237 append("<a
class='btn' id
='logGitHub'>")
238 append("<img id
='imgGitHub' src
='resources/icons/github-icon.png' alt
='GitHub'/>")
240 append("<div
class='popover bottom'>")
241 append("<div
class='arrow'> 
;</div
>")
242 append("<div
class='githubTitle'>")
243 append("<h3
>Github Sign In</h3
>")
246 append("<label id
='lbloginGit'>Username</label>")
247 append("<input id
='loginGit' name
='login' type='text'/>")
248 append("<label id
='logginMessage'>Hello ")
249 append("<a id
='githubAccount'><strong id
='nickName'></strong
></a
>")
253 append("<label id
='lbpasswordGit'>Password</label>")
254 append("<input id
='passwordGit' name
='password' type='password'/>")
255 append("<div id
='listBranches'>")
256 append("<label id
='lbBranches'>Branch</label>")
257 append("<select
class='dropdown' id
='dropBranches' name
='dropBranches' tabindex
='1'></select
>")
261 append("<label id
='lbrepositoryGit'>Repository</label>")
262 append("<input id
='repositoryGit' name
='repository' type='text'/>")
265 append("<label id
='lbbranchGit'>Branch</label>")
266 append("<input id
='branchGit' name
='branch' type='text'/>")
269 append("<a id
='signIn'>Sign In</a
>")
278 protected fun content is abstract
280 protected fun footer do
281 if ctx.opt_custom_footer_text.value != null then
282 append("<footer
>{ctx.opt_custom_footer_text.value.to_s}</footer
>")
286 # Generate a clickable graphviz image using a dot content
287 protected fun generate_dot(dot: String, name: String, alt: String) do
288 var output_dir = dot_dir
289 if output_dir == null then return
290 var file = new OFStream.open("{output_dir}/{name}.dot
")
293 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
; \
}")
294 append("<article
class='graph'>")
295 append("<img src
='{name}.png' usemap
='#{name}' style
='margin:auto' alt
='{alt}'/>")
297 var fmap = new IFStream.open("{output_dir}/{name}.map
")
298 append(fmap.read_all)
302 # Add a (source) link for a given location
303 protected fun show_source(l: Location): String
305 if source == null then
306 return "({l.file.filename.simplify_path})"
308 # THIS IS JUST UGLY ! (but there is no replace yet)
309 var x = source.split_with("%f
")
310 source = x.join(l.file.filename.simplify_path)
311 x = source.split_with("%l
")
312 source = x.join(l.line_start.to_s)
313 x = source.split_with("%L
")
314 source = x.join(l.line_end.to_s)
315 return " (<a href
=\
"{source.to_s}\">source
</a
>)"
319 # Render the page as a html string
320 fun render: String do
321 append("<!DOCTYPE html
>")
327 append("<div
class='page'>")
335 # Save html page in the specified file
336 fun save(file: String) do
337 var out = new OFStream.open(file)
346 private var mbuilder: ModelBuilder
347 private var mmodules = new Array[MModule]
349 init(ctx: NitdocContext, dot_dir: nullable String) do
351 self.mbuilder = ctx.mbuilder
352 self.dot_dir = dot_dir
354 var mmodules = new HashSet[MModule]
355 for mmodule in mbuilder.model.mmodules do
356 if mmodule.name == "<main
>" then continue
357 var owner = mmodule.public_owner
358 if owner != null then
361 mmodules.add(mmodule)
365 var sorter = new ComparableSorter[MModule]
366 self.mmodules.add_all(mmodules)
367 sorter.sort(self.mmodules)
370 redef fun title do return "Overview"
374 append("<li
class='current'>Overview</li
>")
375 append("<li
><a href
='full-index.html'>Full Index</a
></li
>")
379 append("<div
class='content fullpage'>")
380 var title = "Overview"
381 if ctx.opt_custom_title.value != null then
382 title = ctx.opt_custom_title.value.to_s
384 append("<h1
>{title}</h1
>")
386 if ctx.opt_custom_overview_text.value != null then
387 text = ctx.opt_custom_overview_text.value.to_s
389 append("<article
class='overview'>{text}</article
>")
390 append("<article
class='overview'>")
392 append("<h2
>Modules</h2
>")
394 for mmodule in mmodules do
395 if mbuilder.mmodule2nmodule.has_key(mmodule) then
396 var amodule = mbuilder.mmodule2nmodule[mmodule]
398 mmodule.html_link(self)
399 append(" 
;{amodule.short_comment}</li
>")
409 private fun process_generate_dot do
411 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
")
412 for mmodule in mmodules do
413 op.append("\
"{mmodule.name}\"[URL=\
"{mmodule.url}\"];\n
")
414 for imported in mmodule.in_importation.direct_greaters do
415 if imported.direct_owner == null then
416 op.append("\
"{mmodule.name}\"->\
"{imported.name}\";\n
")
421 generate_dot(op.to_s, "dep
", "Modules hierarchy
")
425 # The full index page
426 class NitdocFullindex
429 init(ctx: NitdocContext) do
434 redef fun title do return "Full Index"
438 append("<li
><a href
='index.html'>Overview</a
></li
>")
439 append("<li
class='current'>Full Index</li
>")
443 append("<div
class='content fullpage'>")
444 append("<h1
>Full Index</h1
>")
451 # Add to content modules column
452 private fun module_column do
453 var sorted = ctx.mbuilder.model.mmodule_importation_hierarchy.to_a
454 var sorter = new ComparableSorter[MModule]
456 append("<article
class='modules filterable'>")
457 append("<h2
>Modules</h2
>")
459 for mmodule in sorted do
461 mmodule.html_link(self)
468 # Add to content classes modules
469 private fun classes_column do
470 var sorted = ctx.mbuilder.model.mclasses
471 var sorter = new ComparableSorter[MClass]
473 append("<article
class='modules filterable'>")
474 append("<h2
>Classes</h2
>")
476 for mclass in sorted do
477 if mclass.visibility < ctx.min_visibility then continue
479 mclass.html_link(self)
486 # Insert the properties column of fullindex page
487 private fun properties_column do
488 var sorted = ctx.mbuilder.model.mproperties
489 var sorter = new ComparableSorter[MProperty]
491 append("<article
class='modules filterable'>")
492 append("<h2
>Properties</h2
>")
494 for mproperty in sorted do
495 if mproperty.visibility < ctx.min_visibility then continue
496 if mproperty isa MAttribute then continue
498 mproperty.intro.html_link(self)
500 mproperty.intro.mclassdef.mclass.html_link(self)
513 private var mmodule: MModule
514 private var mbuilder: ModelBuilder
516 init(mmodule: MModule, ctx: NitdocContext, dot_dir: nullable String) do
518 self.mmodule = mmodule
519 self.mbuilder = ctx.mbuilder
520 self.dot_dir = dot_dir
524 if mbuilder.mmodule2nmodule.has_key(mmodule) then
525 var nmodule = mbuilder.mmodule2nmodule[mmodule]
526 return "{mmodule.name} module | {nmodule.short_comment}"
528 return "{mmodule.name} module"
534 append("<li
><a href
='index.html'>Overview</a
></li
>")
535 append("<li
class='current'>{mmodule.name}</li
>")
536 append("<li
><a href
='full-index.html'>Full Index</a
></li
>")
541 append("<div
class='content'>")
542 append("<h1
>{mmodule.name}</h1
>")
543 append("<div
class='subtitle'>")
544 mmodule.html_signature(self)
546 mmodule.html_full_comment(self)
553 private fun process_generate_dot do
554 var name = "dep_
{mmodule.name}"
556 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
")
557 for m in mmodule.in_importation.poset do
558 if m.name == "<main
>" then continue
559 var public_owner = m.public_owner
560 if public_owner == null then
563 op.append("\
"{m.name}\"[shape
=box
,margin
=0.03];\n
")
565 op.append("\
"{m.name}\"[URL=\
"{m.url}\"];\n
")
568 for imported in m.in_importation.direct_greaters do
569 if imported.name == "<main
>" then continue
570 if imported.public_owner == null then
571 op.append("\
"{public_owner.name}\"->\
"{imported.name}\";\n
")
576 generate_dot(op.to_s, name, "Dependency graph
for module {mmodule.name}")
579 private fun sidebar do
580 append("<div
class='menu'>")
582 append("<h3
>Module Hierarchy</h3
>")
583 var dependencies = new Array[MModule]
584 for dep in mmodule.in_importation.greaters do
585 if dep == mmodule or dep.public_owner != null then continue
586 dependencies.add(dep)
588 if dependencies.length > 0 then
589 append("<h4
>All dependencies
</h4
>")
590 display_module_list(dependencies)
592 var clients = new Array[MModule]
593 for dep in mmodule.in_importation.smallers do
594 if dep == mmodule or dep.public_owner != null then continue
597 if clients.length > 0 then
598 append("<h4
>All clients
</h4
>")
599 display_module_list(clients)
602 if mmodule.in_nesting.direct_greaters.length > 0 then
604 append("<h3
>Nested Modules</h3
>")
605 display_module_list(mmodule.in_nesting.direct_greaters.to_a)
611 private fun display_module_list(list: Array[MModule]) do
613 var sorter = new ComparableSorter[MModule]
623 # display the class column
624 private fun classes do
625 var intro_mclasses = mmodule.intro_mclasses
626 var redef_mclasses = mmodule.redef_mclasses
627 var all_mclasses = new HashSet[MClass]
628 for m in mmodule.in_nesting.greaters do
629 all_mclasses.add_all(m.intro_mclasses)
630 all_mclasses.add_all(m.redef_mclasses)
632 all_mclasses.add_all(intro_mclasses)
633 all_mclasses.add_all(redef_mclasses)
635 var sorted = new Array[MClass]
636 sorted.add_all(all_mclasses)
637 var sorter = new ComparableSorter[MClass]
639 append("<div
class='module'>")
640 append("<article
class='classes filterable'>")
641 append("<h2
>Classes</h2
>")
644 if c.visibility < ctx.min_visibility then continue
645 if redef_mclasses.has(c) and c.intro_mmodule.public_owner != mmodule then
646 append("<li
class='redef'>")
647 append("<span title
='refined in this module'>R
</span
>")
649 append("<li
class='intro'>")
650 append("<span title
='introduced in this module'>I
</span
>")
660 # display the property column
661 private fun properties do
663 var mpropdefs = new HashSet[MPropDef]
664 for m in mmodule.in_nesting.greaters do
665 for c in m.mclassdefs do mpropdefs.add_all(c.mpropdefs)
667 for c in mmodule.mclassdefs do mpropdefs.add_all(c.mpropdefs)
668 var sorted = mpropdefs.to_a
669 var sorter = new ComparableSorter[MPropDef]
671 # display properties in one column
672 append("<article
class='properties filterable'>")
673 append("<h2
>Properties</h2
>")
675 for mprop in sorted do
676 if mprop isa MAttributeDef then continue
677 if mprop.mproperty.visibility < ctx.min_visibility then continue
678 mprop.html_list_item(self)
689 private var mclass: MClass
690 private var vtypes = new HashSet[MVirtualTypeDef]
691 private var consts = new HashSet[MMethodDef]
692 private var meths = new HashSet[MMethodDef]
693 private var inherited = new HashSet[MPropDef]
695 init(mclass: MClass, ctx: NitdocContext, dot_dir: nullable String, source: nullable String) do
698 self.dot_dir = dot_dir
701 for mclassdef in mclass.mclassdefs do
702 for mpropdef in mclassdef.mpropdefs do
703 if mpropdef.mproperty.visibility < ctx.min_visibility then continue
704 if mpropdef isa MVirtualTypeDef then vtypes.add(mpropdef)
705 if mpropdef isa MMethodDef then
706 if mpropdef.mproperty.is_init then
714 # get inherited properties
715 for mprop in mclass.inherited_mproperties do
716 var mpropdef = mprop.intro
717 if mprop.visibility < ctx.min_visibility then continue
718 if mpropdef isa MVirtualTypeDef then vtypes.add(mpropdef)
719 if mpropdef isa MMethodDef then
720 if mpropdef.mproperty.is_init then
726 inherited.add(mpropdef)
731 var nclass = ctx.mbuilder.mclassdef2nclassdef[mclass.intro]
732 if nclass isa AStdClassdef then
733 return "{mclass.name} class | {nclass.short_comment}"
735 return "{mclass.name} class"
741 append("<li
><a href
='index.html'>Overview</a
></li
>")
742 var public_owner = mclass.public_owner
743 if public_owner is null then
745 mclass.intro_mmodule.html_link(self)
749 public_owner.html_link(self)
752 append("<li
class='current'>{mclass.name}</li
>")
753 append("<li
><a href
='full-index.html'>Full Index</a
></li
>")
757 append("<div
class='menu'>")
761 append("<div
class='content'>")
766 private fun properties_column do
767 var sorter = new ComparableSorter[MPropDef]
768 append("<nav
class='properties filterable'>")
769 append("<h3
>Properties</h3
>")
771 if vtypes.length > 0 then
772 var vts = new Array[MVirtualTypeDef]
775 append("<h4
>Virtual Types</h4
>")
778 mprop.html_sidebar_item(self)
783 if consts.length > 0 then
784 var cts = new Array[MMethodDef]
787 append("<h4
>Constructors</h4
>")
790 mprop.html_sidebar_item(self)
795 if meths.length > 0 then
796 var mts = new Array[MMethodDef]
799 append("<h4
>Methods</h4
>")
802 if mclass.name != "Object" and mprop.mproperty.intro_mclassdef.mclass.name == "Object" and mprop.mproperty.visibility <= protected_visibility then continue
803 mprop.html_sidebar_item(self)
810 private fun inheritance_column do
811 var sorted = new Array[MClass]
812 var sorterp = new ComparableSorter[MClass]
814 append("<h3
>Inheritance</h3
>")
815 var greaters = mclass.in_hierarchy(ctx.mainmodule).greaters.to_a
816 if greaters.length > 1 then
817 ctx.mainmodule.linearize_mclasses(greaters)
818 append("<h4
>Superclasses</h4
>")
820 for sup in greaters do
821 if sup == mclass then continue
828 var smallers = mclass.in_hierarchy(ctx.mainmodule).smallers.to_a
829 var direct_smallers = mclass.in_hierarchy(ctx.mainmodule).direct_smallers.to_a
830 if smallers.length <= 1 then
831 append("<h4
>No Known Subclasses</h4
>")
832 else if smallers.length <= 100 then
833 ctx.mainmodule.linearize_mclasses(smallers)
834 append("<h4
>Subclasses</h4
>")
836 for sub in smallers do
837 if sub == mclass then continue
843 else if direct_smallers.length <= 100 then
844 ctx.mainmodule.linearize_mclasses(direct_smallers)
845 append("<h4
>Direct Subclasses Only</h4
>")
847 for sub in direct_smallers do
848 if sub == mclass then continue
855 append("<h4
>Too much
Subclasses to list
</h4
>")
860 private fun class_doc do
862 append("<h1
>{mclass.signature}</h1
>")
863 append("<div
class='subtitle info'>")
864 mclass.html_full_signature(self)
867 var nclass = ctx.mbuilder.mclassdef2nclassdef[mclass.intro]
868 append("<div style
=\
"float: right;\"><a id
=\
"lblDiffCommit\"></a
></div
>")
869 append("<section
class='description'>")
870 if nclass isa AStdClassdef and not nclass.full_comment.is_empty then append("<pre
class=\
"text_label\" title
=\
"122\" name
=\
"\" tag
=\
"{mclass.mclassdefs.first.location.to_s}\" type=\
"2\">{nclass.full_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
>")
874 var concern2meths = new ArrayMap[MModule, Array[MMethodDef]]
875 var sorted_meths = new Array[MMethodDef]
876 var sorted = new Array[MModule]
877 sorted_meths.add_all(meths)
878 ctx.mainmodule.linearize_mpropdefs(sorted_meths)
880 if inherited.has(meth) then continue
881 var mmodule = meth.mclassdef.mmodule
882 if not concern2meths.has_key(mmodule) then
884 concern2meths[mmodule] = new Array[MMethodDef]
886 concern2meths[mmodule].add(meth)
888 var sections = new ArrayMap[MModule, Array[MModule]]
889 for mmodule in concern2meths.keys do
890 var owner = mmodule.public_owner
891 if owner == null then owner = mmodule
892 if not sections.has_key(owner) then sections[owner] = new Array[MModule]
893 if owner != mmodule then sections[owner].add(mmodule)
895 append("<section
class='concerns'>")
896 append("<h2
class='section-header'>Concerns</h2
>")
898 for owner, mmodules in sections do
899 var nowner = ctx.mbuilder.mmodule2nmodule[owner]
901 if nowner.short_comment.is_empty then
902 append("<a href
=\
"#{owner.anchor}\">{owner.name}</a
>")
904 append("<a href
=\
"#{owner.anchor}\">{owner.name}</a
>: {nowner.short_comment}")
906 if not mmodules.is_empty then
908 for mmodule in mmodules do
909 var nmodule = ctx.mbuilder.mmodule2nmodule[mmodule]
910 if nmodule.short_comment.is_empty then
911 append("<li
><a href
=\
"#{mmodule.anchor}\">{mmodule.name}</a
></li
>")
913 append("<li
><a href
=\
"#{mmodule.anchor}\">{mmodule.name}</a
>: {nmodule.short_comment}</li
>")
923 var prop_sorter = new ComparableSorter[MPropDef]
924 var sorterprop = new ComparableSorter[MProperty]
925 var sorterc = new ComparableSorter[MClass]
926 var lmmodule = new List[MModule]
927 # virtual and formal types
928 var local_vtypes = new Array[MVirtualTypeDef]
929 for vt in vtypes do if not inherited.has(vt) then local_vtypes.add(vt)
930 if local_vtypes.length > 0 or mclass.arity > 0 then
931 append("<section
class='types'>")
932 append("<h2
>Formal and Virtual Types</h2
>")
934 if mclass.arity > 0 and nclass isa AStdClassdef then
935 for ft, bound in mclass.parameter_types do
936 append("<article id
='FT_{ft}'>")
937 append("<h3
class='signature'>{ft}: ")
938 bound.html_link(self)
940 append("<div
class=\
"info\">formal generic
type</div
>")
945 prop_sorter.sort(local_vtypes)
946 for prop in local_vtypes do prop.html_full_desc(self)
950 var local_consts = new Array[MMethodDef]
951 for const in consts do if not inherited.has(const) then local_consts.add(const)
952 prop_sorter.sort(local_consts)
953 if local_consts.length > 0 then
954 append("<section
class='constructors'>")
955 append("<h2
class='section-header'>Constructors</h2
>")
956 for prop in local_consts do prop.html_full_desc(self)
960 if not concern2meths.is_empty then
961 append("<section
class='methods'>")
962 append("<h2
class='section-header'>Methods</h2
>")
963 for owner, mmodules in sections do
964 append("<a id
=\
"{owner.anchor}\"></a
>")
965 if owner != mclass.intro_mmodule and owner != mclass.public_owner then
966 var nowner = ctx.mbuilder.mmodule2nmodule[owner]
967 append("<h3
class=\
"concern-toplevel\">Methods refined
in ")
968 owner.html_link(self)
970 append("<p
class=\
"concern-doc\">")
971 owner.html_link(self)
972 if not nowner.short_comment.is_empty then
973 append(": {nowner.short_comment}")
977 if concern2meths.has_key(owner) then
978 var mmethods = concern2meths[owner]
979 prop_sorter.sort(mmethods)
980 for prop in mmethods do prop.html_full_desc(self)
982 for mmodule in mmodules do
983 append("<a id
=\
"{mmodule.anchor}\"></a
>")
984 var nmodule = ctx.mbuilder.mmodule2nmodule[mmodule]
985 if mmodule != mclass.intro_mmodule and mmodule != mclass.public_owner then
986 append("<p
class=\
"concern-doc\">")
987 mmodule.html_link(self)
988 if not nmodule.short_comment.is_empty then
989 append(": {nmodule.short_comment}")
993 var mmethods = concern2meths[mmodule]
994 prop_sorter.sort(mmethods)
995 for prop in mmethods do prop.html_full_desc(self)
999 # inherited properties
1000 if inherited.length > 0 then
1001 var sorted_inherited = new Array[MPropDef]
1002 sorted_inherited.add_all(inherited)
1003 ctx.mainmodule.linearize_mpropdefs(sorted_inherited)
1004 var classes = new ArrayMap[MClass, Array[MPropDef]]
1005 for mmethod in sorted_inherited.reversed do
1006 var mclass = mmethod.mclassdef.mclass
1007 if not classes.has_key(mclass) then classes[mclass] = new Array[MPropDef]
1008 classes[mclass].add(mmethod)
1010 append("<h3
>Inherited Properties</h3
>")
1011 for c, mmethods in classes do
1012 prop_sorter.sort(mmethods)
1013 append("<p
>Defined in ")
1016 for i in [0..mmethods.length[ do
1017 var mmethod = mmethods[i]
1018 mmethod.html_link(self)
1019 if i <= mmethods.length - 1 then append(", ")
1024 append("</section
>")
1027 private fun process_generate_dot do
1028 var pe = ctx.class_hierarchy[mclass]
1029 var cla = new HashSet[MClass]
1030 var sm = new HashSet[MClass]
1031 var sm2 = new HashSet[MClass]
1033 while cla.length + sm.length < 10 and sm.length > 0 do
1037 sm2.add_all(pe.poset[x].direct_smallers)
1043 cla.add_all(pe.greaters)
1046 var name = "dep_
{mclass.name}"
1047 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
")
1050 op.append("\
"{c.name}\"[shape
=box
,margin
=0.03];\n
")
1052 op.append("\
"{c.name}\"[URL=\
"{c.url}\"];\n
")
1054 for c2 in pe.poset[c].direct_greaters do
1055 if not cla.has(c2) then continue
1056 op.append("\
"{c.name}\"->\
"{c2.name}\";\n
")
1058 if not pe.poset[c].direct_smallers.is_empty then
1060 for c2 in pe.poset[c].direct_smallers do
1061 if cla.has(c2) then others = false
1064 op.append("\
"{c.name}...\"[label=\
"\"];\n
")
1065 op.append("\
"{c.name}...\"->\
"{c.name}\"[style
=dotted
];\n
")
1070 generate_dot(op.to_s, name, "Dependency graph
for class {mclass.name}")
1080 redef type OTHER: MModule
1081 redef fun <(other: OTHER): Bool do return self.name < other.name
1083 # Get the list of all methods in a module
1084 fun imported_methods: Set[MMethod] do
1085 var methods = new HashSet[MMethod]
1086 for mclass in imported_mclasses do
1087 for method in mclass.intro_methods do
1094 # Get the list aof all refined methods in a module
1095 fun redef_methods: Set[MMethod] do
1096 var methods = new HashSet[MMethod]
1097 for mclass in redef_mclasses do
1098 for method in mclass.intro_methods do
1105 # URL to nitdoc page
1107 var res = new Buffer
1108 res.append("module_
")
1109 var mowner = public_owner
1110 if mowner != null then
1111 res.append("{public_owner.name}_
")
1113 res.append("{self.name}.html
")
1117 # html anchor id to the module in a nitdoc page
1118 fun anchor: String do
1119 var res = new Buffer
1121 var mowner = public_owner
1122 if mowner != null then
1123 res.append("{public_owner.name}_
")
1125 res.append(self.name)
1129 # Return a link (html a tag) to the nitdoc module page
1130 fun html_link(page: NitdocPage) do
1131 if page.ctx.mbuilder.mmodule2nmodule.has_key(self) then
1132 page.append("<a href
='{url}' title
='{page.ctx.mbuilder.mmodule2nmodule[self].short_comment}'>{name}</a
>")
1134 page.append("<a href
='{url}'>{name}</a
>")
1138 # Return the module signature decorated with html
1139 fun html_signature(page: NitdocPage) do
1140 page.append("<span
>module ")
1141 html_full_namespace(page)
1142 page.append("</span
>")
1145 # Return the module full namespace decorated with html
1146 fun html_full_namespace(page: NitdocPage) do
1147 page.append("<span
>")
1148 var mowner = public_owner
1149 if mowner != null then
1150 public_owner.html_namespace(page)
1154 page.append("</span
>")
1157 # Return the module full namespace decorated with html
1158 fun html_namespace(page: NitdocPage) do
1159 page.append("<span
>")
1160 var mowner = public_owner
1161 if mowner != null then
1162 public_owner.html_namespace(page)
1166 page.append("</span
>")
1169 # Return the full comment of the module decorated with html
1170 fun html_full_comment(page: NitdocPage) do
1171 if page.ctx.mbuilder.mmodule2nmodule.has_key(self) then
1172 page.append("<div id
='description'>")
1173 page.append("<pre
class='text_label'>{page.ctx.mbuilder.mmodule2nmodule[self].full_comment}</pre
>")
1174 page.append("<textarea
class='edit' rows
='1' cols
='76' id
='fileContent'></textarea
>")
1175 page.append("<a id
='cancelBtn'>Cancel</a
>")
1176 page.append("<a id
='commitBtn'>Commit</a
>")
1177 page.append("<pre
class='text_label' id
='preSave' type='2'></pre
>")
1178 page.append("</div
>")
1185 redef type OTHER: MClass
1186 redef fun <(other: OTHER): Bool do return self.name < other.name
1188 # Return the module signature decorated with html
1189 fun html_full_signature(page: NitdocPage) do
1190 if visibility < public_visibility then page.append("{visibility.to_s} ")
1191 page.append("{kind} ")
1192 html_namespace(page)
1195 # name with formal parameter
1197 private fun signature: String do
1199 return "{name}[{intro.parameter_names.join(", ")}]"
1205 # Return a link (html a tag) to the nitdoc class page
1206 fun html_link(page: NitdocPage) do
1207 page.append("<a href
='{url}'")
1208 if page.ctx.mbuilder.mclassdef2nclassdef.has_key(intro) then
1209 var nclass = page.ctx.mbuilder.mclassdef2nclassdef[intro]
1210 if nclass isa AStdClassdef then
1211 page.append(" title
=\
"{nclass.short_comment}\"")
1214 page.append(">{signature}</a
>")
1217 # Return the class namespace decorated with html
1218 fun html_namespace(page: NitdocPage) do
1219 intro_mmodule.html_namespace(page)
1220 page.append("::<span
>")
1222 page.append("</span
>")
1226 return "class_
{public_owner}_
{c_name}.html
"
1229 # Escape name for html output
1230 redef fun name do return super.html_escape
1233 redef class MProperty
1235 redef type OTHER: MProperty
1236 redef fun <(other: OTHER): Bool do return self.name < other.name
1238 # Return the property namespace decorated with html
1239 fun html_namespace(page: NitdocPage) do
1240 intro_mclassdef.mclass.html_namespace(page)
1241 page.append("::<span
>")
1242 intro.html_link(page)
1243 page.append("</span
>")
1246 # Escape name for html output
1247 redef fun name do return super.html_escape
1251 fun html_link(page: NitdocPage) is abstract
1254 redef class MClassType
1255 redef fun html_link(page) do mclass.html_link(page)
1258 redef class MNullableType
1259 redef fun html_link(page) do
1260 page.append("nullable ")
1261 mtype.html_link(page)
1265 redef class MGenericType
1266 redef fun html_link(page) do
1267 page.append("<a href
='{mclass.url}'>{mclass.name}</a
>[")
1268 for i in [0..arguments.length[ do
1269 arguments[i].html_link(page)
1270 if i < arguments.length - 1 then page.append(", ")
1276 redef class MParameterType
1277 redef fun html_link(page) do
1278 var name = mclass.intro.parameter_names[rank]
1279 page.append("<a href
='{mclass.url}#FT_{name}' title
='formal type'>{name}</a
>")
1283 redef class MVirtualType
1284 redef fun html_link(page) do mproperty.intro.html_link(page)
1287 redef class MClassDef
1288 # Return the classdef namespace decorated with html
1289 fun html_namespace(page: NitdocPage) do
1290 mmodule.html_full_namespace(page)
1291 page.append("::<span
>")
1292 mclass.html_link(page)
1293 page.append("</span
>")
1297 redef class MPropDef
1299 redef type OTHER: MPropDef
1300 redef fun <(other: OTHER): Bool do return self.mproperty.name < other.mproperty.name
1302 fun url: String do return "{mclassdef.mclass.url}#{anchor}"
1303 fun anchor
: String do return "PROP_{mclassdef.mclass.public_owner.name}_{c_name}"
1305 # Return a link (html a tag) to the nitdoc class page
1306 fun html_link
(page
: NitdocPage) do
1307 if page
.ctx
.mbuilder
.mpropdef2npropdef
.has_key
(self) then
1308 var nprop
= page
.ctx
.mbuilder
.mpropdef2npropdef
[self]
1309 page
.append
("<a href=\"{url}\
" title=\"{nprop.short_comment}\
">{mproperty.name}</a>")
1311 page
.append
("<a href=\"{url}\
">{mproperty.name}</a>")
1315 # Return a list item for the mpropdef
1316 fun html_list_item
(page
: NitdocPage) do
1318 page
.append
("<li class='intro'>")
1319 page
.append
("<span title='introduction'>I</span> ")
1321 page
.append
("<li class='redef'>")
1322 page
.append
("<span title='redefinition'>R</span> ")
1326 mclassdef
.mclass
.html_link
(page
)
1328 page
.append
("</li>")
1331 # Return a list item for the mpropdef
1332 fun html_sidebar_item
(page
: NitdocClass) do
1333 if is_intro
and mclassdef
.mclass
== page
.mclass
then
1334 page
.append
("<li class='intro'>")
1335 page
.append
("<span title='Introduced'>I</span>")
1336 else if is_intro
and mclassdef
.mclass
!= page
.mclass
then
1337 page
.append
("<li class='inherit'>")
1338 page
.append
("<span title='Inherited'>H</span>")
1340 page
.append
("<li class='redef'>")
1341 page
.append
("<span title='Redefined'>R</span>")
1344 page
.append
("</li>")
1347 fun html_full_desc
(page
: NitdocClass) is abstract
1348 fun html_info
(page
: NitdocClass) is abstract
1350 fun full_name
: String do
1351 return "{mclassdef.mclass.public_owner.name}::{mclassdef.mclass.name}::{mproperty.name}"
1354 fun html_inheritance
(page
: NitdocClass) do
1356 page
.append
("<p class='info'>")
1357 page
.ctx
.mainmodule
.linearize_mpropdefs
(mproperty
.mpropdefs
)
1358 var previous_defs
= new Array[MPropDef]
1359 var next_defs
= new Array[MPropDef]
1360 var self_passed
= false
1361 for def
in mproperty
.mpropdefs
do
1366 if not self_passed
then
1367 if def
.mclassdef
.mclass
.in_hierarchy
(page
.ctx
.mainmodule
) < page
.mclass
then continue
1368 if def
.is_intro
then continue
1369 previous_defs
.add
(def
)
1371 if page
.mclass
.in_hierarchy
(page
.ctx
.mainmodule
) < def
.mclassdef
.mclass
then continue
1375 page
.append
("defined by ")
1376 mclassdef
.mmodule
.html_full_namespace
(page
)
1377 if page
.ctx
.mbuilder
.mpropdef2npropdef
.has_key
(self) then
1378 page
.append
(" {page.show_source(page.ctx.mbuilder.mpropdef2npropdef[self].location)}")
1380 if not is_intro
then
1381 page
.append
(", introduced by ")
1382 mproperty
.intro
.mclassdef
.mclass
.html_link
(page
)
1383 if page
.ctx
.mbuilder
.mpropdef2npropdef
.has_key
(self) then
1384 page
.append
(" {page.show_source(page.ctx.mbuilder.mpropdef2npropdef[self].location)}")
1387 if not previous_defs
.is_empty
then
1388 page
.append
(", inherited from ")
1389 for i
in [0..previous_defs
.length
[ do
1390 var def
= previous_defs
[i
]
1391 def
.mclassdef
.mclass
.html_link
(page
)
1392 if page
.ctx
.mbuilder
.mpropdef2npropdef
.has_key
(def
) then
1393 page
.append
(" {page.show_source(page.ctx.mbuilder.mpropdef2npropdef[def].location)}")
1396 if i
< previous_defs
.length
- 1 then page
.append
(", ")
1399 if not next_defs
.is_empty
then
1400 page
.append
(", redefined by ")
1401 for i
in [0..next_defs
.length
[ do
1402 var def
= next_defs
[i
]
1403 def
.mclassdef
.mclass
.html_link
(page
)
1404 if page
.ctx
.mbuilder
.mpropdef2npropdef
.has_key
(def
) then
1405 page
.append
(" {page.show_source(page.ctx.mbuilder.mpropdef2npropdef[def].location)}")
1407 if i
< next_defs
.length
- 1 then page
.append
(", ")
1410 page
.append
(".</p>")
1414 redef class MMethodDef
1415 redef fun html_full_desc
(page
) do
1416 if not page
.ctx
.mbuilder
.mpropdef2npropdef
.has_key
(self) then return
1417 var nprop
= page
.ctx
.mbuilder
.mpropdef2npropdef
[self]
1418 var classes
= new Array[String]
1419 var is_redef
= mproperty
.intro_mclassdef
.mclass
!= page
.mclass
1421 if mproperty
.is_init
then classes
.add
("init")
1422 if is_redef
then classes
.add
("redef")
1423 classes
.add
(mproperty
.visibility
.to_s
)
1424 page
.append
("<article class='{classes.join(" ")}' id='{anchor}'>")
1425 if nprop
isa AAttrPropdef then
1426 if nprop
.mreadpropdef
== self then
1427 page
.append
("<h3 class='signature'>{mproperty.name}: ")
1428 nprop
.html_signature
(page
)
1429 page
.append
("</h3>")
1431 page
.append
("<h3 class='signature'>{mproperty.name}(value: ")
1432 nprop
.html_signature
(page
)
1433 page
.append
(")</h3>")
1436 var intro_nprop
= page
.ctx
.mbuilder
.mpropdef2npropdef
[mproperty
.intro
]
1437 page
.append
("<h3 class='signature'>{mproperty.name}")
1438 intro_nprop
.html_signature
(page
)
1439 page
.append
("</h3>")
1442 page
.append
("<div class='description'>")
1443 if nprop
.full_comment
== "" then
1444 page
.append
("<a class=\"newComment\
" title=\"32\
" tag=\"\
">New Comment</a>")
1446 page
.append
("<pre class=\"text_label\
" title=\"\
" name=\"\
" tag=\"\
" type=\"1\
">{nprop.full_comment}</pre>")
1448 page
.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>")
1449 html_inheritance
(page
)
1450 page
.append
("</div>")
1451 page
.append
("</article>")
1454 redef fun html_info
(page
) do
1455 page
.append
("<div class='info'>")
1456 if mproperty
.visibility
< public_visibility
then page
.append
("{mproperty.visibility.to_s} ")
1457 if mproperty
.intro_mclassdef
.mclass
!= page
.mclass
then page
.append
("redef ")
1459 mproperty
.html_namespace
(page
)
1460 page
.append
("</div>")
1461 page
.append
("<div style=\"float
: right
;\
"><a id=\"lblDiffCommit\
"></a></div>")
1465 redef class MVirtualTypeDef
1466 redef fun html_full_desc
(page
) do
1467 var is_redef
= mproperty
.intro_mclassdef
.mclass
!= page
.mclass
1468 var classes
= new Array[String]
1470 if is_redef
then classes
.add
("redef")
1471 classes
.add
(mproperty
.visibility
.to_s
)
1472 page
.append
("<article class='{classes.join(" ")}' id='{anchor}'>")
1473 page
.append
("<h3 class='signature'>{mproperty.name}: ")
1474 bound
.html_link
(page
)
1475 page
.append
("</h3>")
1477 page
.append
("<div class='description'>")
1479 if page
.ctx
.mbuilder
.mpropdef2npropdef
.has_key
(self) and page
.ctx
.mbuilder
.mpropdef2npropdef
[self].full_comment
!= "" then
1480 var nprop
= page
.ctx
.mbuilder
.mpropdef2npropdef
[self]
1481 page
.append
("<pre class=\"text_label\
" title=\"\
" name=\"\
" tag=\"\
" type=\"1\
">{nprop.full_comment}</pre>")
1483 page
.append
("<a class=\"newComment\
" title=\"32\
" tag=\"\
">New Comment</a>")
1485 page
.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>")
1486 html_inheritance
(page
)
1487 page
.append
("</div>")
1488 page
.append
("</article>")
1491 redef fun html_info
(page
) do
1492 page
.append
("<div class='info'>")
1493 if mproperty
.intro_mclassdef
.mclass
!= page
.mclass
then page
.append
("redef ")
1494 page
.append
("type ")
1495 mproperty
.html_namespace
(page
)
1496 page
.append
("</div>")
1497 page
.append
("<div style=\"float
: right
;\
"><a id=\"lblDiffCommit\
"></a></div>")
1506 private fun short_comment
: String do
1507 if n_moduledecl
!= null and n_moduledecl
.n_doc
!= null then
1508 return n_moduledecl
.n_doc
.n_comment
.first
.text
.substring_from
(2).replace
("\n", "").html_escape
1513 private fun full_comment
: String do
1514 var res
= new Buffer
1515 if n_moduledecl
!= null and n_moduledecl
.n_doc
!= null then
1516 for t
in n_moduledecl
.n_doc
.n_comment
do
1517 res
.append
(t
.text
.substring_from
(1).html_escape
)
1524 redef class AStdClassdef
1525 private fun short_comment
: String do
1526 if n_doc
!= null then return n_doc
.n_comment
.first
.text
.substring_from
(2).replace
("\n", "").html_escape
1530 private fun full_comment
: String do
1531 var res
= new Buffer
1532 if n_doc
!= null then
1533 for t
in n_doc
.n_comment
do res
.append
(t
.text
.substring_from
(1).html_escape
)
1539 redef class APropdef
1540 private fun short_comment
: String is abstract
1541 private fun full_comment
: String is abstract
1542 private fun html_signature
(page
: NitdocPage) is abstract
1545 redef class AAttrPropdef
1546 redef fun short_comment
do
1547 if n_doc
!= null then return n_doc
.n_comment
.first
.text
.substring_from
(2).replace
("\n", "").html_escape
1551 redef fun full_comment
: String do
1552 var res
= new Buffer
1553 if n_doc
!= null then
1554 for t
in n_doc
.n_comment
do res
.append
(t
.text
.substring_from
(1).html_escape
)
1559 redef fun html_signature
(page
) do
1560 if n_type
!= null then n_type
.mtype
.html_link
(page
)
1564 redef class AMethPropdef
1565 redef fun short_comment
do
1566 if n_doc
!= null then return n_doc
.n_comment
.first
.text
.substring_from
(2).replace
("\n", "").html_escape
1570 redef fun full_comment
do
1571 var res
= new Buffer
1572 if n_doc
!= null then
1573 for t
in n_doc
.n_comment
do res
.append
(t
.text
.substring_from
(1).html_escape
)
1578 redef fun html_signature
(page
) do
1579 if n_signature
!= null then n_signature
.html_link
(page
)
1583 redef class ATypePropdef
1584 redef fun short_comment
do
1585 if n_doc
!= null then return n_doc
.n_comment
.first
.text
.substring_from
(2).replace
("\n", "").html_escape
1589 redef fun full_comment
do
1590 var res
= new Buffer
1591 if n_doc
!= null then
1592 for t
in n_doc
.n_comment
do res
.append
(t
.text
.substring_from
(1).html_escape
)
1597 redef fun html_signature
(page
) do
1598 mpropdef
.bound
.html_link
(page
)
1602 redef class ASignature
1603 fun html_link
(page
: NitdocPage) do
1605 if not n_params
.is_empty
then
1607 for i
in [0..n_params
.length
[ do
1608 n_params
[i
].html_link
(page
)
1609 if i
< n_params
.length
- 1 then page
.append
(", ")
1613 if n_type
!= null then
1615 n_type
.mtype
.html_link
(page
)
1621 fun html_link
(page
: NitdocPage) do
1622 page
.append
(n_id
.text
)
1623 if n_type
!= null then
1625 n_type
.mtype
.html_link
(page
)
1626 if n_dotdotdot
!= null then page
.append
("...")
1631 var nitdoc
= new NitdocContext
1632 nitdoc
.generate_nitdoc