Signed-off-by: Jean-Christophe Beaupré <jcbrinfo@users.noreply.github.com>
+
+ # Filter the entity based on the options specified by the user.
+ #
+ # Return `true` if the specified entity has to be included in the generated
+ # documentation
+ private fun filter_mclass(mclass: MClass): Bool do
+ return mclass.visibility >= min_visibility
+ end
+
+ # Filter the entity based on the options specified by the user.
+ #
+ # Return `true` if the specified entity has to be included in the generated
+ # documentation
+ private fun filter_mproperty(mproperty: MProperty): Bool do
+ return mproperty.visibility >= min_visibility and
+ not mproperty isa MAttribute
+ end
end
# The Nitdoc class explores the model and generate pages for each mentities found
end
# The Nitdoc class explores the model and generate pages for each mentities found
private fun classes do
for mclass in model.mclasses do
private fun classes do
for mclass in model.mclasses do
- if mclass.visibility <= ctx.min_visibility then continue
+ if not ctx.filter_mclass(mclass) then continue
var page = new NitdocClass(ctx, model, mainmodule, mclass)
page.render.write_to_file("{ctx.output_dir.to_s}/{page.page_url}")
end
var page = new NitdocClass(ctx, model, mainmodule, mclass)
page.render.write_to_file("{ctx.output_dir.to_s}/{page.page_url}")
end
private fun properties do
for mproperty in model.mproperties do
private fun properties do
for mproperty in model.mproperties do
- if mproperty.visibility <= ctx.min_visibility then continue
+ if not ctx.filter_mproperty(mproperty) then continue
if mproperty isa MInnerClass then continue
if mproperty isa MInnerClass then continue
- if mproperty isa MAttribute then continue
var page = new NitdocProperty(ctx, model, mainmodule, mproperty)
page.render.write_to_file("{ctx.output_dir.to_s}/{page.page_url}")
end
var page = new NitdocProperty(ctx, model, mainmodule, mproperty)
page.render.write_to_file("{ctx.output_dir.to_s}/{page.page_url}")
end
add_result_for(mmodule.name, mmodule.full_name, mmodule.nitdoc_url)
end
for mclass in model.mclasses do
add_result_for(mmodule.name, mmodule.full_name, mmodule.nitdoc_url)
end
for mclass in model.mclasses do
- if mclass.visibility < ctx.min_visibility then continue
+ if not ctx.filter_mclass(mclass) then continue
add_result_for(mclass.name, mclass.full_name, mclass.nitdoc_url)
end
for mproperty in model.mproperties do
add_result_for(mclass.name, mclass.full_name, mclass.nitdoc_url)
end
for mproperty in model.mproperties do
- if mproperty.visibility < ctx.min_visibility then continue
- if mproperty isa MAttribute then continue
+ if not ctx.filter_mproperty(mproperty) then continue
for mpropdef in mproperty.mpropdefs do
var full_name = mpropdef.mclassdef.mclass.full_name
var cls_url = mpropdef.mclassdef.mclass.nitdoc_url
for mpropdef in mproperty.mpropdefs do
var full_name = mpropdef.mclassdef.mclass.full_name
var cls_url = mpropdef.mclassdef.mclass.nitdoc_url
private fun classes_list: Array[MClass] do
var sorted = new Array[MClass]
for mclass in model.mclasses do
private fun classes_list: Array[MClass] do
var sorted = new Array[MClass]
for mclass in model.mclasses do
- if mclass.visibility < ctx.min_visibility then continue
+ if not ctx.filter_mclass(mclass) then continue
sorted.add mclass
end
name_sorter.sort(sorted)
sorted.add mclass
end
name_sorter.sort(sorted)
private fun mprops_list: Array[MProperty] do
var sorted = new Array[MProperty]
for mproperty in model.mproperties do
private fun mprops_list: Array[MProperty] do
var sorted = new Array[MProperty]
for mproperty in model.mproperties do
- if mproperty.visibility < ctx.min_visibility then continue
- if mproperty isa MAttribute then continue
- sorted.add mproperty
+ if ctx.filter_mproperty(mproperty) then sorted.add mproperty
end
name_sorter.sort(sorted)
return sorted
end
name_sorter.sort(sorted)
return sorted
# parents
var hparents = new HashSet[MClass]
for c in mclass.in_hierarchy(mainmodule).direct_greaters do
# parents
var hparents = new HashSet[MClass]
for c in mclass.in_hierarchy(mainmodule).direct_greaters do
- if c.visibility < ctx.min_visibility then continue
- hparents.add c
+ if ctx.filter_mclass(c) then hparents.add c
end
# ancestors
var hancestors = new HashSet[MClass]
for c in mclass.in_hierarchy(mainmodule).greaters do
if c == mclass then continue
end
# ancestors
var hancestors = new HashSet[MClass]
for c in mclass.in_hierarchy(mainmodule).greaters do
if c == mclass then continue
- if c.visibility < ctx.min_visibility then continue
+ if not ctx.filter_mclass(c) then continue
if hparents.has(c) then continue
hancestors.add c
end
if hparents.has(c) then continue
hancestors.add c
end
# children
var hchildren = new HashSet[MClass]
for c in mclass.in_hierarchy(mainmodule).direct_smallers do
# children
var hchildren = new HashSet[MClass]
for c in mclass.in_hierarchy(mainmodule).direct_smallers do
- if c.visibility < ctx.min_visibility then continue
- hchildren.add c
+ if ctx.filter_mclass(c) then hchildren.add c
end
# descendants
var hdescendants = new HashSet[MClass]
for c in mclass.in_hierarchy(mainmodule).smallers do
if c == mclass then continue
end
# descendants
var hdescendants = new HashSet[MClass]
for c in mclass.in_hierarchy(mainmodule).smallers do
if c == mclass then continue
- if c.visibility < ctx.min_visibility then continue
+ if not ctx.filter_mclass(c) then continue
if hchildren.has(c) then continue
hdescendants.add c
end
if hchildren.has(c) then continue
hdescendants.add c
end