New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
nbconvert: Fix sphinx preprocessor date format string for Windows #4085
Conversation
since we're talking about this again, does anyone else think it's weird that we're making our output uglier for most of our users, just to accommodate windows users?
instead of not having a leading zero when we use %-d. Can we just code this in as a platform-specific ugliness, as opposed to an OS agnostic ugliness? |
Must have flew under my radar, sure sounds like a good idea to me. Will post back when implemented (couple min to switch branches) |
Ah, I see why this flew off my radar, in the latex template refact. I allow latex to use it's default date (which is the time of the document build). If users want to override it, they do so using templates (part of moving people away from setting config=true variables where templating can be used). I'll go ahead and 'fix' this so it can be back ported. In the refactored templates the sphinx preprocessor is almost empty. |
Should be good now |
Are there other places we might need a formatted date? Is it worth pulling it out into some |
@takluyver https://github.com/ipython/ipython/blob/master/IPython/nbconvert/exporters/exporter.py#L286 , maybe it would be useful to have this behaviour here too |
OK. I wonder if this belongs somewhere in IPython.utils - maybe IPython.utils.text. Or is there a logical place for it in nbconvert? |
^ nothing better than IPython.utils. In nbconvert it could be put in a utils.strings module. I guess it depends on if you think it will be used outside of nbconvert? |
I can imagine using it in something like the notebook HTML interface. |
Tell me if that looks good |
@@ -18,6 +18,7 @@ | |||
|
|||
# Stdlib imports | |||
import os.path | |||
import sys |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think this import is now superfluous.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's not on my machine, still required - py3.3
I'm not entirely convinced about making this a function - we might want one or more config attributes later to overwrite the default format. What about just doing a |
Either way we need logic to discern between win32 and else, so I don't see what you mean ... unless you're suggesting ignoring @ivanov 's suggestion? |
I mean, something like this:
And then using e.g. |
I added a new region to the text.py file since there aren't any other public variables in that module. |
I think this is the only reason (and the {0} trick) to use a function |
Thanks, that's what I was thinking of. I don't think there's any special reason to avoid using public variables - after all, a function is just a public variable pointing to a callable object. |
True 😃 |
ready to merge, then? |
I am, @takluyver ? |
nbconvert: Fix sphinx preprocessor date format string for Windows
nbconvert: Fix sphinx preprocessor date format string for Windows
This is a fix for a regression that was introduced in 32ea709.