Merge branch 'master' of orgmode.org:org-mode
This commit is contained in:
commit
4a48a04905
|
@ -1698,43 +1698,43 @@ CONTENTS is nil. INFO is a plist holding contextual information."
|
|||
(format "\\begin{center}\n%s\n\\end{center}" output)
|
||||
output)))
|
||||
;; Case 3: Standard table.
|
||||
(t (let* (
|
||||
(info (org-export-table-format-info raw-table))
|
||||
(clean-table (org-export-clean-table
|
||||
raw-table (plist-get info :special-column-p)))
|
||||
(columns-number (length (plist-get info :alignment))))
|
||||
;; Convert ROWS to send them to `orgtbl-to-latex'. In
|
||||
;; particular, send each cell to
|
||||
;; `org-element-parse-secondary-string' to expand any Org
|
||||
;; object within. Eventually, flesh the format string out with
|
||||
;; the table.
|
||||
(format (org-latex-table--format-string table info)
|
||||
(orgtbl-to-latex
|
||||
(mapcar
|
||||
(lambda (row)
|
||||
(if (string-match org-table-hline-regexp row)
|
||||
'hline
|
||||
(mapcar
|
||||
(lambda (cell)
|
||||
(org-export-secondary-string
|
||||
(org-element-parse-secondary-string
|
||||
cell
|
||||
(cdr (assq 'table org-element-string-restrictions)))
|
||||
'latex info))
|
||||
(org-split-string row "[ \t]*|[ \t]*"))))
|
||||
(org-split-string clean-table "\n"))
|
||||
`(:tstart nil :tend nil
|
||||
;; Longtable environment requires specific
|
||||
;; header line end.
|
||||
:hlend ,(and attr
|
||||
(string-match "\\<longtable\\>" attr)
|
||||
(format "\\\\
|
||||
(t
|
||||
(let* ((table-info (org-export-table-format-info raw-table))
|
||||
(clean-table (org-export-clean-table
|
||||
raw-table (plist-get table-info :special-column-p)))
|
||||
(columns-number (length (plist-get table-info :alignment))))
|
||||
;; Convert ROWS to send them to `orgtbl-to-latex'. In
|
||||
;; particular, send each cell to
|
||||
;; `org-element-parse-secondary-string' to expand any Org
|
||||
;; object within. Eventually, flesh the format string out with
|
||||
;; the table.
|
||||
(format (org-latex-table--format-string table table-info)
|
||||
(orgtbl-to-latex
|
||||
(mapcar
|
||||
(lambda (row)
|
||||
(if (string-match org-table-hline-regexp row)
|
||||
'hline
|
||||
(mapcar
|
||||
(lambda (cell)
|
||||
(org-export-secondary-string
|
||||
(org-element-parse-secondary-string
|
||||
cell
|
||||
(cdr (assq 'table org-element-string-restrictions)))
|
||||
'latex info))
|
||||
(org-split-string row "[ \t]*|[ \t]*"))))
|
||||
(org-split-string clean-table "\n"))
|
||||
`(:tstart nil :tend nil
|
||||
;; Longtable environment requires specific
|
||||
;; header line end.
|
||||
:hlend ,(and attr
|
||||
(string-match "\\<longtable\\>" attr)
|
||||
(format "\\\\
|
||||
\\hline
|
||||
\\endhead
|
||||
\\hline\\multicolumn{%d}{r}{Continued on next page}\\\\
|
||||
\\endfoot
|
||||
\\endlastfoot"
|
||||
columns-number))))))))))
|
||||
columns-number))))))))))
|
||||
|
||||
|
||||
;;;; Target
|
||||
|
|
|
@ -2466,23 +2466,31 @@ Return new code as a string."
|
|||
"Extract info from TABLE.
|
||||
Return a plist whose properties and values are:
|
||||
`:alignment' vector of strings among \"r\", \"l\" and \"c\",
|
||||
`:column-groups' vector of symbols among `start', `end', `startend',
|
||||
`:special-column-p' boolean."
|
||||
`:column-groups' vector of symbols among `start', `end', `start-end',
|
||||
`:row-groups' list of integers representing row groups.
|
||||
`:special-column-p' non-nil if table has a special column.
|
||||
`:width' vector of integers representing desired width of
|
||||
current column, or nil."
|
||||
(with-temp-buffer
|
||||
(insert table)
|
||||
(goto-char 1)
|
||||
(org-table-align)
|
||||
(let ((align (vconcat (mapcar (lambda (c) (if c "r" "l"))
|
||||
org-table-last-alignment)))
|
||||
(colgroups (make-vector (length org-table-last-alignment) nil))
|
||||
(width (make-vector (length org-table-last-alignment) nil))
|
||||
(colgroups (make-vector (length org-table-last-alignment) nil))
|
||||
(row-group 0)
|
||||
(rowgroups)
|
||||
(special-column-p 'empty))
|
||||
(mapc (lambda (row)
|
||||
;; Determine if a special column is present by looking
|
||||
;; for special markers in the first column. More
|
||||
;; accurately, the first column is considered special if
|
||||
;; it only contains special markers and, maybe, empty
|
||||
;; cells.
|
||||
(unless (string-match "^[ \t]*|[-+]+|[ \t]*$" row)
|
||||
(if (string-match "^[ \t]*|[-+]+|[ \t]*$" row)
|
||||
(incf row-group)
|
||||
(push row-group rowgroups)
|
||||
;; Determine if a special column is present by looking
|
||||
;; for special markers in the first column. More
|
||||
;; accurately, the first column is considered special
|
||||
;; if it only contains special markers and, maybe,
|
||||
;; empty cells.
|
||||
(setq special-column-p
|
||||
(cond
|
||||
((not special-column-p) nil)
|
||||
|
@ -2490,13 +2498,15 @@ Return a plist whose properties and values are:
|
|||
row) 'special)
|
||||
((string-match "^[ \t]*| +|" row) special-column-p))))
|
||||
(cond
|
||||
;; Read forced alignment and width information, if any,
|
||||
;; and determine final alignment for the table.
|
||||
((org-table-cookie-line-p row)
|
||||
;; Read forced alignment information, if any, and
|
||||
;; determine final alignment for the table.
|
||||
(let ((col 0))
|
||||
(mapc (lambda (field)
|
||||
(when (string-match "<\\([lrc]\\)[0-9]*>" field)
|
||||
(aset align col (match-string 1 field)))
|
||||
(when (string-match "<\\([lrc]\\)\\([0-9]+\\)?>" field)
|
||||
(aset align col (match-string 1 field))
|
||||
(aset width col (let ((w (match-string 2 field)))
|
||||
(and w (string-to-number w)))))
|
||||
(incf col))
|
||||
(org-split-string row "[ \t]*|[ \t]*"))))
|
||||
;; Read column groups information.
|
||||
|
@ -2513,7 +2523,9 @@ Return a plist whose properties and values are:
|
|||
;; Return plist.
|
||||
(list :alignment align
|
||||
:column-groups colgroups
|
||||
:special-column-p (eq special-column-p 'special)))))
|
||||
:row-groups (reverse rowgroups)
|
||||
:special-column-p (eq special-column-p 'special)
|
||||
:width width))))
|
||||
|
||||
(defun org-export-clean-table (table specialp)
|
||||
"Clean string TABLE from its formatting elements.
|
||||
|
|
|
@ -73,7 +73,7 @@
|
|||
"Parse a variable ASSIGNMENT in a header argument.
|
||||
If the right hand side of the assignment has a literal value
|
||||
return that value, otherwise interpret as a reference to an
|
||||
external resource and find it's value using
|
||||
external resource and find its value using
|
||||
`org-babel-ref-resolve'. Return a list with two elements. The
|
||||
first element of the list will be the name of the variable, and
|
||||
the second will be an emacs-lisp representation of the value of
|
||||
|
|
|
@ -540,7 +540,7 @@ block."
|
|||
|
||||
(defun org-babel-expand-body:generic (body params &optional var-lines)
|
||||
"Expand BODY with PARAMS.
|
||||
Expand a block of code with org-babel according to it's header
|
||||
Expand a block of code with org-babel according to its header
|
||||
arguments. This generic implementation of body expansion is
|
||||
called for languages which have not defined their own specific
|
||||
org-babel-expand-body:lang function."
|
||||
|
@ -2217,7 +2217,7 @@ appropriate."
|
|||
cell))
|
||||
|
||||
(defun org-babel-number-p (string)
|
||||
"If STRING represents a number return it's value."
|
||||
"If STRING represents a number return its value."
|
||||
(if (and (string-match "^-?[0-9]*\\.?[0-9]*$" string)
|
||||
(= (length (substring string (match-beginning 0)
|
||||
(match-end 0)))
|
||||
|
|
|
@ -717,7 +717,7 @@ If :auto-sitemap is set, publish the sitemap too.
|
|||
If :makeindex is set, also produce a file theindex.org."
|
||||
(mapc
|
||||
(lambda (project)
|
||||
;; Each project uses it's own cache file:
|
||||
;; Each project uses its own cache file:
|
||||
(org-publish-initialize-cache (car project))
|
||||
(let*
|
||||
((project-plist (cdr project))
|
||||
|
|
Loading…
Reference in New Issue