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
410 # build poset with public owners
411 var poset = new POSet[MModule]
412 for mmodule in mmodules do
413 poset.add_node(mmodule)
414 for omodule in mmodules do
415 if mmodule == omodule then continue
416 if mmodule.in_importation < omodule then
417 poset.add_node(omodule)
418 poset.add_edge(mmodule, omodule)
424 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
")
425 for mmodule in poset do
426 op.append("\
"{mmodule.name}\"[URL=\
"{mmodule.url}\"];\n
")
427 for omodule in poset[mmodule].direct_greaters do
428 op.append("\
"{mmodule.name}\"->\
"{omodule.name}\";\n
")
432 generate_dot(op.to_s, "dep
", "Modules hierarchy
")
436 # The full index page
437 class NitdocFullindex
440 init(ctx: NitdocContext) do
445 redef fun title do return "Full Index"
449 append("<li
><a href
='index.html'>Overview</a
></li
>")
450 append("<li
class='current'>Full Index</li
>")
454 append("<div
class='content fullpage'>")
455 append("<h1
>Full Index</h1
>")
462 # Add to content modules column
463 private fun module_column do
464 var sorted = ctx.mbuilder.model.mmodule_importation_hierarchy.to_a
465 var sorter = new ComparableSorter[MModule]
467 append("<article
class='modules filterable'>")
468 append("<h2
>Modules</h2
>")
470 for mmodule in sorted do
472 mmodule.html_link(self)
479 # Add to content classes modules
480 private fun classes_column do
481 var sorted = ctx.mbuilder.model.mclasses
482 var sorter = new ComparableSorter[MClass]
484 append("<article
class='modules filterable'>")
485 append("<h2
>Classes</h2
>")
487 for mclass in sorted do
488 if mclass.visibility < ctx.min_visibility then continue
490 mclass.html_link(self)
497 # Insert the properties column of fullindex page
498 private fun properties_column do
499 var sorted = ctx.mbuilder.model.mproperties
500 var sorter = new ComparableSorter[MProperty]
502 append("<article
class='modules filterable'>")
503 append("<h2
>Properties</h2
>")
505 for mproperty in sorted do
506 if mproperty.visibility < ctx.min_visibility then continue
507 if mproperty isa MAttribute then continue
509 mproperty.intro.html_link(self)
511 mproperty.intro.mclassdef.mclass.html_link(self)
524 private var mmodule: MModule
525 private var mbuilder: ModelBuilder
527 init(mmodule: MModule, ctx: NitdocContext, dot_dir: nullable String) do
529 self.mmodule = mmodule
530 self.mbuilder = ctx.mbuilder
531 self.dot_dir = dot_dir
535 if mbuilder.mmodule2nmodule.has_key(mmodule) then
536 var nmodule = mbuilder.mmodule2nmodule[mmodule]
537 return "{mmodule.name} module | {nmodule.short_comment}"
539 return "{mmodule.name} module"
545 append("<li
><a href
='index.html'>Overview</a
></li
>")
546 append("<li
class='current'>{mmodule.name}</li
>")
547 append("<li
><a href
='full-index.html'>Full Index</a
></li
>")
552 append("<div
class='content'>")
553 append("<h1
>{mmodule.name}</h1
>")
554 append("<div
class='subtitle info'>")
555 mmodule.html_signature(self)
557 mmodule.html_full_comment(self)
564 private fun process_generate_dot do
565 # build poset with public owners
566 var poset = new POSet[MModule]
567 for mmodule in self.mmodule.in_importation.poset do
568 if mmodule.name == "<main
>" then continue
569 if mmodule.public_owner != null then continue
570 if not mmodule.in_importation < self.mmodule and not self.mmodule.in_importation < mmodule and mmodule != self.mmodule then continue
571 poset.add_node(mmodule)
572 for omodule in mmodule.in_importation.poset do
573 if mmodule == omodule then continue
574 if omodule.name == "<main
>" then continue
575 if omodule.public_owner != null then continue
576 if mmodule.in_importation < omodule then
577 poset.add_node(omodule)
578 poset.add_edge(mmodule, omodule)
584 var name = "dep_
{mmodule.name}"
585 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
")
586 for mmodule in poset do
587 if mmodule == self.mmodule then
588 op.append("\
"{mmodule.name}\"[shape
=box
,margin
=0.03];\n
")
590 op.append("\
"{mmodule.name}\"[URL=\
"{mmodule.url}\"];\n
")
592 for omodule in poset[mmodule].direct_greaters do
593 op.append("\
"{mmodule.name}\"->\
"{omodule.name}\";\n
")
597 generate_dot(op.to_s, name, "Dependency graph
for module {mmodule.name}")
600 private fun sidebar do
601 append("<div
class='menu'>")
603 append("<h3
>Module Hierarchy</h3
>")
604 var dependencies = new Array[MModule]
605 for dep in mmodule.in_importation.greaters do
606 if dep == mmodule or dep.public_owner != null then continue
607 dependencies.add(dep)
609 if dependencies.length > 0 then
610 append("<h4
>All dependencies
</h4
>")
611 display_module_list(dependencies)
613 var clients = new Array[MModule]
614 for dep in mmodule.in_importation.smallers do
615 if dep.name == "<main
>" then continue
616 if dep == mmodule or dep.public_owner != null then continue
619 if clients.length > 0 then
620 append("<h4
>All clients
</h4
>")
621 display_module_list(clients)
624 if ctx.min_visibility < protected_visibility then
625 if mmodule.in_nesting.direct_greaters.length > 0 then
627 append("<h3
>Nested Modules</h3
>")
628 display_module_list(mmodule.in_nesting.direct_greaters.to_a)
635 private fun display_module_list(list: Array[MModule]) do
637 var sorter = new ComparableSorter[MModule]
647 # display the class column
648 private fun classes do
649 var intro_mclasses = mmodule.intro_mclasses
650 var redef_mclasses = mmodule.redef_mclasses
651 var all_mclasses = new HashSet[MClass]
652 for m in mmodule.in_nesting.greaters do
653 all_mclasses.add_all(m.intro_mclasses)
654 all_mclasses.add_all(m.redef_mclasses)
656 all_mclasses.add_all(intro_mclasses)
657 all_mclasses.add_all(redef_mclasses)
659 var sorted = new Array[MClass]
660 sorted.add_all(all_mclasses)
661 var sorter = new ComparableSorter[MClass]
663 append("<div
class='module'>")
664 append("<article
class='classes filterable'>")
665 append("<h2
>Classes</h2
>")
668 if c.visibility < ctx.min_visibility then continue
669 if redef_mclasses.has(c) and c.intro_mmodule.public_owner != mmodule then
670 append("<li
class='redef'>")
671 append("<span title
='refined in this module'>R
</span
>")
673 append("<li
class='intro'>")
674 append("<span title
='introduced in this module'>I
</span
>")
684 # display the property column
685 private fun properties do
687 var mpropdefs = new HashSet[MPropDef]
688 for m in mmodule.in_nesting.greaters do
689 for c in m.mclassdefs do mpropdefs.add_all(c.mpropdefs)
691 for c in mmodule.mclassdefs do mpropdefs.add_all(c.mpropdefs)
692 var sorted = mpropdefs.to_a
693 var sorter = new ComparableSorter[MPropDef]
695 # display properties in one column
696 append("<article
class='properties filterable'>")
697 append("<h2
>Properties</h2
>")
699 for mprop in sorted do
700 if mprop isa MAttributeDef then continue
701 if mprop.mproperty.visibility < ctx.min_visibility then continue
702 mprop.html_list_item(self)
713 private var mclass: MClass
714 private var vtypes = new HashSet[MVirtualTypeDef]
715 private var consts = new HashSet[MMethodDef]
716 private var meths = new HashSet[MMethodDef]
717 private var inherited = new HashSet[MPropDef]
719 init(mclass: MClass, ctx: NitdocContext, dot_dir: nullable String, source: nullable String) do
722 self.dot_dir = dot_dir
725 for mclassdef in mclass.mclassdefs do
726 for mpropdef in mclassdef.mpropdefs do
727 if mpropdef.mproperty.visibility < ctx.min_visibility then continue
728 if mpropdef isa MVirtualTypeDef then vtypes.add(mpropdef)
729 if mpropdef isa MMethodDef then
730 if mpropdef.mproperty.is_init then
738 # get inherited properties
739 for mprop in mclass.inherited_mproperties do
740 var mpropdef = mprop.intro
741 if mprop.visibility < ctx.min_visibility then continue
742 if mpropdef isa MVirtualTypeDef then vtypes.add(mpropdef)
743 if mpropdef isa MMethodDef then
744 if mpropdef.mproperty.is_init then
750 inherited.add(mpropdef)
755 var nclass = ctx.mbuilder.mclassdef2nclassdef[mclass.intro]
756 if nclass isa AStdClassdef then
757 return "{mclass.name} class | {nclass.short_comment}"
759 return "{mclass.name} class"
765 append("<li
><a href
='index.html'>Overview</a
></li
>")
766 var public_owner = mclass.public_owner
767 if public_owner is null then
769 mclass.intro_mmodule.html_link(self)
773 public_owner.html_link(self)
776 append("<li
class='current'>{mclass.name}</li
>")
777 append("<li
><a href
='full-index.html'>Full Index</a
></li
>")
781 append("<div
class='menu'>")
785 append("<div
class='content'>")
790 private fun properties_column do
791 var sorter = new ComparableSorter[MPropDef]
792 append("<nav
class='properties filterable'>")
793 append("<h3
>Properties</h3
>")
795 if vtypes.length > 0 then
796 var vts = new Array[MVirtualTypeDef]
799 append("<h4
>Virtual Types</h4
>")
802 mprop.html_sidebar_item(self)
807 if consts.length > 0 then
808 var cts = new Array[MMethodDef]
811 append("<h4
>Constructors</h4
>")
814 if mprop.mproperty.name == "init" and mprop.mclassdef.mclass != mclass then continue
815 mprop.html_sidebar_item(self)
820 if meths.length > 0 then
821 var mts = new Array[MMethodDef]
824 append("<h4
>Methods</h4
>")
827 if mclass.name != "Object" and mprop.mproperty.intro_mclassdef.mclass.name == "Object" and mprop.mproperty.visibility <= protected_visibility then continue
828 mprop.html_sidebar_item(self)
835 private fun inheritance_column do
836 var sorted = new Array[MClass]
837 var sorterp = new ComparableSorter[MClass]
839 append("<h3
>Inheritance</h3
>")
840 var greaters = mclass.in_hierarchy(ctx.mainmodule).greaters.to_a
841 if greaters.length > 1 then
842 ctx.mainmodule.linearize_mclasses(greaters)
843 append("<h4
>Superclasses</h4
>")
845 for sup in greaters do
846 if sup == mclass then continue
853 var smallers = mclass.in_hierarchy(ctx.mainmodule).smallers.to_a
854 var direct_smallers = mclass.in_hierarchy(ctx.mainmodule).direct_smallers.to_a
855 if smallers.length <= 1 then
856 append("<h4
>No Known Subclasses</h4
>")
857 else if smallers.length <= 100 then
858 ctx.mainmodule.linearize_mclasses(smallers)
859 append("<h4
>Subclasses</h4
>")
861 for sub in smallers do
862 if sub == mclass then continue
868 else if direct_smallers.length <= 100 then
869 ctx.mainmodule.linearize_mclasses(direct_smallers)
870 append("<h4
>Direct Subclasses Only</h4
>")
872 for sub in direct_smallers do
873 if sub == mclass then continue
880 append("<h4
>Too much
Subclasses to list
</h4
>")
885 private fun class_doc do
887 append("<h1
>{mclass.signature}</h1
>")
888 append("<div
class='subtitle info'>")
889 mclass.html_full_signature(self)
892 var nclass = ctx.mbuilder.mclassdef2nclassdef[mclass.intro]
893 append("<div style
=\
"float: right;\"><a id
=\
"lblDiffCommit\"></a
></div
>")
894 append("<section
class='description'>")
895 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
>")
899 var concern2meths = new ArrayMap[MModule, Array[MMethodDef]]
900 var sorted_meths = new Array[MMethodDef]
901 var sorted = new Array[MModule]
902 sorted_meths.add_all(meths)
903 ctx.mainmodule.linearize_mpropdefs(sorted_meths)
905 if inherited.has(meth) then continue
906 var mmodule = meth.mclassdef.mmodule
907 if not concern2meths.has_key(mmodule) then
909 concern2meths[mmodule] = new Array[MMethodDef]
911 concern2meths[mmodule].add(meth)
913 var sections = new ArrayMap[MModule, Array[MModule]]
914 for mmodule in concern2meths.keys do
915 var owner = mmodule.public_owner
916 if owner == null then owner = mmodule
917 if not sections.has_key(owner) then sections[owner] = new Array[MModule]
918 if owner != mmodule then sections[owner].add(mmodule)
920 append("<section
class='concerns'>")
921 append("<h2
class='section-header'>Concerns</h2
>")
923 for owner, mmodules in sections do
924 var nowner = ctx.mbuilder.mmodule2nmodule[owner]
926 if nowner.short_comment.is_empty then
927 append("<a href
=\
"#{owner.anchor}\">{owner.name}</a
>")
929 append("<a href
=\
"#{owner.anchor}\">{owner.name}</a
>: {nowner.short_comment}")
931 if not mmodules.is_empty then
933 for mmodule in mmodules do
934 var nmodule = ctx.mbuilder.mmodule2nmodule[mmodule]
935 if nmodule.short_comment.is_empty then
936 append("<li
><a href
=\
"#{mmodule.anchor}\">{mmodule.name}</a
></li
>")
938 append("<li
><a href
=\
"#{mmodule.anchor}\">{mmodule.name}</a
>: {nmodule.short_comment}</li
>")
948 var prop_sorter = new ComparableSorter[MPropDef]
949 var sorterprop = new ComparableSorter[MProperty]
950 var sorterc = new ComparableSorter[MClass]
951 var lmmodule = new List[MModule]
952 # virtual and formal types
953 var local_vtypes = new Array[MVirtualTypeDef]
954 for vt in vtypes do if not inherited.has(vt) then local_vtypes.add(vt)
955 if local_vtypes.length > 0 or mclass.arity > 0 then
956 append("<section
class='types'>")
957 append("<h2
>Formal and Virtual Types</h2
>")
959 if mclass.arity > 0 and nclass isa AStdClassdef then
960 for ft, bound in mclass.parameter_types do
961 append("<article id
='FT_{ft}'>")
962 append("<h3
class='signature'>{ft}: ")
963 bound.html_link(self)
965 append("<div
class=\
"info\">formal generic
type</div
>")
970 prop_sorter.sort(local_vtypes)
971 for prop in local_vtypes do prop.html_full_desc(self)
975 var local_consts = new Array[MMethodDef]
976 for const in consts do if not inherited.has(const) then local_consts.add(const)
977 prop_sorter.sort(local_consts)
978 if local_consts.length > 0 then
979 append("<section
class='constructors'>")
980 append("<h2
class='section-header'>Constructors</h2
>")
981 for prop in local_consts do prop.html_full_desc(self)
985 if not concern2meths.is_empty then
986 append("<section
class='methods'>")
987 append("<h2
class='section-header'>Methods</h2
>")
988 for owner, mmodules in sections do
989 append("<a id
=\
"{owner.anchor}\"></a
>")
990 if owner != mclass.intro_mmodule and owner != mclass.public_owner then
991 var nowner = ctx.mbuilder.mmodule2nmodule[owner]
992 append("<h3
class=\
"concern-toplevel\">Methods refined
in ")
993 owner.html_link(self)
995 append("<p
class=\
"concern-doc\">")
996 owner.html_link(self)
997 if not nowner.short_comment.is_empty then
998 append(": {nowner.short_comment}")
1002 if concern2meths.has_key(owner) then
1003 var mmethods = concern2meths[owner]
1004 prop_sorter.sort(mmethods)
1005 for prop in mmethods do prop.html_full_desc(self)
1007 for mmodule in mmodules do
1008 append("<a id
=\
"{mmodule.anchor}\"></a
>")
1009 var nmodule = ctx.mbuilder.mmodule2nmodule[mmodule]
1010 if mmodule != mclass.intro_mmodule and mmodule != mclass.public_owner then
1011 append("<p
class=\
"concern-doc\">")
1012 mmodule.html_link(self)
1013 if not nmodule.short_comment.is_empty then
1014 append(": {nmodule.short_comment}")
1018 var mmethods = concern2meths[mmodule]
1019 prop_sorter.sort(mmethods)
1020 for prop in mmethods do prop.html_full_desc(self)
1024 # inherited properties
1025 if inherited.length > 0 then
1026 var sorted_inherited = new Array[MPropDef]
1027 sorted_inherited.add_all(inherited)
1028 ctx.mainmodule.linearize_mpropdefs(sorted_inherited)
1029 var classes = new ArrayMap[MClass, Array[MPropDef]]
1030 for mmethod in sorted_inherited.reversed do
1031 var mclass = mmethod.mclassdef.mclass
1032 if not classes.has_key(mclass) then classes[mclass] = new Array[MPropDef]
1033 classes[mclass].add(mmethod)
1035 append("<h3
>Inherited Properties</h3
>")
1036 for c, mmethods in classes do
1037 prop_sorter.sort(mmethods)
1038 append("<p
>Defined in ")
1041 for i in [0..mmethods.length[ do
1042 var mmethod = mmethods[i]
1043 mmethod.html_link(self)
1044 if i <= mmethods.length - 1 then append(", ")
1049 append("</section
>")
1052 private fun process_generate_dot do
1053 var pe = ctx.class_hierarchy[mclass]
1054 var cla = new HashSet[MClass]
1055 var sm = new HashSet[MClass]
1056 var sm2 = new HashSet[MClass]
1058 while cla.length + sm.length < 10 and sm.length > 0 do
1062 sm2.add_all(pe.poset[x].direct_smallers)
1068 cla.add_all(pe.greaters)
1071 var name = "dep_
{mclass.name}"
1072 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
")
1075 op.append("\
"{c.name}\"[shape
=box
,margin
=0.03];\n
")
1077 op.append("\
"{c.name}\"[URL=\
"{c.url}\"];\n
")
1079 for c2 in pe.poset[c].direct_greaters do
1080 if not cla.has(c2) then continue
1081 op.append("\
"{c.name}\"->\
"{c2.name}\";\n
")
1083 if not pe.poset[c].direct_smallers.is_empty then
1085 for c2 in pe.poset[c].direct_smallers do
1086 if cla.has(c2) then others = false
1089 op.append("\
"{c.name}...\"[label=\
"\"];\n
")
1090 op.append("\
"{c.name}...\"->\
"{c.name}\"[style
=dotted
];\n
")
1095 generate_dot(op.to_s, name, "Dependency graph
for class {mclass.name}")
1105 redef type OTHER: MModule
1106 redef fun <(other: OTHER): Bool do return self.name < other.name
1108 # URL to nitdoc page
1110 var res = new Buffer
1111 res.append("module_
")
1112 var mowner = public_owner
1113 if mowner != null then
1114 res.append("{public_owner.name}_
")
1116 res.append("{self.name}.html
")
1120 # html anchor id to the module in a nitdoc page
1121 fun anchor: String do
1122 var res = new Buffer
1124 var mowner = public_owner
1125 if mowner != null then
1126 res.append("{public_owner.name}_
")
1128 res.append(self.name)
1132 # Return a link (html a tag) to the nitdoc module page
1133 fun html_link(page: NitdocPage) do
1134 if page.ctx.mbuilder.mmodule2nmodule.has_key(self) then
1135 page.append("<a href
='{url}' title
='{page.ctx.mbuilder.mmodule2nmodule[self].short_comment}'>{name}</a
>")
1137 page.append("<a href
='{url}'>{name}</a
>")
1141 # Return the module signature decorated with html
1142 fun html_signature(page: NitdocPage) do
1143 page.append("<span
>module ")
1144 html_full_namespace(page)
1145 page.append("</span
>")
1148 # Return the module full namespace decorated with html
1149 fun html_full_namespace(page: NitdocPage) do
1150 page.append("<span
>")
1151 var mowner = public_owner
1152 if mowner != null then
1153 public_owner.html_namespace(page)
1157 page.append("</span
>")
1160 # Return the module full namespace decorated with html
1161 fun html_namespace(page: NitdocPage) do
1162 page.append("<span
>")
1163 var mowner = public_owner
1164 if mowner != null then
1165 public_owner.html_namespace(page)
1169 page.append("</span
>")
1172 # Return the full comment of the module decorated with html
1173 fun html_full_comment(page: NitdocPage) do
1174 if page.ctx.mbuilder.mmodule2nmodule.has_key(self) then
1175 page.append("<div id
='description'>")
1176 page.append("<pre
class='text_label'>{page.ctx.mbuilder.mmodule2nmodule[self].full_comment}</pre
>")
1177 page.append("<textarea
class='edit' rows
='1' cols
='76' id
='fileContent'></textarea
>")
1178 page.append("<a id
='cancelBtn'>Cancel</a
>")
1179 page.append("<a id
='commitBtn'>Commit</a
>")
1180 page.append("<pre
class='text_label' id
='preSave' type='2'></pre
>")
1181 page.append("</div
>")
1188 redef type OTHER: MClass
1189 redef fun <(other: OTHER): Bool do return self.name < other.name
1191 # Return the module signature decorated with html
1192 fun html_full_signature(page: NitdocPage) do
1193 if visibility < public_visibility then page.append("{visibility.to_s} ")
1194 page.append("{kind} ")
1195 html_namespace(page)
1198 # name with formal parameter
1200 private fun signature: String do
1202 return "{name}[{intro.parameter_names.join(", ")}]"
1208 # Return a link (html a tag) to the nitdoc class page
1209 fun html_link(page: NitdocPage) do
1210 page.append("<a href
='{url}'")
1211 if page.ctx.mbuilder.mclassdef2nclassdef.has_key(intro) then
1212 var nclass = page.ctx.mbuilder.mclassdef2nclassdef[intro]
1213 if nclass isa AStdClassdef then
1214 page.append(" title
=\
"{nclass.short_comment}\"")
1217 page.append(">{signature}</a
>")
1220 # Return the class namespace decorated with html
1221 fun html_namespace(page: NitdocPage) do
1222 intro_mmodule.html_namespace(page)
1223 page.append("::<span
>")
1225 page.append("</span
>")
1229 return "class_
{public_owner}_
{c_name}.html
"
1232 # Escape name for html output
1233 redef fun name do return super.html_escape
1236 redef class MProperty
1238 redef type OTHER: MProperty
1239 redef fun <(other: OTHER): Bool do return self.name < other.name
1241 # Return the property namespace decorated with html
1242 fun html_namespace(page: NitdocPage) do
1243 intro_mclassdef.mclass.html_namespace(page)
1244 page.append("::<span
>")
1245 intro.html_link(page)
1246 page.append("</span
>")
1249 # Escape name for html output
1250 redef fun name do return super.html_escape
1254 fun html_link(page: NitdocPage) is abstract
1257 redef class MClassType
1258 redef fun html_link(page) do mclass.html_link(page)
1261 redef class MNullableType
1262 redef fun html_link(page) do
1263 page.append("nullable ")
1264 mtype.html_link(page)
1268 redef class MGenericType
1269 redef fun html_link(page) do
1270 page.append("<a href
='{mclass.url}'>{mclass.name}</a
>[")
1271 for i in [0..arguments.length[ do
1272 arguments[i].html_link(page)
1273 if i < arguments.length - 1 then page.append(", ")
1279 redef class MParameterType
1280 redef fun html_link(page) do
1281 var name = mclass.intro.parameter_names[rank]
1282 page.append("<a href
='{mclass.url}#FT_{name}' title
='formal type'>{name}</a
>")
1286 redef class MVirtualType
1287 redef fun html_link(page) do mproperty.intro.html_link(page)
1290 redef class MClassDef
1291 # Return the classdef namespace decorated with html
1292 fun html_namespace(page: NitdocPage) do
1293 mmodule.html_full_namespace(page)
1294 page.append("::<span
>")
1295 mclass.html_link(page)
1296 page.append("</span
>")
1300 redef class MPropDef
1302 redef type OTHER: MPropDef
1303 redef fun <(other: OTHER): Bool do return self.mproperty.name < other.mproperty.name
1305 fun url: String do return "{mclassdef.mclass.url}#{anchor}"
1306 fun anchor
: String do return "PROP_{mclassdef.mclass.public_owner.name}_{c_name}"
1308 # Return a link (html a tag) to the nitdoc class page
1309 fun html_link
(page
: NitdocPage) do
1310 if page
.ctx
.mbuilder
.mpropdef2npropdef
.has_key
(self) then
1311 var nprop
= page
.ctx
.mbuilder
.mpropdef2npropdef
[self]
1312 page
.append
("<a href=\"{url}\
" title=\"{nprop.short_comment}\
">{mproperty.name}</a>")
1314 page
.append
("<a href=\"{url}\
">{mproperty.name}</a>")
1318 # Return a list item for the mpropdef
1319 private fun html_list_item
(page
: NitdocPage) do
1321 page
.append
("<li class='intro'>")
1322 page
.append
("<span title='introduction'>I</span> ")
1324 page
.append
("<li class='redef'>")
1325 page
.append
("<span title='redefinition'>R</span> ")
1329 mclassdef
.mclass
.html_link
(page
)
1331 page
.append
("</li>")
1334 # Return a list item for the mpropdef
1335 private fun html_sidebar_item
(page
: NitdocClass) do
1336 if is_intro
and mclassdef
.mclass
== page
.mclass
then
1337 page
.append
("<li class='intro'>")
1338 page
.append
("<span title='Introduced'>I</span>")
1339 else if is_intro
and mclassdef
.mclass
!= page
.mclass
then
1340 page
.append
("<li class='inherit'>")
1341 page
.append
("<span title='Inherited'>H</span>")
1343 page
.append
("<li class='redef'>")
1344 page
.append
("<span title='Redefined'>R</span>")
1347 page
.append
("</li>")
1350 private fun html_full_desc
(page
: NitdocClass) is abstract
1351 private fun html_info
(page
: NitdocClass) is abstract
1353 fun full_name
: String do
1354 return "{mclassdef.mclass.public_owner.name}::{mclassdef.mclass.name}::{mproperty.name}"
1357 private fun html_inheritance
(page
: NitdocClass) do
1359 page
.append
("<p class='info'>")
1360 page
.ctx
.mainmodule
.linearize_mpropdefs
(mproperty
.mpropdefs
)
1361 var previous_defs
= new Array[MPropDef]
1362 var next_defs
= new Array[MPropDef]
1363 var self_passed
= false
1364 for def
in mproperty
.mpropdefs
do
1369 if not self_passed
then
1370 if def
.mclassdef
.mclass
.in_hierarchy
(page
.ctx
.mainmodule
) < page
.mclass
then continue
1371 if def
.is_intro
then continue
1372 previous_defs
.add
(def
)
1374 if page
.mclass
.in_hierarchy
(page
.ctx
.mainmodule
) < def
.mclassdef
.mclass
then continue
1378 page
.append
("defined by ")
1379 mclassdef
.mmodule
.html_full_namespace
(page
)
1380 if page
.ctx
.mbuilder
.mpropdef2npropdef
.has_key
(self) then
1381 page
.append
(" {page.show_source(page.ctx.mbuilder.mpropdef2npropdef[self].location)}")
1383 if not is_intro
then
1384 page
.append
(", introduced by ")
1385 mproperty
.intro
.mclassdef
.mclass
.html_link
(page
)
1386 if page
.ctx
.mbuilder
.mpropdef2npropdef
.has_key
(self) then
1387 page
.append
(" {page.show_source(page.ctx.mbuilder.mpropdef2npropdef[self].location)}")
1390 if not previous_defs
.is_empty
then
1391 page
.append
(", inherited from ")
1392 for i
in [0..previous_defs
.length
[ do
1393 var def
= previous_defs
[i
]
1394 def
.mclassdef
.mclass
.html_link
(page
)
1395 if page
.ctx
.mbuilder
.mpropdef2npropdef
.has_key
(def
) then
1396 page
.append
(" {page.show_source(page.ctx.mbuilder.mpropdef2npropdef[def].location)}")
1399 if i
< previous_defs
.length
- 1 then page
.append
(", ")
1402 if not next_defs
.is_empty
then
1403 page
.append
(", redefined by ")
1404 for i
in [0..next_defs
.length
[ do
1405 var def
= next_defs
[i
]
1406 def
.mclassdef
.mclass
.html_link
(page
)
1407 if page
.ctx
.mbuilder
.mpropdef2npropdef
.has_key
(def
) then
1408 page
.append
(" {page.show_source(page.ctx.mbuilder.mpropdef2npropdef[def].location)}")
1410 if i
< next_defs
.length
- 1 then page
.append
(", ")
1413 page
.append
(".</p>")
1416 private fun html_comment
(page
: NitdocClass) do
1417 if not page
.ctx
.mbuilder
.mpropdef2npropdef
.has_key
(self) then return
1418 var nprop
= page
.ctx
.mbuilder
.mpropdef2npropdef
[self]
1419 page
.append
("<div class='description'>")
1420 if not is_intro
then
1421 var intro_nprop
= page
.ctx
.mbuilder
.mpropdef2npropdef
[mproperty
.intro
]
1422 page
.append
("<p>from ")
1423 mproperty
.html_namespace
(page
)
1425 if intro_nprop
.full_comment
== "" then
1426 page
.append
("<a class=\"newComment\
" title=\"32\
" tag=\"\
">New Comment</a>")
1428 page
.append
("<pre class=\"text_label\
" title=\"\
" name=\"\
" tag=\"\
" type=\"1\
">{intro_nprop.full_comment}</pre>")
1430 page
.append
("<p>from ")
1431 mclassdef
.html_namespace
(page
)
1434 if nprop
.full_comment
== "" then
1435 page
.append
("<a class=\"newComment\
" title=\"32\
" tag=\"\
">New Comment</a>")
1437 page
.append
("<pre class=\"text_label\
" title=\"\
" name=\"\
" tag=\"\
" type=\"1\
">{nprop.full_comment}</pre>")
1439 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>")
1440 html_inheritance
(page
)
1441 page
.append
("</div>")
1445 redef class MMethodDef
1446 redef fun html_full_desc
(page
) do
1447 var classes
= new Array[String]
1448 var is_redef
= mproperty
.intro_mclassdef
.mclass
!= page
.mclass
1449 if mproperty
.is_init
then
1454 if is_redef
then classes
.add
("redef")
1455 classes
.add
(mproperty
.visibility
.to_s
)
1456 page
.append
("<article class='{classes.join(" ")}' id='{anchor}'>")
1457 if page
.ctx
.mbuilder
.mpropdef2npropdef
.has_key
(self) then
1458 page
.append
("<h3 class='signature'>{mproperty.name}")
1459 msignature
.html_signature
(page
)
1460 page
.append
("</h3>")
1462 page
.append
("<h3 class='signature'>init")
1463 msignature
.html_signature
(page
)
1464 page
.append
("</h3>")
1468 page
.append
("</article>")
1471 redef fun html_info
(page
) do
1472 page
.append
("<div class='info'>")
1473 if mproperty
.visibility
< public_visibility
then page
.append
("{mproperty.visibility.to_s} ")
1474 if mproperty
.intro_mclassdef
.mclass
!= page
.mclass
then page
.append
("redef ")
1475 if mproperty
.is_init
then
1476 page
.append
("init ")
1480 mproperty
.html_namespace
(page
)
1481 page
.append
("</div>")
1482 page
.append
("<div style=\"float
: right
;\
"><a id=\"lblDiffCommit\
"></a></div>")
1486 redef class MVirtualTypeDef
1487 redef fun html_full_desc
(page
) do
1488 var is_redef
= mproperty
.intro_mclassdef
.mclass
!= page
.mclass
1489 var classes
= new Array[String]
1491 if is_redef
then classes
.add
("redef")
1492 classes
.add
(mproperty
.visibility
.to_s
)
1493 page
.append
("<article class='{classes.join(" ")}' id='{anchor}'>")
1494 page
.append
("<h3 class='signature'>{mproperty.name}: ")
1495 bound
.html_link
(page
)
1496 page
.append
("</h3>")
1499 page
.append
("</article>")
1502 redef fun html_info
(page
) do
1503 page
.append
("<div class='info'>")
1504 if mproperty
.intro_mclassdef
.mclass
!= page
.mclass
then page
.append
("redef ")
1505 page
.append
("type ")
1506 mproperty
.html_namespace
(page
)
1507 page
.append
("</div>")
1508 page
.append
("<div style=\"float
: right
;\
"><a id=\"lblDiffCommit\
"></a></div>")
1512 redef class MSignature
1513 private fun html_signature
(page
: NitdocPage) do
1514 if not mparameters
.is_empty
then
1516 for i
in [0..mparameters
.length
[ do
1517 mparameters
[i
].html_link
(page
)
1518 if i
< mparameters
.length
- 1 then page
.append
(", ")
1522 if return_mtype
!= null then
1524 return_mtype
.html_link
(page
)
1529 redef class MParameter
1530 private fun html_link
(page
: NitdocPage) do
1531 page
.append
("{name}: ")
1532 mtype
.html_link
(page
)
1533 if is_vararg
then page
.append
("...")
1542 private fun short_comment
: String do
1543 if n_moduledecl
!= null and n_moduledecl
.n_doc
!= null then
1544 return n_moduledecl
.n_doc
.n_comment
.first
.text
.substring_from
(2).replace
("\n", "").html_escape
1549 private fun full_comment
: String do
1550 var res
= new Buffer
1551 if n_moduledecl
!= null and n_moduledecl
.n_doc
!= null then
1552 for t
in n_moduledecl
.n_doc
.n_comment
do
1553 res
.append
(t
.text
.substring_from
(1).html_escape
)
1560 redef class AStdClassdef
1561 private fun short_comment
: String do
1562 if n_doc
!= null then return n_doc
.n_comment
.first
.text
.substring_from
(2).replace
("\n", "").html_escape
1566 private fun full_comment
: String do
1567 var res
= new Buffer
1568 if n_doc
!= null then
1569 for t
in n_doc
.n_comment
do res
.append
(t
.text
.substring_from
(1).html_escape
)
1575 redef class APropdef
1576 private fun short_comment
: String is abstract
1577 private fun full_comment
: String is abstract
1580 redef class AAttrPropdef
1581 redef fun short_comment
do
1582 if n_doc
!= null then return n_doc
.n_comment
.first
.text
.substring_from
(2).replace
("\n", "").html_escape
1586 redef fun full_comment
: String do
1587 var res
= new Buffer
1588 if n_doc
!= null then
1589 for t
in n_doc
.n_comment
do res
.append
(t
.text
.substring_from
(1).html_escape
)
1595 redef class AMethPropdef
1596 redef fun short_comment
do
1597 if n_doc
!= null then return n_doc
.n_comment
.first
.text
.substring_from
(2).replace
("\n", "").html_escape
1601 redef fun full_comment
do
1602 var res
= new Buffer
1603 if n_doc
!= null then
1604 for t
in n_doc
.n_comment
do res
.append
(t
.text
.substring_from
(1).html_escape
)
1610 redef class ATypePropdef
1611 redef fun short_comment
do
1612 if n_doc
!= null then return n_doc
.n_comment
.first
.text
.substring_from
(2).replace
("\n", "").html_escape
1616 redef fun full_comment
do
1617 var res
= new Buffer
1618 if n_doc
!= null then
1619 for t
in n_doc
.n_comment
do res
.append
(t
.text
.substring_from
(1).html_escape
)
1625 var nitdoc
= new NitdocContext
1626 nitdoc
.generate_nitdoc