Merge: src/doc/commands: clean commands hierarchy
[nit.git] / src / doc / term / term.nit
index 5010fc9..7d490e4 100644 (file)
@@ -15,7 +15,8 @@
 module term
 
 import commands::commands_parser
-import templates::templates_term
+import templates::term_model
+import templates::md_commands
 
 redef class CommandParser
 
@@ -221,13 +222,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