X-Git-Url: http://nitlanguage.org diff --git a/src/nitdoc.nit b/src/nitdoc.nit index ba0e164..2765264 100644 --- a/src/nitdoc.nit +++ b/src/nitdoc.nit @@ -24,9 +24,9 @@ import abstracttool # Store knowledge and facilities to generate files class DocContext -special AbstractCompiler + super AbstractCompiler # Destination directory - readable writable var _dir: String = "." + readable writable var _dir: String = "doc" # Content of a generated file var _stage_context: StageContext = new StageContext(null) @@ -65,191 +65,250 @@ special AbstractCompiler f.close end - # Currently computed module - readable var _module: nullable MMSrcModule - - # Is the current directory module computed as a simple modude ? - readable writable var _inside_mode: Bool = false + # Start a new file + fun clear + do + _stage_context = new StageContext(null) + end - # Is the current module computed as a intruded one ? - readable writable var _intrude_mode: Bool = false + # Sorter of entities in alphabetical order + var _sorter: AlphaSorter[MMEntity] = new AlphaSorter[MMEntity] - # Compued introducing entities (for the index) - var _entities: Array[MMEntity] = new Array[MMEntity] + # Sort entities in the alphabetical order + fun sort(array: Array[MMEntity]) + do + _sorter.sort(array) + end - # Register an entity (for the index) - fun register(e: MMEntity) + readable var _opt_dir: OptionString = new OptionString("Directory where doc is generated", "-d", "--dir") + readable var _opt_source: OptionString = new OptionString("What link for source (%f for filename, %l for first line, %L for last line)", "--source") + readable var _opt_public: OptionBool = new OptionBool("Generate only the public API", "--public") + readable var _opt_private: OptionBool = new OptionBool("Generate the private API", "--private") + readable var _opt_nodot: OptionBool = new OptionBool("Do not generate graphes with graphviz", "--no-dot") + readable var _opt_sharedir: OptionString = new OptionString("Directory containing the nitdoc files", "--sharedir") + readable var _opt_overview_text: OptionString = new OptionString("Text displayed as introduction of Overview page", "--overview-text") + readable var _opt_footer_text: OptionString = new OptionString("Text displayed as footer of all pages", "--footer-text") + var sharedir: nullable String + + fun public_only: Bool do - _entities.add(e) - if e isa MMSrcModule then - _module = e - end + if self._opt_public.value == true then return true + return false end - # Start a new file - fun clear + fun with_private: Bool do - _stage_context = new StageContext(null) + if self._opt_private.value == true then return true + return false end - # Generate common files (frames, index, overview) - fun extract_other_doc + # The current processed filename + var filename: String + + # The main virtual module + var mainmod: nullable MMVirtualModule + + redef fun perform_work(mods) do - info("Generating other files",1) - _module = null - inside_mode = false - intrude_mode = false - clear - add("
\n") - add("Overview