From 0916777b9eb50f560e011fcd6faa29873e60487a Mon Sep 17 00:00:00 2001 From: Jean Privat Date: Wed, 9 Sep 2015 11:46:22 -0400 Subject: [PATCH] nitcatalog: add a *content* section with the modules and groups Signed-off-by: Jean Privat --- src/nitcatalog.nit | 47 ++++++++++++++++++++++++++++++++++++++++++++++- 1 file changed, 46 insertions(+), 1 deletion(-) diff --git a/src/nitcatalog.nit b/src/nitcatalog.nit index c843b51..fe6d8c7 100644 --- a/src/nitcatalog.nit +++ b/src/nitcatalog.nit @@ -25,7 +25,7 @@ # * [X] generate a page per package with the readme and most metadata # * [ ] link/include/be included in the documentation # * [ ] propose `related packages` -# * [ ] show directory content (a la nitls) +# * [X] show directory content (a la nitls) # * [X] gather git information from the working directory # * [ ] gather git information from the repository # * [ ] gather package information from github @@ -238,6 +238,34 @@ class Catalog res.add "" end + # Recursively generate a level in the file tree of the *content* section + private fun gen_content_level(ot: OrderedTree[Object], os: Array[Object], res: Template) + do + res.add "\n" + end # Compute information and generate a full HTML page for a package fun package_page(mpackage: MPackage): Writable @@ -257,6 +285,23 @@ class Catalog res.add mdoc.html_documentation score += mdoc.content.length.score end + + res.add "

Content

" + var ot = new OrderedTree[Object] + for g in mpackage.mgroups do + var pa = g.parent + if g.is_interesting then + ot.add(pa, g) + pa = g + end + for mp in g.module_paths do + ot.add(pa, mp) + end + end + ot.sort_with(alpha_comparator) + gen_content_level(ot, ot.roots, res) + + res.add """