Repository: getnikola/nikola

Issue:
hang during executing task build_sass
The change in build_sass at \* SHA 78e7bbde0fc5d8feb58232f86ea2b54f30a00bf3 causes nikola to hang on the build_sass command on my Linux system. Removing the shell=True from the subprocess.check_output call in build_sass.py solves the problem.

I see that commit was a fix for Windows support, but it seems to break it on Linux.

new_post -f html fails
Trying to create a new HTML post, I'm getting the following traceback:

```
Traceback (most recent call last):
  File "/home/tim/code/virtualenvs/nikola/local/lib/python2.7/site-packages/doit/doit_cmd.py", line 105, in run
    return self.sub_cmds[command].parse_execute(args)
  File "/home/tim/code/virtualenvs/nikola/local/lib/python2.7/site-packages/doit/cmd_base.py", line 76, in parse_execute
    return self.execute(params, args)
  File "/home/tim/tmp/2/nikola/scripts/../nikola/plugin_categories.py", line 83, in execute
    self._execute(options, args)
  File "/home/tim/tmp/2/nikola/nikola/plugins/command/new_post.py", line 278, in _execute
    slug=slug, date=date, tags=tags, **metadata)
  File "/home/tim/tmp/2/nikola/scripts/../nikola/plugin_categories.py", line 209, in create_post
    raise NotImplementedError()
NotImplementedError
```

Reproducible with the following sequence:

```
mkvirtualenv nikola
git clone git@github.com:getnikola/nikola.git
cd nikola
pip install -e .
nikola init blog
cd blog
patch -p1 conf.py <<EOF
--- a/conf.py   2013-11-27 13:34:32.172996506 -0600
+++ b/conf.py   2013-11-26 15:15:59.658675387 -0600
@@ -108,10 +108,12 @@
 POSTS = (
     ("posts/*.rst", "posts", "post.tmpl"),
     ("posts/*.txt", "posts", "post.tmpl"),
+    ("posts/*.html", "posts", "post.tmpl"),
 )
 PAGES = (
     ("stories/*.rst", "stories", "story.tmpl"),
     ("stories/*.txt", "stories", "story.tmpl"),
+    ("stories/*.html", "stories", "story.tmpl"),
 )

 # One or more folders containing files to be copied as-is into the output.
EOF
nikola new_post -f html
```

Entering a title and hitting `enter` produces the traceback above.



Discussion:

Resolving patch:
diff --git a/nikola/plugin_categories.py b/nikola/plugin_categories.py
--- a/nikola/plugin_categories.py
+++ b/nikola/plugin_categories.py
@@ -199,6 +199,7 @@ class PageCompiler(BasePlugin):
     default_metadata['tags'] = ''
     default_metadata['link'] = ''
     default_metadata['description'] = ''
+    default_metadata['type'] = 'text'
 
     def compile_html(self, source, dest, is_two_file=False):
         """Compile the source, save it on dest."""
diff --git a/nikola/plugins/compile/ipynb/__init__.py b/nikola/plugins/compile/ipynb/__init__.py
--- a/nikola/plugins/compile/ipynb/__init__.py
+++ b/nikola/plugins/compile/ipynb/__init__.py
@@ -80,7 +80,7 @@ def create_post(self, path, onefile=False, **kw):
             fd.write('\n'.join((metadata['title'], metadata['slug'],
                                 metadata['date'], metadata['tags'],
                                 metadata['link'],
-                                metadata['description'])))
+                                metadata['description'], metadata['type'])))
         print("Your post's metadata is at: ", meta_path)
         with codecs.open(path, "wb+", "utf8") as fd:
             fd.write("""{
diff --git a/nikola/post.py b/nikola/post.py
--- a/nikola/post.py
+++ b/nikola/post.py
@@ -158,6 +158,10 @@ def __init__(
                                         default_metadata.get('date', None),
                                         source_path))
 
+        if 'type' not in default_metadata:
+            # default value is 'text'
+            default_metadata['type'] = 'text'
+
         # If time zone is set, build localized datetime.
         self.date = to_datetime(self.meta[self.default_lang]['date'], tzinfo)
 
@@ -607,10 +611,10 @@ def get_metadata_from_meta_file(path, lang=None):
     if os.path.isfile(meta_path):
         with codecs.open(meta_path, "r", "utf8") as meta_file:
             meta_data = meta_file.readlines()
-        while len(meta_data) < 6:
+        while len(meta_data) < 7:
             meta_data.append("")
-        (title, slug, date, tags, link, description) = [
-            x.strip() for x in meta_data][:6]
+        (title, slug, date, tags, link, description, _type) = [
+            x.strip() for x in meta_data][:7]
 
         meta = {}
 
@@ -626,6 +630,8 @@ def get_metadata_from_meta_file(path, lang=None):
             meta['link'] = link
         if description:
             meta['description'] = description
+        if _type:
+            meta['type'] = _type
 
         return meta
 


Test patch: