summaryrefslogtreecommitdiff
path: root/lisp/org/ox.el
diff options
context:
space:
mode:
Diffstat (limited to 'lisp/org/ox.el')
-rw-r--r--lisp/org/ox.el476
1 files changed, 308 insertions, 168 deletions
diff --git a/lisp/org/ox.el b/lisp/org/ox.el
index 0ae1e45f036..5b4134ecca2 100644
--- a/lisp/org/ox.el
+++ b/lisp/org/ox.el
@@ -73,6 +73,7 @@
(require 'cl-lib)
(require 'ob-exp)
+(require 'ol)
(require 'org-element)
(require 'org-macro)
(require 'tabulated-list)
@@ -1499,7 +1500,7 @@ Assume buffer is in Org mode. Narrowing, if any, is ignored."
(cond
;; Options in `org-export-special-keywords'.
((equal key "SETUPFILE")
- (let* ((uri (org-unbracket-string "\"" "\"" (org-trim val)))
+ (let* ((uri (org-strip-quotes (org-trim val)))
(uri-is-url (org-file-url-p uri))
(uri (if uri-is-url
uri
@@ -1650,7 +1651,7 @@ an alist where associations are (VARIABLE-NAME VALUE)."
"BIND")
(push (read (format "(%s)" val)) alist)
;; Enter setup file.
- (let* ((uri (org-unbracket-string "\"" "\"" val))
+ (let* ((uri (org-strip-quotes val))
(uri-is-url (org-file-url-p uri))
(uri (if uri-is-url
uri
@@ -2007,17 +2008,18 @@ Return a string."
;; normalized first.
(org-element-normalize-contents
data
- ;; When normalizing contents of the
- ;; first paragraph in an item or
- ;; a footnote definition, ignore
- ;; first line's indentation: there is
- ;; none and it might be misleading.
- (when (eq type 'paragraph)
- (and
- (eq (car (org-element-contents parent))
- data)
- (memq (org-element-type parent)
- '(footnote-definition item)))))))
+ ;; When normalizing first paragraph
+ ;; of an item or
+ ;; a footnote-definition, ignore
+ ;; first line's indentation.
+ (and
+ (eq type 'paragraph)
+ (memq (org-element-type parent)
+ '(footnote-definition item))
+ (eq (car (org-element-contents parent))
+ data)
+ (eq (org-element-property :pre-blank parent)
+ 0)))))
"")))
(broken-link-handler
(funcall transcoder data
@@ -2672,10 +2674,7 @@ The function assumes BUFFER's major mode is `org-mode'."
(quote ,val))
vars))))))
;; Whole buffer contents.
- (insert
- ,(org-with-wide-buffer
- (buffer-substring-no-properties
- (point-min) (point-max))))
+ (insert ,(org-with-wide-buffer (buffer-string)))
;; Narrowing.
,(if (org-region-active-p)
`(narrow-to-region ,(region-beginning) ,(region-end))
@@ -2921,56 +2920,47 @@ returned by the function."
'(entity bold italic latex-environment latex-fragment strike-through
subscript superscript underline)
(lambda (datum)
- (let ((new
- (cl-case (org-element-type datum)
- ;; ... entities...
- (entity
- (and (not (plist-get info :with-entities))
- (list (concat
- (org-export-expand datum nil)
- (make-string
- (or (org-element-property :post-blank datum) 0)
- ?\s)))))
- ;; ... emphasis...
- ((bold italic strike-through underline)
- (and (not (plist-get info :with-emphasize))
- (let ((marker (cl-case (org-element-type datum)
- (bold "*")
- (italic "/")
- (strike-through "+")
- (underline "_"))))
- (append
- (list marker)
- (org-element-contents datum)
- (list (concat
- marker
- (make-string
- (or (org-element-property :post-blank datum)
- 0)
- ?\s)))))))
- ;; ... LaTeX environments and fragments...
- ((latex-environment latex-fragment)
- (and (eq (plist-get info :with-latex) 'verbatim)
- (list (org-export-expand datum nil))))
- ;; ... sub/superscripts...
- ((subscript superscript)
- (let ((sub/super-p (plist-get info :with-sub-superscript))
- (bracketp (org-element-property :use-brackets-p datum)))
- (and (or (not sub/super-p)
- (and (eq sub/super-p '{}) (not bracketp)))
- (append
- (list (concat
- (if (eq (org-element-type datum) 'subscript)
- "_"
- "^")
- (and bracketp "{")))
- (org-element-contents datum)
- (list (concat
- (and bracketp "}")
- (and (org-element-property :post-blank datum)
- (make-string
- (org-element-property :post-blank datum)
- ?\s)))))))))))
+ (let* ((type (org-element-type datum))
+ (post-blank
+ (pcase (org-element-property :post-blank datum)
+ (`nil nil)
+ (n (make-string n (if (eq type 'latex-environment) ?\n ?\s)))))
+ (new
+ (cl-case type
+ ;; ... entities...
+ (entity
+ (and (not (plist-get info :with-entities))
+ (list (concat (org-export-expand datum nil)
+ post-blank))))
+ ;; ... emphasis...
+ ((bold italic strike-through underline)
+ (and (not (plist-get info :with-emphasize))
+ (let ((marker (cl-case type
+ (bold "*")
+ (italic "/")
+ (strike-through "+")
+ (underline "_"))))
+ (append
+ (list marker)
+ (org-element-contents datum)
+ (list (concat marker post-blank))))))
+ ;; ... LaTeX environments and fragments...
+ ((latex-environment latex-fragment)
+ (and (eq (plist-get info :with-latex) 'verbatim)
+ (list (concat (org-export-expand datum nil)
+ post-blank))))
+ ;; ... sub/superscripts...
+ ((subscript superscript)
+ (let ((sub/super-p (plist-get info :with-sub-superscript))
+ (bracketp (org-element-property :use-brackets-p datum)))
+ (and (or (not sub/super-p)
+ (and (eq sub/super-p '{}) (not bracketp)))
+ (append
+ (list (concat (if (eq type 'subscript) "_" "^")
+ (and bracketp "{")))
+ (org-element-contents datum)
+ (list (concat (and bracketp "}")
+ post-blank)))))))))
(when new
;; Splice NEW at DATUM location in parse tree.
(dolist (e new (org-element-extract-element datum))
@@ -3042,20 +3032,23 @@ Return code as a string."
;; Run first hook with current back-end's name as argument.
(run-hook-with-args 'org-export-before-processing-hook
(org-export-backend-name backend))
- ;; Include files, delete comments and expand macros.
(org-export-expand-include-keyword)
(org-export--delete-comment-trees)
(org-macro-initialize-templates)
- (org-macro-replace-all
- (append org-macro-templates org-export-global-macros)
- nil parsed-keywords)
- ;; Refresh buffer properties and radio targets after
- ;; potentially invasive previous changes. Likewise, do it
- ;; again after executing Babel code.
+ (org-macro-replace-all (append org-macro-templates
+ org-export-global-macros)
+ parsed-keywords)
+ ;; Refresh buffer properties and radio targets after previous
+ ;; potentially invasive changes.
(org-set-regexps-and-options)
(org-update-radio-target-regexp)
+ ;; Possibly execute Babel code. Re-run a macro expansion
+ ;; specifically for {{{results}}} since inline source blocks
+ ;; may have generated some more. Refresh buffer properties
+ ;; and radio targets another time.
(when org-export-use-babel
(org-babel-exp-process-buffer)
+ (org-macro-replace-all '(("results" . "$1")) parsed-keywords)
(org-set-regexps-and-options)
(org-update-radio-target-regexp))
;; Run last hook with current back-end's name as argument.
@@ -3090,29 +3083,6 @@ Return code as a string."
(dolist (filter (plist-get info :filter-options))
(let ((result (funcall filter info backend-name)))
(when result (setq info result)))))
- ;; Expand export-specific set of macros: {{{author}}},
- ;; {{{date(FORMAT)}}}, {{{email}}} and {{{title}}}. It must
- ;; be done once regular macros have been expanded, since
- ;; parsed keywords may contain one of them.
- (org-macro-replace-all
- (list
- (cons "author" (org-element-interpret-data (plist-get info :author)))
- (cons "date"
- (let* ((date (plist-get info :date))
- (value (or (org-element-interpret-data date) "")))
- (if (and (consp date)
- (not (cdr date))
- (eq (org-element-type (car date)) 'timestamp))
- (format "(eval (if (org-string-nw-p \"$1\") %s %S))"
- (format "(org-timestamp-format '%S \"$1\")"
- (org-element-copy (car date)))
- value)
- value)))
- (cons "email" (org-element-interpret-data (plist-get info :email)))
- (cons "title" (org-element-interpret-data (plist-get info :title)))
- (cons "results" "$1"))
- 'finalize
- parsed-keywords)
;; Parse buffer.
(setq tree (org-element-parse-buffer nil visible-only))
;; Prune tree from non-exported elements and transform
@@ -3238,7 +3208,7 @@ locally for the subtree through node properties."
(org-entry-put
node "EXPORT_OPTIONS" (mapconcat 'identity items " "))
(while items
- (insert "#+OPTIONS:")
+ (insert "#+options:")
(let ((width 10))
(while (and items
(< (+ width (length (car items)) 1) fill-column))
@@ -3264,7 +3234,7 @@ locally for the subtree through node properties."
(if subtreep (org-entry-put node (concat "EXPORT_" (car key)) val)
(insert
(format "#+%s:%s\n"
- (car key)
+ (downcase (car key))
(if (org-string-nw-p val) (format " %s" val) ""))))))))
(defun org-export-expand-include-keyword (&optional included dir footnotes)
@@ -3275,7 +3245,8 @@ avoid infinite recursion. Optional argument DIR is the current
working directory. It is used to properly resolve relative
paths. Optional argument FOOTNOTES is a hash-table used for
storing and resolving footnotes. It is created automatically."
- (let ((case-fold-search t)
+ (let ((includer-file (buffer-file-name (buffer-base-buffer)))
+ (case-fold-search t)
(file-prefix (make-hash-table :test #'equal))
(current-prefix 0)
(footnotes (or footnotes (make-hash-table :test #'equal)))
@@ -3298,11 +3269,16 @@ storing and resolving footnotes. It is created automatically."
(beginning-of-line)
;; Extract arguments from keyword's value.
(let* ((value (org-element-property :value element))
- (ind (org-get-indentation))
+ (ind (current-indentation))
location
+ (coding-system-for-read
+ (or (and (string-match ":coding +\\(\\S-+\\)>" value)
+ (prog1 (intern (match-string 1 value))
+ (setq value (replace-match "" nil nil value))))
+ coding-system-for-read))
(file
- (and (string-match
- "^\\(\".+?\"\\|\\S-+\\)\\(?:\\s-+\\|$\\)" value)
+ (and (string-match "^\\(\".+?\"\\|\\S-+\\)\\(?:\\s-+\\|$\\)"
+ value)
(prog1
(save-match-data
(let ((matched (match-string 1 value)))
@@ -3311,9 +3287,8 @@ storing and resolving footnotes. It is created automatically."
(setq location (match-string 2 matched))
(setq matched
(replace-match "" nil nil matched 1)))
- (expand-file-name
- (org-unbracket-string "\"" "\"" matched)
- dir)))
+ (expand-file-name (org-strip-quotes matched)
+ dir)))
(setq value (replace-match "" nil nil value)))))
(only-contents
(and (string-match ":only-contents *\\([^: \r\t\n]\\S-*\\)?"
@@ -3388,10 +3363,12 @@ storing and resolving footnotes. It is created automatically."
(insert
(org-export--prepare-file-contents
file lines ind minlevel
- (or
- (gethash file file-prefix)
- (puthash file (cl-incf current-prefix) file-prefix))
- footnotes)))
+ (or (gethash file file-prefix)
+ (puthash file
+ (cl-incf current-prefix)
+ file-prefix))
+ footnotes
+ includer-file)))
(org-export-expand-include-keyword
(cons (list file lines) included)
(file-name-directory file)
@@ -3468,8 +3445,34 @@ Return a string of lines to be included in the format expected by
(while (< (point) end) (cl-incf counter) (forward-line))
counter))))))))
+(defun org-export--update-included-link (file-dir includer-dir)
+ "Update relative file name of link at point, if possible.
+
+FILE-DIR is the directory of the file being included.
+INCLUDER-DIR is the directory of the file where the inclusion is
+going to happen.
+
+Move point after the link."
+ (let* ((link (org-element-link-parser))
+ (path (org-element-property :path link)))
+ (if (or (not (string= "file" (org-element-property :type link)))
+ (file-remote-p path)
+ (file-name-absolute-p path))
+ (goto-char (org-element-property :end link))
+ (let ((new-path (file-relative-name (expand-file-name path file-dir)
+ includer-dir))
+ (new-link (org-element-copy link))
+ (contents (and (org-element-property :contents-begin link)
+ (buffer-substring
+ (org-element-property :contents-begin link)
+ (org-element-property :contents-end link)))))
+ (org-element-put-property new-link :path new-path)
+ (delete-region (org-element-property :begin link)
+ (org-element-property :end link))
+ (insert (org-element-link-interpreter new-link contents))))))
+
(defun org-export--prepare-file-contents
- (file &optional lines ind minlevel id footnotes)
+ (file &optional lines ind minlevel id footnotes includer)
"Prepare contents of FILE for inclusion and return it as a string.
When optional argument LINES is a string specifying a range of
@@ -3491,7 +3494,10 @@ This is useful to avoid conflicts when more than one Org file
with footnotes is included in a document.
Optional argument FOOTNOTES is a hash-table to store footnotes in
-the included document."
+the included document.
+
+Optional argument INCLUDER is the file name where the inclusion
+is to happen."
(with-temp-buffer
(insert-file-contents file)
(when lines
@@ -3507,6 +3513,42 @@ the included document."
(forward-line (1- lend))
(point))))
(narrow-to-region beg end)))
+ ;; Adapt all file links within the included document that contain
+ ;; relative paths in order to make these paths relative to the
+ ;; base document, or absolute.
+ (when includer
+ (let ((file-dir (file-name-directory file))
+ (includer-dir (file-name-directory includer)))
+ (unless (file-equal-p file-dir includer-dir)
+ (goto-char (point-min))
+ (unless (eq major-mode 'org-mode)
+ (let ((org-inhibit-startup t)) (org-mode))) ;set regexps
+ (let ((regexp (concat org-link-plain-re "\\|" org-link-angle-re)))
+ (while (re-search-forward org-link-any-re nil t)
+ (let ((link (save-excursion
+ (forward-char -1)
+ (save-match-data (org-element-context)))))
+ (when (eq 'link (org-element-type link))
+ ;; Look for file links within link's description.
+ ;; Org doesn't support such construct, but
+ ;; `org-export-insert-image-links' may activate
+ ;; them.
+ (let ((contents-begin
+ (org-element-property :contents-begin link))
+ (begin (org-element-property :begin link)))
+ (when contents-begin
+ (save-excursion
+ (goto-char (org-element-property :contents-end link))
+ (while (re-search-backward regexp contents-begin t)
+ (save-match-data
+ (org-export--update-included-link
+ file-dir includer-dir))
+ (goto-char (match-beginning 0)))))
+ ;; Update current link, if necessary.
+ (when (string= "file" (org-element-property :type link))
+ (goto-char begin)
+ (org-export--update-included-link
+ file-dir includer-dir))))))))))
;; Remove blank lines at beginning and end of contents. The logic
;; behind that removal is that blank lines around include keyword
;; override blank lines in included file.
@@ -3665,18 +3707,24 @@ will become the empty string."
(cdr (nreverse (cons (funcall prepare-value s) result))))))))
(if property (plist-get attributes property) attributes)))
-(defun org-export-get-caption (element &optional shortp)
+(defun org-export-get-caption (element &optional short)
"Return caption from ELEMENT as a secondary string.
-When optional argument SHORTP is non-nil, return short caption,
-as a secondary string, instead.
+When optional argument SHORT is non-nil, return short caption, as
+a secondary string, instead.
Caption lines are separated by a white space."
- (let ((full-caption (org-element-property :caption element)) caption)
- (dolist (line full-caption (cdr caption))
- (let ((cap (funcall (if shortp 'cdr 'car) line)))
- (when cap
- (setq caption (nconc (list " ") (copy-sequence cap) caption)))))))
+ (let ((full-caption (org-element-property :caption element))
+ (get (if short #'cdr #'car))
+ caption)
+ (dolist (line full-caption)
+ (pcase (funcall get line)
+ (`nil nil)
+ (c
+ (setq caption
+ (nconc (list " ")
+ (copy-sequence c) caption)))))
+ (cdr caption)))
;;;; For Derived Back-ends
@@ -4010,19 +4058,19 @@ inherited from parent headlines and FILETAGS keywords."
;; Add FILETAGS keywords and return results.
(org-uniquify (append (plist-get info :filetags) current-tag-list))))))
-(defun org-export-get-node-property (property blob &optional inherited)
- "Return node PROPERTY value for BLOB.
+(defun org-export-get-node-property (property datum &optional inherited)
+ "Return node PROPERTY value for DATUM.
-PROPERTY is an upcase symbol (i.e. `:COOKIE_DATA'). BLOB is an
+PROPERTY is an upcase symbol (e.g., `:COOKIE_DATA'). DATUM is an
element or object.
If optional argument INHERITED is non-nil, the value can be
inherited from a parent headline.
Return value is a string or nil."
- (let ((headline (if (eq (org-element-type blob) 'headline) blob
- (org-export-get-parent-headline blob))))
- (if (not inherited) (org-element-property property blob)
+ (let ((headline (if (eq (org-element-type datum) 'headline) datum
+ (org-export-get-parent-headline datum))))
+ (if (not inherited) (org-element-property property datum)
(let ((parent headline))
(catch 'found
(while parent
@@ -4120,6 +4168,9 @@ meant to be translated with `org-export-data' or alike."
;; specified id or custom-id in parse tree, the path to the external
;; file with the id.
;;
+;; `org-export-resolve-link' searches for the destination of a link
+;; within the parsed tree and returns the element.
+;;
;; `org-export-resolve-coderef' associates a reference to a line
;; number in the element it belongs, or returns the reference itself
;; when the element isn't numbered.
@@ -4150,7 +4201,7 @@ The function ignores links with an implicit type (e.g.,
(let ((protocol (org-link-get-parameter type :export)))
(and (functionp protocol)
(funcall protocol
- (org-link-unescape (org-element-property :path link))
+ (org-element-property :path link)
desc
backend))))))
@@ -4207,8 +4258,8 @@ structure of RULES.
Return modified DATA."
(let ((link-re (format "\\`\\(?:%s\\|%s\\)\\'"
- org-plain-link-re
- org-angle-link-re))
+ org-link-plain-re
+ org-link-angle-re))
(case-fold-search t))
(org-element-map data 'link
(lambda (l)
@@ -4314,7 +4365,7 @@ as returned by `org-export-search-cells'."
(let ((targets (org-export-search-cells datum)))
(and targets (cl-some (lambda (cell) (member cell targets)) cells))))
-(defun org-export-resolve-fuzzy-link (link info)
+(defun org-export-resolve-fuzzy-link (link info &rest pseudo-types)
"Return LINK destination.
INFO is a plist holding contextual information.
@@ -4331,10 +4382,14 @@ Return value can be an object or an element:
- Otherwise, throw an error.
+PSEUDO-TYPES are pseudo-elements types, i.e., elements defined
+specifically in an export back-end, that could have a name
+affiliated keyword.
+
Assume LINK type is \"fuzzy\". White spaces are not
significant."
(let* ((search-cells (org-export-string-to-search-cell
- (org-link-unescape (org-element-property :path link))))
+ (org-element-property :path link)))
(link-cache (or (plist-get info :resolve-fuzzy-link-cache)
(let ((table (make-hash-table :test #'eq)))
(plist-put info :resolve-fuzzy-link-cache table)
@@ -4343,7 +4398,7 @@ significant."
(if (not (eq cached 'not-found)) cached
(let ((matches
(org-element-map (plist-get info :parse-tree)
- (cons 'target org-element-all-elements)
+ (append pseudo-types '(target) org-element-all-elements)
(lambda (datum)
(and (org-export-match-search-cell-p datum search-cells)
datum)))))
@@ -4402,11 +4457,36 @@ has type \"radio\"."
radio))
info 'first-match)))
+(defun org-export-resolve-link (link info)
+ "Return LINK destination.
+
+LINK is a string or a link object.
+
+INFO is a plist holding contextual information.
+
+Return value can be an object or an element:
+
+- If LINK path matches an ID or a custom ID, return the headline.
+
+- If LINK path matches a fuzzy link, return its destination.
+
+- Otherwise, throw an error."
+ ;; Convert string links to link objects.
+ (when (stringp link)
+ (setq link (with-temp-buffer
+ (save-excursion
+ (insert (org-link-make-string link)))
+ (org-element-link-parser))))
+ (pcase (org-element-property :type link)
+ ((or "custom-id" "id") (org-export-resolve-id-link link info))
+ ("fuzzy" (org-export-resolve-fuzzy-link link info))
+ (_ (signal 'org-link-broken (list (org-element-property :path link))))))
+
(defun org-export-file-uri (filename)
"Return file URI associated to FILENAME."
(cond ((string-prefix-p "//" filename) (concat "file:" filename))
((not (file-name-absolute-p filename)) filename)
- ((org-file-remote-p filename) (concat "file:/" filename))
+ ((file-remote-p filename) (concat "file:/" filename))
(t
(let ((fullname (expand-file-name filename)))
(concat (if (string-prefix-p "/" fullname) "file://" "file:///")
@@ -4449,9 +4529,19 @@ REFERENCE is a number representing a reference, as returned by
DATUM is either an element or an object. INFO is the current
export state, as a plist.
-This function checks `:crossrefs' property in INFO for search
-cells matching DATUM before creating a new reference. Returned
-reference consists of alphanumeric characters only."
+References for the current document are stored in
+`:internal-references' property. Its value is an alist with
+associations of the following types:
+
+ (REFERENCE . DATUM) and (SEARCH-CELL . ID)
+
+REFERENCE is the reference string to be used for object or
+element DATUM. SEARCH-CELL is a search cell, as returned by
+`org-export-search-cells'. ID is a number or a string uniquely
+identifying DATUM within the document.
+
+This function also checks `:crossrefs' property for search cells
+matching DATUM before creating a new reference."
(let ((cache (plist-get info :internal-references)))
(or (car (rassq datum cache))
(let* ((crossrefs (plist-get info :crossrefs))
@@ -4861,26 +4951,32 @@ same column as TABLE-CELL, or nil."
(plist-put info :table-cell-width-cache table)
table)))
(width-vector (or (gethash table cache)
- (puthash table (make-vector columns 'empty) cache)))
- (value (aref width-vector column)))
- (if (not (eq value 'empty)) value
- (let (cookie-width)
- (dolist (row (org-element-contents table)
- (aset width-vector column cookie-width))
- (when (org-export-table-row-is-special-p row info)
- ;; In a special row, try to find a width cookie at COLUMN.
- (let* ((value (org-element-contents
- (elt (org-element-contents row) column)))
- (cookie (car value)))
- ;; The following checks avoid expanding unnecessarily
- ;; the cell with `org-export-data'.
- (when (and value
- (not (cdr value))
- (stringp cookie)
- (string-match "\\`<[lrc]?\\([0-9]+\\)?>\\'" cookie)
- (match-string 1 cookie))
- (setq cookie-width
- (string-to-number (match-string 1 cookie)))))))))))
+ (puthash table (make-vector columns 'empty) cache))))
+ ;; Table rows may not have the same number of cells. Extend
+ ;; WIDTH-VECTOR appropriately if we encounter a row larger than
+ ;; expected.
+ (when (>= column (length width-vector))
+ (setq width-vector
+ (vconcat width-vector
+ (make-list (- (1+ column) (length width-vector))
+ 'empty)))
+ (puthash table width-vector cache))
+ (pcase (aref width-vector column)
+ (`empty
+ (catch 'found
+ (dolist (row (org-element-contents table))
+ (when (org-export-table-row-is-special-p row info)
+ ;; In a special row, try to find a width cookie at
+ ;; COLUMN. The following checks avoid expanding
+ ;; unnecessarily the cell with `org-export-data'.
+ (pcase (org-element-contents
+ (elt (org-element-contents row) column))
+ (`(,(and (pred stringp) cookie))
+ (when (string-match "\\`<[lrc]?\\([0-9]+\\)>\\'" cookie)
+ (let ((w (string-to-number (match-string 1 cookie))))
+ (throw 'found (aset width-vector column w))))))))
+ (aset width-vector column nil)))
+ (value value))))
(defun org-export-table-cell-alignment (table-cell info)
"Return TABLE-CELL contents alignment.
@@ -4905,6 +5001,15 @@ Possible values are `left', `right' and `center'."
table)))
(align-vector (or (gethash table cache)
(puthash table (make-vector columns nil) cache))))
+ ;; Table rows may not have the same number of cells. Extend
+ ;; ALIGN-VECTOR appropriately if we encounter a row larger than
+ ;; expected.
+ (when (>= column (length align-vector))
+ (setq align-vector
+ (vconcat align-vector
+ (make-list (- (1+ column) (length align-vector))
+ nil)))
+ (puthash table align-vector cache))
(or (aref align-vector column)
(let ((number-cells 0)
(total-cells 0)
@@ -5231,10 +5336,12 @@ Footnote sections are ignored."
(+ (org-export-get-relative-level scope info) n))
limit))))
(org-element-map (org-element-contents scope) 'headline
- (lambda (headline)
- (unless (org-element-property :footnote-section-p headline)
- (let ((level (org-export-get-relative-level headline info)))
- (and (<= level n) headline))))
+ (lambda (h)
+ (and (not (org-element-property :footnote-section-p h))
+ (not (equal "notoc"
+ (org-export-get-node-property :UNNUMBERED h t)))
+ (>= n (org-export-get-relative-level h info))
+ h))
info)))
(defun org-export-collect-elements (type info &optional predicate)
@@ -5280,13 +5387,27 @@ Return a list of elements recognized as figures."
(org-export-collect-elements 'paragraph info predicate))
(defun org-export-collect-listings (info)
- "Build a list of src blocks.
+ "Build a list of source blocks.
INFO is a plist used as a communication channel.
-Return a list of src-block elements with a caption."
+Return a list of `src-block' elements with a caption."
(org-export-collect-elements 'src-block info))
+(defun org-export-excluded-from-toc-p (headline info)
+ "Non-nil if HEADLINE should be excluded from tables of contents.
+
+INFO is a plist used as a communication channel.
+
+Note that such headlines are already excluded from
+`org-export-collect-headlines'. Therefore, this function is not
+necessary if you only need to list headlines in the table of
+contents. However, it is useful if some additional processing is
+required on headlines excluded from table of contents."
+ (or (org-element-property :footnote-section-p headline)
+ (org-export-low-level-p headline info)
+ (equal "notoc" (org-export-get-node-property :UNNUMBERED headline t))))
+
(defun org-export-toc-entry-backend (parent &rest transcoders)
"Return an export back-end appropriate for table of contents entries.
@@ -5707,6 +5828,7 @@ them."
("ja" :default "前ページからの続き")
("nl" :default "Vervolg van vorige pagina")
("pt" :default "Continuação da página anterior")
+ ("pt_BR" :html "Continua&ccedil;&atilde;o da p&aacute;gina anterior" :ascii "Continuacao da pagina anterior" :default "Continuação da página anterior")
("ru" :html "(&#1055;&#1088;&#1086;&#1076;&#1086;&#1083;&#1078;&#1077;&#1085;&#1080;&#1077;)"
:utf-8 "(Продолжение)")
("sl" :default "Nadaljevanje s prejšnje strani"))
@@ -5720,11 +5842,13 @@ them."
("ja" :default "次ページに続く")
("nl" :default "Vervolg op volgende pagina")
("pt" :default "Continua na página seguinte")
+ ("pt_BR" :html "Continua na pr&oacute;xima p&aacute;gina" :ascii "Continua na proxima pagina" :default "Continua na próxima página")
("ru" :html "(&#1055;&#1088;&#1086;&#1076;&#1086;&#1083;&#1078;&#1077;&#1085;&#1080;&#1077; &#1089;&#1083;&#1077;&#1076;&#1091;&#1077;&#1090;)"
:utf-8 "(Продолжение следует)")
("sl" :default "Nadaljevanje na naslednji strani"))
("Created"
("cs" :default "Vytvořeno")
+ ("pt_BR" :default "Criado em")
("sl" :default "Ustvarjeno"))
("Date"
("ar" :default "بتاريخ")
@@ -5779,6 +5903,7 @@ them."
("es" :default "Figura")
("et" :default "Joonis")
("is" :default "Mynd")
+ ("it" :default "Figura")
("ja" :default "図" :html "&#22259;")
("no" :default "Illustrasjon")
("nb" :default "Illustrasjon")
@@ -5796,6 +5921,7 @@ them."
("et" :default "Joonis %d:")
("fr" :default "Figure %d :" :html "Figure&nbsp;%d&nbsp;:")
("is" :default "Mynd %d")
+ ("it" :default "Figura %d:")
("ja" :default "図%d: " :html "&#22259;%d: ")
("no" :default "Illustrasjon %d")
("nb" :default "Illustrasjon %d")
@@ -5844,6 +5970,7 @@ them."
("ja" :default "ソースコード目次")
("no" :default "Dataprogrammer")
("nb" :default "Dataprogrammer")
+ ("pt_BR" :html "&Iacute;ndice de Listagens" :default "Índice de Listagens" :ascii "Indice de Listagens")
("ru" :html "&#1057;&#1087;&#1080;&#1089;&#1086;&#1082; &#1088;&#1072;&#1089;&#1087;&#1077;&#1095;&#1072;&#1090;&#1086;&#1082;"
:utf-8 "Список распечаток")
("sl" :default "Seznam programskih izpisov")
@@ -5857,11 +5984,12 @@ them."
("et" :default "Tabelite nimekiri")
("fr" :default "Liste des tableaux")
("is" :default "Töfluskrá" :html "T&ouml;fluskr&aacute;")
+ ("it" :default "Indice delle tabelle")
("ja" :default "表目次")
("no" :default "Tabeller")
("nb" :default "Tabeller")
("nn" :default "Tabeller")
- ("pt_BR" :default "Índice de Tabelas" :ascii "Indice de Tabelas")
+ ("pt_BR" :html "&Iacute;ndice de Tabelas" :default "Índice de Tabelas" :ascii "Indice de Tabelas")
("ru" :html "&#1057;&#1087;&#1080;&#1089;&#1086;&#1082; &#1090;&#1072;&#1073;&#1083;&#1080;&#1094;"
:utf-8 "Список таблиц")
("sl" :default "Seznam tabel")
@@ -5875,6 +6003,7 @@ them."
("es" :default "Listado de programa")
("et" :default "Loend")
("fr" :default "Programme" :html "Programme")
+ ("it" :default "Listato")
("ja" :default "ソースコード")
("no" :default "Dataprogram")
("nb" :default "Dataprogram")
@@ -5891,10 +6020,11 @@ them."
("es" :default "Listado de programa %d")
("et" :default "Loend %d")
("fr" :default "Programme %d :" :html "Programme&nbsp;%d&nbsp;:")
+ ("it" :default "Listato %d :")
("ja" :default "ソースコード%d:")
("no" :default "Dataprogram %d")
("nb" :default "Dataprogram %d")
- ("pt_BR" :default "Listagem %d")
+ ("pt_BR" :default "Listagem %d:")
("ru" :html "&#1056;&#1072;&#1089;&#1087;&#1077;&#1095;&#1072;&#1090;&#1082;&#1072; %d.:"
:utf-8 "Распечатка %d.:")
("sl" :default "Izpis programa %d")
@@ -5902,19 +6032,24 @@ them."
("References"
("ar" :default "المراجع")
("cs" :default "Reference")
- ("fr" :ascii "References" :default "Références")
("de" :default "Quellen")
("es" :default "Referencias")
+ ("fr" :ascii "References" :default "Références")
+ ("it" :default "Riferimenti")
+ ("pt_BR" :html "Refer&ecirc;ncias" :default "Referências" :ascii "Referencias")
("sl" :default "Reference"))
("See figure %s"
("cs" :default "Viz obrázek %s")
("fr" :default "cf. figure %s"
:html "cf.&nbsp;figure&nbsp;%s" :latex "cf.~figure~%s")
+ ("it" :default "Vedi figura %s")
+ ("pt_BR" :default "Veja a figura %s")
("sl" :default "Glej sliko %s"))
("See listing %s"
("cs" :default "Viz program %s")
("fr" :default "cf. programme %s"
:html "cf.&nbsp;programme&nbsp;%s" :latex "cf.~programme~%s")
+ ("pt_BR" :default "Veja a listagem %s")
("sl" :default "Glej izpis programa %s"))
("See section %s"
("ar" :default "انظر قسم %s")
@@ -5924,6 +6059,7 @@ them."
("es" :ascii "Vea seccion %s" :html "Vea secci&oacute;n %s" :default "Vea sección %s")
("et" :html "Vaata peat&#252;kki %s" :utf-8 "Vaata peatükki %s")
("fr" :default "cf. section %s")
+ ("it" :default "Vedi sezione %s")
("ja" :default "セクション %s を参照")
("pt_BR" :html "Veja a se&ccedil;&atilde;o %s" :default "Veja a seção %s"
:ascii "Veja a secao %s")
@@ -5935,6 +6071,8 @@ them."
("cs" :default "Viz tabulka %s")
("fr" :default "cf. tableau %s"
:html "cf.&nbsp;tableau&nbsp;%s" :latex "cf.~tableau~%s")
+ ("it" :default "Vedi tabella %s")
+ ("pt_BR" :default "Veja a tabela %s")
("sl" :default "Glej tabelo %s"))
("Table"
("ar" :default "جدول")
@@ -5944,6 +6082,7 @@ them."
("et" :default "Tabel")
("fr" :default "Tableau")
("is" :default "Tafla")
+ ("it" :default "Tabella")
("ja" :default "表" :html "&#34920;")
("pt_BR" :default "Tabela")
("ru" :html "&#1058;&#1072;&#1073;&#1083;&#1080;&#1094;&#1072;"
@@ -5958,11 +6097,12 @@ them."
("et" :default "Tabel %d")
("fr" :default "Tableau %d :")
("is" :default "Tafla %d")
+ ("it" :default "Tabella %d:")
("ja" :default "表%d:" :html "&#34920;%d:")
("no" :default "Tabell %d")
("nb" :default "Tabell %d")
("nn" :default "Tabell %d")
- ("pt_BR" :default "Tabela %d")
+ ("pt_BR" :default "Tabela %d:")
("ru" :html "&#1058;&#1072;&#1073;&#1083;&#1080;&#1094;&#1072; %d.:"
:utf-8 "Таблица %d.:")
("sl" :default "Tabela %d")
@@ -6003,9 +6143,9 @@ them."
("es" :default "Referencia desconocida")
("et" :default "Tundmatu viide")
("fr" :ascii "Destination inconnue" :default "Référence inconnue")
+ ("it" :default "Riferimento sconosciuto")
("ja" :default "不明な参照先")
- ("pt_BR" :default "Referência desconhecida"
- :ascii "Referencia desconhecida")
+ ("pt_BR" :html "Refer&ecirc;ncia desconhecida" :default "Referência desconhecida" :ascii "Referencia desconhecida")
("ru" :html "&#1053;&#1077;&#1080;&#1079;&#1074;&#1077;&#1089;&#1090;&#1085;&#1072;&#1103; &#1089;&#1089;&#1099;&#1083;&#1082;&#1072;"
:utf-8 "Неизвестная ссылка")
("sl" :default "Neznana referenca")