X-Git-Url: http://nitlanguage.org diff --git a/src/nitdoc.nit b/src/nitdoc.nit index 5434df0..9196911 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) @@ -58,7 +58,6 @@ special AbstractCompiler # Write the content to a new file fun write_to(filename: String) do - print "Generate {filename}" var f = new OFStream.open(filename) for s in _stage_context.content do f.write(s) @@ -66,189 +65,266 @@ special AbstractCompiler f.close end - # Currently computed module - readable var _module: nullable MMSrcModule + # Start a new file + fun clear + do + _stage_context = new StageContext(null) + end - # Is the current directory module computed as a simple modude ? - readable writable var _inside_mode: Bool = false + # Sorter of entities in alphabetical order + var _sorter: AlphaSorter[MMEntity] = new AlphaSorter[MMEntity] - # Is the current module computed as a intruded one ? - readable writable var _intrude_mode: Bool = false + # Sort entities in the alphabetical order + fun sort(array: Array[MMEntity]) + do + _sorter.sort(array) + end - # Compued introducing entities (for the index) - var _entities: Array[MMEntity] = new Array[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_custom_menu_items: OptionString = new OptionString("Items displayed in menu before the 'Overview' item (Each item must be enclosed in 'li' tags)", "--custom-menu-items") + readable var _opt_custom_title: OptionString = new OptionString("Title displayed in the top of the Overview page and as suffix of all page names", "--custom-title") + readable var _opt_custom_overview_text: OptionString = new OptionString("Text displayed as introduction of Overview page before the modules list", "--custom-overview-text") + readable var _opt_custom_footer_text: OptionString = new OptionString("Text displayed as footer of all pages", "--custom-footer-text") + var sharedir: nullable String - # Register an entity (for the index) - fun register(e: MMEntity) + 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 - _module = null - inside_mode = false - intrude_mode = false - clear - add("
\n") - add("Overview