mirror of
https://github.com/sphinx-doc/sphinx.git
synced 2025-02-25 18:55:22 -06:00
Create pygments.css before copying user-supplied static files.
This commit is contained in:
parent
f0b1d78641
commit
23d578da81
@ -644,6 +644,18 @@ class StandaloneHTMLBuilder(Builder):
|
|||||||
# copy static files
|
# copy static files
|
||||||
self.info(bold('copying static files... '), nonl=True)
|
self.info(bold('copying static files... '), nonl=True)
|
||||||
ensuredir(path.join(self.outdir, '_static'))
|
ensuredir(path.join(self.outdir, '_static'))
|
||||||
|
# first, create pygments style file
|
||||||
|
f = open(path.join(self.outdir, '_static', 'pygments.css'), 'w')
|
||||||
|
f.write(PygmentsBridge('html', self.config.pygments_style).get_stylesheet())
|
||||||
|
f.close()
|
||||||
|
# then, copy translations JavaScript file
|
||||||
|
if self.config.language is not None:
|
||||||
|
jsfile = path.join(path.dirname(__file__), 'locale', self.config.language,
|
||||||
|
'LC_MESSAGES', 'sphinx.js')
|
||||||
|
if path.isfile(jsfile):
|
||||||
|
shutil.copyfile(jsfile, path.join(self.outdir, '_static',
|
||||||
|
'translations.js'))
|
||||||
|
# then, copy over all user-supplied static files
|
||||||
staticdirnames = [path.join(path.dirname(__file__), 'static')] + \
|
staticdirnames = [path.join(path.dirname(__file__), 'static')] + \
|
||||||
[path.join(self.confdir, spath)
|
[path.join(self.confdir, spath)
|
||||||
for spath in self.config.html_static_path]
|
for spath in self.config.html_static_path]
|
||||||
@ -661,22 +673,11 @@ class StandaloneHTMLBuilder(Builder):
|
|||||||
if path.exists(targetname):
|
if path.exists(targetname):
|
||||||
shutil.rmtree(targetname)
|
shutil.rmtree(targetname)
|
||||||
shutil.copytree(fullname, targetname)
|
shutil.copytree(fullname, targetname)
|
||||||
# add translations JavaScript file
|
# last, copy logo file (handled differently)
|
||||||
if self.config.language is not None:
|
|
||||||
jsfile = path.join(path.dirname(__file__), 'locale', self.config.language,
|
|
||||||
'LC_MESSAGES', 'sphinx.js')
|
|
||||||
if path.isfile(jsfile):
|
|
||||||
shutil.copyfile(jsfile, path.join(self.outdir, '_static',
|
|
||||||
'translations.js'))
|
|
||||||
# copy logo file (handled differently)
|
|
||||||
if self.config.html_logo:
|
if self.config.html_logo:
|
||||||
logobase = path.basename(self.config.html_logo)
|
logobase = path.basename(self.config.html_logo)
|
||||||
shutil.copyfile(path.join(self.confdir, self.config.html_logo),
|
shutil.copyfile(path.join(self.confdir, self.config.html_logo),
|
||||||
path.join(self.outdir, '_static', logobase))
|
path.join(self.outdir, '_static', logobase))
|
||||||
# add pygments style file
|
|
||||||
f = open(path.join(self.outdir, '_static', 'pygments.css'), 'w')
|
|
||||||
f.write(PygmentsBridge('html', self.config.pygments_style).get_stylesheet())
|
|
||||||
f.close()
|
|
||||||
self.info('done')
|
self.info('done')
|
||||||
|
|
||||||
# dump the search index
|
# dump the search index
|
||||||
|
Loading…
Reference in New Issue
Block a user