From 4d8158b19447f82102d124c457cf48b47bf85e86 Mon Sep 17 00:00:00 2001 From: Alexandre Terrasa Date: Sat, 20 Jul 2013 10:40:26 -0400 Subject: [PATCH] ni_nitdoc: also display VT in module column Signed-off-by: Alexandre Terrasa --- src/ni_nitdoc.nit | 49 +++++++++++++++++++++++++++++++------------------ 1 file changed, 31 insertions(+), 18 deletions(-) diff --git a/src/ni_nitdoc.nit b/src/ni_nitdoc.nit index d05eab7..9696c0f 100644 --- a/src/ni_nitdoc.nit +++ b/src/ni_nitdoc.nit @@ -569,6 +569,7 @@ class NitdocModule append("") end + # display the class column fun classes do var amodule = mbuilder.mmodule2nmodule[mmodule] var intro_mclasses = mmodule.intro_mclasses @@ -605,7 +606,9 @@ class NitdocModule append("") end + # display the property column fun properties do + # get properties var amodule = mbuilder.mmodule2nmodule[mmodule] var mpropdefs = new HashSet[MPropDef] for m in mmodule.in_nesting.greaters do @@ -615,23 +618,14 @@ class NitdocModule var sorted = mpropdefs.to_a var sorter = new ComparableSorter[MPropDef] sorter.sort(sorted) + # display properties in one column append("
") append("

Properties

") append("
    ") - for p in sorted do - if p isa MAttributeDef then continue - if p.mproperty.visibility <= none_visibility then continue - if not mbuilder.mpropdef2npropdef.has_key(p) then continue - var nprop = mbuilder.mpropdef2npropdef[p] - if p.is_intro then - append("
  • ") - append("I {p.link(nprop)} ({p.mclassdef.mclass.name})") - append("
  • ") - else - append("
  • ") - append("R {p.link(nprop)} ({p.mclassdef.mclass.name})") - append("
  • ") - end + for mprop in sorted do + if mprop isa MAttributeDef then continue + if mprop.mproperty.visibility <= none_visibility then continue + append(mprop.html_list_item(mbuilder)) end append("
") append("
") @@ -743,7 +737,6 @@ class NitdocClass private fun display_mpropdef_list(list: Array[MPropDef]) do append("") @@ -1101,8 +1094,28 @@ redef class MPropDef redef fun <(other: OTHER): Bool do return self.mproperty.name < other.mproperty.name # Return a link (html a tag) to the nitdoc class page - fun link(nprop: APropdef): String do - return "{mproperty.name}" + fun link(mbuilder: ModelBuilder): String do + if mbuilder.mpropdef2npropdef.has_key(self) then + var nprop = mbuilder.mpropdef2npropdef[self] + return "{mproperty.name}" + else + return "{mproperty.name}" + end + end + + # Return a list item for the mpropdef + fun html_list_item(mbuilder: ModelBuilder): String do + var res = new Buffer + if is_intro then + res.append("
  • ") + res.append("I {link(mbuilder)} ({mclassdef.mclass.name})") + res.append("
  • ") + else + res.append("
  • ") + res.append("R {link(mbuilder)} ({mclassdef.mclass.name})") + res.append("
  • ") + end + return res.to_s end end -- 1.7.9.5