Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Guess format from path on new_post (Issue #2798)
  • Loading branch information
Roberto Alsina committed May 25, 2017
1 parent 274cf88 commit 5ab12ac
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 0 deletions.
1 change: 1 addition & 0 deletions CHANGES.txt
Expand Up @@ -4,6 +4,7 @@ New in master
Features
--------

* Guess file format from file name on new_post (Issue #2798)
* Use BaguetteBox as lightbox in base theme (Issue #2777)
* New ``deduplicate_ids``, for preventing duplication of HTML id
attributes (Issue #2570)
Expand Down
8 changes: 8 additions & 0 deletions nikola/plugins/command/new_post.py
Expand Up @@ -273,6 +273,14 @@ def _execute(self, options, args):
if extension in extensions:
content_format = compiler

elif not content_format and import_file:
# content_format not specified. If import_file was given, use
# it to guess (Issue #2798)
extension = os.path.splitext(import_file)[-1]
for compiler, extensions in self.site.config['COMPILERS'].items():
if extension in extensions:
content_format = compiler

elif not content_format: # Issue #400
content_format = get_default_compiler(
is_post,
Expand Down

0 comments on commit 5ab12ac

Please sign in to comment.