From d06b014e06070a3b9e205d65df4e970209b5f7ac Mon Sep 17 00:00:00 2001 From: Alexandre Terrasa Date: Wed, 10 Jul 2013 01:07:14 -0400 Subject: [PATCH] ni_nitdoc: fixed class inheritance display Signed-off-by: Alexandre Terrasa --- src/ni_nitdoc.nit | 21 +++++++++++++++------ 1 file changed, 15 insertions(+), 6 deletions(-) diff --git a/src/ni_nitdoc.nit b/src/ni_nitdoc.nit index 048af66..85b975f 100644 --- a/src/ni_nitdoc.nit +++ b/src/ni_nitdoc.nit @@ -848,30 +848,39 @@ class NitdocMClasses var sorterp = new ComparableSorter[MClass] open("nav") add("h3").text("Inheritance") - if mclass.parents.length > 0 then - sorted = mclass.parents.to_a + if mclass.ancestors.length > 1 then + sorted = mclass.ancestors.to_a sorterp.sort(sorted) add("h4").text("Superclasses") open("ul") - for sup in sorted do add_html("
  • {sup.name}
  • ") + for sup in sorted do + if sup == mclass then continue + add_html("
  • {sup.name}
  • ") + end close("ul") end - if mclass.descendants.length is 0 then + if mclass.descendants.length <= 1 then add("h4").text("No Known Subclasses") else if mclass.descendants.length <= 100 then sorted = mclass.descendants.to_a sorterp.sort(sorted) add("h4").text("Subclasses") open("ul") - for sub in sorted do add_html("
  • {sub.name}
  • ") + for sub in sorted do + if sub == mclass then continue + add_html("
  • {sub.name}
  • ") + end close("ul") else if mclass.children.length <= 100 then sorted = mclass.children.to_a sorterp.sort(sorted) add("h4").text("Direct Subclasses Only") open("ul") - for sub in sorted do add_html("
  • {sub.name}
  • ") + for sub in sorted do + if sub == mclass then continue + add_html("
  • {sub.name}
  • ") + end close("ul") else add("h4").text("Too much Subclasses to list") -- 1.7.9.5