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