Ver código fonte

org-lparse.el: Abort export if list-tables are malformed

* contrib/lisp/org-lparse.el (org-lparse-format-table-row): In
list-tables, require that the header row be a row with max
number of columns. Abort export if this condition is not met.
Jambunathan K 13 anos atrás
pai
commit
d85635306b
1 arquivos alterados com 6 adições e 1 exclusões
  1. 6 1
      contrib/lisp/org-lparse.el

+ 6 - 1
contrib/lisp/org-lparse.el

@@ -2049,7 +2049,12 @@ See `org-xhtml-entity-format-callbacks-alist' for more information."
   lines)
 
 (defun org-lparse-format-table-row (fields &optional text-for-empty-fields)
-  (unless org-lparse-table-ncols
+  (if org-lparse-table-ncols
+      ;; second and subsequent rows of the table
+      (when (and org-lparse-list-table-p
+		 (> (length fields) org-lparse-table-ncols))
+	(error "Table row has %d columns but header row claims %d columns"
+	       (length fields) org-lparse-table-ncols))
     ;; first row of the table
     (setq org-lparse-table-ncols (length fields))
     (when org-lparse-table-is-styled