import commands::commands_graph
import commands::commands_usage
import commands::commands_ini
+import commands::commands_main
import templates::templates_html
import doc_down
return "<pre>{content}</pre>"
end
end
+
+# Main commands
+
+redef class CmdMains
+ redef fun to_html do return super # FIXME lin
+end
+
+redef class CmdMainCompile
+ redef fun to_html do
+ var command = self.command
+ if command == null then return ""
+
+ return "<pre>{command}</pre>"
+ end
+end
+
+redef class CmdManSynopsis
+ redef fun to_html do
+ var synopsis = self.synopsis
+ if synopsis == null then return ""
+
+ return "<pre>{synopsis}</pre>"
+ end
+end
+
+redef class CmdManOptions
+ redef fun to_html do
+ var options = self.options
+ if options == null or options.is_empty then return ""
+
+ var tpl = new Template
+ tpl.addn "<pre>"
+ tpl.addn "<table width='100%'>"
+ for opt, desc in options do
+ tpl.addn "<tr>"
+ tpl.addn "<th valign='top' width='30%'>{opt}</th>"
+ tpl.addn "<td width='70%'>{desc}</td>"
+ tpl.addn "</tr>"
+ end
+ tpl.addn "</table>"
+ tpl.addn "</pre>"
+
+ return tpl.write_to_string
+ end
+end
+
+redef class CmdTesting
+ redef fun to_html do
+ var command = self.command
+ if command == null then return ""
+
+ return "<pre>{command}</pre>"
+ end
+end
module test_commands_html is test
import test_commands
+intrude import doc::commands::commands_main
import doc::commands::commands_html
class TestCommandsHtml
cmd.file = cmd.file.as(not null).basename # for testing path
print_html cmd.to_html
end
+
+ # CmdMain
+
+ fun test_cmd_mains is test do
+ var cmd = new CmdMains(test_view, mentity_name = "test_prog")
+ cmd.init_command
+ print_html cmd.to_html
+ end
+
+ fun test_cmd_main_compile is test do
+ var cmd = new CmdMainCompile(test_view, mentity_name = "test_prog::test_prog")
+ cmd.init_command
+ print_html cmd.to_html
+ end
+
+ fun test_cmd_testing is test do
+ var cmd = new CmdTesting(test_view, mentity_name = "test_prog")
+ cmd.init_command
+ print_html cmd.to_html
+ end
+
+ fun test_cmd_man_synopsis is test do
+ var cmd = new CmdManSynopsis(test_view, mentity_name = "test_prog")
+ cmd.init_command
+ print_html cmd.to_html
+ end
+
+ fun test_cmd_man_options is test do
+ var cmd = new CmdManOptions(test_view, mentity_name = "test_prog")
+ cmd.init_command
+ print_html cmd.to_html
+ end
+end
+
+# Avoid path diff
+redef class CmdMainCompile
+ redef fun test_path(file) do
+ if file == null then return null
+ return file.filename.basename
+ end
+end
+
+# Avoid path diff
+redef class CmdTesting
+ redef fun test_path(mentity) do
+ var file = mentity.location.file
+ if file == null then return null
+ return file.filename.basename
+ end
end
--- /dev/null
+<pre>nitc test_prog.nit</pre>
--- /dev/null
+<ul><li><a href="test_prog_58d_58dtest_prog" title="A test program with a fake model to check model tools.">test_prog</a> - <span class="synopsys nitdoc">A test program with a fake model to check model tools.</span></li></ul>
--- /dev/null
+<pre>
+<table width='100%'>
+<tr>
+<th valign='top' width='30%'>--opt1</th>
+<td width='70%'>Option 1.</td>
+</tr>
+<tr>
+<th valign='top' width='30%'>--opt2</th>
+<td width='70%'>Option 2.</td>
+</tr>
+</table>
+</pre>
+
--- /dev/null
+<pre>test_prog [*options*] ARGS...</pre>
-<ul><li><a href="test_prog_58d_58dcareers" title="Careers of the game.">careers</a> - <span class="synopsys nitdoc">Careers of the game.</span></li><li><a href="test_prog_58d_58dcharacter" title="Characters are playable entity in the world.">character</a> - <span class="synopsys nitdoc">Characters are playable entity in the world.</span></li><li><a href="test_prog_58d_58dcombat" title="COmbat interactions between characters.">combat</a> - <span class="synopsys nitdoc">COmbat interactions between characters.</span></li><li><a href="excluded_58d_58dexcluded">excluded</a></li><li><a href="test_prog_58d_58dgame" title="A game abstraction for RPG.">game</a> - <span class="synopsys nitdoc">A game abstraction for RPG.</span></li><li><a href="test_prog_58d_58dgame_examples">game_examples</a></li><li><a href="test_prog_58d_58dplatform" title="Declares base types allowed on the platform.">platform</a> - <span class="synopsys nitdoc">Declares base types allowed on the platform.</span></li><li><a href="test_prog_58d_58draces" title="Races of the game.">races</a> - <span class="synopsys nitdoc">Races of the game.</span></li><li><a href="test_prog_58d_58drpg" title="A worlg RPG abstraction.">rpg</a> - <span class="synopsys nitdoc">A worlg RPG abstraction.</span></li><li><a href="test_prog_58d_58dtest_prog" title="A test program with a fake model to check model tools.">test_prog</a> - <span class="synopsys nitdoc">A test program with a fake model to check model tools.</span></li></ul>
+<ul><li><a href="test_prog_58d_58dcareers" title="Careers of the game.">careers</a> - <span class="synopsys nitdoc">Careers of the game.</span></li><li><a href="test_prog_58d_58dcharacter" title="Characters are playable entity in the world.">character</a> - <span class="synopsys nitdoc">Characters are playable entity in the world.</span></li><li><a href="test_prog_58d_58dcombat" title="COmbat interactions between characters.">combat</a> - <span class="synopsys nitdoc">COmbat interactions between characters.</span></li><li><a href="excluded_58d_58dexcluded">excluded</a></li><li><a href="test_prog_58d_58dgame" title="A game abstraction for RPG.">game</a> - <span class="synopsys nitdoc">A game abstraction for RPG.</span></li><li><a href="test_prog_58d_58dgame_examples">game_examples</a></li><li><a href="test_prog_58d_58dplatform" title="Declares base types allowed on the platform.">platform</a> - <span class="synopsys nitdoc">Declares base types allowed on the platform.</span></li><li><a href="test_prog_58d_58draces" title="Races of the game.">races</a> - <span class="synopsys nitdoc">Races of the game.</span></li><li><a href="test_prog_58d_58drpg" title="A worlg RPG abstraction.">rpg</a> - <span class="synopsys nitdoc">A worlg RPG abstraction.</span></li><li><a href="test_prog_58d_58dtest_game">test_game</a></li><li><a href="test_prog_58d_58dtest_prog" title="A test program with a fake model to check model tools.">test_prog</a> - <span class="synopsys nitdoc">A test program with a fake model to check model tools.</span></li></ul>
--- /dev/null
+<pre>nitunit tests</pre>