X-Git-Url: http://nitlanguage.org diff --git a/src/doc/doc_model.nit b/src/doc/doc_model.nit index 023290d..9080dbf 100644 --- a/src/doc/doc_model.nit +++ b/src/doc/doc_model.nit @@ -16,9 +16,9 @@ module doc_model import model_utils -import modelize_property import markdown import doc_templates +import ordered_tree redef class MDoc # Comment synopsys HTML escaped @@ -144,10 +144,9 @@ redef class MConcern end redef class MProject - redef fun nitdoc_name do return name.html_escape redef fun nitdoc_id do return nitdoc_name - redef fun nitdoc_url do return "project_{name}.html" + redef fun nitdoc_url do return root.nitdoc_url redef fun mdoc do if root != null then @@ -218,14 +217,9 @@ redef class MGroup end return tpl end - - redef fun tpl_css_classes do return ["public"] end redef class MModule - # Is the mmodule created by nitdoc for internal purpose? - var is_fictive: Bool writable = false - redef fun nitdoc_name do return name.html_escape redef fun nitdoc_id do @@ -272,13 +266,6 @@ redef class MModule return tpl end - redef fun tpl_title do - var title = new Template - title.add tpl_icon - title.add tpl_namespace - return title - end - redef fun tpl_css_classes do return ["public"] end @@ -690,3 +677,39 @@ redef class MParameter end end +redef class ConcernsTree + + private var seen = new HashSet[MConcern] + + redef fun add(p, e) do + if seen.has(e) then return + seen.add e + super(p, e) + end + + fun to_tpl: TplList do + var lst = new TplList.with_classes(["list-unstyled", "list-definition"]) + for r in roots do + var li = r.tpl_concern_item + lst.add_li li + build_list(r, li) + end + return lst + end + + private fun build_list(e: MConcern, li: TplListItem) do + if not sub.has_key(e) then return + var subs = sub[e] + var lst = new TplList.with_classes(["list-unstyled", "list-definition"]) + for e2 in subs do + if e2 isa MGroup and e2.is_root then + build_list(e2, li) + else + var sli = e2.tpl_concern_item + lst.add_li sli + build_list(e2, sli) + end + end + li.append lst + end +end