X-Git-Url: http://nitlanguage.org diff --git a/src/nitdoc.nit b/src/nitdoc.nit index 344aac6..91f00b8 100644 --- a/src/nitdoc.nit +++ b/src/nitdoc.nit @@ -73,14 +73,10 @@ class NitdocContext toolcontext.option_context.add_option(opt_github_gitdir) toolcontext.option_context.add_option(opt_piwik_tracker) toolcontext.option_context.add_option(opt_piwik_site_id) - toolcontext.process_options + toolcontext.tooldescription = "Usage: nitdoc [OPTION]... ...\nGenerates HTML pages of API documentation from Nit source files." + toolcontext.process_options(args) self.arguments = toolcontext.option_context.rest - if arguments.length < 1 then - print "usage: nitdoc [options] file..." - toolcontext.option_context.usage - exit(0) - end self.process_options model = new Model @@ -109,14 +105,9 @@ class NitdocContext if opt_sharedir.value != null then share_dir = opt_sharedir.value else - var dir = "NIT_DIR".environ - if dir.is_empty then - dir = "{sys.program_name.dirname}/../share/nitdoc" - else - dir = "{dir}/share/nitdoc" - end - share_dir = dir - if share_dir == null then + var dir = toolcontext.nit_dir + share_dir = "{dir}/share/nitdoc" + if dir == null or not share_dir.file_exists then print "Error: Cannot locate nitdoc share files. Uses --sharedir or envvar NIT_DIR" abort end @@ -440,7 +431,7 @@ class NitdocOverview end end # build graph - var op = new Buffer + var op = new FlatBuffer op.append("digraph dep \{ rankdir=BT; node[shape=none,margin=0,width=0,height=0,fontsize=10]; edge[dir=none,color=gray]; ranksep=0.2; nodesep=0.1;\n") for mmodule in poset do op.append("\"{mmodule.name}\"[URL=\"{mmodule.url}\"];\n") @@ -711,7 +702,7 @@ class NitdocModule end end # build graph - var op = new Buffer + var op = new FlatBuffer var name = "dep_{mmodule.name}" op.append("digraph {name} \{ rankdir=BT; node[shape=none,margin=0,width=0,height=0,fontsize=10]; edge[dir=none,color=gray]; ranksep=0.2; nodesep=0.1;\n") for mmodule in poset do @@ -1095,7 +1086,7 @@ class NitdocClass end cla.add_all(pe.greaters) - var op = new Buffer + var op = new FlatBuffer var name = "dep_{mclass.name}" op.append("digraph {name} \{ rankdir=BT; node[shape=none,margin=0,width=0,height=0,fontsize=10]; edge[dir=none,color=gray]; ranksep=0.2; nodesep=0.1;\n") for c in cla do @@ -1136,7 +1127,7 @@ redef class MModule # module_owner_name.html private fun url: String do if url_cache == null then - var res = new Buffer + var res = new FlatBuffer res.append("module_") var mowner = public_owner if mowner != null then @@ -1153,7 +1144,7 @@ redef class MModule # MOD_owner_name private fun anchor: String do if anchor_cache == null then - var res = new Buffer + var res = new FlatBuffer res.append("MOD_") var mowner = public_owner if mowner != null then @@ -1170,7 +1161,7 @@ redef class MModule # html_name private fun html_link(page: NitdocPage) do if html_link_cache == null then - var res = new Buffer + var res = new FlatBuffer if page.ctx.mbuilder.mmodule2nmodule.has_key(self) then res.append("{html_name}") else @@ -1282,7 +1273,7 @@ redef class MClass # html_name(signature) private fun html_link(page: NitdocPage) do if html_link_cache == null then - var res = new Buffer + var res = new FlatBuffer res.append("html_name private fun html_short_link(page: NitdocPage) do if html_short_link_cache == null then - var res = new Buffer + var res = new FlatBuffer res.append("html_name private fun html_link_anchor(page: NitdocPage) do if html_link_anchor_cache == null then - var res = new Buffer + var res = new FlatBuffer res.append("html_name private fun html_link(page: NitdocPage) do if html_link_cache == null then - var res = new Buffer + var res = new FlatBuffer if page.ctx.mbuilder.mpropdef2npropdef.has_key(self) then var nprop = page.ctx.mbuilder.mpropdef2npropdef[self] res.append("{mproperty.html_name}") @@ -1745,7 +1736,7 @@ redef class MSignature end private fun untyped_signature(page: NitdocPage): String do - var res = new Buffer + var res = new FlatBuffer if not mparameters.is_empty then res.append("(") for i in [0..mparameters.length[ do @@ -1785,11 +1776,11 @@ redef class ADoc end private fun full_comment: String do - var res = new Buffer + var res = new FlatBuffer for t in n_comment do var text = t.text text = text.substring_from(1) - if text.first == ' ' then text = text.substring_from(1) + if text.chars.first == ' ' then text = text.substring_from(1) res.append(text.html_escape) end var str = res.to_s