Skip to content
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

Fix 2798 #2799

Merged
merged 2 commits into from May 25, 2017
Merged

Fix 2798 #2799

merged 2 commits into from May 25, 2017

Conversation

ralsina
Copy link
Member

@ralsina ralsina commented May 25, 2017

Guess content format from path or imported file on nikola new_post

Fixes #2798

content_format = get_default_compiler(
is_post,
self.site.config['COMPILERS'],
self.site.config['post_pages'])

if content_format not in compiler_names:
elif content_format not in compiler_names:
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Perhaps that if was there for a reason? (I can’t see it though.)

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I checked, this seems to work just as well :)

if extension in extensions:
content_format = compiler

elif not content_format and import_file:
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Perhaps we could merge that and the first if into one?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Perhaps, but it saves 3 lines of code at the cost of a non-stupid condition. I like stupid conditions.

@Kwpolska Kwpolska merged commit 001fdc2 into master May 25, 2017
@Kwpolska Kwpolska deleted the fix-2798 branch May 25, 2017 15:54
@Kwpolska
Copy link
Member

Thanks for fixing this!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants