diff --git a/contrib/lisp/org-e-ascii.el b/contrib/lisp/org-e-ascii.el index fd9623753..c3daf9f02 100644 --- a/contrib/lisp/org-e-ascii.el +++ b/contrib/lisp/org-e-ascii.el @@ -676,41 +676,34 @@ title." (concat "\n" (make-string (length first-part) under-char)))))))) -(defun org-e-ascii--has-caption-or-name-p (element info) - "Non-nil when ELEMENT has a caption or a name affiliated keyword. - -INFO is a plist used as a communication channel. - -This function is meant to be used as a predicate for -`org-export-get-ordinal'." - (or (org-element-property :caption element) - (org-element-property :name element))) +(defun org-e-ascii--has-caption-p (element info) + "Non-nil when ELEMENT has a caption affiliated keyword. +INFO is a plist used as a communication channel. This function +is meant to be used as a predicate for `org-export-get-ordinal'." + (org-element-property :caption element)) (defun org-e-ascii--build-caption (element info) "Return caption string for ELEMENT, if applicable. INFO is a plist used as a communication channel. -The caption string contains the sequence number of ELEMENT if it -has a name affiliated keyword, along with the real caption, if -any. Return nil when ELEMENT has no affiliated caption or name -keyword." - (let ((caption (org-element-property :caption element)) - (name (org-element-property :name element))) - (when (or caption name) +The caption string contains the sequence number of ELEMENT along +with its real caption. Return nil when ELEMENT has no affiliated +caption keyword." + (let ((caption (org-element-property :caption element))) + (when caption ;; Get sequence number of current src-block among every - ;; src-block with either a caption or a name. + ;; src-block with a caption. (let ((reference (org-export-get-ordinal - element info nil 'org-e-ascii--has-caption-or-name-p)) + element info nil 'org-e-ascii--has-caption-p)) (title-fmt (org-e-ascii--translate (case (org-element-type element) (table "Table %d: %s") - (src-block "Listing %d: %s")) info))) + (src-block "Listing %d: %s")) + info))) (org-e-ascii--fill-string - (format - title-fmt reference - (if (not caption) name (org-export-data (car caption) info))) + (format title-fmt reference (org-export-data (car caption) info)) (org-e-ascii--current-text-width element info) info))))) (defun org-e-ascii--build-toc (info &optional n keyword) @@ -774,9 +767,8 @@ generation. INFO is a plist used as a communication channel." (org-e-ascii--indent-string (org-e-ascii--fill-string (let ((caption (org-element-property :caption src-block))) - (if (not caption) (org-element-property :name src-block) - ;; Use short name in priority, if available. - (org-export-data (or (cdr caption) (car caption)) info))) + ;; Use short name in priority, if available. + (org-export-data (or (cdr caption) (car caption)) info)) (- text-width (length initial-text)) info) (length initial-text)))))) (org-export-collect-listings info) "\n"))))) @@ -812,9 +804,8 @@ generation. INFO is a plist used as a communication channel." (org-e-ascii--indent-string (org-e-ascii--fill-string (let ((caption (org-element-property :caption table))) - (if (not caption) (org-element-property :name table) - ;; Use short name in priority, if available. - (org-export-data (or (cdr caption) (car caption)) info))) + ;; Use short name in priority, if available. + (org-export-data (or (cdr caption) (car caption)) info)) (- text-width (length initial-text)) info) (length initial-text)))))) (org-export-collect-tables info) "\n"))))) @@ -1472,8 +1463,7 @@ INFO is a plist holding contextual information." (when destination (let ((number (org-export-get-ordinal - destination info nil - 'org-e-ascii--has-caption-or-name-p))) + destination info nil 'org-e-ascii--has-caption-p))) (when number (if (atom number) (number-to-string number) (mapconcat 'number-to-string number "."))))))))) diff --git a/contrib/lisp/org-export.el b/contrib/lisp/org-export.el index abd3e1d20..5e3f989d7 100644 --- a/contrib/lisp/org-export.el +++ b/contrib/lisp/org-export.el @@ -3766,8 +3766,7 @@ Return a list of all exportable headlines as parsed elements." "Collect referenceable elements of a determined type. TYPE can be a symbol or a list of symbols specifying element -types to search. Only elements with a caption or a name are -collected. +types to search. Only elements with a caption are collected. INFO is a plist used as a communication channel. @@ -3779,18 +3778,16 @@ Return a list of all elements found, in order of appearance." (org-element-map (plist-get info :parse-tree) type (lambda (element) - (and (or (org-element-property :caption element) - (org-element-property :name element)) + (and (org-element-property :caption element) (or (not predicate) (funcall predicate element)) - element)) info)) + element)) + info)) (defun org-export-collect-tables (info) "Build a list of tables. - INFO is a plist used as a communication channel. -Return a list of table elements with a caption or a name -affiliated keyword." +Return a list of table elements with a caption." (org-export-collect-elements 'table info)) (defun org-export-collect-figures (info predicate) @@ -3801,9 +3798,9 @@ a function which accepts one argument: a paragraph element and whose return value is non-nil when that element should be collected. -A figure is a paragraph type element, with a caption or a name, -verifying PREDICATE. The latter has to be provided since -a \"figure\" is a vague concept that may depend on back-end. +A figure is a paragraph type element, with a caption, verifying +PREDICATE. The latter has to be provided since a \"figure\" is +a vague concept that may depend on back-end. Return a list of elements recognized as figures." (org-export-collect-elements 'paragraph info predicate)) @@ -3813,8 +3810,7 @@ Return a list of elements recognized as figures." INFO is a plist used as a communication channel. -Return a list of src-block elements with a caption or a name -affiliated keyword." +Return a list of src-block elements with a caption." (org-export-collect-elements 'src-block info))