[meta-freescale] [Documentation][PATCH] Scripts: generate one blank line if sphinx table is empty

Lucas Dutra Nunes ldnunes at ossystems.com.br
Fri Apr 15 11:51:23 PDT 2016


An empty table without at least a empty line is not valid on Sphinx, so
a blank line must be added when generating a table like so.

Signed-off-by: Lucas Dutra Nunes <ldnunes at ossystems.com.br>
---
 scripts/doc_utils.py | 9 +++++----
 1 file changed, 5 insertions(+), 4 deletions(-)

diff --git a/scripts/doc_utils.py b/scripts/doc_utils.py
index 9d11bd8..fe6dd88 100644
--- a/scripts/doc_utils.py
+++ b/scripts/doc_utils.py
@@ -21,9 +21,10 @@ def tabularize(lines, spacing=2):
     if lines:
         col_widths = map(lambda col: apply(max, map(len, col) + [0]),
                          apply(zip, lines))
-        return '\n'.join([format_header(lines[0], col_widths, spc),
-                          format_body(lines[1:], col_widths, spc),
-                          format_border(col_widths)]) + \
-               '\n'
+        table_data = [format_header(lines[0], col_widths, spc),
+                      format_body(lines[1:], col_widths, spc),
+                      format_border(col_widths)]
+        table_data = filter(lambda x: len(x) > 0, table_data)
+        return '\n'.join(table_data) + '\n'
     else:
         return ""
-- 
2.1.4



More information about the meta-freescale mailing list