--- /dev/null
+# This file is part of NIT ( http://www.nitlanguage.org ).
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+# Render commands results as Markdown
+module commands_md
+
+import commands::commands_graph
+import commands::commands_usage
+import commands::commands_ini
+import commands::commands_main
+
+import doc_down
+
+redef class DocCommand
+
+ # Render results as a Markdown string
+ fun to_md: Writable do return "**Not yet implemented**"
+end
+
+redef class CmdMessage
+
+ # Render the message as a HTML string
+ fun to_md: Writable is abstract
+end
+
+redef class CmdError
+ redef fun to_md do return "**Error: {to_s}**"
+end
+
+redef class CmdWarning
+ redef fun to_md do return "**Warning: {to_s}**"
+end
+
+# Model commands
+
+redef class CmdEntity
+ redef fun to_md do
+ var mentity = self.mentity
+ if mentity == null then return ""
+ return "`{mentity.name}`"
+ end
+end
+
+redef class CmdEntities
+ redef fun to_md do
+ var mentities = self.results
+ if mentities == null then return ""
+
+ var tpl = new Template
+ for mentity in mentities do
+ var mdoc = mentity.mdoc_or_fallback
+ tpl.add "* `{mentity}`"
+ if mdoc != null then
+ tpl.add " - "
+ tpl.add mdoc.synopsis
+ end
+ tpl.add "\n"
+ end
+ return tpl.write_to_string
+ end
+end
+
+redef class CmdComment
+ redef fun to_md do
+ var mentity = self.mentity
+ if mentity == null then return ""
+
+ var mdoc = self.mdoc
+ var tpl = new Template
+ tpl.add "### `{mentity}`"
+ if mdoc != null then
+ tpl.add " - "
+ tpl.add mdoc.synopsis
+ end
+ tpl.add "\n"
+ if mdoc != null then
+ tpl.add mdoc.comment
+ end
+ return tpl.write_to_string
+ end
+end
+
+redef class CmdEntityLink
+ redef fun to_md do
+ var mentity = self.mentity
+ if mentity == null then return ""
+ return "`{mentity}`"
+ end
+end
+
+redef class CmdEntityCode
+ redef fun to_md do
+ var output = render_code(node)
+ if output == null then return ""
+
+ var tpl = new Template
+ tpl.addn "~~~nit"
+ tpl.add output.write_to_string
+ tpl.addn "~~~"
+ return tpl.write_to_string
+ end
+end
+
+redef class CmdAncestors
+ redef fun to_md do return super # FIXME lin
+end
+
+redef class CmdParents
+ redef fun to_md do return super # FIXME lin
+end
+
+redef class CmdChildren
+ redef fun to_md do return super # FIXME lin
+end
+
+redef class CmdDescendants
+ redef fun to_md do return super # FIXME lin
+end
+
+redef class CmdFeatures
+ redef fun to_md do return super # FIXME lin
+end
+
+redef class CmdLinearization
+ redef fun to_md do return super # FIXME lin
+end
+
+# Usage commands
+
+redef class CmdNew
+ redef fun to_md do return super # FIXME lin
+end
+
+redef class CmdCall
+ redef fun to_md do return super # FIXME lin
+end
+
+redef class CmdReturn
+ redef fun to_md do return super # FIXME lin
+end
+
+redef class CmdParam
+ redef fun to_md do return super # FIXME lin
+end
+
+# Graph commands
+
+redef class CmdGraph
+ redef fun to_md do
+ var output = render
+ if output == null then return ""
+ return output.write_to_string
+ end
+end
+
+# Ini commands
+
+redef class CmdIniDescription
+ redef fun to_md do
+ var desc = self.desc
+ if desc == null then return ""
+
+ return desc
+ end
+end
+
+redef class CmdIniGitUrl
+ redef fun to_md do
+ var url = self.url
+ if url == null then return ""
+ return "[{url}]({url})"
+ end
+end
+
+redef class CmdIniCloneCommand
+ redef fun to_md do
+ var command = self.command
+ if command == null then return ""
+
+ var tpl = new Template
+ tpl.addn "~~~sh"
+ tpl.addn command
+ tpl.addn "~~~"
+ return tpl.write_to_string
+ end
+end
+
+redef class CmdIniIssuesUrl
+ redef fun to_md do
+ var url = self.url
+ if url == null then return ""
+ return "[{url}]({url})"
+ end
+end
+
+redef class CmdIniMaintainer
+ redef fun to_md do
+ var name = self.maintainer
+ if name == null then return ""
+ return "**{name}**"
+ end
+end
+
+redef class CmdIniContributors
+ redef fun to_md do
+ var names = self.contributors
+ if names == null or names.is_empty then return ""
+
+ var tpl = new Template
+ for name in names do
+ tpl.addn "* **{name}**"
+ end
+ return tpl.write_to_string
+ end
+end
+
+redef class CmdIniLicense
+ redef fun to_md do
+ var license = self.license
+ if license == null then return ""
+ return "[{license}](https://opensource.org/licenses/{license})"
+ end
+end
+
+redef class CmdEntityFile
+
+ # URL to the file
+ #
+ # Can be refined in subtools.
+ var file_url: nullable String = file is lazy, writable
+
+ redef fun to_md do
+ var file = self.file
+ if file == null then return ""
+ return "[{file.basename}]({file_url or else ""})"
+ end
+end
+
+redef class CmdEntityFileContent
+ redef fun to_md do
+ var content = self.content
+ if content == null then return ""
+
+ var tpl = new Template
+ tpl.addn "~~~"
+ tpl.add content
+ tpl.addn "~~~"
+ return tpl.write_to_string
+ end
+end
+
+# Main commands
+
+redef class CmdMains
+ redef fun to_md do return super # FIXME lin
+end
+
+redef class CmdMainCompile
+ redef fun to_md do
+ var command = self.command
+ if command == null then return ""
+
+ var tpl = new Template
+ tpl.addn "~~~sh"
+ tpl.addn command
+ tpl.addn "~~~"
+ return tpl.write_to_string
+ end
+end
+
+redef class CmdManSynopsis
+ redef fun to_md do
+ var synopsis = self.synopsis
+ if synopsis == null then return ""
+
+ var tpl = new Template
+ tpl.addn "~~~"
+ tpl.addn synopsis
+ tpl.addn "~~~"
+ return tpl.write_to_string
+ end
+end
+
+redef class CmdManOptions
+ redef fun to_md do
+ var options = self.options
+ if options == null or options.is_empty then return ""
+
+ var tpl = new Template
+ tpl.addn "~~~"
+ for opt, desc in options do
+ tpl.addn "* {opt}\t\t{desc}"
+ end
+ tpl.addn "~~~"
+
+ return tpl.write_to_string
+ end
+end
+
+redef class CmdTesting
+ redef fun to_md do
+ var command = self.command
+ if command == null then return ""
+
+ var tpl = new Template
+ tpl.addn "~~~sh"
+ tpl.addn command
+ tpl.addn "~~~"
+ return tpl.write_to_string
+ end
+end
--- /dev/null
+# This file is part of NIT ( http://www.nitlanguage.org ).
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+module test_commands_md is test
+
+import test_commands
+intrude import doc::commands::commands_main
+import doc::commands::commands_md
+
+class TestCommandsHtml
+ super TestCommands
+ test
+
+ fun print_md(md: nullable Writable) do
+ if md == null then return
+ printn md
+ end
+
+ # CmdEntity
+
+ fun test_cmd_entity is test do
+ var cmd = new CmdEntity(test_view, mentity_name = "test_prog::Character")
+ cmd.init_command
+ print_md cmd.to_md
+ end
+
+ fun test_cmd_comment is test do
+ var cmd = new CmdComment(test_view, mentity_name = "test_prog::Character")
+ cmd.init_command
+ print_md cmd.to_md
+ end
+
+ fun test_cmd_link is test do
+ var cmd = new CmdEntityLink(test_view, mentity_name = "test_prog::Character")
+ cmd.init_command
+ print_md cmd.to_md
+ end
+
+ # CmdInheritance
+
+ fun test_cmd_parents is test do
+ var cmd = new CmdParents(test_view, mentity_name = "test_prog::Warrior")
+ cmd.init_command
+ print_md cmd.to_md
+ end
+
+ fun test_cmd_ancestors is test do
+ var cmd = new CmdAncestors(test_view, mentity_name = "test_prog::Warrior", parents = false)
+ cmd.init_command
+ print_md cmd.to_md
+ end
+
+ fun test_cmd_children is test do
+ var cmd = new CmdChildren(test_view, mentity_name = "test_prog::Career")
+ cmd.init_command
+ print_md cmd.to_md
+ end
+
+ fun test_cmd_descendants is test do
+ var cmd = new CmdDescendants(test_view, mentity_name = "test_prog::Career")
+ cmd.init_command
+ print_md cmd.to_md
+ end
+
+ # CmdSearch
+
+ fun test_cmd_search is test do
+ var cmd = new CmdSearch(test_view, query = "Carer", limit = 10)
+ cmd.init_command
+ print_md cmd.to_md
+ end
+
+ # CmdFeatures
+
+ fun test_cmd_features is test do
+ var cmd = new CmdFeatures(test_view, mentity_name = "test_prog::Career")
+ cmd.init_command
+ print_md cmd.to_md
+ end
+
+ # CmdLinearization
+
+ fun test_cmd_lin is test do
+ var cmd = new CmdLinearization(test_view, mentity_name = "init")
+ cmd.init_command
+ print_md cmd.to_md
+ end
+
+ # CmdModel
+
+ fun test_cmd_mentities is test do
+ var cmd = new CmdModelEntities(test_view, kind = "modules")
+ cmd.init_command
+ print_md cmd.to_md
+ end
+
+ # CmdUsage
+
+ fun test_cmd_new is test do
+ var cmd = new CmdNew(test_view, test_builder, mentity_name = "test_prog::Character")
+ cmd.init_command
+ print_md cmd.to_md
+ end
+
+ fun test_cmd_call is test do
+ var cmd = new CmdCall(test_view, test_builder, mentity_name = "strength_bonus")
+ cmd.init_command
+ print_md cmd.to_md
+ end
+
+ fun test_cmd_return is test do
+ var cmd = new CmdReturn(test_view, mentity_name = "test_prog::Character")
+ cmd.init_command
+ print_md cmd.to_md
+ end
+
+ fun test_cmd_param is test do
+ var cmd = new CmdParam(test_view, mentity_name = "test_prog::Character")
+ cmd.init_command
+ print_md cmd.to_md
+ end
+
+ # CmdIni
+
+ fun test_cmd_ini_desc is test do
+ var cmd = new CmdIniDescription(test_view, mentity_name = "test_prog")
+ cmd.init_command
+ print_md cmd.to_md
+ end
+
+ fun test_cmd_ini_git is test do
+ var cmd = new CmdIniGitUrl(test_view, mentity_name = "test_prog")
+ cmd.init_command
+ print_md cmd.to_md
+ end
+
+ fun test_cmd_ini_clone is test do
+ var cmd = new CmdIniCloneCommand(test_view, mentity_name = "test_prog")
+ cmd.init_command
+ print_md cmd.to_md
+ end
+
+ fun test_cmd_ini_issues is test do
+ var cmd = new CmdIniIssuesUrl(test_view, mentity_name = "test_prog")
+ cmd.init_command
+ print_md cmd.to_md
+ end
+
+ fun test_cmd_ini_maintainer is test do
+ var cmd = new CmdIniMaintainer(test_view, mentity_name = "test_prog")
+ cmd.init_command
+ print_md cmd.to_md
+ end
+
+ fun test_cmd_ini_contributors is test do
+ var cmd = new CmdIniContributors(test_view, mentity_name = "test_prog")
+ cmd.init_command
+ print_md cmd.to_md
+ end
+
+ fun test_cmd_ini_license is test do
+ var cmd = new CmdIniLicense(test_view, mentity_name = "test_prog")
+ cmd.init_command
+ print_md cmd.to_md
+ end
+
+ fun test_cmd_ini_license_file is test do
+ var cmd = new CmdLicenseFile(test_view, mentity_name = "test_prog")
+ cmd.init_command
+ cmd.file = cmd.file.as(not null).basename # for testing path
+ print_md cmd.to_md
+ end
+
+ fun test_cmd_ini_license_file_content is test do
+ var cmd = new CmdLicenseFileContent(test_view, mentity_name = "test_prog")
+ cmd.init_command
+ cmd.file = cmd.file.as(not null).basename # for testing path
+ print_md cmd.to_md
+ end
+
+ fun test_cmd_ini_contrib_file is test do
+ var cmd = new CmdContribFile(test_view, mentity_name = "test_prog")
+ cmd.init_command
+ cmd.file = cmd.file.as(not null).basename # for testing path
+ print_md cmd.to_md
+ end
+
+ fun test_cmd_ini_contrib_file_content is test do
+ var cmd = new CmdContribFileContent(test_view, mentity_name = "test_prog")
+ cmd.init_command
+ cmd.file = cmd.file.as(not null).basename # for testing path
+ print_md cmd.to_md
+ end
+
+ # CmdMain
+
+ fun test_cmd_mains is test do
+ var cmd = new CmdMains(test_view, mentity_name = "test_prog")
+ cmd.init_command
+ print_md cmd.to_md
+ 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_md cmd.to_md
+ end
+
+ fun test_cmd_testing is test do
+ var cmd = new CmdTesting(test_view, mentity_name = "test_prog")
+ cmd.init_command
+ print_md cmd.to_md
+ end
+
+ fun test_cmd_man_synopsis is test do
+ var cmd = new CmdManSynopsis(test_view, mentity_name = "test_prog")
+ cmd.init_command
+ print_md cmd.to_md
+ end
+
+ fun test_cmd_man_options is test do
+ var cmd = new CmdManOptions(test_view, mentity_name = "test_prog")
+ cmd.init_command
+ print_md cmd.to_md
+ 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
+* `Object` - Root of everything.
--- /dev/null
+* `character$Character$init`
+* `character$Character$total_strengh` - The actual strength of the character.
--- /dev/null
+* `Alcoholic` - Alcoholics are good to nothing escept taking punches.
+* `Magician` - Magicians know magic and how to use it.
+* `Warrior` - Warriors are good for fighting.
--- /dev/null
+### `Character` - Characters can be played by both the human or the machine.
--- /dev/null
+* `Alcoholic` - Alcoholics are good to nothing escept taking punches.
+* `Magician` - Magicians know magic and how to use it.
+* `Warrior` - Warriors are good for fighting.
--- /dev/null
+`Character`
\ No newline at end of file
--- /dev/null
+* `_endurance_bonus`
+* `_intelligence_bonus`
+* `_strength_bonus`
+* `endurance_bonus`
+* `endurance_bonus=`
+* `careers$Career$init`
+* `intelligence_bonus`
+* `intelligence_bonus=`
+* `strength_bonus`
+* `strength_bonus=`
--- /dev/null
+~~~sh
+git clone https://github.com/nitlang/nit.git
+~~~
--- /dev/null
+[CONTRIBUTING.md](CONTRIBUTING.md)
\ No newline at end of file
--- /dev/null
+~~~
+# Contributing rules
+
+* Be nice
+* Be polite
+* Code well
+~~~
--- /dev/null
+* **Riri <riri@example.com>**
+* **Fifi (http://www.example.com/~fifi)**
+* **Loulou**
--- /dev/null
+Dummy program used for testing Nit tools
\ No newline at end of file
--- /dev/null
+[https://github.com/nitlang/nit.git](https://github.com/nitlang/nit.git)
\ No newline at end of file
--- /dev/null
+[https://github.com/nitlang/nit/issues](https://github.com/nitlang/nit/issues)
\ No newline at end of file
--- /dev/null
+[Apache-2.0](https://opensource.org/licenses/Apache-2.0)
\ No newline at end of file
--- /dev/null
+[LICENSE.md](LICENSE.md)
\ No newline at end of file
--- /dev/null
+~~~
+# My Custom License
+
+This is the license content.
+~~~
--- /dev/null
+**John Doe <jdoe@example.com> (http://www.example.com/~jdoe), Spider-Man**
\ No newline at end of file
--- /dev/null
+* `platform$Object$init`
+* `races$Race$init`
+* `careers$Career$init`
+* `races$Human$init`
+* `races$Elf$init`
+* `careers$Warrior$init`
+* `careers$Magician$init`
+* `careers$Alcoholic$init`
+* `character$Character$init`
+* `races$Dwarf$init`
--- /dev/null
+`Character`
\ No newline at end of file
--- /dev/null
+~~~sh
+nitc test_prog.nit
+~~~
--- /dev/null
+* `test_prog` - A test program with a fake model to check model tools.
--- /dev/null
+~~~
+* --opt1 Option 1.
+* --opt2 Option 2.
+~~~
--- /dev/null
+~~~
+test_prog [*options*] ARGS...
+~~~
--- /dev/null
+* `careers` - Careers of the game.
+* `character` - Characters are playable entity in the world.
+* `combat` - COmbat interactions between characters.
+* `excluded`
+* `game` - A game abstraction for RPG.
+* `game_examples`
+* `platform` - Declares base types allowed on the platform.
+* `races` - Races of the game.
+* `rpg` - A worlg RPG abstraction.
+* `test_game`
+* `test_prog` - A test program with a fake model to check model tools.
--- /dev/null
+* `Career` - A `Career` gives a characteristic bonus or malus to the character.
--- /dev/null
+* `Career` - A `Career` gives a characteristic bonus or malus to the character.
+* `career` - The current `Career` of the character.
+* `game` - Gaming group
+* `game` - A game abstraction for RPG.
+* `races` - Races of the game.
+* `careers` - Careers of the game.
+* `Game` - This is the interface you have to implement to use ure gaming platform.
+* `Race` - Race determines basic characteristics and what the character will be able to do in life.
+* `Starter`
+* `age`
--- /dev/null
+~~~sh
+nitunit tests
+~~~