diff --git a/lisp/org-exp.el b/lisp/org-exp.el index 00afbdbb5..e03c14155 100644 --- a/lisp/org-exp.el +++ b/lisp/org-exp.el @@ -2002,23 +2002,28 @@ When it is nil, all comments will be removed." (defun org-store-forced-table-alignment () "Find table lines which force alignment, store the results in properties." - (let (line cnt aligns) + (let (line cnt cookies) (goto-char (point-min)) - (while (re-search-forward "|[ \t]*<[lrc][0-9]*>[ \t]*|" nil t) + (while (re-search-forward "|[ \t]*<\\([lrc]?[0-9]+\\|[lrc]\\)>[ \t]*|" + nil t) ;; OK, this looks like a table line with an alignment cookie (org-if-unprotected (setq line (buffer-substring (point-at-bol) (point-at-eol))) (when (and (org-at-table-p) (org-table-cookie-line-p line)) - (setq cnt 0 aligns nil) + (setq cnt 0 cookies nil) (mapc (lambda (x) (setq cnt (1+ cnt)) - (if (string-match "\\`<\\([lrc]\\)" x) - (push (cons cnt (downcase (match-string 1 x))) aligns))) + (when (string-match "\\`<\\([lrc]\\)?\\([0-9]+\\)?>\\'" x) + (let ((align (and (match-end 1) + (downcase (match-string 1 x)))) + (width (and (match-end 2) + (string-to-number (match-string 2 x))))) + (push (cons cnt (list align width)) cookies)))) (org-split-string line "[ \t]*|[ \t]*")) (add-text-properties (org-table-begin) (org-table-end) - (list 'org-forced-aligns aligns)))) + (list 'org-col-cookies cookies)))) (goto-char (point-at-eol))))) (defun org-export-remove-special-table-lines () diff --git a/lisp/org-html.el b/lisp/org-html.el index 38df432ab..a2a94267f 100644 --- a/lisp/org-html.el +++ b/lisp/org-html.el @@ -1980,8 +1980,8 @@ for formatting. This is required for the DocBook exporter." (let* ((caption (org-find-text-property-in-string 'org-caption (car lines))) (label (org-find-text-property-in-string 'org-label (car lines))) - (forced-aligns (org-find-text-property-in-string 'org-forced-aligns - (car lines))) + (col-cookies (org-find-text-property-in-string 'org-col-cookies + (car lines))) (attributes (org-find-text-property-in-string 'org-attributes (car lines))) (html-table-tag (org-export-splice-attributes @@ -1994,9 +1994,9 @@ for formatting. This is required for the DocBook exporter." tbopen line fields html gr colgropen rowstart rowend ali align aligns n) (setq caption (and caption (org-html-do-expand caption))) - (when (and forced-aligns org-table-clean-did-remove-column) - (setq forced-aligns - (mapcar (lambda (x) (cons (1- (car x)) (cdr x))) forced-aligns))) + (when (and col-cookies org-table-clean-did-remove-column) + (setq col-cookies + (mapcar (lambda (x) (cons (1- (car x)) (cdr x))) col-cookies))) (if splice (setq head nil)) (unless splice (push (if head "" "") html)) (setq tbopen t) @@ -2057,8 +2057,8 @@ for formatting. This is required for the DocBook exporter." (lambda (x) (setq gr (pop org-table-colgroup-info) i (1+ i) - align (if (assoc i forced-aligns) - (cdr (assoc (cdr (assoc i forced-aligns)) + align (if (nth 1 (assoc i col-cookies)) + (cdr (assoc (nth 1 (assoc i col-cookies)) '(("l" . "left") ("r" . "right") ("c" . "center")))) (if (> (/ (float x) nline)