mirror of
git://git.sv.gnu.org/emacs.git
synced 2025-12-15 10:30:25 -08:00
Merge Org 8.2.6-1.
The last merge was from 8.2.5c, but many important bugs got fixed between 8.2.5c and 8.2.6-1.
This commit is contained in:
parent
d5ff4ded7a
commit
30cb51f1bc
33 changed files with 1460 additions and 691 deletions
|
|
@ -530,8 +530,9 @@ INFO is a plist used as a communication channel."
|
|||
(+ (- (org-list-get-ind beg-item struct)
|
||||
(org-list-get-ind
|
||||
(org-list-get-top-point struct) struct))
|
||||
(length (org-ascii--checkbox parent-item info))
|
||||
(length
|
||||
(string-width (or (org-ascii--checkbox parent-item info)
|
||||
""))
|
||||
(string-width
|
||||
(or (org-list-get-tag beg-item struct)
|
||||
(org-list-get-bullet beg-item struct)))))))))))))
|
||||
|
||||
|
|
@ -589,7 +590,8 @@ possible. It doesn't apply to `inlinetask' elements."
|
|||
(when tags
|
||||
(format
|
||||
(format " %%%ds"
|
||||
(max (- text-width (1+ (length first-part))) (length tags)))
|
||||
(max (- text-width (1+ (string-width first-part)))
|
||||
(string-width tags)))
|
||||
tags))
|
||||
;; Maybe underline text, if ELEMENT type is `headline' and an
|
||||
;; underline character has been defined.
|
||||
|
|
@ -600,7 +602,9 @@ possible. It doesn't apply to `inlinetask' elements."
|
|||
org-ascii-underline)))))
|
||||
(and under-char
|
||||
(concat "\n"
|
||||
(make-string (length first-part) under-char))))))))
|
||||
(make-string (/ (string-width first-part)
|
||||
(char-width under-char))
|
||||
under-char))))))))
|
||||
|
||||
(defun org-ascii--has-caption-p (element info)
|
||||
"Non-nil when ELEMENT has a caption affiliated keyword.
|
||||
|
|
@ -647,7 +651,7 @@ which the table of contents generation has been initiated."
|
|||
(let ((title (org-ascii--translate "Table of Contents" info)))
|
||||
(concat
|
||||
title "\n"
|
||||
(make-string (length title)
|
||||
(make-string (string-width title)
|
||||
(if (eq (plist-get info :ascii-charset) 'utf-8) ?─ ?_))
|
||||
"\n\n"
|
||||
(let ((text-width
|
||||
|
|
@ -674,7 +678,7 @@ generation. INFO is a plist used as a communication channel."
|
|||
(let ((title (org-ascii--translate "List of Listings" info)))
|
||||
(concat
|
||||
title "\n"
|
||||
(make-string (length title)
|
||||
(make-string (string-width title)
|
||||
(if (eq (plist-get info :ascii-charset) 'utf-8) ?─ ?_))
|
||||
"\n\n"
|
||||
(let ((text-width
|
||||
|
|
@ -688,9 +692,10 @@ generation. INFO is a plist used as a communication channel."
|
|||
;; Store initial text so its length can be computed. This is
|
||||
;; used to properly align caption right to it in case of
|
||||
;; filling (like contents of a description list item).
|
||||
(let ((initial-text
|
||||
(format (org-ascii--translate "Listing %d:" info)
|
||||
(incf count))))
|
||||
(let* ((initial-text
|
||||
(format (org-ascii--translate "Listing %d:" info)
|
||||
(incf count)))
|
||||
(initial-width (string-width initial-text)))
|
||||
(concat
|
||||
initial-text " "
|
||||
(org-trim
|
||||
|
|
@ -700,8 +705,8 @@ generation. INFO is a plist used as a communication channel."
|
|||
(let ((caption (or (org-export-get-caption src-block t)
|
||||
(org-export-get-caption src-block))))
|
||||
(org-export-data caption info))
|
||||
(- text-width (length initial-text)) info)
|
||||
(length initial-text))))))
|
||||
(- text-width initial-width) info)
|
||||
initial-width)))))
|
||||
(org-export-collect-listings info) "\n")))))
|
||||
|
||||
(defun org-ascii--list-tables (keyword info)
|
||||
|
|
@ -712,7 +717,7 @@ generation. INFO is a plist used as a communication channel."
|
|||
(let ((title (org-ascii--translate "List of Tables" info)))
|
||||
(concat
|
||||
title "\n"
|
||||
(make-string (length title)
|
||||
(make-string (string-width title)
|
||||
(if (eq (plist-get info :ascii-charset) 'utf-8) ?─ ?_))
|
||||
"\n\n"
|
||||
(let ((text-width
|
||||
|
|
@ -726,9 +731,10 @@ generation. INFO is a plist used as a communication channel."
|
|||
;; Store initial text so its length can be computed. This is
|
||||
;; used to properly align caption right to it in case of
|
||||
;; filling (like contents of a description list item).
|
||||
(let ((initial-text
|
||||
(format (org-ascii--translate "Table %d:" info)
|
||||
(incf count))))
|
||||
(let* ((initial-text
|
||||
(format (org-ascii--translate "Table %d:" info)
|
||||
(incf count)))
|
||||
(initial-width (string-width initial-text)))
|
||||
(concat
|
||||
initial-text " "
|
||||
(org-trim
|
||||
|
|
@ -738,13 +744,12 @@ generation. INFO is a plist used as a communication channel."
|
|||
(let ((caption (or (org-export-get-caption table t)
|
||||
(org-export-get-caption table))))
|
||||
(org-export-data caption info))
|
||||
(- text-width (length initial-text)) info)
|
||||
(length initial-text))))))
|
||||
(- text-width initial-width) info)
|
||||
initial-width)))))
|
||||
(org-export-collect-tables info) "\n")))))
|
||||
|
||||
(defun org-ascii--unique-links (element info)
|
||||
"Return a list of unique link references in ELEMENT.
|
||||
|
||||
ELEMENT is either a headline element or a section element. INFO
|
||||
is a plist used as a communication channel."
|
||||
(let* (seen
|
||||
|
|
@ -754,8 +759,14 @@ is a plist used as a communication channel."
|
|||
;; Update SEEN links along the way.
|
||||
(lambda (link)
|
||||
(let ((footprint
|
||||
;; Normalize description in footprints.
|
||||
(cons (org-element-property :raw-link link)
|
||||
(org-element-contents link))))
|
||||
(let ((contents (org-element-contents link)))
|
||||
(and contents
|
||||
(replace-regexp-in-string
|
||||
"[ \r\t\n]+" " "
|
||||
(org-trim
|
||||
(org-element-interpret-data contents))))))))
|
||||
;; Ignore LINK if it hasn't been translated already.
|
||||
;; It can happen if it is located in an affiliated
|
||||
;; keyword that was ignored.
|
||||
|
|
@ -852,14 +863,16 @@ INFO is a plist used as a communication channel."
|
|||
((and (org-string-nw-p date) (org-string-nw-p author))
|
||||
(concat
|
||||
author
|
||||
(make-string (- text-width (length date) (length author)) ? )
|
||||
(make-string (- text-width (string-width date) (string-width author))
|
||||
?\s)
|
||||
date
|
||||
(when (org-string-nw-p email) (concat "\n" email))
|
||||
"\n\n\n"))
|
||||
((and (org-string-nw-p date) (org-string-nw-p email))
|
||||
(concat
|
||||
email
|
||||
(make-string (- text-width (length date) (length email)) ? )
|
||||
(make-string (- text-width (string-width date) (string-width email))
|
||||
?\s)
|
||||
date "\n\n\n"))
|
||||
((org-string-nw-p date)
|
||||
(concat
|
||||
|
|
@ -879,7 +892,10 @@ INFO is a plist used as a communication channel."
|
|||
(formatted-title (org-ascii--fill-string title title-len info))
|
||||
(line
|
||||
(make-string
|
||||
(min (+ (max title-len (length author) (length email)) 2)
|
||||
(min (+ (max title-len
|
||||
(string-width (or author ""))
|
||||
(string-width (or email "")))
|
||||
2)
|
||||
text-width) (if utf8p ?━ ?_))))
|
||||
(org-ascii--justify-string
|
||||
(concat line "\n"
|
||||
|
|
@ -918,7 +934,7 @@ holding export options."
|
|||
(concat
|
||||
title "\n"
|
||||
(make-string
|
||||
(length title)
|
||||
(string-width title)
|
||||
(if (eq (plist-get info :ascii-charset) 'utf-8) ?─ ?_))))
|
||||
"\n\n"
|
||||
(let ((text-width (- org-ascii-text-width org-ascii-global-margin)))
|
||||
|
|
@ -1195,7 +1211,7 @@ contextual information."
|
|||
;;;; Inlinetask
|
||||
|
||||
(defun org-ascii-format-inlinetask-default
|
||||
(todo type priority name tags contents width inlinetask info)
|
||||
(todo type priority name tags contents width inlinetask info)
|
||||
"Format an inline task element for ASCII export.
|
||||
See `org-ascii-format-inlinetask-function' for a description
|
||||
of the parameters."
|
||||
|
|
@ -1208,7 +1224,7 @@ of the parameters."
|
|||
(unless utf8p (concat (make-string width ? ) "\n"))
|
||||
;; Add title. Fill it if wider than inlinetask.
|
||||
(let ((title (org-ascii--build-title inlinetask info width)))
|
||||
(if (<= (length title) width) title
|
||||
(if (<= (string-width title) width) title
|
||||
(org-ascii--fill-string title width info)))
|
||||
"\n"
|
||||
;; If CONTENTS is not empty, insert it along with
|
||||
|
|
@ -1301,7 +1317,7 @@ contextual information."
|
|||
;; Contents: Pay attention to indentation. Note: check-boxes are
|
||||
;; already taken care of at the paragraph level so they don't
|
||||
;; interfere with indentation.
|
||||
(let ((contents (org-ascii--indent-string contents (length bullet))))
|
||||
(let ((contents (org-ascii--indent-string contents (string-width bullet))))
|
||||
(if (eq (org-element-type (car (org-element-contents item))) 'paragraph)
|
||||
(org-trim contents)
|
||||
(concat "\n" contents))))))
|
||||
|
|
@ -1376,10 +1392,7 @@ INFO is a plist holding contextual information."
|
|||
(org-export-resolve-coderef ref info))))
|
||||
;; Do not apply a special syntax on radio links. Though, use
|
||||
;; transcoded target's contents as output.
|
||||
((string= type "radio")
|
||||
(let ((destination (org-export-resolve-radio-link link info)))
|
||||
(when destination
|
||||
(org-export-data (org-element-contents destination) info))))
|
||||
((string= type "radio") desc)
|
||||
;; Do not apply a special syntax on fuzzy links pointing to
|
||||
;; targets.
|
||||
((string= type "fuzzy")
|
||||
|
|
@ -1652,7 +1665,7 @@ are ignored."
|
|||
(org-element-map table 'table-row
|
||||
(lambda (row)
|
||||
(setq max-width
|
||||
(max (length
|
||||
(max (string-width
|
||||
(org-export-data
|
||||
(org-element-contents
|
||||
(elt (org-element-contents row) col))
|
||||
|
|
@ -1672,7 +1685,8 @@ a communication channel."
|
|||
;; each cell in the column.
|
||||
(let ((width (org-ascii--table-cell-width table-cell info)))
|
||||
;; When contents are too large, truncate them.
|
||||
(unless (or org-ascii-table-widen-columns (<= (length contents) width))
|
||||
(unless (or org-ascii-table-widen-columns
|
||||
(<= (string-width (or contents "")) width))
|
||||
(setq contents (concat (substring contents 0 (- width 2)) "=>")))
|
||||
;; Align contents correctly within the cell.
|
||||
(let* ((indent-tabs-mode nil)
|
||||
|
|
@ -1681,7 +1695,9 @@ a communication channel."
|
|||
(org-ascii--justify-string
|
||||
contents width
|
||||
(org-export-table-cell-alignment table-cell info)))))
|
||||
(setq contents (concat data (make-string (- width (length data)) ? ))))
|
||||
(setq contents
|
||||
(concat data
|
||||
(make-string (- width (string-width (or data ""))) ?\s))))
|
||||
;; Return cell.
|
||||
(concat (format " %s " contents)
|
||||
(when (memq 'right (org-export-table-cell-borders table-cell info))
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue