Skip to content
Permalink
Browse files

Merge pull request #2799 from getnikola/fix-2798

Fix 2798
  • Loading branch information
Kwpolska committed May 25, 2017
2 parents 47db894 + 5ab12ac commit 001fdc2d792e265a99ae4a1e7d11f0969cc04c97
Showing with 20 additions and 2 deletions.
  1. +1 −0 CHANGES.txt
  2. +19 −2 nikola/plugins/command/new_post.py
@@ -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)
@@ -265,16 +265,33 @@ def _execute(self, options, args):
if "@" in content_format:
content_format, content_subformat = content_format.split("@")

if not content_format: # Issue #400
if not content_format and path:
# content_format not specified. If path was given, use
# it to guess (Issue #2798)
extension = os.path.splitext(path)[-1]
for compiler, extensions in self.site.config['COMPILERS'].items():
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,
self.site.config['COMPILERS'],
self.site.config['post_pages'])

if content_format not in compiler_names:
elif content_format not in compiler_names:
LOGGER.error("Unknown {0} format {1}, maybe you need to install a plugin or enable an existing one?".format(content_type, content_format))
self.print_compilers()
return

compiler_plugin = self.site.plugin_manager.getPluginByName(
content_format, "PageCompiler").plugin_object

0 comments on commit 001fdc2

Please sign in to comment.
You can’t perform that action at this time.