src/doc/commands/templates: rename `templates_json` in `json_model`
[nit.git] / src / doc / term / term.nit
index 58ad127..d653969 100644 (file)
@@ -15,7 +15,7 @@
 module term
 
 import commands::commands_parser
-import templates::templates_term
+import templates::term_model
 
 redef class CommandParser
 
@@ -25,7 +25,7 @@ redef class CommandParser
 
                # Translate links to doc commands
                if cmd isa CmdEntityLink then
-                       cmd = new CmdComment(view, mentity_name = query)
+                       cmd = new CmdComment(model, filter, mentity_name = query)
                        var opts = new HashMap[String, String]
                        var status = cmd.parser_init(query, opts)
                        if not status isa CmdSuccess then error = status
@@ -221,13 +221,12 @@ redef class CmdEntityCode
                else
                        print title
                end
-               if no_color == null or not no_color then
+               var node = self.node
+               if (no_color == null or not no_color) and node != null then
                        var ansi = render_code(node)
-                       if ansi != null then
-                               print "~~~"
-                               print ansi.write_to_string
-                               print "~~~"
-                       end
+                       print "~~~"
+                       print ansi.write_to_string
+                       print "~~~"
                else
                        printn mentity.cs_source_code
                end