##// END OF EJS Templates
BUG: Fix savefig path in Windows...
Kevin Sheppard -
Show More
@@ -188,6 +188,7 b' To Do'
188 import atexit
188 import atexit
189 import errno
189 import errno
190 import os
190 import os
191 import pathlib
191 import re
192 import re
192 import sys
193 import sys
193 import tempfile
194 import tempfile
@@ -415,11 +416,13 b' class EmbeddedSphinxShell(object):'
415 source_dir = self.source_dir
416 source_dir = self.source_dir
416 saveargs = decorator.split(' ')
417 saveargs = decorator.split(' ')
417 filename = saveargs[1]
418 filename = saveargs[1]
418 # insert relative path to image file in source (as absolute path for Sphinx)
419 # insert relative path to image file in source
419 outfile = '/' + os.path.relpath(os.path.join(savefig_dir,filename),
420 # as absolute path for Sphinx
420 source_dir)
421 # sphinx expects a posix path, even on Windows
422 posix_path = pathlib.Path(savefig_dir,filename).as_posix()
423 outfile = '/' + os.path.relpath(posix_path, source_dir)
421
424
422 imagerows = ['.. image:: %s'%outfile]
425 imagerows = ['.. image:: %s' % outfile]
423
426
424 for kwarg in saveargs[2:]:
427 for kwarg in saveargs[2:]:
425 arg, val = kwarg.split('=')
428 arg, val = kwarg.split('=')
General Comments 0
You need to be logged in to leave comments. Login now