@@ -1061,24 +1061,12 @@ def __init__(self):
10611061 self .root_directory = configs .containmentFolder
10621062 self .root_file_name = configs .rootFileName
10631063 self .full_root_file_path = os .path .join (self .root_directory , self .root_file_name )
1064- # The {page,class,file}_view_hierarchy files are all `.. include::`ed in the
1065- # root library document. Though we are generating rst, we will want to use a
1066- # file extension `.rst.include` to bypass the fact that the sphinx builder will
1067- # process them separately if we leave them as .rst (via the source_suffix
1068- # configuration of the sphinx app). If users are getting warnings about it
1069- # then we can actually check for `.include` in app.config.source_suffix, but
1070- # it is very unlikely this is going to be a problem.
1071- # See https://github.com/sphinx-doc/sphinx/issues/1668
1072- self .page_hierarchy_file = os .path .join (self .root_directory , "page_view_hierarchy.rst.include" )
1073- self .class_hierarchy_file = os .path .join (self .root_directory , "class_view_hierarchy.rst.include" )
1074- self .file_hierarchy_file = os .path .join (self .root_directory , "file_view_hierarchy.rst.include" )
1075- self .unabridged_api_file = os .path .join (self .root_directory , "unabridged_api.rst.include" )
1076- # NOTE: do *NOT* do .rst.include for the unabridged orphan kinds, the purpose of
1077- # that document is to have it be processed by sphinx with its corresponding
1078- # .. toctree:: calls to kinds that the user has asked to be excluded. Sphinx
1079- # processing this document directly is desired (it is also marked :orphan: to
1080- # avoid a warning on the fact that it is *NOT* included in any exhale toctree).
1081- self .unabridged_orphan_file = os .path .join (self .root_directory , "unabridged_orphan.rst" )
1064+ # These documents are all included in the root file document.
1065+ self .page_hierarchy_file = os .path .join (self .root_directory , configs .pageHierarchyFilename )
1066+ self .class_hierarchy_file = os .path .join (self .root_directory , configs .classHierarchyFilename )
1067+ self .file_hierarchy_file = os .path .join (self .root_directory , configs .fileHierarchyFilename )
1068+ self .unabridged_api_file = os .path .join (self .root_directory , configs .unabridgedApiFilename )
1069+ self .unabridged_orphan_file = os .path .join (self .root_directory , configs .unabridgedOrphanFilename )
10821070
10831071 # whether or not we should generate the raw html tree view
10841072 self .use_tree_view = configs .createTreeView
@@ -2287,18 +2275,6 @@ def generateFullAPI(self):
22872275 2. :func:`~exhale.graph.ExhaleRoot.generateNodeDocuments`
22882276 3. :func:`~exhale.graph.ExhaleRoot.generateAPIRootBody`
22892277 '''
2290- self .generateAPIRootHeader ()
2291- self .generateNodeDocuments ()
2292- self .generateAPIRootBody ()
2293-
2294- def generateAPIRootHeader (self ):
2295- '''
2296- This method creates the root library api file that will include all of the
2297- different hierarchy views and full api listing. If ``self.root_directory`` is
2298- not a current directory, it is created first. Afterward, the root API file is
2299- created and its title is written, as well as the value of
2300- ``configs.afterTitleDescription``.
2301- '''
23022278 try :
23032279 # TODO: update to pathlib everywhere...
23042280 root_directory_path = Path (self .root_directory )
@@ -2307,6 +2283,26 @@ def generateAPIRootHeader(self):
23072283 utils .fancyError (
23082284 "Cannot create the directory {0} {1}" .format (self .root_directory , e )
23092285 )
2286+ # TODO: API root body does not need to be separate, but it does need to happen
2287+ # after node documents are generated due to bad design (link names and other
2288+ # items get initialized). Or at least that's what I remember.
2289+ skip_root = self .root_file_name == "EXCLUDE"
2290+ if not skip_root :
2291+ self .generateAPIRootHeader ()
2292+ self .generateNodeDocuments ()
2293+ self .gerrymanderNodeFilenames ()
2294+ self .generateViewHierarchies ()
2295+ self .generateUnabridgedAPI ()
2296+ if not skip_root :
2297+ self .generateAPIRootBody ()
2298+
2299+ def generateAPIRootHeader (self ):
2300+ '''
2301+ This method creates the root library api file that will include all of the
2302+ different hierarchy views and full api listing. The root API file is created
2303+ and its title is written, as well as the value of
2304+ ``configs.afterTitleDescription``.
2305+ '''
23102306 try :
23112307 with codecs .open (self .full_root_file_path , "w" , "utf-8" ) as generated_index :
23122308 # Add the metadata if they requested it
@@ -3613,9 +3609,7 @@ def generateAPIRootBody(self):
36133609 conditionally use a ``toctree`` if you really need it.
36143610 '''
36153611 try :
3616- self .gerrymanderNodeFilenames ()
3617- self .generateViewHierarchies ()
3618- self .generateUnabridgedAPI ()
3612+
36193613 with codecs .open (self .full_root_file_path , "a" , "utf-8" ) as generated_index :
36203614 # Include index page, if present
36213615 for page in self .pages :
0 commit comments