@@ -41,7 +41,7 @@ class BaseMkdocs(BaseBuilder):
41
41
"""Mkdocs builder."""
42
42
43
43
# The default theme for mkdocs is the 'mkdocs' theme
44
- DEFAULT_THEME_NAME = ' mkdocs'
44
+ DEFAULT_THEME_NAME = " mkdocs"
45
45
46
46
def __init__ (self , * args , ** kwargs ):
47
47
super ().__init__ (* args , ** kwargs )
@@ -57,13 +57,13 @@ def __init__(self, *args, **kwargs):
57
57
# for these project that were building with MkDocs in the Corporate
58
58
# site.
59
59
if self .project .has_feature (Feature .MKDOCS_THEME_RTD ):
60
- self .DEFAULT_THEME_NAME = ' readthedocs'
60
+ self .DEFAULT_THEME_NAME = " readthedocs"
61
61
log .warning (
62
62
"Project using readthedocs theme as default for MkDocs." ,
63
63
project_slug = self .project .slug ,
64
64
)
65
65
else :
66
- self .DEFAULT_THEME_NAME = ' mkdocs'
66
+ self .DEFAULT_THEME_NAME = " mkdocs"
67
67
68
68
def get_final_doctype (self ):
69
69
"""
@@ -119,10 +119,10 @@ def load_yaml_config(self):
119
119
except IOError :
120
120
raise MkDocsYAMLParseError (MkDocsYAMLParseError .NOT_FOUND )
121
121
except yaml .YAMLError as exc :
122
- note = ''
123
- if hasattr (exc , ' problem_mark' ):
122
+ note = ""
123
+ if hasattr (exc , " problem_mark" ):
124
124
mark = exc .problem_mark
125
- note = ' (line %d, column %d)' % (
125
+ note = " (line %d, column %d)" % (
126
126
mark .line + 1 ,
127
127
mark .column + 1 ,
128
128
)
@@ -146,7 +146,7 @@ def append_conf(self):
146
146
MkDocsYAMLParseError .INVALID_DOCS_DIR_CONFIG ,
147
147
)
148
148
149
- user_config [' docs_dir' ] = docs_dir
149
+ user_config [" docs_dir" ] = docs_dir
150
150
static_url = self .project .proxied_static_path
151
151
152
152
# Set mkdocs config values.
@@ -201,14 +201,14 @@ def append_conf(self):
201
201
202
202
# Use Read the Docs' analytics setup rather than mkdocs'
203
203
# This supports using RTD's privacy improvements around analytics
204
- user_config [' google_analytics' ] = None
204
+ user_config [" google_analytics" ] = None
205
205
206
206
# README: make MkDocs to use ``readthedocs`` theme as default if the
207
207
# user didn't specify a specific theme manually
208
208
if self .project .has_feature (Feature .MKDOCS_THEME_RTD ):
209
- if ' theme' not in user_config :
209
+ if " theme" not in user_config :
210
210
# mkdocs<0.17 syntax
211
- user_config [' theme' ] = self .DEFAULT_THEME_NAME
211
+ user_config [" theme" ] = self .DEFAULT_THEME_NAME
212
212
213
213
# Write the modified mkdocs configuration
214
214
with safe_open (self .yaml_file , "w" , encoding = "utf-8" ) as f :
@@ -219,7 +219,7 @@ def append_conf(self):
219
219
220
220
# Write the mkdocs.yml to the build logs
221
221
self .run (
222
- ' cat' ,
222
+ " cat" ,
223
223
os .path .relpath (self .yaml_file , self .project_path ),
224
224
cwd = self .project_path ,
225
225
)
@@ -229,9 +229,9 @@ def generate_rtd_data(self, docs_dir, mkdocs_config):
229
229
# Use the analytics code from mkdocs.yml
230
230
# if it isn't set already by Read the Docs,
231
231
analytics_code = self .version .project .analytics_code
232
- if not analytics_code and mkdocs_config .get (' google_analytics' ):
232
+ if not analytics_code and mkdocs_config .get (" google_analytics" ):
233
233
# http://www.mkdocs.org/user-guide/configuration/#google_analytics
234
- analytics_code = mkdocs_config [' google_analytics' ][0 ]
234
+ analytics_code = mkdocs_config [" google_analytics" ][0 ]
235
235
236
236
commit = (
237
237
self .version .project .vcs_repo (
@@ -271,14 +271,14 @@ def generate_rtd_data(self, docs_dir, mkdocs_config):
271
271
"html_theme" : readthedocs_data ["theme" ],
272
272
"pagename" : None ,
273
273
}
274
- tmpl = template_loader .get_template (' doc_builder/data.js.tmpl' )
274
+ tmpl = template_loader .get_template (" doc_builder/data.js.tmpl" )
275
275
return tmpl .render (data_ctx )
276
276
277
277
def build (self ):
278
278
build_command = [
279
- self .python_env .venv_bin (filename = ' python' ),
280
- '-m' ,
281
- ' mkdocs' ,
279
+ self .python_env .venv_bin (filename = " python" ),
280
+ "-m" ,
281
+ " mkdocs" ,
282
282
self .builder ,
283
283
"--clean" ,
284
284
"--site-dir" ,
@@ -287,7 +287,7 @@ def build(self):
287
287
os .path .relpath (self .yaml_file , self .project_path ),
288
288
]
289
289
if self .config .mkdocs .fail_on_warning :
290
- build_command .append (' --strict' )
290
+ build_command .append (" --strict" )
291
291
cmd_ret = self .run (
292
292
* build_command ,
293
293
cwd = self .project_path ,
@@ -305,19 +305,19 @@ def get_theme_name(self, mkdocs_config):
305
305
:see: http://www.mkdocs.org/about/release-notes/#theme-customization-1164
306
306
:returns: the name of the theme RTD will use
307
307
"""
308
- theme_setting = mkdocs_config .get (' theme' )
308
+ theme_setting = mkdocs_config .get (" theme" )
309
309
if isinstance (theme_setting , dict ):
310
310
# Full nested theme config (the new configuration)
311
- return theme_setting .get (' name' ) or self .DEFAULT_THEME_NAME
311
+ return theme_setting .get (" name" ) or self .DEFAULT_THEME_NAME
312
312
313
313
if theme_setting :
314
314
# A string which is the name of the theme
315
315
return theme_setting
316
316
317
- theme_dir = mkdocs_config .get (' theme_dir' )
317
+ theme_dir = mkdocs_config .get (" theme_dir" )
318
318
if theme_dir :
319
319
# Use the name of the directory in this project's custom theme directory
320
- return theme_dir .rstrip ('/' ).split ('/' )[- 1 ]
320
+ return theme_dir .rstrip ("/" ).split ("/" )[- 1 ]
321
321
322
322
return self .DEFAULT_THEME_NAME
323
323
0 commit comments