Repository: mne-tools/mne-python

Issue:
BUG: Adding more than one figure to Report is broken
If a call to `add_figs_to_section` is made with a list of figures, only the first one is added.

In this example, only the first figure appears on the report.

```Python
import numpy as np
import matplotlib.pyplot as plt
from mne.report import Report

r = Report('test')

fig1 = plt.figure()
plt.plot([1, 2], [1, 1])
fig2 = plt.figure()
plt.plot([1, 2], [2, 2])

r.add_figs_to_section([fig1, fig2], section='ts', captions=['fig1', 'fig2'])

r.save('test.html', overwrite=True)
```

Discussion:

Patch:
diff --git a/mne/report.py b/mne/report.py
index a8e0d21a6..892aab074 100644
--- a/mne/report.py
+++ b/mne/report.py
@@ -554,7 +554,12 @@ image_template = Template(u"""
     {{if comment is not None}}
         <br><br>
         <div style="text-align:center;">
-            {{comment}}
+            <style>
+                p.test {word-wrap: break-word;}
+            </style>
+            <p class="test">
+                {{comment}}
+            </p>
         </div>
     {{endif}}
 {{else}}
@@ -698,10 +703,16 @@ class Report(object):
         if not isinstance(captions, (list, tuple)):
             captions = [captions]
         if not isinstance(comments, (list, tuple)):
-            comments = [comments]
-        if not len(items) == len(captions):
-            raise ValueError('Captions and report items must have the same'
-                             ' length.')
+            if comments is None:
+                comments = [comments] * len(captions)
+            else:
+                comments = [comments]
+        if len(comments) != len(items):
+            raise ValueError('Comments and report items must have the same '
+                             'length or comments should be None.')
+        elif len(captions) != len(items):
+            raise ValueError('Captions and report items must have the same '
+                             'length.')
 
         # Book-keeping of section names
         if section not in self.sections:


Test patch:
diff --git a/mne/tests/test_report.py b/mne/tests/test_report.py
index 500f408b4..dd0d02ffe 100644
--- a/mne/tests/test_report.py
+++ b/mne/tests/test_report.py
@@ -212,4 +212,21 @@ def test_add_htmls_to_section():
     assert_equal(html, html_compare)
 
 
+def test_validate_input():
+    report = Report()
+    items = ['a', 'b', 'c']
+    captions = ['Letter A', 'Letter B', 'Letter C']
+    section = 'ABCs'
+    comments = ['First letter of the alphabet.',
+                'Second letter of the alphabet',
+                'Third letter of the alphabet']
+    assert_raises(ValueError, report._validate_input, items, captions[:-1],
+                  section, comments=None)
+    assert_raises(ValueError, report._validate_input, items, captions, section,
+                  comments=comments[:-1])
+    values = report._validate_input(items, captions, section, comments=None)
+    items_new, captions_new, comments_new = values
+    assert_equal(len(comments_new), len(items))
+
+
 run_tests_if_main()