nitweb: allow options in graph card
authorAlexandre Terrasa <alexandre@moz-code.org>
Tue, 26 Sep 2017 20:25:45 +0000 (16:25 -0400)
committerAlexandre Terrasa <alexandre@moz-code.org>
Thu, 28 Sep 2017 22:39:32 +0000 (18:39 -0400)
Signed-off-by: Alexandre Terrasa <alexandre@moz-code.org>

src/web/api_docdown.nit

index 80c50c7..a5ca012 100644 (file)
@@ -317,7 +317,11 @@ redef class GraphCommand
                var mentity = v.find_mentity(model, name)
                if mentity == null then return
                var g = new InheritanceGraph(mentity, model)
-               v.add g.draw(3, 3).to_svg
+               var pdepth = if opts.has_key("pdepth") and opts["pdepth"].is_int then
+                       opts["pdepth"].to_i else 3
+               var cdepth = if opts.has_key("cdepth") and opts["cdepth"].is_int then
+                       opts["cdepth"].to_i else 3
+               v.add g.draw(pdepth, cdepth).to_svg
        end
 end