Show More
@@ -0,0 +1,22 b'' | |||||
|
1 | { | |||
|
2 | "metadata": { | |||
|
3 | "name": "" | |||
|
4 | }, | |||
|
5 | "nbformat": 3, | |||
|
6 | "nbformat_minor": 0, | |||
|
7 | "worksheets": [ | |||
|
8 | { | |||
|
9 | "cells": [ | |||
|
10 | { | |||
|
11 | "cell_type": "code", | |||
|
12 | "collapsed": false, | |||
|
13 | "input": [], | |||
|
14 | "language": "python", | |||
|
15 | "metadata": {}, | |||
|
16 | "outputs": [] | |||
|
17 | } | |||
|
18 | ], | |||
|
19 | "metadata": {} | |||
|
20 | } | |||
|
21 | ] | |||
|
22 | } No newline at end of file |
@@ -31,10 +31,10 b' class PDFPostProcessor(PostProcessorBase):' | |||||
31 | How many times pdflatex will be called. |
|
31 | How many times pdflatex will be called. | |
32 | """) |
|
32 | """) | |
33 |
|
33 | |||
34 | latex_command = List(["pdflatex", "{filename}"], config=True, help=""" |
|
34 | latex_command = List([u"pdflatex", u"{filename}"], config=True, help=""" | |
35 | Shell command used to compile PDF.""") |
|
35 | Shell command used to compile PDF.""") | |
36 |
|
36 | |||
37 | bib_command = List(["bibtex", "{filename}"], config=True, help=""" |
|
37 | bib_command = List([u"bibtex", u"{filename}"], config=True, help=""" | |
38 | Shell command used to run bibtex.""") |
|
38 | Shell command used to run bibtex.""") | |
39 |
|
39 | |||
40 | verbose = Bool(False, config=True, help=""" |
|
40 | verbose = Bool(False, config=True, help=""" | |
@@ -69,6 +69,13 b' class PDFPostProcessor(PostProcessorBase):' | |||||
69 | or failed (False). |
|
69 | or failed (False). | |
70 | """ |
|
70 | """ | |
71 | command = [c.format(filename=filename) for c in command_list] |
|
71 | command = [c.format(filename=filename) for c in command_list] | |
|
72 | #In windows and python 2.x there is a bug in subprocess.Popen and | |||
|
73 | # unicode commands are not supported | |||
|
74 | if sys.platform == 'win32' and sys.version_info < (3,0): | |||
|
75 | #We must use cp1252 encoding for calling subprocess.Popen | |||
|
76 | #Note that sys.stdin.encoding and encoding.DEFAULT_ENCODING | |||
|
77 | # could be different (cp437 in case of dos console) | |||
|
78 | command = [c.encode('cp1252') for c in command] | |||
72 | times = 'time' if count == 1 else 'times' |
|
79 | times = 'time' if count == 1 else 'times' | |
73 | self.log.info("Running %s %i %s: %s", command_list[0], count, times, command) |
|
80 | self.log.info("Running %s %i %s: %s", command_list[0], count, times, command) | |
74 | with open(os.devnull, 'rb') as null: |
|
81 | with open(os.devnull, 'rb') as null: |
@@ -1,3 +1,4 b'' | |||||
|
1 | # -*- coding: utf-8 -*- | |||
1 | """Test NbConvertApp""" |
|
2 | """Test NbConvertApp""" | |
2 |
|
3 | |||
3 | #----------------------------------------------------------------------------- |
|
4 | #----------------------------------------------------------------------------- | |
@@ -183,3 +184,24 b' class TestNbConvertApp(TestsBase):' | |||||
183 | self.call('nbconvert --log-level 0 --config="override.py"') |
|
184 | self.call('nbconvert --log-level 0 --config="override.py"') | |
184 | assert not os.path.isfile('notebook1.py') |
|
185 | assert not os.path.isfile('notebook1.py') | |
185 | assert os.path.isfile('notebook2.py') |
|
186 | assert os.path.isfile('notebook2.py') | |
|
187 | ||||
|
188 | def test_accents_in_filename(self): | |||
|
189 | """ | |||
|
190 | Can notebook names include accents? | |||
|
191 | """ | |||
|
192 | with self.create_temp_cwd(['nb*.ipynb']): | |||
|
193 | self.call('nbconvert --log-level 0 --to python nb1_*') | |||
|
194 | assert os.path.isfile(u'nb1_análisis.py') | |||
|
195 | ||||
|
196 | @dec.onlyif_cmds_exist('pdflatex') | |||
|
197 | @dec.onlyif_cmds_exist('pandoc') | |||
|
198 | def test_filename_spaces(self): | |||
|
199 | """ | |||
|
200 | Generate PDFs if notebooks have an accent in their name? | |||
|
201 | """ | |||
|
202 | with self.create_temp_cwd(['nb*.ipynb']): | |||
|
203 | o,e = self.call('nbconvert --log-level 0 --to latex ' | |||
|
204 | '"nb1_*" --post PDF ' | |||
|
205 | '--PDFPostProcessor.verbose=True') | |||
|
206 | assert os.path.isfile(u'nb1_análisis.tex') | |||
|
207 | assert os.path.isfile(u'nb1_análisis.pdf') |
General Comments 0
You need to be logged in to leave comments.
Login now