From e8b611ca5025c2cf92e40e426fef146fe27f2b96 Mon Sep 17 00:00:00 2001 From: Alexandre Terrasa Date: Tue, 12 Jun 2018 10:59:31 -0400 Subject: [PATCH 01/19] src/doc/commands: clean importation for `commands_base` Signed-off-by: Alexandre Terrasa --- src/doc/commands/commands_base.nit | 1 - src/doc/commands/commands_catalog.nit | 1 + 2 files changed, 1 insertion(+), 1 deletion(-) diff --git a/src/doc/commands/commands_base.nit b/src/doc/commands/commands_base.nit index b1af0e18df..84ef6568fa 100644 --- a/src/doc/commands/commands_base.nit +++ b/src/doc/commands/commands_base.nit @@ -24,7 +24,6 @@ module commands_base import model::model_index -import catalog # Documentation command # diff --git a/src/doc/commands/commands_catalog.nit b/src/doc/commands/commands_catalog.nit index 0bfe6ab754..d7a5a43308 100644 --- a/src/doc/commands/commands_catalog.nit +++ b/src/doc/commands/commands_catalog.nit @@ -16,6 +16,7 @@ module commands_catalog import commands_model +import catalog # A DocCommand based on a Catalog abstract class CmdCatalog From 5250980e1c5a7bab9c30b39a23a1badf5214f558 Mon Sep 17 00:00:00 2001 From: Alexandre Terrasa Date: Sun, 10 Jun 2018 18:44:07 -0400 Subject: [PATCH 02/19] lib/html: escape Bootstrap links titles Signed-off-by: Alexandre Terrasa --- lib/html/bootstrap.nit | 2 +- src/doc/doc_down.nit | 2 +- src/doc/templates/templates_html.nit | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/lib/html/bootstrap.nit b/lib/html/bootstrap.nit index cc3d6e2986..3e12dd79e6 100644 --- a/lib/html/bootstrap.nit +++ b/lib/html/bootstrap.nit @@ -72,7 +72,7 @@ class Link redef fun rendering do add "{text}" end end diff --git a/src/doc/doc_down.nit b/src/doc/doc_down.nit index f02b1fdf3c..c47da0bddb 100644 --- a/src/doc/doc_down.nit +++ b/src/doc/doc_down.nit @@ -22,7 +22,7 @@ private import parser_util redef class MDoc # Synopsis HTML escaped. - var synopsis: String is lazy do return content.first.html_escape + var synopsis: String is lazy do return content.first # Comment without synopsis HTML escaped var comment: String is lazy do diff --git a/src/doc/templates/templates_html.nit b/src/doc/templates/templates_html.nit index 4faf0a6570..4a2100d08a 100644 --- a/src/doc/templates/templates_html.nit +++ b/src/doc/templates/templates_html.nit @@ -47,7 +47,7 @@ redef class MEntity end var mdoc = self.mdoc_or_fallback if title == null and mdoc != null then - title = mdoc.synopsis.html_escape + title = mdoc.synopsis end return new Link(html_url, text, title) end From 614676651b9e787dd146438359501bc302916021 Mon Sep 17 00:00:00 2001 From: Alexandre Terrasa Date: Sun, 10 Jun 2018 18:47:50 -0400 Subject: [PATCH 03/19] src/doc/doc_down: move base MDoc services to `mdoc` module Signed-off-by: Alexandre Terrasa --- src/doc/doc_down.nit | 13 ------------- src/model/mdoc.nit | 13 +++++++++++++ 2 files changed, 13 insertions(+), 13 deletions(-) diff --git a/src/doc/doc_down.nit b/src/doc/doc_down.nit index c47da0bddb..7d5c24d917 100644 --- a/src/doc/doc_down.nit +++ b/src/doc/doc_down.nit @@ -21,19 +21,6 @@ private import parser_util redef class MDoc - # Synopsis HTML escaped. - var synopsis: String is lazy do return content.first - - # Comment without synopsis HTML escaped - var comment: String is lazy do - var lines = content.to_a - if not lines.is_empty then lines.shift - return lines.join("\n") - end - - # Full comment HTML escaped. - var documentation: String is lazy do return content.join("\n") - private var markdown_proc: MarkdownProcessor is lazy, writable do return original_mentity.as(not null).model.nitdoc_md_processor end diff --git a/src/model/mdoc.nit b/src/model/mdoc.nit index 261fafe3d1..52a6b7aa7e 100644 --- a/src/model/mdoc.nit +++ b/src/model/mdoc.nit @@ -31,6 +31,19 @@ class MDoc # The original location of the doc for error messages var location: Location + + # The comment first line + var synopsis: String is lazy do return content.first + + # All comment lines except for the synopsis + var comment: String is lazy do + var lines = content.to_a + if not lines.is_empty then lines.shift + return lines.join("\n") + end + + # Full comment + var documentation: String is lazy do return content.join("\n") end redef class MEntity From b9c446036cbd56d9ca358b45a3081a26ea24faeb Mon Sep 17 00:00:00 2001 From: Alexandre Terrasa Date: Sun, 10 Jun 2018 19:03:33 -0400 Subject: [PATCH 04/19] src/doc/templates: move `html_list_item` to `static_cards` Signed-off-by: Alexandre Terrasa --- src/doc/static/static_cards.nit | 13 ++++++++++++- src/doc/templates/templates_html.nit | 12 ------------ 2 files changed, 12 insertions(+), 13 deletions(-) diff --git a/src/doc/static/static_cards.nit b/src/doc/static/static_cards.nit index e589ca6ef8..9b706c5171 100644 --- a/src/doc/static/static_cards.nit +++ b/src/doc/static/static_cards.nit @@ -282,10 +282,21 @@ class CardInheritance addn "

{title}

" addn "
    " for mentity in mentities do - addn mentity.html_list_item + addn html_list_item(mentity) end addn "
" end + + private fun html_list_item(mentity: MEntity): ListItem do + var tpl = new Template + tpl.add mentity.html_namespace + var comment = mentity.mdoc_or_fallback + if comment != null then + tpl.add ": " + tpl.add comment.html_synopsis + end + return new ListItem(tpl) + end end # A card about the linearization of a MEntity diff --git a/src/doc/templates/templates_html.nit b/src/doc/templates/templates_html.nit index 4a2100d08a..77e398023a 100644 --- a/src/doc/templates/templates_html.nit +++ b/src/doc/templates/templates_html.nit @@ -86,18 +86,6 @@ redef class MEntity # An icon representative of the mentity fun html_icon: BSIcon do return new BSIcon("tag", ["text-muted"]) - # A li element that can go in a `HTMLList` - fun html_list_item: ListItem do - var tpl = new Template - tpl.add html_namespace - var comment = mdoc_or_fallback - if comment != null then - tpl.add ": " - tpl.add comment.html_synopsis - end - return new ListItem(tpl) - end - # CSS classes used to decorate `self` # # Mainly used for icons. From c7a746fc6e02cf5340b7a254bd0efb8424b30270 Mon Sep 17 00:00:00 2001 From: Alexandre Terrasa Date: Sun, 10 Jun 2018 19:19:40 -0400 Subject: [PATCH 05/19] src/doc/commands: redef `render_comment` in `commands_html` and `commands_md` Signed-off-by: Alexandre Terrasa --- src/doc/commands/commands_html.nit | 11 +++++++++++ src/doc/commands/commands_md.nit | 11 +++++++++++ src/doc/commands/commands_model.nit | 7 +------ 3 files changed, 23 insertions(+), 6 deletions(-) diff --git a/src/doc/commands/commands_html.nit b/src/doc/commands/commands_html.nit index 7aac39ab2d..c712e6c7c2 100644 --- a/src/doc/commands/commands_html.nit +++ b/src/doc/commands/commands_html.nit @@ -104,6 +104,17 @@ redef class CmdComment end return tpl.write_to_string end + + redef fun render_comment do + var mdoc = self.mdoc + if mdoc == null then return null + + if format == "html" then + if full_doc then return mdoc.html_documentation + return mdoc.html_synopsis + end + return super + end end redef class CmdEntityLink diff --git a/src/doc/commands/commands_md.nit b/src/doc/commands/commands_md.nit index 77ad14a02c..78ca986add 100644 --- a/src/doc/commands/commands_md.nit +++ b/src/doc/commands/commands_md.nit @@ -89,6 +89,17 @@ redef class CmdComment end return tpl.write_to_string end + + redef fun render_comment do + var mdoc = self.mdoc + if mdoc == null then return null + + if format == "md" then + if full_doc then return mdoc.md_documentation + return mdoc.md_synopsis + end + return super + end end redef class CmdEntityLink diff --git a/src/doc/commands/commands_model.nit b/src/doc/commands/commands_model.nit index abf5d7d04f..5b51e3f2f3 100644 --- a/src/doc/commands/commands_model.nit +++ b/src/doc/commands/commands_model.nit @@ -23,7 +23,6 @@ import model::model_collect import modelize import modelbuilder import htmlight -import doc_down # Retrieve the MDoc related to a MEntity class CmdComment @@ -47,7 +46,7 @@ class CmdComment # Format to render the comment # - # Can be one of `raw` or `html`. + # Can be one of `raw`, `html` or `md`. # Default is `raw`. var format = "raw" is optional, writable @@ -74,10 +73,6 @@ class CmdComment var mdoc = self.mdoc if mdoc == null then return null - if format == "html" then - if full_doc then return mdoc.html_documentation - return mdoc.html_synopsis - end if full_doc then return mdoc.documentation return mdoc.synopsis end From 0aaffccdea1565b45a302926113e3c82c839f5df Mon Sep 17 00:00:00 2001 From: Alexandre Terrasa Date: Tue, 12 Jun 2018 11:17:48 -0400 Subject: [PATCH 06/19] src/doc/commands: refactor `CmdCode` and `CmdEntityCode` Signed-off-by: Alexandre Terrasa --- src/doc/commands/commands_html.nit | 2 +- src/doc/commands/commands_json.nit | 2 +- src/doc/commands/commands_md.nit | 2 +- src/doc/commands/commands_model.nit | 10 +++++----- src/doc/term/term.nit | 11 +++++------ 5 files changed, 13 insertions(+), 14 deletions(-) diff --git a/src/doc/commands/commands_html.nit b/src/doc/commands/commands_html.nit index c712e6c7c2..88ddfd1dd2 100644 --- a/src/doc/commands/commands_html.nit +++ b/src/doc/commands/commands_html.nit @@ -125,7 +125,7 @@ redef class CmdEntityLink end end -redef class CmdEntityCode +redef class CmdCode redef fun to_html do var output = render_code(node) if output == null then return "" diff --git a/src/doc/commands/commands_json.nit b/src/doc/commands/commands_json.nit index b109c87b5c..cdab14eb67 100644 --- a/src/doc/commands/commands_json.nit +++ b/src/doc/commands/commands_json.nit @@ -86,7 +86,7 @@ redef class CmdEntityLink end end -redef class CmdEntityCode +redef class CmdCode redef fun to_json do var obj = new JsonObject var node = self.node diff --git a/src/doc/commands/commands_md.nit b/src/doc/commands/commands_md.nit index 78ca986add..b2af5109da 100644 --- a/src/doc/commands/commands_md.nit +++ b/src/doc/commands/commands_md.nit @@ -110,7 +110,7 @@ redef class CmdEntityLink end end -redef class CmdEntityCode +redef class CmdCode redef fun to_md do var output = render_code(node) if output == null then return "" diff --git a/src/doc/commands/commands_model.nit b/src/doc/commands/commands_model.nit index 5b51e3f2f3..ff7862e073 100644 --- a/src/doc/commands/commands_model.nit +++ b/src/doc/commands/commands_model.nit @@ -422,10 +422,10 @@ end abstract class CmdCode super DocCommand - autoinit(model, modelbuilder, filter, format) + autoinit(model, filter, node, format) - # ModelBuilder used to get AST nodes - var modelbuilder: ModelBuilder + # AST node to display code from + var node: nullable ANode = null is optional, writable # Rendering format # @@ -470,8 +470,8 @@ class CmdEntityCode autoinit(model, modelbuilder, filter, mentity, mentity_name, format) - # AST node to return - var node: nullable ANode = null is optional, writable + # ModelBuilder used to get AST nodes from entities + var modelbuilder: ModelBuilder # Same as `CmdEntity::init_mentity` # diff --git a/src/doc/term/term.nit b/src/doc/term/term.nit index fc864bbedf..de36f0533e 100644 --- a/src/doc/term/term.nit +++ b/src/doc/term/term.nit @@ -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 From 8d1a526e93dd9157ced8d727b570ba30c24dcb3e Mon Sep 17 00:00:00 2001 From: Alexandre Terrasa Date: Tue, 12 Jun 2018 11:25:31 -0400 Subject: [PATCH 07/19] src/doc/commands: move `render_code` to clients modules Signed-off-by: Alexandre Terrasa --- src/doc/commands/commands_html.nit | 42 ++++++++++++++++++++--------- src/doc/commands/commands_json.nit | 12 ++++----- src/doc/commands/commands_md.nit | 16 ++++++++--- src/doc/commands/commands_model.nit | 25 +---------------- 4 files changed, 48 insertions(+), 47 deletions(-) diff --git a/src/doc/commands/commands_html.nit b/src/doc/commands/commands_html.nit index 88ddfd1dd2..3d74a6bae8 100644 --- a/src/doc/commands/commands_html.nit +++ b/src/doc/commands/commands_html.nit @@ -127,9 +127,35 @@ end redef class CmdCode redef fun to_html do - var output = render_code(node) - if output == null then return "" - return "
{output.write_to_string}
" + var node = self.node + if node == null then return "" + + var code = render_code(node) + return "
{code.write_to_string}
" + end + + redef fun render_code(node) do + if format == "html" then + var hl = new CmdHtmlightVisitor + hl.show_infobox = false + hl.highlight_node node + return hl.html + end + return super + end +end + +# Custom HtmlightVisitor for commands +# +# We create a new subclass so its behavior can be refined in clients without +# breaking the main implementation. +class CmdHtmlightVisitor + super HtmlightVisitor + + redef fun hrefto(mentity) do + if mentity isa MClassDef then return mentity.mclass.html_url + if mentity isa MPropDef then return mentity.mproperty.html_url + return mentity.html_url end end @@ -333,13 +359,3 @@ redef class CmdTesting return "
{command}
" end end - -# Misc - -redef class CmdHtmlightVisitor - redef fun hrefto(mentity) do - if mentity isa MClassDef then return mentity.mclass.html_url - if mentity isa MPropDef then return mentity.mproperty.html_url - return mentity.html_url - end -end diff --git a/src/doc/commands/commands_json.nit b/src/doc/commands/commands_json.nit index cdab14eb67..79a49bea08 100644 --- a/src/doc/commands/commands_json.nit +++ b/src/doc/commands/commands_json.nit @@ -90,13 +90,11 @@ redef class CmdCode redef fun to_json do var obj = new JsonObject var node = self.node - if node != null then - obj["location"] = node.location - end - var output = render_code(node) - if output != null then - obj["code"] = output.write_to_string - end + if node == null then return obj + + var code = render_code(node) + obj["location"] = node.location + obj["code"] = code.write_to_string return obj end end diff --git a/src/doc/commands/commands_md.nit b/src/doc/commands/commands_md.nit index b2af5109da..2670ebde9a 100644 --- a/src/doc/commands/commands_md.nit +++ b/src/doc/commands/commands_md.nit @@ -112,15 +112,25 @@ end redef class CmdCode redef fun to_md do - var output = render_code(node) - if output == null then return "" + var node = self.node + if node == null then return "" + var code = render_code(node) var tpl = new Template tpl.addn "~~~nit" - tpl.add output.write_to_string + tpl.add code.write_to_string tpl.addn "~~~" return tpl.write_to_string end + + redef fun render_code(node) do + if format == "ansi" then + var hl = new AnsiHighlightVisitor + hl.highlight_node node + return hl.result + end + return super + end end redef class CmdAncestors diff --git a/src/doc/commands/commands_model.nit b/src/doc/commands/commands_model.nit index ff7862e073..3a7215b36a 100644 --- a/src/doc/commands/commands_model.nit +++ b/src/doc/commands/commands_model.nit @@ -18,11 +18,7 @@ module commands_model import commands_base - -import model::model_collect import modelize -import modelbuilder -import htmlight # Retrieve the MDoc related to a MEntity class CmdComment @@ -439,30 +435,11 @@ abstract class CmdCode var format = "raw" is optional, writable # Render `node` depending on the selected `format` - fun render_code(node: nullable ANode): nullable Writable do - if node == null then return null - if format == "html" then - var hl = new CmdHtmlightVisitor - hl.show_infobox = false - hl.highlight_node node - return hl.html - else if format == "ansi" then - var hl = new AnsiHighlightVisitor - hl.highlight_node node - return hl.result - end + fun render_code(node: ANode): Writable do return node.location.text end end -# Custom HtmlightVisitor for commands -# -# We create a new subclass so its behavior can be refined in clients without -# breaking the main implementation. -class CmdHtmlightVisitor - super HtmlightVisitor -end - # Cmd that finds the source code related to an `mentity` class CmdEntityCode super CmdEntity From e8bd1bf54a1331555a8b1c5712c661f69191ad84 Mon Sep 17 00:00:00 2001 From: Alexandre Terrasa Date: Tue, 12 Jun 2018 11:37:14 -0400 Subject: [PATCH 08/19] src/doc/commands: clean commands modules importation Signed-off-by: Alexandre Terrasa --- src/doc/commands/commands_html.nit | 9 +++++---- src/doc/commands/commands_http.nit | 8 ++++++-- src/doc/commands/commands_ini.nit | 2 +- src/doc/commands/commands_json.nit | 11 +++++------ src/doc/commands/commands_main.nit | 2 +- src/doc/commands/commands_md.nit | 9 +++++---- src/doc/commands/commands_parser.nit | 11 +++++------ 7 files changed, 28 insertions(+), 24 deletions(-) diff --git a/src/doc/commands/commands_html.nit b/src/doc/commands/commands_html.nit index 3d74a6bae8..56d0e5b320 100644 --- a/src/doc/commands/commands_html.nit +++ b/src/doc/commands/commands_html.nit @@ -15,10 +15,11 @@ # Render commands results as HTML module commands_html -import commands::commands_graph -import commands::commands_usage -import commands::commands_ini -import commands::commands_main +import commands_catalog +import commands_graph +import commands_ini +import commands_main +import commands_usage import templates::templates_html import doc_down diff --git a/src/doc/commands/commands_http.nit b/src/doc/commands/commands_http.nit index 70d2062e5a..28d5a365df 100644 --- a/src/doc/commands/commands_http.nit +++ b/src/doc/commands/commands_http.nit @@ -18,8 +18,12 @@ # To be more generic, param names should be extracted as variables. module commands_http -import commands -import commands::commands_catalog +import commands_catalog +import commands_graph +import commands_ini +import commands_main +import commands_usage + import nitcorn::vararg_routes redef class DocCommand diff --git a/src/doc/commands/commands_ini.nit b/src/doc/commands/commands_ini.nit index 9274fd09b0..df312c4ef8 100644 --- a/src/doc/commands/commands_ini.nit +++ b/src/doc/commands/commands_ini.nit @@ -14,7 +14,7 @@ module commands_ini -import doc::commands::commands_model +import commands_model # Cmd that finds the ini file related to an `mentity` abstract class CmdIni diff --git a/src/doc/commands/commands_json.nit b/src/doc/commands/commands_json.nit index 79a49bea08..045f497fa9 100644 --- a/src/doc/commands/commands_json.nit +++ b/src/doc/commands/commands_json.nit @@ -15,12 +15,11 @@ # Translate command results to json module commands_json -import commands::commands_model -import commands::commands_graph -import commands::commands_usage -import commands::commands_catalog -import commands::commands_ini -import commands::commands_main +import commands_catalog +import commands_graph +import commands_ini +import commands_main +import commands_usage import templates::templates_json import catalog::catalog_json diff --git a/src/doc/commands/commands_main.nit b/src/doc/commands/commands_main.nit index 9533722516..2b3e861cd9 100644 --- a/src/doc/commands/commands_main.nit +++ b/src/doc/commands/commands_main.nit @@ -14,7 +14,7 @@ module commands_main -import doc::commands::commands_model +import commands_model # Cmd that finds the mains of an `mentity` class CmdMains diff --git a/src/doc/commands/commands_md.nit b/src/doc/commands/commands_md.nit index 2670ebde9a..0abb26fa2a 100644 --- a/src/doc/commands/commands_md.nit +++ b/src/doc/commands/commands_md.nit @@ -15,10 +15,11 @@ # 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 commands_catalog +import commands_graph +import commands_ini +import commands_main +import commands_usage import doc_down diff --git a/src/doc/commands/commands_parser.nit b/src/doc/commands/commands_parser.nit index 920b2faa5f..b4c23632d7 100644 --- a/src/doc/commands/commands_parser.nit +++ b/src/doc/commands/commands_parser.nit @@ -17,12 +17,11 @@ # Used by both Nitx and the Markdown doc commands. module commands_parser -import commands::commands_model -import commands::commands_graph -import commands::commands_usage -import commands::commands_catalog -import commands::commands_ini -import commands::commands_main +import commands_catalog +import commands_graph +import commands_ini +import commands_main +import commands_usage # Parse string commands to create DocQueries class CommandParser From 911512f2bcba816b288374c199d89a3bfded7b3c Mon Sep 17 00:00:00 2001 From: Alexandre Terrasa Date: Tue, 12 Jun 2018 11:41:59 -0400 Subject: [PATCH 09/19] src/doc/commands: merge `catalog_json` intro `templates_json` Signed-off-by: Alexandre Terrasa --- src/catalog/catalog_json.nit | 85 ---------------------------- src/doc/commands/commands_json.nit | 2 +- src/doc/templates/templates_json.nit | 70 ++++++++++++++++++++++- 3 files changed, 70 insertions(+), 87 deletions(-) delete mode 100644 src/catalog/catalog_json.nit diff --git a/src/catalog/catalog_json.nit b/src/catalog/catalog_json.nit deleted file mode 100644 index da1bcfcbe2..0000000000 --- a/src/catalog/catalog_json.nit +++ /dev/null @@ -1,85 +0,0 @@ -# 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. - -# Translate catalog entities to JSON -module catalog_json - -import catalog - -redef class MPackageMetadata - serialize - - redef fun core_serialize_to(v) do - super - v.serialize_attribute("license", license) - v.serialize_attribute("maintainers", maintainers) - v.serialize_attribute("contributors", contributors) - v.serialize_attribute("tags", tags) - v.serialize_attribute("tryit", tryit) - v.serialize_attribute("apk", apk) - v.serialize_attribute("homepage", homepage) - v.serialize_attribute("browse", browse) - v.serialize_attribute("git", git) - v.serialize_attribute("issues", issues) - v.serialize_attribute("first_date", first_date) - v.serialize_attribute("last_date", last_date) - end -end - -# Catalog statistics -redef class CatalogStats - serialize - - redef fun core_serialize_to(v) do - super - v.serialize_attribute("packages", packages) - v.serialize_attribute("maintainers", maintainers) - v.serialize_attribute("contributors", contributors) - v.serialize_attribute("tags", tags) - v.serialize_attribute("modules", modules) - v.serialize_attribute("classes", classes) - v.serialize_attribute("methods", methods) - v.serialize_attribute("loc", loc) - end -end - -# MPackage statistics for the catalog -redef class MPackageStats - serialize - - redef fun core_serialize_to(v) do - super - v.serialize_attribute("mmodules", mmodules) - v.serialize_attribute("mclasses", mclasses) - v.serialize_attribute("mmethods", mmethods) - v.serialize_attribute("loc", loc) - v.serialize_attribute("errors", errors) - v.serialize_attribute("warnings", warnings) - v.serialize_attribute("warnings_per_kloc", warnings_per_kloc) - v.serialize_attribute("documentation_score", documentation_score) - v.serialize_attribute("commits", commits) - v.serialize_attribute("score", score) - end -end - -redef class Person - serialize - - redef fun core_serialize_to(v) do - super - v.serialize_attribute("name", name) - v.serialize_attribute("email", email) - v.serialize_attribute("gravatar", gravatar) - end -end diff --git a/src/doc/commands/commands_json.nit b/src/doc/commands/commands_json.nit index 045f497fa9..e4a1020cb5 100644 --- a/src/doc/commands/commands_json.nit +++ b/src/doc/commands/commands_json.nit @@ -22,7 +22,7 @@ import commands_main import commands_usage import templates::templates_json -import catalog::catalog_json +import json::static redef class DocCommand # Return a JSON Serializable representation of `self` results diff --git a/src/doc/templates/templates_json.nit b/src/doc/templates/templates_json.nit index a75dc49d7c..113546078f 100644 --- a/src/doc/templates/templates_json.nit +++ b/src/doc/templates/templates_json.nit @@ -25,7 +25,6 @@ module templates_json import model::model_collect -import json::static import json::serialization_write import catalog import doc_down @@ -376,3 +375,72 @@ end redef class String super JsonRef end + +# Catalog + +redef class MPackageMetadata + serialize + + redef fun core_serialize_to(v) do + super + v.serialize_attribute("license", license) + v.serialize_attribute("maintainers", maintainers) + v.serialize_attribute("contributors", contributors) + v.serialize_attribute("tags", tags) + v.serialize_attribute("tryit", tryit) + v.serialize_attribute("apk", apk) + v.serialize_attribute("homepage", homepage) + v.serialize_attribute("browse", browse) + v.serialize_attribute("git", git) + v.serialize_attribute("issues", issues) + v.serialize_attribute("first_date", first_date) + v.serialize_attribute("last_date", last_date) + end +end + +# Catalog statistics +redef class CatalogStats + serialize + + redef fun core_serialize_to(v) do + super + v.serialize_attribute("packages", packages) + v.serialize_attribute("maintainers", maintainers) + v.serialize_attribute("contributors", contributors) + v.serialize_attribute("tags", tags) + v.serialize_attribute("modules", modules) + v.serialize_attribute("classes", classes) + v.serialize_attribute("methods", methods) + v.serialize_attribute("loc", loc) + end +end + +# MPackage statistics for the catalog +redef class MPackageStats + serialize + + redef fun core_serialize_to(v) do + super + v.serialize_attribute("mmodules", mmodules) + v.serialize_attribute("mclasses", mclasses) + v.serialize_attribute("mmethods", mmethods) + v.serialize_attribute("loc", loc) + v.serialize_attribute("errors", errors) + v.serialize_attribute("warnings", warnings) + v.serialize_attribute("warnings_per_kloc", warnings_per_kloc) + v.serialize_attribute("documentation_score", documentation_score) + v.serialize_attribute("commits", commits) + v.serialize_attribute("score", score) + end +end + +redef class Person + serialize + + redef fun core_serialize_to(v) do + super + v.serialize_attribute("name", name) + v.serialize_attribute("email", email) + v.serialize_attribute("gravatar", gravatar) + end +end From e2e432241ae6731b9b103f2be5012ff94e6201c8 Mon Sep 17 00:00:00 2001 From: Alexandre Terrasa Date: Tue, 12 Jun 2018 11:54:49 -0400 Subject: [PATCH 10/19] src/doc/commands: move markdown related services from `doc_down` to `commands_md` Signed-off-by: Alexandre Terrasa --- src/doc/commands/commands_docdown.nit | 1 + src/doc/commands/commands_md.nit | 38 ++++++++++++++++++++++++++- src/doc/doc_down.nit | 31 ---------------------- 3 files changed, 38 insertions(+), 32 deletions(-) diff --git a/src/doc/commands/commands_docdown.nit b/src/doc/commands/commands_docdown.nit index fe7345e8e4..c05195b1f1 100644 --- a/src/doc/commands/commands_docdown.nit +++ b/src/doc/commands/commands_docdown.nit @@ -17,6 +17,7 @@ module commands_docdown import commands::commands_parser import commands::commands_html +import commands::commands_md intrude import doc_down intrude import markdown::wikilinks diff --git a/src/doc/commands/commands_md.nit b/src/doc/commands/commands_md.nit index 0abb26fa2a..f8dee5b2d1 100644 --- a/src/doc/commands/commands_md.nit +++ b/src/doc/commands/commands_md.nit @@ -21,7 +21,7 @@ import commands_ini import commands_main import commands_usage -import doc_down +import highlight redef class DocCommand @@ -342,3 +342,39 @@ redef class CmdTesting return tpl.write_to_string end end + +# MDoc + +redef class MDoc + + # Renders the synopsis as a HTML comment block. + var md_synopsis: Writable is lazy do + if content.is_empty then return "" + return content.first + end + + # + var md_comment: Writable is lazy do + if content.is_empty then return "" + var lines = content.to_a + lines.shift + return lines.join("\n") + end + + # Renders the synopsis and the comment as a HTML comment block. + var md_documentation: Writable is lazy do return lines_to_md(content.to_a) + + private fun lines_to_md(lines: Array[String]): Writable do + var res = new Template + if not lines.is_empty then + var syn = lines.first + if not syn.has_prefix(" ") and not syn.has_prefix("\t") and + not syn.trim.has_prefix("#") then + lines.shift + res.add "# {syn}\n" + end + end + res.add lines.join("\n") + return res + end +end diff --git a/src/doc/doc_down.nit b/src/doc/doc_down.nit index 7d5c24d917..1fddb06a4e 100644 --- a/src/doc/doc_down.nit +++ b/src/doc/doc_down.nit @@ -37,12 +37,6 @@ redef class MDoc return res end - # Renders the synopsis as a HTML comment block. - var md_synopsis: Writable is lazy do - if content.is_empty then return "" - return content.first - end - # Renders the comment without the synopsis as a HTML comment block. var html_comment: Writable is lazy do var lines = content.to_a @@ -50,20 +44,9 @@ redef class MDoc return lines_to_html(lines) end - # - var md_comment: Writable is lazy do - if content.is_empty then return "" - var lines = content.to_a - lines.shift - return lines.join("\n") - end - # Renders the synopsis and the comment as a HTML comment block. var html_documentation: Writable is lazy do return lines_to_html(content.to_a) - # Renders the synopsis and the comment as a HTML comment block. - var md_documentation: Writable is lazy do return lines_to_md(content.to_a) - # Renders markdown line as a HTML comment block. private fun lines_to_html(lines: Array[String]): Writable do var res = new Template @@ -96,20 +79,6 @@ redef class MDoc decorator.current_mdoc = null return res end - - private fun lines_to_md(lines: Array[String]): Writable do - var res = new Template - if not lines.is_empty then - var syn = lines.first - if not syn.has_prefix(" ") and not syn.has_prefix("\t") and - not syn.trim.has_prefix("#") then - lines.shift - res.add "# {syn}\n" - end - end - res.add lines.join("\n") - return res - end end # The specific markdown decorator used internally to process MDoc object. From bf4b767a0bdfe1ef160f2322c334cc1e4844535b Mon Sep 17 00:00:00 2001 From: Alexandre Terrasa Date: Tue, 12 Jun 2018 12:02:28 -0400 Subject: [PATCH 11/19] src/doc/commands: merge `doc_down` intro `templates_html` Signed-off-by: Alexandre Terrasa --- src/doc/commands/commands_docdown.nit | 1 - src/doc/commands/commands_html.nit | 2 - src/doc/doc_down.nit | 207 -------------------------- src/doc/templates/templates_html.nit | 198 +++++++++++++++++++++++- src/doc/templates/templates_json.nit | 3 +- src/frontend/parse_examples.nit | 1 - src/nitcatalog.nit | 3 +- src/nitweb.nit | 1 - 8 files changed, 200 insertions(+), 216 deletions(-) delete mode 100644 src/doc/doc_down.nit diff --git a/src/doc/commands/commands_docdown.nit b/src/doc/commands/commands_docdown.nit index c05195b1f1..596f5495ed 100644 --- a/src/doc/commands/commands_docdown.nit +++ b/src/doc/commands/commands_docdown.nit @@ -19,7 +19,6 @@ import commands::commands_parser import commands::commands_html import commands::commands_md -intrude import doc_down intrude import markdown::wikilinks # Retrieve the MDoc summary diff --git a/src/doc/commands/commands_html.nit b/src/doc/commands/commands_html.nit index 56d0e5b320..df8b43a340 100644 --- a/src/doc/commands/commands_html.nit +++ b/src/doc/commands/commands_html.nit @@ -22,8 +22,6 @@ import commands_main import commands_usage import templates::templates_html -import doc_down -import highlight redef class DocCommand diff --git a/src/doc/doc_down.nit b/src/doc/doc_down.nit deleted file mode 100644 index 1fddb06a4e..0000000000 --- a/src/doc/doc_down.nit +++ /dev/null @@ -1,207 +0,0 @@ -# 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. - -# Handle markdown formatting in Nit comments. -module doc_down - -import markdown -import htmlight -private import parser_util - -redef class MDoc - - private var markdown_proc: MarkdownProcessor is lazy, writable do - return original_mentity.as(not null).model.nitdoc_md_processor - end - - private var inline_proc: MarkdownProcessor is lazy, writable do - return original_mentity.as(not null).model.nitdoc_inline_processor - end - - # Renders the synopsis as a HTML comment block. - var html_synopsis: Writable is lazy do - var res = new Template - var syn = inline_proc.process(content.first) - res.add "{syn}" - return res - end - - # Renders the comment without the synopsis as a HTML comment block. - var html_comment: Writable is lazy do - var lines = content.to_a - if not lines.is_empty then lines.shift - return lines_to_html(lines) - end - - # Renders the synopsis and the comment as a HTML comment block. - var html_documentation: Writable is lazy do return lines_to_html(content.to_a) - - # Renders markdown line as a HTML comment block. - private fun lines_to_html(lines: Array[String]): Writable do - var res = new Template - var decorator = markdown_proc.decorator.as(NitdocDecorator) - decorator.current_mdoc = self - res.add "
" - # do not use DocUnit as synopsys - if not lines.is_empty then - if not lines.first.has_prefix(" ") and - not lines.first.has_prefix("\t") then - # parse synopsys - var syn = inline_proc.process(lines.shift) - res.add "

{syn}

" - end - end - # check for annotations - for i in [0 .. lines.length[ do - var line = lines[i] - if line.to_upper.has_prefix("ENSURE") or line.to_upper.has_prefix("REQUIRE") then - var html = inline_proc.process(line) - lines[i] = "

{html}

" - else if line.to_upper.has_prefix("TODO") or line.to_upper.has_prefix("FIXME") then - var html = inline_proc.process(line) - lines[i] = "

{html}

" - end - end - # add other lines - res.add markdown_proc.process(lines.join("\n")) - res.add "
" - decorator.current_mdoc = null - return res - end -end - -# The specific markdown decorator used internally to process MDoc object. -# -# You should use the various methods of `MDoc` like `MDoc::html_documentation` -# -# The class is public so specific behavior can be plugged on it. -class NitdocDecorator - super HTMLDecorator - - private var toolcontext = new ToolContext - - # The currently processed mdoc. - # - # Unfortunately, this seems to be the simpler way to get the currently processed `MDoc` object. - var current_mdoc: nullable MDoc = null - - redef fun add_code(v, block) do - var meta = block.meta or else "nit" - - # Do not try to highlight non-nit code. - if meta != "nit" and meta != "nitish" then - v.add "
"
-			v.emit_in block
-			v.add "
\n" - return - end - # Try to parse code - var code = block.raw_content - var ast = toolcontext.parse_something(code) - if ast isa AError then - v.add "
"
-			v.emit_in block
-			v.add "
\n" - return - end - v.add "
"
-		var hl = new HtmlightVisitor
-		hl.line_id_prefix = ""
-		hl.highlight_node(ast)
-		v.add(hl.html)
-		v.add "
\n" - end - - redef fun add_span_code(v, text, from, to) do - # Try to parse it - var code = code_from_text(text, from, to) - var ast = toolcontext.parse_something(code) - - if ast isa AError then - v.add "" - append_code(v, text, from, to) - else - v.add "" - var hl = new HtmlightVisitor - hl.line_id_prefix = "" - hl.highlight_node(ast) - v.add(hl.html) - end - v.add "" - end - - private fun code_from_text(buffer: Text, from, to: Int): String do - var out = new FlatBuffer - for i in [from..to[ do out.add buffer[i] - return out.write_to_string - end -end - -# Decorator for span elements. -# -# Because inline comments can appear as span elements, -# InlineDecorator do not decorate things like paragraphs or headers. -private class InlineDecorator - super NitdocDecorator - - redef fun add_paragraph(v, block) do - v.emit_in block - end - - redef fun add_headline(v, block) do - # save headline - var line = block.block.first_line - if line == null then return - var txt = line.value - var id = strip_id(txt) - var lvl = block.depth - headlines[id] = new HeadLine(id, txt, lvl) - - v.emit_in block - end - - redef fun add_code(v, block) do - # Try to parse code - var ast = toolcontext.parse_something(block.block.text.to_s) - if ast isa AError then - v.add "" - v.emit_in block - v.add "" - return - end - v.add "" - var hl = new HtmlightVisitor - hl.highlight_node(ast) - v.add(hl.html) - v.add "" - end -end - -redef class Model - # Get a markdown processor for Nitdoc comments. - var nitdoc_md_processor: MarkdownProcessor is lazy, writable do - var proc = new MarkdownProcessor - proc.decorator = new NitdocDecorator - return proc - end - - # Get a markdown inline processor for Nitdoc comments. - # - # This processor is specificaly designed to inlinable doc elements like synopsys. - var nitdoc_inline_processor: MarkdownProcessor is lazy, writable do - var proc = new MarkdownProcessor - proc.decorator = new InlineDecorator - return proc - end -end diff --git a/src/doc/templates/templates_html.nit b/src/doc/templates/templates_html.nit index 77e398023a..d715d7b18e 100644 --- a/src/doc/templates/templates_html.nit +++ b/src/doc/templates/templates_html.nit @@ -16,10 +16,13 @@ module templates_html import model::model_collect -import doc::doc_down -import html::bootstrap import catalog +import markdown +import htmlight +import html::bootstrap +private import parser_util + redef class MEntity # The MEntity unique ID in the HTML output @@ -352,6 +355,8 @@ redef class MParameter end end +# Catalog + redef class Person # HTML uniq id @@ -377,3 +382,192 @@ redef class Person return tpl.write_to_string end end + +# MDoc + +redef class MDoc + + private var markdown_proc: MarkdownProcessor is lazy, writable do + return original_mentity.as(not null).model.nitdoc_md_processor + end + + private var inline_proc: MarkdownProcessor is lazy, writable do + return original_mentity.as(not null).model.nitdoc_inline_processor + end + + # Renders the synopsis as a HTML comment block. + var html_synopsis: Writable is lazy do + var res = new Template + var syn = inline_proc.process(content.first) + res.add "{syn}" + return res + end + + # Renders the comment without the synopsis as a HTML comment block. + var html_comment: Writable is lazy do + var lines = content.to_a + if not lines.is_empty then lines.shift + return lines_to_html(lines) + end + + # Renders the synopsis and the comment as a HTML comment block. + var html_documentation: Writable is lazy do return lines_to_html(content.to_a) + + # Renders markdown line as a HTML comment block. + private fun lines_to_html(lines: Array[String]): Writable do + var res = new Template + var decorator = markdown_proc.decorator.as(NitdocDecorator) + decorator.current_mdoc = self + res.add "
" + # do not use DocUnit as synopsys + if not lines.is_empty then + if not lines.first.has_prefix(" ") and + not lines.first.has_prefix("\t") then + # parse synopsys + var syn = inline_proc.process(lines.shift) + res.add "

{syn}

" + end + end + # check for annotations + for i in [0 .. lines.length[ do + var line = lines[i] + if line.to_upper.has_prefix("ENSURE") or line.to_upper.has_prefix("REQUIRE") then + var html = inline_proc.process(line) + lines[i] = "

{html}

" + else if line.to_upper.has_prefix("TODO") or line.to_upper.has_prefix("FIXME") then + var html = inline_proc.process(line) + lines[i] = "

{html}

" + end + end + # add other lines + res.add markdown_proc.process(lines.join("\n")) + res.add "
" + decorator.current_mdoc = null + return res + end +end + +# The specific markdown decorator used internally to process MDoc object. +# +# You should use the various methods of `MDoc` like `MDoc::html_documentation` +# +# The class is public so specific behavior can be plugged on it. +class NitdocDecorator + super HTMLDecorator + + private var toolcontext = new ToolContext + + # The currently processed mdoc. + # + # Unfortunately, this seems to be the simpler way to get the currently processed `MDoc` object. + var current_mdoc: nullable MDoc = null + + redef fun add_code(v, block) do + var meta = block.meta or else "nit" + + # Do not try to highlight non-nit code. + if meta != "nit" and meta != "nitish" then + v.add "
"
+			v.emit_in block
+			v.add "
\n" + return + end + # Try to parse code + var code = block.raw_content + var ast = toolcontext.parse_something(code) + if ast isa AError then + v.add "
"
+			v.emit_in block
+			v.add "
\n" + return + end + v.add "
"
+		var hl = new HtmlightVisitor
+		hl.line_id_prefix = ""
+		hl.highlight_node(ast)
+		v.add(hl.html)
+		v.add "
\n" + end + + redef fun add_span_code(v, text, from, to) do + # Try to parse it + var code = code_from_text(text, from, to) + var ast = toolcontext.parse_something(code) + + if ast isa AError then + v.add "" + append_code(v, text, from, to) + else + v.add "" + var hl = new HtmlightVisitor + hl.line_id_prefix = "" + hl.highlight_node(ast) + v.add(hl.html) + end + v.add "" + end + + private fun code_from_text(buffer: Text, from, to: Int): String do + var out = new FlatBuffer + for i in [from..to[ do out.add buffer[i] + return out.write_to_string + end +end + +# Decorator for span elements. +# +# Because inline comments can appear as span elements, +# InlineDecorator do not decorate things like paragraphs or headers. +class InlineDecorator + super NitdocDecorator + + redef fun add_paragraph(v, block) do + v.emit_in block + end + + redef fun add_headline(v, block) do + # save headline + var line = block.block.first_line + if line == null then return + var txt = line.value + var id = strip_id(txt) + var lvl = block.depth + headlines[id] = new HeadLine(id, txt, lvl) + + v.emit_in block + end + + redef fun add_code(v, block) do + # Try to parse code + var ast = toolcontext.parse_something(block.block.text.to_s) + if ast isa AError then + v.add "" + v.emit_in block + v.add "" + return + end + v.add "" + var hl = new HtmlightVisitor + hl.highlight_node(ast) + v.add(hl.html) + v.add "" + end +end + +redef class Model + # Get a markdown processor for Nitdoc comments. + var nitdoc_md_processor: MarkdownProcessor is lazy, writable do + var proc = new MarkdownProcessor + proc.decorator = new NitdocDecorator + return proc + end + + # Get a markdown inline processor for Nitdoc comments. + # + # This processor is specificaly designed to inlinable doc elements like synopsys. + var nitdoc_inline_processor: MarkdownProcessor is lazy, writable do + var proc = new MarkdownProcessor + proc.decorator = new InlineDecorator + return proc + end +end diff --git a/src/doc/templates/templates_json.nit b/src/doc/templates/templates_json.nit index 113546078f..e1dacf85ce 100644 --- a/src/doc/templates/templates_json.nit +++ b/src/doc/templates/templates_json.nit @@ -27,7 +27,8 @@ module templates_json import model::model_collect import json::serialization_write import catalog -import doc_down + +import templates_html redef class MEntity serialize diff --git a/src/frontend/parse_examples.nit b/src/frontend/parse_examples.nit index 84c83a6121..78258fa096 100644 --- a/src/frontend/parse_examples.nit +++ b/src/frontend/parse_examples.nit @@ -22,7 +22,6 @@ module parse_examples import counter import typing import parse_annotations -import doc_down import model::model_examples redef class ToolContext diff --git a/src/nitcatalog.nit b/src/nitcatalog.nit index 244be796ed..a8b3192047 100644 --- a/src/nitcatalog.nit +++ b/src/nitcatalog.nit @@ -22,9 +22,10 @@ module nitcatalog import loader # Scan&load packages, groups and modules -import doc::doc_down # Display mdoc import catalog +import templates_html + # A HTML page in a catalog # # This is just a template with the header pre-filled and the footer injected at rendering. diff --git a/src/nitweb.nit b/src/nitweb.nit index ab16edc96e..4ba30f5537 100644 --- a/src/nitweb.nit +++ b/src/nitweb.nit @@ -17,7 +17,6 @@ module nitweb import frontend import doc::api -import doc::doc_down redef class ToolContext From 303ba12a1ffabd44bb45788b7fbb61ba47a88836 Mon Sep 17 00:00:00 2001 From: Alexandre Terrasa Date: Tue, 12 Jun 2018 12:07:28 -0400 Subject: [PATCH 12/19] src/doc/commands: move cmd processing to `commands_html` Signed-off-by: Alexandre Terrasa --- src/doc/commands/commands_docdown.nit | 103 ------------------------- src/doc/commands/commands_html.nit | 104 ++++++++++++++++++++++++++ 2 files changed, 104 insertions(+), 103 deletions(-) diff --git a/src/doc/commands/commands_docdown.nit b/src/doc/commands/commands_docdown.nit index 596f5495ed..95bdee90f6 100644 --- a/src/doc/commands/commands_docdown.nit +++ b/src/doc/commands/commands_docdown.nit @@ -15,12 +15,9 @@ # Doc down related queries module commands_docdown -import commands::commands_parser import commands::commands_html import commands::commands_md -intrude import markdown::wikilinks - # Retrieve the MDoc summary # # List all MarkdownHeading found and their ids. @@ -61,103 +58,3 @@ class CmdSummary return res end end - -# Custom Markdown processor able to process doc commands -class CmdDecorator - super NitdocDecorator - - redef type PROCESSOR: CmdMarkdownProcessor - - # Model used by wikilink commands to find entities - var model: Model - - # Filter to apply if any - var filter: nullable ModelFilter - - redef fun add_span_code(v, buffer, from, to) do - var text = new FlatBuffer - buffer.read(text, from, to) - var name = text.write_to_string - name = name.replace("nullable ", "") - var mentity = try_find_mentity(name) - if mentity == null then - super - else - v.add "" - v.emit_text mentity.html_link.write_to_string - v.add "" - end - end - - private fun try_find_mentity(text: String): nullable MEntity do - var mentity = model.mentity_by_full_name(text, filter) - if mentity != null then return mentity - - var mentities = model.mentities_by_name(text, filter) - if mentities.is_empty then - return null - else if mentities.length > 1 then - # TODO smart resolve conflicts - end - return mentities.first - end - - redef fun add_wikilink(v, token) do - v.render_wikilink(token, model) - end -end - -# Same as `InlineDecorator` but with wikilink commands handling -class CmdInlineDecorator - super InlineDecorator - - redef type PROCESSOR: CmdMarkdownProcessor - - # Model used by wikilink commands to find entities - var model: Model - - redef fun add_wikilink(v, token) do - v.render_wikilink(token, model) - end -end - -# Custom MarkdownEmitter for commands -class CmdMarkdownProcessor - super MarkdownProcessor - - # Parser used to process doc commands - var parser: CommandParser - - # Render a wikilink - fun render_wikilink(token: TokenWikiLink, model: Model) do - var link = token.link - if link == null then return - var name = token.name - if name != null then link = "{name} | {link}" - - var command = parser.parse(link.write_to_string) - var error = parser.error - - if error isa CmdError then - emit_text error.to_html.write_to_string - return - end - if error isa CmdWarning then - emit_text error.to_html.write_to_string - end - add command.as(not null).to_html - end -end - -redef class Text - # Read `self` between `nstart` and `nend` (excluded) and writte chars to `out`. - private fun read(out: FlatBuffer, nstart, nend: Int): Int do - var pos = nstart - while pos < length and pos < nend do - out.add self[pos] - pos += 1 - end - if pos == length then return -1 - return pos - end -end diff --git a/src/doc/commands/commands_html.nit b/src/doc/commands/commands_html.nit index df8b43a340..e00a02486e 100644 --- a/src/doc/commands/commands_html.nit +++ b/src/doc/commands/commands_html.nit @@ -19,9 +19,11 @@ import commands_catalog import commands_graph import commands_ini import commands_main +import commands_parser import commands_usage import templates::templates_html +intrude import markdown::wikilinks redef class DocCommand @@ -358,3 +360,105 @@ redef class CmdTesting return "
{command}
" end end + +# MDoc + +# Custom Markdown processor able to process doc commands +class CmdDecorator + super NitdocDecorator + + redef type PROCESSOR: CmdMarkdownProcessor + + # Model used by wikilink commands to find entities + var model: Model + + # Filter to apply if any + var filter: nullable ModelFilter + + redef fun add_span_code(v, buffer, from, to) do + var text = new FlatBuffer + buffer.read(text, from, to) + var name = text.write_to_string + name = name.replace("nullable ", "") + var mentity = try_find_mentity(name) + if mentity == null then + super + else + v.add "" + v.emit_text mentity.html_link.write_to_string + v.add "" + end + end + + private fun try_find_mentity(text: String): nullable MEntity do + var mentity = model.mentity_by_full_name(text, filter) + if mentity != null then return mentity + + var mentities = model.mentities_by_name(text, filter) + if mentities.is_empty then + return null + else if mentities.length > 1 then + # TODO smart resolve conflicts + end + return mentities.first + end + + redef fun add_wikilink(v, token) do + v.render_wikilink(token, model) + end +end + +# Same as `InlineDecorator` but with wikilink commands handling +class CmdInlineDecorator + super InlineDecorator + + redef type PROCESSOR: CmdMarkdownProcessor + + # Model used by wikilink commands to find entities + var model: Model + + redef fun add_wikilink(v, token) do + v.render_wikilink(token, model) + end +end + +# Custom MarkdownEmitter for commands +class CmdMarkdownProcessor + super MarkdownProcessor + + # Parser used to process doc commands + var parser: CommandParser + + # Render a wikilink + fun render_wikilink(token: TokenWikiLink, model: Model) do + var link = token.link + if link == null then return + var name = token.name + if name != null then link = "{name} | {link}" + + var command = parser.parse(link.write_to_string) + var error = parser.error + + if error isa CmdError then + emit_text error.to_html.write_to_string + return + end + if error isa CmdWarning then + emit_text error.to_html.write_to_string + end + add command.as(not null).to_html + end +end + +redef class Text + # Read `self` between `nstart` and `nend` (excluded) and writte chars to `out`. + private fun read(out: FlatBuffer, nstart, nend: Int): Int do + var pos = nstart + while pos < length and pos < nend do + out.add self[pos] + pos += 1 + end + if pos == length then return -1 + return pos + end +end From 0066469ca95a7bafb29cf2113aea9119f2447b96 Mon Sep 17 00:00:00 2001 From: Alexandre Terrasa Date: Tue, 12 Jun 2018 12:23:39 -0400 Subject: [PATCH 13/19] src/doc/commands: clean `commands_docdown` Signed-off-by: Alexandre Terrasa --- src/doc/commands/commands_docdown.nit | 12 +++--------- 1 file changed, 3 insertions(+), 9 deletions(-) diff --git a/src/doc/commands/commands_docdown.nit b/src/doc/commands/commands_docdown.nit index 95bdee90f6..1699454ab9 100644 --- a/src/doc/commands/commands_docdown.nit +++ b/src/doc/commands/commands_docdown.nit @@ -15,8 +15,8 @@ # Doc down related queries module commands_docdown -import commands::commands_html -import commands::commands_md +import commands_md +import markdown # Retrieve the MDoc summary # @@ -25,7 +25,7 @@ class CmdSummary super CmdComment # Markdown processor used to parse the headlines - var markdown_processor: nullable MarkdownProcessor = null is optional, writable + var markdown_processor: MarkdownProcessor is writable # Resulting summary # @@ -37,12 +37,6 @@ class CmdSummary if not res isa CmdSuccess then return res var mentity = self.mentity.as(not null) - var markdown_processor = self.markdown_processor - if markdown_processor == null then - markdown_processor = new MarkdownProcessor - self.markdown_processor = markdown_processor - end - var mdoc = self.mdoc if mdoc == null then mdoc = if fallback then mentity.mdoc_or_fallback else mentity.mdoc From 9dec397bf2c1afe84527b0cd245009eaf8312734 Mon Sep 17 00:00:00 2001 From: Alexandre Terrasa Date: Thu, 21 Jun 2018 23:48:20 -0400 Subject: [PATCH 14/19] src/doc/commands/templates: rename `templates_html` in `html_model` Signed-off-by: Alexandre Terrasa --- src/catalog/catalog.nit | 18 ----------------- src/doc/commands/commands_html.nit | 2 +- src/doc/static/static_base.nit | 2 -- src/doc/static/static_cards.nit | 5 +---- .../{templates_html.nit => html_model.nit} | 5 +++-- src/doc/templates/templates_json.nit | 2 +- src/nitcatalog.nit | 20 ++++++++++++++++++- 7 files changed, 25 insertions(+), 29 deletions(-) rename src/doc/templates/{templates_html.nit => html_model.nit} (99%) diff --git a/src/catalog/catalog.nit b/src/catalog/catalog.nit index 6a12238d53..140278e3a7 100644 --- a/src/catalog/catalog.nit +++ b/src/catalog/catalog.nit @@ -165,24 +165,6 @@ class Person return email.md5.to_lower end - # Return a full-featured link to a person - fun to_html: String - do - var res = "" - var e = name.html_escape - var page = self.page - if page != null then - res += "" - end - var gravatar = self.gravatar - if gravatar != null then - res += " " - end - res += e - if page != null then res += "" - return res - end - # The standard representation of a person. # # ~~~ diff --git a/src/doc/commands/commands_html.nit b/src/doc/commands/commands_html.nit index e00a02486e..2d485f62a4 100644 --- a/src/doc/commands/commands_html.nit +++ b/src/doc/commands/commands_html.nit @@ -22,7 +22,7 @@ import commands_main import commands_parser import commands_usage -import templates::templates_html +import templates::html_model intrude import markdown::wikilinks redef class DocCommand diff --git a/src/doc/static/static_base.nit b/src/doc/static/static_base.nit index a7ae6bbe49..16f09aaac9 100644 --- a/src/doc/static/static_base.nit +++ b/src/doc/static/static_base.nit @@ -18,8 +18,6 @@ module static_base import static_cards import modelize -intrude import markdown::wikilinks - # The model of a Nitdoc documentation class DocModel diff --git a/src/doc/static/static_cards.nit b/src/doc/static/static_cards.nit index 9b706c5171..c02f56586f 100644 --- a/src/doc/static/static_cards.nit +++ b/src/doc/static/static_cards.nit @@ -15,10 +15,7 @@ # Cards templates for the static documentation module static_cards -import doc::commands::commands_graph -import doc::commands::commands_catalog -import doc::commands::commands_docdown -import templates_html +import templates::html_commands # A card that can be rendered to HTML # diff --git a/src/doc/templates/templates_html.nit b/src/doc/templates/html_model.nit similarity index 99% rename from src/doc/templates/templates_html.nit rename to src/doc/templates/html_model.nit index d715d7b18e..6ec000ff84 100644 --- a/src/doc/templates/templates_html.nit +++ b/src/doc/templates/html_model.nit @@ -13,7 +13,7 @@ # limitations under the License. # Translate mentities to html blocks. -module templates_html +module html_model import model::model_collect import catalog @@ -370,7 +370,8 @@ redef class Person # Link to this person `html_url` fun html_link: Link do return new Link(html_url, name) - redef fun to_html do + # Render `self` as HTML + fun to_html: String do var tpl = new Template tpl.addn "" var gravatar = self.gravatar diff --git a/src/doc/templates/templates_json.nit b/src/doc/templates/templates_json.nit index e1dacf85ce..4c17b7fe2f 100644 --- a/src/doc/templates/templates_json.nit +++ b/src/doc/templates/templates_json.nit @@ -28,7 +28,7 @@ import model::model_collect import json::serialization_write import catalog -import templates_html +import html_model redef class MEntity serialize diff --git a/src/nitcatalog.nit b/src/nitcatalog.nit index a8b3192047..2a0a4a5b06 100644 --- a/src/nitcatalog.nit +++ b/src/nitcatalog.nit @@ -24,7 +24,7 @@ module nitcatalog import loader # Scan&load packages, groups and modules import catalog -import templates_html +import doc::templates::html_model # A HTML page in a catalog # @@ -532,6 +532,24 @@ redef class Catalog var piwik_site_id: Int = 1 end +redef class Person + redef fun to_html do + var res = "" + var e = name.html_escape + var page = self.page + if page != null then + res += "" + end + var gravatar = self.gravatar + if gravatar != null then + res += " " + end + res += e + if page != null then res += "" + return res + end +end + var model = new Model var tc = new ToolContext From c9a7ef928efa110d3506f993352392de6721cfcd Mon Sep 17 00:00:00 2001 From: Alexandre Terrasa Date: Thu, 21 Jun 2018 23:49:38 -0400 Subject: [PATCH 15/19] src/doc/commands/templates: rename `templates_term` in `term_model` Signed-off-by: Alexandre Terrasa --- src/doc/templates/{templates_term.nit => term_model.nit} | 2 +- src/doc/term/term.nit | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) rename src/doc/templates/{templates_term.nit => term_model.nit} (99%) diff --git a/src/doc/templates/templates_term.nit b/src/doc/templates/term_model.nit similarity index 99% rename from src/doc/templates/templates_term.nit rename to src/doc/templates/term_model.nit index b4fc2fe3d5..4a442c5508 100644 --- a/src/doc/templates/templates_term.nit +++ b/src/doc/templates/term_model.nit @@ -16,7 +16,7 @@ # # This module introduces Markdown rendering services in model entities. # With the `no_color` option set to `false`, the output can be highlighted for console. -module templates_term +module term_model import model_collect import console diff --git a/src/doc/term/term.nit b/src/doc/term/term.nit index de36f0533e..d6539691c7 100644 --- a/src/doc/term/term.nit +++ b/src/doc/term/term.nit @@ -15,7 +15,7 @@ module term import commands::commands_parser -import templates::templates_term +import templates::term_model redef class CommandParser From 0abb08f150488255f3b83f4817e2d72d8baba30b Mon Sep 17 00:00:00 2001 From: Alexandre Terrasa Date: Thu, 21 Jun 2018 23:54:06 -0400 Subject: [PATCH 16/19] src/doc/commands/templates: rename `templates_json` in `json_model` Signed-off-by: Alexandre Terrasa --- src/doc/commands/commands_json.nit | 2 +- src/doc/templates/{templates_json.nit => json_model.nit} | 2 +- .../tests/{test_templates_json.nit => test_json_model.nit} | 4 ++-- .../test_classdefs_to_full_json.res | 0 .../test_classes_to_full_json.res | 0 .../test_groups_to_full_json.res | 0 .../test_modules_to_full_json.res | 0 .../test_packages_to_full_json.res | 0 .../test_propdefs_to_full_json.res | 0 .../test_props_to_full_json.res | 0 .../test_refs_to_full_json.res | 0 11 files changed, 4 insertions(+), 4 deletions(-) rename src/doc/templates/{templates_json.nit => json_model.nit} (99%) rename src/doc/templates/tests/{test_templates_json.nit => test_json_model.nit} (98%) rename src/doc/templates/tests/{test_templates_json.sav => test_json_model.sav}/test_classdefs_to_full_json.res (100%) rename src/doc/templates/tests/{test_templates_json.sav => test_json_model.sav}/test_classes_to_full_json.res (100%) rename src/doc/templates/tests/{test_templates_json.sav => test_json_model.sav}/test_groups_to_full_json.res (100%) rename src/doc/templates/tests/{test_templates_json.sav => test_json_model.sav}/test_modules_to_full_json.res (100%) rename src/doc/templates/tests/{test_templates_json.sav => test_json_model.sav}/test_packages_to_full_json.res (100%) rename src/doc/templates/tests/{test_templates_json.sav => test_json_model.sav}/test_propdefs_to_full_json.res (100%) rename src/doc/templates/tests/{test_templates_json.sav => test_json_model.sav}/test_props_to_full_json.res (100%) rename src/doc/templates/tests/{test_templates_json.sav => test_json_model.sav}/test_refs_to_full_json.res (100%) diff --git a/src/doc/commands/commands_json.nit b/src/doc/commands/commands_json.nit index e4a1020cb5..9f197d7c54 100644 --- a/src/doc/commands/commands_json.nit +++ b/src/doc/commands/commands_json.nit @@ -21,7 +21,7 @@ import commands_ini import commands_main import commands_usage -import templates::templates_json +import templates::json_model import json::static redef class DocCommand diff --git a/src/doc/templates/templates_json.nit b/src/doc/templates/json_model.nit similarity index 99% rename from src/doc/templates/templates_json.nit rename to src/doc/templates/json_model.nit index 4c17b7fe2f..b91a23725b 100644 --- a/src/doc/templates/templates_json.nit +++ b/src/doc/templates/json_model.nit @@ -22,7 +22,7 @@ # rather than the refs. # # TODO consider serialization module? -module templates_json +module json_model import model::model_collect import json::serialization_write diff --git a/src/doc/templates/tests/test_templates_json.nit b/src/doc/templates/tests/test_json_model.nit similarity index 98% rename from src/doc/templates/tests/test_templates_json.nit rename to src/doc/templates/tests/test_json_model.nit index f1ba5367fc..d2f6c128ec 100644 --- a/src/doc/templates/tests/test_templates_json.nit +++ b/src/doc/templates/tests/test_json_model.nit @@ -12,9 +12,9 @@ # See the License for the specific language governing permissions and # limitations under the License. -module test_templates_json is test +module test_json_model is test -import templates_json +import json_model import frontend class TestModelSerialization diff --git a/src/doc/templates/tests/test_templates_json.sav/test_classdefs_to_full_json.res b/src/doc/templates/tests/test_json_model.sav/test_classdefs_to_full_json.res similarity index 100% rename from src/doc/templates/tests/test_templates_json.sav/test_classdefs_to_full_json.res rename to src/doc/templates/tests/test_json_model.sav/test_classdefs_to_full_json.res diff --git a/src/doc/templates/tests/test_templates_json.sav/test_classes_to_full_json.res b/src/doc/templates/tests/test_json_model.sav/test_classes_to_full_json.res similarity index 100% rename from src/doc/templates/tests/test_templates_json.sav/test_classes_to_full_json.res rename to src/doc/templates/tests/test_json_model.sav/test_classes_to_full_json.res diff --git a/src/doc/templates/tests/test_templates_json.sav/test_groups_to_full_json.res b/src/doc/templates/tests/test_json_model.sav/test_groups_to_full_json.res similarity index 100% rename from src/doc/templates/tests/test_templates_json.sav/test_groups_to_full_json.res rename to src/doc/templates/tests/test_json_model.sav/test_groups_to_full_json.res diff --git a/src/doc/templates/tests/test_templates_json.sav/test_modules_to_full_json.res b/src/doc/templates/tests/test_json_model.sav/test_modules_to_full_json.res similarity index 100% rename from src/doc/templates/tests/test_templates_json.sav/test_modules_to_full_json.res rename to src/doc/templates/tests/test_json_model.sav/test_modules_to_full_json.res diff --git a/src/doc/templates/tests/test_templates_json.sav/test_packages_to_full_json.res b/src/doc/templates/tests/test_json_model.sav/test_packages_to_full_json.res similarity index 100% rename from src/doc/templates/tests/test_templates_json.sav/test_packages_to_full_json.res rename to src/doc/templates/tests/test_json_model.sav/test_packages_to_full_json.res diff --git a/src/doc/templates/tests/test_templates_json.sav/test_propdefs_to_full_json.res b/src/doc/templates/tests/test_json_model.sav/test_propdefs_to_full_json.res similarity index 100% rename from src/doc/templates/tests/test_templates_json.sav/test_propdefs_to_full_json.res rename to src/doc/templates/tests/test_json_model.sav/test_propdefs_to_full_json.res diff --git a/src/doc/templates/tests/test_templates_json.sav/test_props_to_full_json.res b/src/doc/templates/tests/test_json_model.sav/test_props_to_full_json.res similarity index 100% rename from src/doc/templates/tests/test_templates_json.sav/test_props_to_full_json.res rename to src/doc/templates/tests/test_json_model.sav/test_props_to_full_json.res diff --git a/src/doc/templates/tests/test_templates_json.sav/test_refs_to_full_json.res b/src/doc/templates/tests/test_json_model.sav/test_refs_to_full_json.res similarity index 100% rename from src/doc/templates/tests/test_templates_json.sav/test_refs_to_full_json.res rename to src/doc/templates/tests/test_json_model.sav/test_refs_to_full_json.res From cb3d91d437c85e6e384f791fcd7f57b91808def7 Mon Sep 17 00:00:00 2001 From: Alexandre Terrasa Date: Thu, 21 Jun 2018 23:59:09 -0400 Subject: [PATCH 17/19] src/doc/commands/templates: move `commands_html` to `html_commands` Signed-off-by: Alexandre Terrasa --- src/doc/api/api_base.nit | 2 +- .../commands_html.nit => templates/html_commands.nit} | 9 ++------- .../tests/test_html_commands.nit} | 4 ++-- .../tests/test_html_commands.sav}/test_cmd_ancestors.res | 0 .../tests/test_html_commands.sav}/test_cmd_call.res | 0 .../tests/test_html_commands.sav}/test_cmd_children.res | 0 .../tests/test_html_commands.sav}/test_cmd_comment.res | 0 .../test_html_commands.sav}/test_cmd_descendants.res | 0 .../tests/test_html_commands.sav}/test_cmd_entity.res | 0 .../tests/test_html_commands.sav}/test_cmd_features.res | 0 .../tests/test_html_commands.sav}/test_cmd_ini_clone.res | 0 .../test_cmd_ini_contrib_file.res | 0 .../test_cmd_ini_contrib_file_content.res | 0 .../test_cmd_ini_contributors.res | 0 .../tests/test_html_commands.sav}/test_cmd_ini_desc.res | 0 .../tests/test_html_commands.sav}/test_cmd_ini_git.res | 0 .../test_html_commands.sav}/test_cmd_ini_issues.res | 0 .../test_html_commands.sav}/test_cmd_ini_license.res | 0 .../test_cmd_ini_license_file.res | 0 .../test_cmd_ini_license_file_content.res | 0 .../test_html_commands.sav}/test_cmd_ini_maintainer.res | 0 .../tests/test_html_commands.sav}/test_cmd_lin.res | 0 .../tests/test_html_commands.sav}/test_cmd_link.res | 0 .../test_html_commands.sav}/test_cmd_main_compile.res | 0 .../tests/test_html_commands.sav}/test_cmd_mains.res | 0 .../test_html_commands.sav}/test_cmd_man_options.res | 0 .../test_html_commands.sav}/test_cmd_man_synopsis.res | 0 .../tests/test_html_commands.sav}/test_cmd_mentities.res | 0 .../tests/test_html_commands.sav}/test_cmd_new.res | 0 .../tests/test_html_commands.sav}/test_cmd_param.res | 0 .../tests/test_html_commands.sav}/test_cmd_parents.res | 0 .../tests/test_html_commands.sav}/test_cmd_return.res | 0 .../tests/test_html_commands.sav}/test_cmd_search.res | 0 .../tests/test_html_commands.sav}/test_cmd_testing.res | 0 34 files changed, 5 insertions(+), 10 deletions(-) rename src/doc/{commands/commands_html.nit => templates/html_commands.nit} (98%) rename src/doc/{commands/tests/test_commands_html.nit => templates/tests/test_html_commands.nit} (98%) rename src/doc/{commands/tests/test_commands_html.sav => templates/tests/test_html_commands.sav}/test_cmd_ancestors.res (100%) rename src/doc/{commands/tests/test_commands_html.sav => templates/tests/test_html_commands.sav}/test_cmd_call.res (100%) rename src/doc/{commands/tests/test_commands_html.sav => templates/tests/test_html_commands.sav}/test_cmd_children.res (100%) rename src/doc/{commands/tests/test_commands_html.sav => templates/tests/test_html_commands.sav}/test_cmd_comment.res (100%) rename src/doc/{commands/tests/test_commands_html.sav => templates/tests/test_html_commands.sav}/test_cmd_descendants.res (100%) rename src/doc/{commands/tests/test_commands_html.sav => templates/tests/test_html_commands.sav}/test_cmd_entity.res (100%) rename src/doc/{commands/tests/test_commands_html.sav => templates/tests/test_html_commands.sav}/test_cmd_features.res (100%) rename src/doc/{commands/tests/test_commands_html.sav => templates/tests/test_html_commands.sav}/test_cmd_ini_clone.res (100%) rename src/doc/{commands/tests/test_commands_html.sav => templates/tests/test_html_commands.sav}/test_cmd_ini_contrib_file.res (100%) rename src/doc/{commands/tests/test_commands_html.sav => templates/tests/test_html_commands.sav}/test_cmd_ini_contrib_file_content.res (100%) rename src/doc/{commands/tests/test_commands_html.sav => templates/tests/test_html_commands.sav}/test_cmd_ini_contributors.res (100%) rename src/doc/{commands/tests/test_commands_html.sav => templates/tests/test_html_commands.sav}/test_cmd_ini_desc.res (100%) rename src/doc/{commands/tests/test_commands_html.sav => templates/tests/test_html_commands.sav}/test_cmd_ini_git.res (100%) rename src/doc/{commands/tests/test_commands_html.sav => templates/tests/test_html_commands.sav}/test_cmd_ini_issues.res (100%) rename src/doc/{commands/tests/test_commands_html.sav => templates/tests/test_html_commands.sav}/test_cmd_ini_license.res (100%) rename src/doc/{commands/tests/test_commands_html.sav => templates/tests/test_html_commands.sav}/test_cmd_ini_license_file.res (100%) rename src/doc/{commands/tests/test_commands_html.sav => templates/tests/test_html_commands.sav}/test_cmd_ini_license_file_content.res (100%) rename src/doc/{commands/tests/test_commands_html.sav => templates/tests/test_html_commands.sav}/test_cmd_ini_maintainer.res (100%) rename src/doc/{commands/tests/test_commands_html.sav => templates/tests/test_html_commands.sav}/test_cmd_lin.res (100%) rename src/doc/{commands/tests/test_commands_html.sav => templates/tests/test_html_commands.sav}/test_cmd_link.res (100%) rename src/doc/{commands/tests/test_commands_html.sav => templates/tests/test_html_commands.sav}/test_cmd_main_compile.res (100%) rename src/doc/{commands/tests/test_commands_html.sav => templates/tests/test_html_commands.sav}/test_cmd_mains.res (100%) rename src/doc/{commands/tests/test_commands_html.sav => templates/tests/test_html_commands.sav}/test_cmd_man_options.res (100%) rename src/doc/{commands/tests/test_commands_html.sav => templates/tests/test_html_commands.sav}/test_cmd_man_synopsis.res (100%) rename src/doc/{commands/tests/test_commands_html.sav => templates/tests/test_html_commands.sav}/test_cmd_mentities.res (100%) rename src/doc/{commands/tests/test_commands_html.sav => templates/tests/test_html_commands.sav}/test_cmd_new.res (100%) rename src/doc/{commands/tests/test_commands_html.sav => templates/tests/test_html_commands.sav}/test_cmd_param.res (100%) rename src/doc/{commands/tests/test_commands_html.sav => templates/tests/test_html_commands.sav}/test_cmd_parents.res (100%) rename src/doc/{commands/tests/test_commands_html.sav => templates/tests/test_html_commands.sav}/test_cmd_return.res (100%) rename src/doc/{commands/tests/test_commands_html.sav => templates/tests/test_html_commands.sav}/test_cmd_search.res (100%) rename src/doc/{commands/tests/test_commands_html.sav => templates/tests/test_html_commands.sav}/test_cmd_testing.res (100%) diff --git a/src/doc/api/api_base.nit b/src/doc/api/api_base.nit index 4c3db90912..9e1cec2a50 100644 --- a/src/doc/api/api_base.nit +++ b/src/doc/api/api_base.nit @@ -22,7 +22,7 @@ import popcorn::pop_json import commands::commands_http import commands::commands_json -import commands::commands_html +import templates::html_commands # Nitweb config file. class NitwebConfig diff --git a/src/doc/commands/commands_html.nit b/src/doc/templates/html_commands.nit similarity index 98% rename from src/doc/commands/commands_html.nit rename to src/doc/templates/html_commands.nit index 2d485f62a4..39e088c35a 100644 --- a/src/doc/commands/commands_html.nit +++ b/src/doc/templates/html_commands.nit @@ -13,9 +13,10 @@ # limitations under the License. # Render commands results as HTML -module commands_html +module html_commands import commands_catalog +import commands_docdown import commands_graph import commands_ini import commands_main @@ -284,12 +285,6 @@ redef class CmdIniLicense 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_html do var file = self.file if file == null then return "" diff --git a/src/doc/commands/tests/test_commands_html.nit b/src/doc/templates/tests/test_html_commands.nit similarity index 98% rename from src/doc/commands/tests/test_commands_html.nit rename to src/doc/templates/tests/test_html_commands.nit index bd28d91280..dbaa9df0e6 100644 --- a/src/doc/commands/tests/test_commands_html.nit +++ b/src/doc/templates/tests/test_html_commands.nit @@ -12,11 +12,11 @@ # See the License for the specific language governing permissions and # limitations under the License. -module test_commands_html is test +module test_html_commands is test import test_commands intrude import doc::commands::commands_main -import doc::commands::commands_html +import html_commands class TestCommandsHtml super TestCommands diff --git a/src/doc/commands/tests/test_commands_html.sav/test_cmd_ancestors.res b/src/doc/templates/tests/test_html_commands.sav/test_cmd_ancestors.res similarity index 100% rename from src/doc/commands/tests/test_commands_html.sav/test_cmd_ancestors.res rename to src/doc/templates/tests/test_html_commands.sav/test_cmd_ancestors.res diff --git a/src/doc/commands/tests/test_commands_html.sav/test_cmd_call.res b/src/doc/templates/tests/test_html_commands.sav/test_cmd_call.res similarity index 100% rename from src/doc/commands/tests/test_commands_html.sav/test_cmd_call.res rename to src/doc/templates/tests/test_html_commands.sav/test_cmd_call.res diff --git a/src/doc/commands/tests/test_commands_html.sav/test_cmd_children.res b/src/doc/templates/tests/test_html_commands.sav/test_cmd_children.res similarity index 100% rename from src/doc/commands/tests/test_commands_html.sav/test_cmd_children.res rename to src/doc/templates/tests/test_html_commands.sav/test_cmd_children.res diff --git a/src/doc/commands/tests/test_commands_html.sav/test_cmd_comment.res b/src/doc/templates/tests/test_html_commands.sav/test_cmd_comment.res similarity index 100% rename from src/doc/commands/tests/test_commands_html.sav/test_cmd_comment.res rename to src/doc/templates/tests/test_html_commands.sav/test_cmd_comment.res diff --git a/src/doc/commands/tests/test_commands_html.sav/test_cmd_descendants.res b/src/doc/templates/tests/test_html_commands.sav/test_cmd_descendants.res similarity index 100% rename from src/doc/commands/tests/test_commands_html.sav/test_cmd_descendants.res rename to src/doc/templates/tests/test_html_commands.sav/test_cmd_descendants.res diff --git a/src/doc/commands/tests/test_commands_html.sav/test_cmd_entity.res b/src/doc/templates/tests/test_html_commands.sav/test_cmd_entity.res similarity index 100% rename from src/doc/commands/tests/test_commands_html.sav/test_cmd_entity.res rename to src/doc/templates/tests/test_html_commands.sav/test_cmd_entity.res diff --git a/src/doc/commands/tests/test_commands_html.sav/test_cmd_features.res b/src/doc/templates/tests/test_html_commands.sav/test_cmd_features.res similarity index 100% rename from src/doc/commands/tests/test_commands_html.sav/test_cmd_features.res rename to src/doc/templates/tests/test_html_commands.sav/test_cmd_features.res diff --git a/src/doc/commands/tests/test_commands_html.sav/test_cmd_ini_clone.res b/src/doc/templates/tests/test_html_commands.sav/test_cmd_ini_clone.res similarity index 100% rename from src/doc/commands/tests/test_commands_html.sav/test_cmd_ini_clone.res rename to src/doc/templates/tests/test_html_commands.sav/test_cmd_ini_clone.res diff --git a/src/doc/commands/tests/test_commands_html.sav/test_cmd_ini_contrib_file.res b/src/doc/templates/tests/test_html_commands.sav/test_cmd_ini_contrib_file.res similarity index 100% rename from src/doc/commands/tests/test_commands_html.sav/test_cmd_ini_contrib_file.res rename to src/doc/templates/tests/test_html_commands.sav/test_cmd_ini_contrib_file.res diff --git a/src/doc/commands/tests/test_commands_html.sav/test_cmd_ini_contrib_file_content.res b/src/doc/templates/tests/test_html_commands.sav/test_cmd_ini_contrib_file_content.res similarity index 100% rename from src/doc/commands/tests/test_commands_html.sav/test_cmd_ini_contrib_file_content.res rename to src/doc/templates/tests/test_html_commands.sav/test_cmd_ini_contrib_file_content.res diff --git a/src/doc/commands/tests/test_commands_html.sav/test_cmd_ini_contributors.res b/src/doc/templates/tests/test_html_commands.sav/test_cmd_ini_contributors.res similarity index 100% rename from src/doc/commands/tests/test_commands_html.sav/test_cmd_ini_contributors.res rename to src/doc/templates/tests/test_html_commands.sav/test_cmd_ini_contributors.res diff --git a/src/doc/commands/tests/test_commands_html.sav/test_cmd_ini_desc.res b/src/doc/templates/tests/test_html_commands.sav/test_cmd_ini_desc.res similarity index 100% rename from src/doc/commands/tests/test_commands_html.sav/test_cmd_ini_desc.res rename to src/doc/templates/tests/test_html_commands.sav/test_cmd_ini_desc.res diff --git a/src/doc/commands/tests/test_commands_html.sav/test_cmd_ini_git.res b/src/doc/templates/tests/test_html_commands.sav/test_cmd_ini_git.res similarity index 100% rename from src/doc/commands/tests/test_commands_html.sav/test_cmd_ini_git.res rename to src/doc/templates/tests/test_html_commands.sav/test_cmd_ini_git.res diff --git a/src/doc/commands/tests/test_commands_html.sav/test_cmd_ini_issues.res b/src/doc/templates/tests/test_html_commands.sav/test_cmd_ini_issues.res similarity index 100% rename from src/doc/commands/tests/test_commands_html.sav/test_cmd_ini_issues.res rename to src/doc/templates/tests/test_html_commands.sav/test_cmd_ini_issues.res diff --git a/src/doc/commands/tests/test_commands_html.sav/test_cmd_ini_license.res b/src/doc/templates/tests/test_html_commands.sav/test_cmd_ini_license.res similarity index 100% rename from src/doc/commands/tests/test_commands_html.sav/test_cmd_ini_license.res rename to src/doc/templates/tests/test_html_commands.sav/test_cmd_ini_license.res diff --git a/src/doc/commands/tests/test_commands_html.sav/test_cmd_ini_license_file.res b/src/doc/templates/tests/test_html_commands.sav/test_cmd_ini_license_file.res similarity index 100% rename from src/doc/commands/tests/test_commands_html.sav/test_cmd_ini_license_file.res rename to src/doc/templates/tests/test_html_commands.sav/test_cmd_ini_license_file.res diff --git a/src/doc/commands/tests/test_commands_html.sav/test_cmd_ini_license_file_content.res b/src/doc/templates/tests/test_html_commands.sav/test_cmd_ini_license_file_content.res similarity index 100% rename from src/doc/commands/tests/test_commands_html.sav/test_cmd_ini_license_file_content.res rename to src/doc/templates/tests/test_html_commands.sav/test_cmd_ini_license_file_content.res diff --git a/src/doc/commands/tests/test_commands_html.sav/test_cmd_ini_maintainer.res b/src/doc/templates/tests/test_html_commands.sav/test_cmd_ini_maintainer.res similarity index 100% rename from src/doc/commands/tests/test_commands_html.sav/test_cmd_ini_maintainer.res rename to src/doc/templates/tests/test_html_commands.sav/test_cmd_ini_maintainer.res diff --git a/src/doc/commands/tests/test_commands_html.sav/test_cmd_lin.res b/src/doc/templates/tests/test_html_commands.sav/test_cmd_lin.res similarity index 100% rename from src/doc/commands/tests/test_commands_html.sav/test_cmd_lin.res rename to src/doc/templates/tests/test_html_commands.sav/test_cmd_lin.res diff --git a/src/doc/commands/tests/test_commands_html.sav/test_cmd_link.res b/src/doc/templates/tests/test_html_commands.sav/test_cmd_link.res similarity index 100% rename from src/doc/commands/tests/test_commands_html.sav/test_cmd_link.res rename to src/doc/templates/tests/test_html_commands.sav/test_cmd_link.res diff --git a/src/doc/commands/tests/test_commands_html.sav/test_cmd_main_compile.res b/src/doc/templates/tests/test_html_commands.sav/test_cmd_main_compile.res similarity index 100% rename from src/doc/commands/tests/test_commands_html.sav/test_cmd_main_compile.res rename to src/doc/templates/tests/test_html_commands.sav/test_cmd_main_compile.res diff --git a/src/doc/commands/tests/test_commands_html.sav/test_cmd_mains.res b/src/doc/templates/tests/test_html_commands.sav/test_cmd_mains.res similarity index 100% rename from src/doc/commands/tests/test_commands_html.sav/test_cmd_mains.res rename to src/doc/templates/tests/test_html_commands.sav/test_cmd_mains.res diff --git a/src/doc/commands/tests/test_commands_html.sav/test_cmd_man_options.res b/src/doc/templates/tests/test_html_commands.sav/test_cmd_man_options.res similarity index 100% rename from src/doc/commands/tests/test_commands_html.sav/test_cmd_man_options.res rename to src/doc/templates/tests/test_html_commands.sav/test_cmd_man_options.res diff --git a/src/doc/commands/tests/test_commands_html.sav/test_cmd_man_synopsis.res b/src/doc/templates/tests/test_html_commands.sav/test_cmd_man_synopsis.res similarity index 100% rename from src/doc/commands/tests/test_commands_html.sav/test_cmd_man_synopsis.res rename to src/doc/templates/tests/test_html_commands.sav/test_cmd_man_synopsis.res diff --git a/src/doc/commands/tests/test_commands_html.sav/test_cmd_mentities.res b/src/doc/templates/tests/test_html_commands.sav/test_cmd_mentities.res similarity index 100% rename from src/doc/commands/tests/test_commands_html.sav/test_cmd_mentities.res rename to src/doc/templates/tests/test_html_commands.sav/test_cmd_mentities.res diff --git a/src/doc/commands/tests/test_commands_html.sav/test_cmd_new.res b/src/doc/templates/tests/test_html_commands.sav/test_cmd_new.res similarity index 100% rename from src/doc/commands/tests/test_commands_html.sav/test_cmd_new.res rename to src/doc/templates/tests/test_html_commands.sav/test_cmd_new.res diff --git a/src/doc/commands/tests/test_commands_html.sav/test_cmd_param.res b/src/doc/templates/tests/test_html_commands.sav/test_cmd_param.res similarity index 100% rename from src/doc/commands/tests/test_commands_html.sav/test_cmd_param.res rename to src/doc/templates/tests/test_html_commands.sav/test_cmd_param.res diff --git a/src/doc/commands/tests/test_commands_html.sav/test_cmd_parents.res b/src/doc/templates/tests/test_html_commands.sav/test_cmd_parents.res similarity index 100% rename from src/doc/commands/tests/test_commands_html.sav/test_cmd_parents.res rename to src/doc/templates/tests/test_html_commands.sav/test_cmd_parents.res diff --git a/src/doc/commands/tests/test_commands_html.sav/test_cmd_return.res b/src/doc/templates/tests/test_html_commands.sav/test_cmd_return.res similarity index 100% rename from src/doc/commands/tests/test_commands_html.sav/test_cmd_return.res rename to src/doc/templates/tests/test_html_commands.sav/test_cmd_return.res diff --git a/src/doc/commands/tests/test_commands_html.sav/test_cmd_search.res b/src/doc/templates/tests/test_html_commands.sav/test_cmd_search.res similarity index 100% rename from src/doc/commands/tests/test_commands_html.sav/test_cmd_search.res rename to src/doc/templates/tests/test_html_commands.sav/test_cmd_search.res diff --git a/src/doc/commands/tests/test_commands_html.sav/test_cmd_testing.res b/src/doc/templates/tests/test_html_commands.sav/test_cmd_testing.res similarity index 100% rename from src/doc/commands/tests/test_commands_html.sav/test_cmd_testing.res rename to src/doc/templates/tests/test_html_commands.sav/test_cmd_testing.res From adead3b8c36167048417277b05a068dcfcbdcea1 Mon Sep 17 00:00:00 2001 From: Alexandre Terrasa Date: Fri, 22 Jun 2018 00:01:30 -0400 Subject: [PATCH 18/19] src/doc/commands/templates: move `commands_json` to `json_commands` Signed-off-by: Alexandre Terrasa --- src/doc/api/api_base.nit | 3 ++- .../commands_json.nit => templates/json_commands.nit} | 2 +- .../tests/test_json_commands.nit} | 4 ++-- .../tests/test_json_commands.sav}/test_cmd_ancestors.res | 0 .../tests/test_json_commands.sav}/test_cmd_call.res | 0 .../tests/test_json_commands.sav}/test_cmd_children.res | 0 .../tests/test_json_commands.sav}/test_cmd_comment.res | 0 .../tests/test_json_commands.sav}/test_cmd_descendants.res | 0 .../tests/test_json_commands.sav}/test_cmd_entity.res | 0 .../tests/test_json_commands.sav}/test_cmd_features.res | 0 .../tests/test_json_commands.sav}/test_cmd_ini_clone.res | 0 .../test_json_commands.sav}/test_cmd_ini_contrib_file.res | 0 .../test_cmd_ini_contrib_file_content.res | 0 .../test_json_commands.sav}/test_cmd_ini_contributors.res | 0 .../tests/test_json_commands.sav}/test_cmd_ini_desc.res | 0 .../tests/test_json_commands.sav}/test_cmd_ini_git.res | 0 .../tests/test_json_commands.sav}/test_cmd_ini_issues.res | 0 .../tests/test_json_commands.sav}/test_cmd_ini_license.res | 0 .../test_json_commands.sav}/test_cmd_ini_license_file.res | 0 .../test_cmd_ini_license_file_content.res | 0 .../tests/test_json_commands.sav}/test_cmd_ini_maintainer.res | 0 .../tests/test_json_commands.sav}/test_cmd_lin.res | 0 .../tests/test_json_commands.sav}/test_cmd_link.res | 0 .../tests/test_json_commands.sav}/test_cmd_main_compile.res | 0 .../tests/test_json_commands.sav}/test_cmd_mains.res | 0 .../tests/test_json_commands.sav}/test_cmd_man_options.res | 0 .../tests/test_json_commands.sav}/test_cmd_man_synopsis.res | 0 .../tests/test_json_commands.sav}/test_cmd_mentities.res | 0 .../tests/test_json_commands.sav}/test_cmd_new.res | 0 .../tests/test_json_commands.sav}/test_cmd_param.res | 0 .../tests/test_json_commands.sav}/test_cmd_parents.res | 0 .../tests/test_json_commands.sav}/test_cmd_return.res | 0 .../tests/test_json_commands.sav}/test_cmd_search.res | 0 .../tests/test_json_commands.sav}/test_cmd_testing.res | 0 34 files changed, 5 insertions(+), 4 deletions(-) rename src/doc/{commands/commands_json.nit => templates/json_commands.nit} (99%) rename src/doc/{commands/tests/test_commands_json.nit => templates/tests/test_json_commands.nit} (99%) rename src/doc/{commands/tests/test_commands_json.sav => templates/tests/test_json_commands.sav}/test_cmd_ancestors.res (100%) rename src/doc/{commands/tests/test_commands_json.sav => templates/tests/test_json_commands.sav}/test_cmd_call.res (100%) rename src/doc/{commands/tests/test_commands_json.sav => templates/tests/test_json_commands.sav}/test_cmd_children.res (100%) rename src/doc/{commands/tests/test_commands_json.sav => templates/tests/test_json_commands.sav}/test_cmd_comment.res (100%) rename src/doc/{commands/tests/test_commands_json.sav => templates/tests/test_json_commands.sav}/test_cmd_descendants.res (100%) rename src/doc/{commands/tests/test_commands_json.sav => templates/tests/test_json_commands.sav}/test_cmd_entity.res (100%) rename src/doc/{commands/tests/test_commands_json.sav => templates/tests/test_json_commands.sav}/test_cmd_features.res (100%) rename src/doc/{commands/tests/test_commands_json.sav => templates/tests/test_json_commands.sav}/test_cmd_ini_clone.res (100%) rename src/doc/{commands/tests/test_commands_json.sav => templates/tests/test_json_commands.sav}/test_cmd_ini_contrib_file.res (100%) rename src/doc/{commands/tests/test_commands_json.sav => templates/tests/test_json_commands.sav}/test_cmd_ini_contrib_file_content.res (100%) rename src/doc/{commands/tests/test_commands_json.sav => templates/tests/test_json_commands.sav}/test_cmd_ini_contributors.res (100%) rename src/doc/{commands/tests/test_commands_json.sav => templates/tests/test_json_commands.sav}/test_cmd_ini_desc.res (100%) rename src/doc/{commands/tests/test_commands_json.sav => templates/tests/test_json_commands.sav}/test_cmd_ini_git.res (100%) rename src/doc/{commands/tests/test_commands_json.sav => templates/tests/test_json_commands.sav}/test_cmd_ini_issues.res (100%) rename src/doc/{commands/tests/test_commands_json.sav => templates/tests/test_json_commands.sav}/test_cmd_ini_license.res (100%) rename src/doc/{commands/tests/test_commands_json.sav => templates/tests/test_json_commands.sav}/test_cmd_ini_license_file.res (100%) rename src/doc/{commands/tests/test_commands_json.sav => templates/tests/test_json_commands.sav}/test_cmd_ini_license_file_content.res (100%) rename src/doc/{commands/tests/test_commands_json.sav => templates/tests/test_json_commands.sav}/test_cmd_ini_maintainer.res (100%) rename src/doc/{commands/tests/test_commands_json.sav => templates/tests/test_json_commands.sav}/test_cmd_lin.res (100%) rename src/doc/{commands/tests/test_commands_json.sav => templates/tests/test_json_commands.sav}/test_cmd_link.res (100%) rename src/doc/{commands/tests/test_commands_json.sav => templates/tests/test_json_commands.sav}/test_cmd_main_compile.res (100%) rename src/doc/{commands/tests/test_commands_json.sav => templates/tests/test_json_commands.sav}/test_cmd_mains.res (100%) rename src/doc/{commands/tests/test_commands_json.sav => templates/tests/test_json_commands.sav}/test_cmd_man_options.res (100%) rename src/doc/{commands/tests/test_commands_json.sav => templates/tests/test_json_commands.sav}/test_cmd_man_synopsis.res (100%) rename src/doc/{commands/tests/test_commands_json.sav => templates/tests/test_json_commands.sav}/test_cmd_mentities.res (100%) rename src/doc/{commands/tests/test_commands_json.sav => templates/tests/test_json_commands.sav}/test_cmd_new.res (100%) rename src/doc/{commands/tests/test_commands_json.sav => templates/tests/test_json_commands.sav}/test_cmd_param.res (100%) rename src/doc/{commands/tests/test_commands_json.sav => templates/tests/test_json_commands.sav}/test_cmd_parents.res (100%) rename src/doc/{commands/tests/test_commands_json.sav => templates/tests/test_json_commands.sav}/test_cmd_return.res (100%) rename src/doc/{commands/tests/test_commands_json.sav => templates/tests/test_json_commands.sav}/test_cmd_search.res (100%) rename src/doc/{commands/tests/test_commands_json.sav => templates/tests/test_json_commands.sav}/test_cmd_testing.res (100%) diff --git a/src/doc/api/api_base.nit b/src/doc/api/api_base.nit index 9e1cec2a50..95a6ff071d 100644 --- a/src/doc/api/api_base.nit +++ b/src/doc/api/api_base.nit @@ -21,7 +21,8 @@ import popcorn::pop_repos import popcorn::pop_json import commands::commands_http -import commands::commands_json + +import templates::json_commands import templates::html_commands # Nitweb config file. diff --git a/src/doc/commands/commands_json.nit b/src/doc/templates/json_commands.nit similarity index 99% rename from src/doc/commands/commands_json.nit rename to src/doc/templates/json_commands.nit index 9f197d7c54..aea7be3ad5 100644 --- a/src/doc/commands/commands_json.nit +++ b/src/doc/templates/json_commands.nit @@ -13,7 +13,7 @@ # limitations under the License. # Translate command results to json -module commands_json +module json_commands import commands_catalog import commands_graph diff --git a/src/doc/commands/tests/test_commands_json.nit b/src/doc/templates/tests/test_json_commands.nit similarity index 99% rename from src/doc/commands/tests/test_commands_json.nit rename to src/doc/templates/tests/test_json_commands.nit index 0713979e87..92728e048b 100644 --- a/src/doc/commands/tests/test_commands_json.nit +++ b/src/doc/templates/tests/test_json_commands.nit @@ -12,11 +12,11 @@ # See the License for the specific language governing permissions and # limitations under the License. -module test_commands_json is test +module test_json_commands is test import test_commands intrude import doc::commands::commands_main -import doc::commands::commands_json +import json_commands class TestCommandsJson super TestCommands diff --git a/src/doc/commands/tests/test_commands_json.sav/test_cmd_ancestors.res b/src/doc/templates/tests/test_json_commands.sav/test_cmd_ancestors.res similarity index 100% rename from src/doc/commands/tests/test_commands_json.sav/test_cmd_ancestors.res rename to src/doc/templates/tests/test_json_commands.sav/test_cmd_ancestors.res diff --git a/src/doc/commands/tests/test_commands_json.sav/test_cmd_call.res b/src/doc/templates/tests/test_json_commands.sav/test_cmd_call.res similarity index 100% rename from src/doc/commands/tests/test_commands_json.sav/test_cmd_call.res rename to src/doc/templates/tests/test_json_commands.sav/test_cmd_call.res diff --git a/src/doc/commands/tests/test_commands_json.sav/test_cmd_children.res b/src/doc/templates/tests/test_json_commands.sav/test_cmd_children.res similarity index 100% rename from src/doc/commands/tests/test_commands_json.sav/test_cmd_children.res rename to src/doc/templates/tests/test_json_commands.sav/test_cmd_children.res diff --git a/src/doc/commands/tests/test_commands_json.sav/test_cmd_comment.res b/src/doc/templates/tests/test_json_commands.sav/test_cmd_comment.res similarity index 100% rename from src/doc/commands/tests/test_commands_json.sav/test_cmd_comment.res rename to src/doc/templates/tests/test_json_commands.sav/test_cmd_comment.res diff --git a/src/doc/commands/tests/test_commands_json.sav/test_cmd_descendants.res b/src/doc/templates/tests/test_json_commands.sav/test_cmd_descendants.res similarity index 100% rename from src/doc/commands/tests/test_commands_json.sav/test_cmd_descendants.res rename to src/doc/templates/tests/test_json_commands.sav/test_cmd_descendants.res diff --git a/src/doc/commands/tests/test_commands_json.sav/test_cmd_entity.res b/src/doc/templates/tests/test_json_commands.sav/test_cmd_entity.res similarity index 100% rename from src/doc/commands/tests/test_commands_json.sav/test_cmd_entity.res rename to src/doc/templates/tests/test_json_commands.sav/test_cmd_entity.res diff --git a/src/doc/commands/tests/test_commands_json.sav/test_cmd_features.res b/src/doc/templates/tests/test_json_commands.sav/test_cmd_features.res similarity index 100% rename from src/doc/commands/tests/test_commands_json.sav/test_cmd_features.res rename to src/doc/templates/tests/test_json_commands.sav/test_cmd_features.res diff --git a/src/doc/commands/tests/test_commands_json.sav/test_cmd_ini_clone.res b/src/doc/templates/tests/test_json_commands.sav/test_cmd_ini_clone.res similarity index 100% rename from src/doc/commands/tests/test_commands_json.sav/test_cmd_ini_clone.res rename to src/doc/templates/tests/test_json_commands.sav/test_cmd_ini_clone.res diff --git a/src/doc/commands/tests/test_commands_json.sav/test_cmd_ini_contrib_file.res b/src/doc/templates/tests/test_json_commands.sav/test_cmd_ini_contrib_file.res similarity index 100% rename from src/doc/commands/tests/test_commands_json.sav/test_cmd_ini_contrib_file.res rename to src/doc/templates/tests/test_json_commands.sav/test_cmd_ini_contrib_file.res diff --git a/src/doc/commands/tests/test_commands_json.sav/test_cmd_ini_contrib_file_content.res b/src/doc/templates/tests/test_json_commands.sav/test_cmd_ini_contrib_file_content.res similarity index 100% rename from src/doc/commands/tests/test_commands_json.sav/test_cmd_ini_contrib_file_content.res rename to src/doc/templates/tests/test_json_commands.sav/test_cmd_ini_contrib_file_content.res diff --git a/src/doc/commands/tests/test_commands_json.sav/test_cmd_ini_contributors.res b/src/doc/templates/tests/test_json_commands.sav/test_cmd_ini_contributors.res similarity index 100% rename from src/doc/commands/tests/test_commands_json.sav/test_cmd_ini_contributors.res rename to src/doc/templates/tests/test_json_commands.sav/test_cmd_ini_contributors.res diff --git a/src/doc/commands/tests/test_commands_json.sav/test_cmd_ini_desc.res b/src/doc/templates/tests/test_json_commands.sav/test_cmd_ini_desc.res similarity index 100% rename from src/doc/commands/tests/test_commands_json.sav/test_cmd_ini_desc.res rename to src/doc/templates/tests/test_json_commands.sav/test_cmd_ini_desc.res diff --git a/src/doc/commands/tests/test_commands_json.sav/test_cmd_ini_git.res b/src/doc/templates/tests/test_json_commands.sav/test_cmd_ini_git.res similarity index 100% rename from src/doc/commands/tests/test_commands_json.sav/test_cmd_ini_git.res rename to src/doc/templates/tests/test_json_commands.sav/test_cmd_ini_git.res diff --git a/src/doc/commands/tests/test_commands_json.sav/test_cmd_ini_issues.res b/src/doc/templates/tests/test_json_commands.sav/test_cmd_ini_issues.res similarity index 100% rename from src/doc/commands/tests/test_commands_json.sav/test_cmd_ini_issues.res rename to src/doc/templates/tests/test_json_commands.sav/test_cmd_ini_issues.res diff --git a/src/doc/commands/tests/test_commands_json.sav/test_cmd_ini_license.res b/src/doc/templates/tests/test_json_commands.sav/test_cmd_ini_license.res similarity index 100% rename from src/doc/commands/tests/test_commands_json.sav/test_cmd_ini_license.res rename to src/doc/templates/tests/test_json_commands.sav/test_cmd_ini_license.res diff --git a/src/doc/commands/tests/test_commands_json.sav/test_cmd_ini_license_file.res b/src/doc/templates/tests/test_json_commands.sav/test_cmd_ini_license_file.res similarity index 100% rename from src/doc/commands/tests/test_commands_json.sav/test_cmd_ini_license_file.res rename to src/doc/templates/tests/test_json_commands.sav/test_cmd_ini_license_file.res diff --git a/src/doc/commands/tests/test_commands_json.sav/test_cmd_ini_license_file_content.res b/src/doc/templates/tests/test_json_commands.sav/test_cmd_ini_license_file_content.res similarity index 100% rename from src/doc/commands/tests/test_commands_json.sav/test_cmd_ini_license_file_content.res rename to src/doc/templates/tests/test_json_commands.sav/test_cmd_ini_license_file_content.res diff --git a/src/doc/commands/tests/test_commands_json.sav/test_cmd_ini_maintainer.res b/src/doc/templates/tests/test_json_commands.sav/test_cmd_ini_maintainer.res similarity index 100% rename from src/doc/commands/tests/test_commands_json.sav/test_cmd_ini_maintainer.res rename to src/doc/templates/tests/test_json_commands.sav/test_cmd_ini_maintainer.res diff --git a/src/doc/commands/tests/test_commands_json.sav/test_cmd_lin.res b/src/doc/templates/tests/test_json_commands.sav/test_cmd_lin.res similarity index 100% rename from src/doc/commands/tests/test_commands_json.sav/test_cmd_lin.res rename to src/doc/templates/tests/test_json_commands.sav/test_cmd_lin.res diff --git a/src/doc/commands/tests/test_commands_json.sav/test_cmd_link.res b/src/doc/templates/tests/test_json_commands.sav/test_cmd_link.res similarity index 100% rename from src/doc/commands/tests/test_commands_json.sav/test_cmd_link.res rename to src/doc/templates/tests/test_json_commands.sav/test_cmd_link.res diff --git a/src/doc/commands/tests/test_commands_json.sav/test_cmd_main_compile.res b/src/doc/templates/tests/test_json_commands.sav/test_cmd_main_compile.res similarity index 100% rename from src/doc/commands/tests/test_commands_json.sav/test_cmd_main_compile.res rename to src/doc/templates/tests/test_json_commands.sav/test_cmd_main_compile.res diff --git a/src/doc/commands/tests/test_commands_json.sav/test_cmd_mains.res b/src/doc/templates/tests/test_json_commands.sav/test_cmd_mains.res similarity index 100% rename from src/doc/commands/tests/test_commands_json.sav/test_cmd_mains.res rename to src/doc/templates/tests/test_json_commands.sav/test_cmd_mains.res diff --git a/src/doc/commands/tests/test_commands_json.sav/test_cmd_man_options.res b/src/doc/templates/tests/test_json_commands.sav/test_cmd_man_options.res similarity index 100% rename from src/doc/commands/tests/test_commands_json.sav/test_cmd_man_options.res rename to src/doc/templates/tests/test_json_commands.sav/test_cmd_man_options.res diff --git a/src/doc/commands/tests/test_commands_json.sav/test_cmd_man_synopsis.res b/src/doc/templates/tests/test_json_commands.sav/test_cmd_man_synopsis.res similarity index 100% rename from src/doc/commands/tests/test_commands_json.sav/test_cmd_man_synopsis.res rename to src/doc/templates/tests/test_json_commands.sav/test_cmd_man_synopsis.res diff --git a/src/doc/commands/tests/test_commands_json.sav/test_cmd_mentities.res b/src/doc/templates/tests/test_json_commands.sav/test_cmd_mentities.res similarity index 100% rename from src/doc/commands/tests/test_commands_json.sav/test_cmd_mentities.res rename to src/doc/templates/tests/test_json_commands.sav/test_cmd_mentities.res diff --git a/src/doc/commands/tests/test_commands_json.sav/test_cmd_new.res b/src/doc/templates/tests/test_json_commands.sav/test_cmd_new.res similarity index 100% rename from src/doc/commands/tests/test_commands_json.sav/test_cmd_new.res rename to src/doc/templates/tests/test_json_commands.sav/test_cmd_new.res diff --git a/src/doc/commands/tests/test_commands_json.sav/test_cmd_param.res b/src/doc/templates/tests/test_json_commands.sav/test_cmd_param.res similarity index 100% rename from src/doc/commands/tests/test_commands_json.sav/test_cmd_param.res rename to src/doc/templates/tests/test_json_commands.sav/test_cmd_param.res diff --git a/src/doc/commands/tests/test_commands_json.sav/test_cmd_parents.res b/src/doc/templates/tests/test_json_commands.sav/test_cmd_parents.res similarity index 100% rename from src/doc/commands/tests/test_commands_json.sav/test_cmd_parents.res rename to src/doc/templates/tests/test_json_commands.sav/test_cmd_parents.res diff --git a/src/doc/commands/tests/test_commands_json.sav/test_cmd_return.res b/src/doc/templates/tests/test_json_commands.sav/test_cmd_return.res similarity index 100% rename from src/doc/commands/tests/test_commands_json.sav/test_cmd_return.res rename to src/doc/templates/tests/test_json_commands.sav/test_cmd_return.res diff --git a/src/doc/commands/tests/test_commands_json.sav/test_cmd_search.res b/src/doc/templates/tests/test_json_commands.sav/test_cmd_search.res similarity index 100% rename from src/doc/commands/tests/test_commands_json.sav/test_cmd_search.res rename to src/doc/templates/tests/test_json_commands.sav/test_cmd_search.res diff --git a/src/doc/commands/tests/test_commands_json.sav/test_cmd_testing.res b/src/doc/templates/tests/test_json_commands.sav/test_cmd_testing.res similarity index 100% rename from src/doc/commands/tests/test_commands_json.sav/test_cmd_testing.res rename to src/doc/templates/tests/test_json_commands.sav/test_cmd_testing.res From b67f694e857503a2fa660b02b7769d9d2f47094d Mon Sep 17 00:00:00 2001 From: Alexandre Terrasa Date: Fri, 22 Jun 2018 00:05:13 -0400 Subject: [PATCH 19/19] src/doc/commands/templates: move `commands_json` to `json_commands` Signed-off-by: Alexandre Terrasa --- src/doc/commands/commands_docdown.nit | 2 +- .../{commands/commands_md.nit => templates/md_commands.nit} | 2 +- .../tests/test_md_commands.nit} | 4 ++-- .../tests/test_md_commands.sav}/test_cmd_ancestors.res | 0 .../tests/test_md_commands.sav}/test_cmd_call.res | 0 .../tests/test_md_commands.sav}/test_cmd_children.res | 0 .../tests/test_md_commands.sav}/test_cmd_comment.res | 0 .../tests/test_md_commands.sav}/test_cmd_descendants.res | 0 .../tests/test_md_commands.sav}/test_cmd_entity.res | 0 .../tests/test_md_commands.sav}/test_cmd_features.res | 0 .../tests/test_md_commands.sav}/test_cmd_ini_clone.res | 0 .../tests/test_md_commands.sav}/test_cmd_ini_contrib_file.res | 0 .../test_cmd_ini_contrib_file_content.res | 0 .../tests/test_md_commands.sav}/test_cmd_ini_contributors.res | 0 .../tests/test_md_commands.sav}/test_cmd_ini_desc.res | 0 .../tests/test_md_commands.sav}/test_cmd_ini_git.res | 0 .../tests/test_md_commands.sav}/test_cmd_ini_issues.res | 0 .../tests/test_md_commands.sav}/test_cmd_ini_license.res | 0 .../tests/test_md_commands.sav}/test_cmd_ini_license_file.res | 0 .../test_cmd_ini_license_file_content.res | 0 .../tests/test_md_commands.sav}/test_cmd_ini_maintainer.res | 0 .../tests/test_md_commands.sav}/test_cmd_lin.res | 0 .../tests/test_md_commands.sav}/test_cmd_link.res | 0 .../tests/test_md_commands.sav}/test_cmd_main_compile.res | 0 .../tests/test_md_commands.sav}/test_cmd_mains.res | 0 .../tests/test_md_commands.sav}/test_cmd_man_options.res | 0 .../tests/test_md_commands.sav}/test_cmd_man_synopsis.res | 0 .../tests/test_md_commands.sav}/test_cmd_mentities.res | 0 .../tests/test_md_commands.sav}/test_cmd_new.res | 0 .../tests/test_md_commands.sav}/test_cmd_param.res | 0 .../tests/test_md_commands.sav}/test_cmd_parents.res | 0 .../tests/test_md_commands.sav}/test_cmd_return.res | 0 .../tests/test_md_commands.sav}/test_cmd_search.res | 0 .../tests/test_md_commands.sav}/test_cmd_testing.res | 0 src/doc/term/term.nit | 1 + 35 files changed, 5 insertions(+), 4 deletions(-) rename src/doc/{commands/commands_md.nit => templates/md_commands.nit} (99%) rename src/doc/{commands/tests/test_commands_md.nit => templates/tests/test_md_commands.nit} (98%) rename src/doc/{commands/tests/test_commands_md.sav => templates/tests/test_md_commands.sav}/test_cmd_ancestors.res (100%) rename src/doc/{commands/tests/test_commands_md.sav => templates/tests/test_md_commands.sav}/test_cmd_call.res (100%) rename src/doc/{commands/tests/test_commands_md.sav => templates/tests/test_md_commands.sav}/test_cmd_children.res (100%) rename src/doc/{commands/tests/test_commands_md.sav => templates/tests/test_md_commands.sav}/test_cmd_comment.res (100%) rename src/doc/{commands/tests/test_commands_md.sav => templates/tests/test_md_commands.sav}/test_cmd_descendants.res (100%) rename src/doc/{commands/tests/test_commands_md.sav => templates/tests/test_md_commands.sav}/test_cmd_entity.res (100%) rename src/doc/{commands/tests/test_commands_md.sav => templates/tests/test_md_commands.sav}/test_cmd_features.res (100%) rename src/doc/{commands/tests/test_commands_md.sav => templates/tests/test_md_commands.sav}/test_cmd_ini_clone.res (100%) rename src/doc/{commands/tests/test_commands_md.sav => templates/tests/test_md_commands.sav}/test_cmd_ini_contrib_file.res (100%) rename src/doc/{commands/tests/test_commands_md.sav => templates/tests/test_md_commands.sav}/test_cmd_ini_contrib_file_content.res (100%) rename src/doc/{commands/tests/test_commands_md.sav => templates/tests/test_md_commands.sav}/test_cmd_ini_contributors.res (100%) rename src/doc/{commands/tests/test_commands_md.sav => templates/tests/test_md_commands.sav}/test_cmd_ini_desc.res (100%) rename src/doc/{commands/tests/test_commands_md.sav => templates/tests/test_md_commands.sav}/test_cmd_ini_git.res (100%) rename src/doc/{commands/tests/test_commands_md.sav => templates/tests/test_md_commands.sav}/test_cmd_ini_issues.res (100%) rename src/doc/{commands/tests/test_commands_md.sav => templates/tests/test_md_commands.sav}/test_cmd_ini_license.res (100%) rename src/doc/{commands/tests/test_commands_md.sav => templates/tests/test_md_commands.sav}/test_cmd_ini_license_file.res (100%) rename src/doc/{commands/tests/test_commands_md.sav => templates/tests/test_md_commands.sav}/test_cmd_ini_license_file_content.res (100%) rename src/doc/{commands/tests/test_commands_md.sav => templates/tests/test_md_commands.sav}/test_cmd_ini_maintainer.res (100%) rename src/doc/{commands/tests/test_commands_md.sav => templates/tests/test_md_commands.sav}/test_cmd_lin.res (100%) rename src/doc/{commands/tests/test_commands_md.sav => templates/tests/test_md_commands.sav}/test_cmd_link.res (100%) rename src/doc/{commands/tests/test_commands_md.sav => templates/tests/test_md_commands.sav}/test_cmd_main_compile.res (100%) rename src/doc/{commands/tests/test_commands_md.sav => templates/tests/test_md_commands.sav}/test_cmd_mains.res (100%) rename src/doc/{commands/tests/test_commands_md.sav => templates/tests/test_md_commands.sav}/test_cmd_man_options.res (100%) rename src/doc/{commands/tests/test_commands_md.sav => templates/tests/test_md_commands.sav}/test_cmd_man_synopsis.res (100%) rename src/doc/{commands/tests/test_commands_md.sav => templates/tests/test_md_commands.sav}/test_cmd_mentities.res (100%) rename src/doc/{commands/tests/test_commands_md.sav => templates/tests/test_md_commands.sav}/test_cmd_new.res (100%) rename src/doc/{commands/tests/test_commands_md.sav => templates/tests/test_md_commands.sav}/test_cmd_param.res (100%) rename src/doc/{commands/tests/test_commands_md.sav => templates/tests/test_md_commands.sav}/test_cmd_parents.res (100%) rename src/doc/{commands/tests/test_commands_md.sav => templates/tests/test_md_commands.sav}/test_cmd_return.res (100%) rename src/doc/{commands/tests/test_commands_md.sav => templates/tests/test_md_commands.sav}/test_cmd_search.res (100%) rename src/doc/{commands/tests/test_commands_md.sav => templates/tests/test_md_commands.sav}/test_cmd_testing.res (100%) diff --git a/src/doc/commands/commands_docdown.nit b/src/doc/commands/commands_docdown.nit index 1699454ab9..ece9daec3e 100644 --- a/src/doc/commands/commands_docdown.nit +++ b/src/doc/commands/commands_docdown.nit @@ -15,7 +15,7 @@ # Doc down related queries module commands_docdown -import commands_md +import templates::md_commands import markdown # Retrieve the MDoc summary diff --git a/src/doc/commands/commands_md.nit b/src/doc/templates/md_commands.nit similarity index 99% rename from src/doc/commands/commands_md.nit rename to src/doc/templates/md_commands.nit index f8dee5b2d1..4c004c7a97 100644 --- a/src/doc/commands/commands_md.nit +++ b/src/doc/templates/md_commands.nit @@ -13,7 +13,7 @@ # limitations under the License. # Render commands results as Markdown -module commands_md +module md_commands import commands_catalog import commands_graph diff --git a/src/doc/commands/tests/test_commands_md.nit b/src/doc/templates/tests/test_md_commands.nit similarity index 98% rename from src/doc/commands/tests/test_commands_md.nit rename to src/doc/templates/tests/test_md_commands.nit index 031e21e636..de7d65597b 100644 --- a/src/doc/commands/tests/test_commands_md.nit +++ b/src/doc/templates/tests/test_md_commands.nit @@ -12,11 +12,11 @@ # See the License for the specific language governing permissions and # limitations under the License. -module test_commands_md is test +module test_md_commands is test import test_commands intrude import doc::commands::commands_main -import doc::commands::commands_md +import md_commands class TestCommandsMd super TestCommands diff --git a/src/doc/commands/tests/test_commands_md.sav/test_cmd_ancestors.res b/src/doc/templates/tests/test_md_commands.sav/test_cmd_ancestors.res similarity index 100% rename from src/doc/commands/tests/test_commands_md.sav/test_cmd_ancestors.res rename to src/doc/templates/tests/test_md_commands.sav/test_cmd_ancestors.res diff --git a/src/doc/commands/tests/test_commands_md.sav/test_cmd_call.res b/src/doc/templates/tests/test_md_commands.sav/test_cmd_call.res similarity index 100% rename from src/doc/commands/tests/test_commands_md.sav/test_cmd_call.res rename to src/doc/templates/tests/test_md_commands.sav/test_cmd_call.res diff --git a/src/doc/commands/tests/test_commands_md.sav/test_cmd_children.res b/src/doc/templates/tests/test_md_commands.sav/test_cmd_children.res similarity index 100% rename from src/doc/commands/tests/test_commands_md.sav/test_cmd_children.res rename to src/doc/templates/tests/test_md_commands.sav/test_cmd_children.res diff --git a/src/doc/commands/tests/test_commands_md.sav/test_cmd_comment.res b/src/doc/templates/tests/test_md_commands.sav/test_cmd_comment.res similarity index 100% rename from src/doc/commands/tests/test_commands_md.sav/test_cmd_comment.res rename to src/doc/templates/tests/test_md_commands.sav/test_cmd_comment.res diff --git a/src/doc/commands/tests/test_commands_md.sav/test_cmd_descendants.res b/src/doc/templates/tests/test_md_commands.sav/test_cmd_descendants.res similarity index 100% rename from src/doc/commands/tests/test_commands_md.sav/test_cmd_descendants.res rename to src/doc/templates/tests/test_md_commands.sav/test_cmd_descendants.res diff --git a/src/doc/commands/tests/test_commands_md.sav/test_cmd_entity.res b/src/doc/templates/tests/test_md_commands.sav/test_cmd_entity.res similarity index 100% rename from src/doc/commands/tests/test_commands_md.sav/test_cmd_entity.res rename to src/doc/templates/tests/test_md_commands.sav/test_cmd_entity.res diff --git a/src/doc/commands/tests/test_commands_md.sav/test_cmd_features.res b/src/doc/templates/tests/test_md_commands.sav/test_cmd_features.res similarity index 100% rename from src/doc/commands/tests/test_commands_md.sav/test_cmd_features.res rename to src/doc/templates/tests/test_md_commands.sav/test_cmd_features.res diff --git a/src/doc/commands/tests/test_commands_md.sav/test_cmd_ini_clone.res b/src/doc/templates/tests/test_md_commands.sav/test_cmd_ini_clone.res similarity index 100% rename from src/doc/commands/tests/test_commands_md.sav/test_cmd_ini_clone.res rename to src/doc/templates/tests/test_md_commands.sav/test_cmd_ini_clone.res diff --git a/src/doc/commands/tests/test_commands_md.sav/test_cmd_ini_contrib_file.res b/src/doc/templates/tests/test_md_commands.sav/test_cmd_ini_contrib_file.res similarity index 100% rename from src/doc/commands/tests/test_commands_md.sav/test_cmd_ini_contrib_file.res rename to src/doc/templates/tests/test_md_commands.sav/test_cmd_ini_contrib_file.res diff --git a/src/doc/commands/tests/test_commands_md.sav/test_cmd_ini_contrib_file_content.res b/src/doc/templates/tests/test_md_commands.sav/test_cmd_ini_contrib_file_content.res similarity index 100% rename from src/doc/commands/tests/test_commands_md.sav/test_cmd_ini_contrib_file_content.res rename to src/doc/templates/tests/test_md_commands.sav/test_cmd_ini_contrib_file_content.res diff --git a/src/doc/commands/tests/test_commands_md.sav/test_cmd_ini_contributors.res b/src/doc/templates/tests/test_md_commands.sav/test_cmd_ini_contributors.res similarity index 100% rename from src/doc/commands/tests/test_commands_md.sav/test_cmd_ini_contributors.res rename to src/doc/templates/tests/test_md_commands.sav/test_cmd_ini_contributors.res diff --git a/src/doc/commands/tests/test_commands_md.sav/test_cmd_ini_desc.res b/src/doc/templates/tests/test_md_commands.sav/test_cmd_ini_desc.res similarity index 100% rename from src/doc/commands/tests/test_commands_md.sav/test_cmd_ini_desc.res rename to src/doc/templates/tests/test_md_commands.sav/test_cmd_ini_desc.res diff --git a/src/doc/commands/tests/test_commands_md.sav/test_cmd_ini_git.res b/src/doc/templates/tests/test_md_commands.sav/test_cmd_ini_git.res similarity index 100% rename from src/doc/commands/tests/test_commands_md.sav/test_cmd_ini_git.res rename to src/doc/templates/tests/test_md_commands.sav/test_cmd_ini_git.res diff --git a/src/doc/commands/tests/test_commands_md.sav/test_cmd_ini_issues.res b/src/doc/templates/tests/test_md_commands.sav/test_cmd_ini_issues.res similarity index 100% rename from src/doc/commands/tests/test_commands_md.sav/test_cmd_ini_issues.res rename to src/doc/templates/tests/test_md_commands.sav/test_cmd_ini_issues.res diff --git a/src/doc/commands/tests/test_commands_md.sav/test_cmd_ini_license.res b/src/doc/templates/tests/test_md_commands.sav/test_cmd_ini_license.res similarity index 100% rename from src/doc/commands/tests/test_commands_md.sav/test_cmd_ini_license.res rename to src/doc/templates/tests/test_md_commands.sav/test_cmd_ini_license.res diff --git a/src/doc/commands/tests/test_commands_md.sav/test_cmd_ini_license_file.res b/src/doc/templates/tests/test_md_commands.sav/test_cmd_ini_license_file.res similarity index 100% rename from src/doc/commands/tests/test_commands_md.sav/test_cmd_ini_license_file.res rename to src/doc/templates/tests/test_md_commands.sav/test_cmd_ini_license_file.res diff --git a/src/doc/commands/tests/test_commands_md.sav/test_cmd_ini_license_file_content.res b/src/doc/templates/tests/test_md_commands.sav/test_cmd_ini_license_file_content.res similarity index 100% rename from src/doc/commands/tests/test_commands_md.sav/test_cmd_ini_license_file_content.res rename to src/doc/templates/tests/test_md_commands.sav/test_cmd_ini_license_file_content.res diff --git a/src/doc/commands/tests/test_commands_md.sav/test_cmd_ini_maintainer.res b/src/doc/templates/tests/test_md_commands.sav/test_cmd_ini_maintainer.res similarity index 100% rename from src/doc/commands/tests/test_commands_md.sav/test_cmd_ini_maintainer.res rename to src/doc/templates/tests/test_md_commands.sav/test_cmd_ini_maintainer.res diff --git a/src/doc/commands/tests/test_commands_md.sav/test_cmd_lin.res b/src/doc/templates/tests/test_md_commands.sav/test_cmd_lin.res similarity index 100% rename from src/doc/commands/tests/test_commands_md.sav/test_cmd_lin.res rename to src/doc/templates/tests/test_md_commands.sav/test_cmd_lin.res diff --git a/src/doc/commands/tests/test_commands_md.sav/test_cmd_link.res b/src/doc/templates/tests/test_md_commands.sav/test_cmd_link.res similarity index 100% rename from src/doc/commands/tests/test_commands_md.sav/test_cmd_link.res rename to src/doc/templates/tests/test_md_commands.sav/test_cmd_link.res diff --git a/src/doc/commands/tests/test_commands_md.sav/test_cmd_main_compile.res b/src/doc/templates/tests/test_md_commands.sav/test_cmd_main_compile.res similarity index 100% rename from src/doc/commands/tests/test_commands_md.sav/test_cmd_main_compile.res rename to src/doc/templates/tests/test_md_commands.sav/test_cmd_main_compile.res diff --git a/src/doc/commands/tests/test_commands_md.sav/test_cmd_mains.res b/src/doc/templates/tests/test_md_commands.sav/test_cmd_mains.res similarity index 100% rename from src/doc/commands/tests/test_commands_md.sav/test_cmd_mains.res rename to src/doc/templates/tests/test_md_commands.sav/test_cmd_mains.res diff --git a/src/doc/commands/tests/test_commands_md.sav/test_cmd_man_options.res b/src/doc/templates/tests/test_md_commands.sav/test_cmd_man_options.res similarity index 100% rename from src/doc/commands/tests/test_commands_md.sav/test_cmd_man_options.res rename to src/doc/templates/tests/test_md_commands.sav/test_cmd_man_options.res diff --git a/src/doc/commands/tests/test_commands_md.sav/test_cmd_man_synopsis.res b/src/doc/templates/tests/test_md_commands.sav/test_cmd_man_synopsis.res similarity index 100% rename from src/doc/commands/tests/test_commands_md.sav/test_cmd_man_synopsis.res rename to src/doc/templates/tests/test_md_commands.sav/test_cmd_man_synopsis.res diff --git a/src/doc/commands/tests/test_commands_md.sav/test_cmd_mentities.res b/src/doc/templates/tests/test_md_commands.sav/test_cmd_mentities.res similarity index 100% rename from src/doc/commands/tests/test_commands_md.sav/test_cmd_mentities.res rename to src/doc/templates/tests/test_md_commands.sav/test_cmd_mentities.res diff --git a/src/doc/commands/tests/test_commands_md.sav/test_cmd_new.res b/src/doc/templates/tests/test_md_commands.sav/test_cmd_new.res similarity index 100% rename from src/doc/commands/tests/test_commands_md.sav/test_cmd_new.res rename to src/doc/templates/tests/test_md_commands.sav/test_cmd_new.res diff --git a/src/doc/commands/tests/test_commands_md.sav/test_cmd_param.res b/src/doc/templates/tests/test_md_commands.sav/test_cmd_param.res similarity index 100% rename from src/doc/commands/tests/test_commands_md.sav/test_cmd_param.res rename to src/doc/templates/tests/test_md_commands.sav/test_cmd_param.res diff --git a/src/doc/commands/tests/test_commands_md.sav/test_cmd_parents.res b/src/doc/templates/tests/test_md_commands.sav/test_cmd_parents.res similarity index 100% rename from src/doc/commands/tests/test_commands_md.sav/test_cmd_parents.res rename to src/doc/templates/tests/test_md_commands.sav/test_cmd_parents.res diff --git a/src/doc/commands/tests/test_commands_md.sav/test_cmd_return.res b/src/doc/templates/tests/test_md_commands.sav/test_cmd_return.res similarity index 100% rename from src/doc/commands/tests/test_commands_md.sav/test_cmd_return.res rename to src/doc/templates/tests/test_md_commands.sav/test_cmd_return.res diff --git a/src/doc/commands/tests/test_commands_md.sav/test_cmd_search.res b/src/doc/templates/tests/test_md_commands.sav/test_cmd_search.res similarity index 100% rename from src/doc/commands/tests/test_commands_md.sav/test_cmd_search.res rename to src/doc/templates/tests/test_md_commands.sav/test_cmd_search.res diff --git a/src/doc/commands/tests/test_commands_md.sav/test_cmd_testing.res b/src/doc/templates/tests/test_md_commands.sav/test_cmd_testing.res similarity index 100% rename from src/doc/commands/tests/test_commands_md.sav/test_cmd_testing.res rename to src/doc/templates/tests/test_md_commands.sav/test_cmd_testing.res diff --git a/src/doc/term/term.nit b/src/doc/term/term.nit index d6539691c7..e23e623c71 100644 --- a/src/doc/term/term.nit +++ b/src/doc/term/term.nit @@ -16,6 +16,7 @@ module term import commands::commands_parser import templates::term_model +import templates::md_commands redef class CommandParser