X-Git-Url: http://nitlanguage.org diff --git a/src/doc/doc_phases/doc_console.nit b/src/doc/doc_phases/doc_console.nit index dbd1d39..f927fd9 100644 --- a/src/doc/doc_phases/doc_console.nit +++ b/src/doc/doc_phases/doc_console.nit @@ -19,6 +19,7 @@ module doc_console import semantize +import doc_extract import doc::console_templates # Nitx handles console I/O. @@ -138,7 +139,7 @@ interface NitxQuery # Pretty prints the results for the console. fun make_results(nitx: Nitx, results: Array[NitxMatch]): DocPage do - var page = new DocPage("Results") + var page = new DocPage("results", "Results") page.root.add_child(new QueryResultArticle(self, results)) return page end @@ -203,7 +204,7 @@ class CommentQuery redef fun perform(nitx, doc) do var name = args.first var res = new Array[NitxMatch] - for mentity in doc.search_mentities(name) do + for mentity in doc.mentities_by_name(name) do res.add new MEntityMatch(self, mentity) end return res @@ -214,7 +215,7 @@ class CommentQuery if len == 1 then var res = results.first.as(MEntityMatch) var mentity = res.mentity - var page = new DocPage("Results") + var page = new DocPage("resultats", "Results") var article = new DefinitionArticle(mentity) article.cs_title = mentity.name article.cs_subtitle = mentity.cs_declaration @@ -317,7 +318,7 @@ class DocQuery redef fun perform(nitx, doc) do var res = new Array[NitxMatch] var name = args.first - for page in doc.pages do + for page in doc.pages.values do if name == "*" then # FIXME dev only res.add new PageMatch(self, page) else if page.title == name then @@ -377,7 +378,7 @@ class CodeQuery return res end # else, lookup the model by name - for mentity in doc.search_mentities(name) do + for mentity in doc.mentities_by_name(name) do if mentity isa MClass then continue if mentity isa MProperty then continue res.add new CodeMatch(self, mentity.cs_location, mentity.cs_source_code) @@ -386,7 +387,7 @@ class CodeQuery end redef fun make_results(nitx, results) do - var page = new DocPage("Code Results") + var page = new DocPage("results", "Code Results") for res in results do page.add new CodeQueryArticle(self, res.as(CodeMatch)) end @@ -435,32 +436,6 @@ end ## exploration -redef class DocModel - - # Lists all MEntities in the model. - private var mentities: Collection[MEntity] is lazy do - var res = new HashSet[MEntity] - res.add_all mprojects - res.add_all mgroups - res.add_all mmodules - res.add_all mclasses - res.add_all mclassdefs - res.add_all mproperties - res.add_all mpropdefs - return res - end - - # Search MEntities that match `name` by their name or namespace. - private fun search_mentities(name: String): Array[MEntity] do - var res = new Array[MEntity] - for mentity in mentities do - if mentity.name != name and mentity.cs_namespace != name then continue - res.add mentity - end - return res - end -end - # Visitor looking for initialized `MType` (new T). # # See `NewQuery`.