Show More
@@ -33,7 +33,7 from IPython.config import Config | |||
|
33 | 33 | from IPython.nbformat import current as nbformat |
|
34 | 34 | from IPython.utils.traitlets import MetaHasTraits, DottedObjectName, Unicode, List, Dict, Any |
|
35 | 35 | from IPython.utils.importstring import import_item |
|
36 |
from IPython.utils |
|
|
36 | from IPython.utils import text | |
|
37 | 37 | from IPython.utils import py3compat |
|
38 | 38 | |
|
39 | 39 | from IPython.nbconvert import preprocessors as nbpreprocessors |
@@ -47,7 +47,7 from IPython.nbconvert import filters | |||
|
47 | 47 | JINJA_EXTENSIONS = ['jinja2.ext.loopcontrols'] |
|
48 | 48 | |
|
49 | 49 | default_filters = { |
|
50 | 'indent': indent, | |
|
50 | 'indent': text.indent, | |
|
51 | 51 | 'markdown2html': filters.markdown2html, |
|
52 | 52 | 'ansi2html': filters.ansi2html, |
|
53 | 53 | 'filter_data_type': filters.DataTypeFilter, |
@@ -283,7 +283,7 class Exporter(LoggingConfigurable): | |||
|
283 | 283 | resources['metadata']['name'] = notebook_name |
|
284 | 284 | |
|
285 | 285 | modified_date = datetime.datetime.fromtimestamp(os.path.getmtime(filename)) |
|
286 |
resources['metadata']['modified_date'] = modified_date.strftime( |
|
|
286 | resources['metadata']['modified_date'] = modified_date.strftime(text.date_format) | |
|
287 | 287 | |
|
288 | 288 | with io.open(filename) as f: |
|
289 | 289 | return self.from_notebook_node(nbformat.read(f, 'json'), resources=resources,**kw) |
@@ -29,6 +29,7 from pygments.formatters import LatexFormatter | |||
|
29 | 29 | # Our own imports |
|
30 | 30 | # Configurable traitlets |
|
31 | 31 | from IPython.utils.traitlets import Unicode, Bool |
|
32 | from IPython.utils import text | |
|
32 | 33 | |
|
33 | 34 | # Needed to override preprocessor |
|
34 | 35 | from .base import (Preprocessor) |
@@ -157,7 +158,7 class SphinxPreprocessor(Preprocessor): | |||
|
157 | 158 | if self.publish_date: |
|
158 | 159 | resources["sphinx"]["date"] = self.publish_date |
|
159 | 160 | elif len(resources['metadata']['modified_date'].strip()) == 0: |
|
160 |
resources["sphinx"]["date"] = date.today().strftime( |
|
|
161 | resources["sphinx"]["date"] = date.today().strftime(text.date_format) | |
|
161 | 162 | else: |
|
162 | 163 | resources["sphinx"]["date"] = resources['metadata']['modified_date'] |
|
163 | 164 | |
@@ -219,7 +220,7 class SphinxPreprocessor(Preprocessor): | |||
|
219 | 220 | if resources['metadata']['modified_date']: |
|
220 | 221 | default_date = resources['metadata']['modified_date'] |
|
221 | 222 | else: |
|
222 |
default_date = date.today().strftime( |
|
|
223 | default_date = date.today().strftime(text.date_format) | |
|
223 | 224 | |
|
224 | 225 | user_date = console.input("Date (deafults to \"" + default_date + "\"): ") |
|
225 | 226 | if len(user_date.strip()) == 0: |
@@ -261,4 +262,3 class SphinxPreprocessor(Preprocessor): | |||
|
261 | 262 | 6: "(for international documents)"} |
|
262 | 263 | |
|
263 | 264 | return console.prompt_dictionary(styles, menu_comments=comments) |
|
264 |
@@ -21,6 +21,7 Inheritance diagram: | |||
|
21 | 21 | |
|
22 | 22 | import os |
|
23 | 23 | import re |
|
24 | import sys | |
|
24 | 25 | import textwrap |
|
25 | 26 | from string import Formatter |
|
26 | 27 | |
@@ -28,6 +29,18 from IPython.external.path import path | |||
|
28 | 29 | from IPython.testing.skipdoctest import skip_doctest_py3, skip_doctest |
|
29 | 30 | from IPython.utils import py3compat |
|
30 | 31 | |
|
32 | ||
|
33 | #----------------------------------------------------------------------------- | |
|
34 | # Declarations | |
|
35 | #----------------------------------------------------------------------------- | |
|
36 | ||
|
37 | # datetime.strftime date format for ipython | |
|
38 | if sys.platform == 'win32': | |
|
39 | date_format = "%B %d, %Y" | |
|
40 | else: | |
|
41 | date_format = "%B %-d, %Y" | |
|
42 | ||
|
43 | ||
|
31 | 44 | #----------------------------------------------------------------------------- |
|
32 | 45 | # Code |
|
33 | 46 | #----------------------------------------------------------------------------- |
General Comments 0
You need to be logged in to leave comments.
Login now