@@ -85,7 +85,7 @@ def __init__(self, num_jobs=1, include_api=True, single_doc=None):
85
85
self .exclude_patterns = self ._exclude_patterns
86
86
87
87
self ._generate_index ()
88
- if self .single_doc_type == 'api ' :
88
+ if self .single_doc_type == 'docstring ' :
89
89
self ._run_os ('sphinx-autogen' , '-o' ,
90
90
'source/generated_single' , 'source/index.rst' )
91
91
@@ -98,7 +98,8 @@ def _exclude_patterns(self):
98
98
if ((f .endswith ('.rst' ) or f .endswith ('.ipynb' ))
99
99
and (f != 'index.rst' )
100
100
and (f != self .single_doc ))]
101
- rst_files += ['generated/*.rst' ]
101
+ if self .single_doc_type != 'api' :
102
+ rst_files += ['generated/*.rst' ]
102
103
elif not self .include_api :
103
104
rst_files = ['api.rst' , 'generated/*.rst' ]
104
105
else :
@@ -112,6 +113,8 @@ def _exclude_patterns(self):
112
113
@property
113
114
def _single_doc_type (self ):
114
115
if self .single_doc :
116
+ if self .single_doc == 'api.rst' :
117
+ return 'api'
115
118
if os .path .exists (os .path .join (SOURCE_PATH , self .single_doc )):
116
119
return 'rst'
117
120
try :
@@ -124,7 +127,7 @@ def _single_doc_type(self):
124
127
'"contributing.rst" or a pandas function or '
125
128
'method (e.g. "pandas.DataFrame.head")' )
126
129
else :
127
- return 'api '
130
+ return 'docstring '
128
131
129
132
def _copy_generated_docstring (self , method ):
130
133
"""Copy existing generated (from api.rst) docstring page because
@@ -154,14 +157,15 @@ def _generate_index(self):
154
157
if self .single_doc_type == 'rst' :
155
158
single_doc = os .path .splitext (os .path .basename (self .single_doc ))[0 ]
156
159
self .include_api = False
157
- elif self .single_doc_type == 'api' and \
158
- self .single_doc .startswith ('pandas.' ):
159
- single_doc = self .single_doc [len ('pandas.' ):]
160
- else :
161
- single_doc = self .single_doc
162
-
163
- if self .single_doc_type == 'api' :
160
+ elif self .single_doc_type == 'docstring' :
161
+ if self .single_doc .startswith ('pandas.' ):
162
+ single_doc = self .single_doc [len ('pandas.' ):]
163
+ else :
164
+ single_doc = self .single_doc
165
+ self .include_api = False
164
166
self ._copy_generated_docstring (single_doc )
167
+ elif self .single_doc_type == 'api' :
168
+ single_doc = 'api'
165
169
166
170
with open (os .path .join (SOURCE_PATH , 'index.rst.template' )) as f :
167
171
t = jinja2 .Template (f .read ())
0 commit comments