Browse Source

Merge branch 'master' of orgmode.org:org-mode

Bastien Guerry 13 years ago
parent
commit
f9d864435d
2 changed files with 9 additions and 23 deletions
  1. 2 2
      EXPERIMENTAL/org-e-ascii.el
  2. 7 21
      contrib/lisp/org-export.el

+ 2 - 2
EXPERIMENTAL/org-e-ascii.el

@@ -54,7 +54,7 @@
 (declare-function org-export-get-footnote-number "org-export" (footnote info))
 (declare-function org-export-get-footnote-number "org-export" (footnote info))
 (declare-function org-export-get-headline-number "org-export" (headline info))
 (declare-function org-export-get-headline-number "org-export" (headline info))
 (declare-function org-export-get-ordinal "org-export"
 (declare-function org-export-get-ordinal "org-export"
-		  (element info &optional types within-section predicate))
+		  (element info &optional types predicate))
 (declare-function org-export-get-parent-headline "org-export" (blob info))
 (declare-function org-export-get-parent-headline "org-export" (blob info))
 (declare-function org-export-get-relative-level "org-export" (headline info))
 (declare-function org-export-get-relative-level "org-export" (headline info))
 (declare-function org-export-handle-code
 (declare-function org-export-handle-code
@@ -642,7 +642,7 @@ keyword."
       ;; src-block with either a caption or a name.
       ;; src-block with either a caption or a name.
       (let ((reference
       (let ((reference
 	     (org-export-get-ordinal
 	     (org-export-get-ordinal
-	      element info nil nil
+	      element info nil
 	      (lambda (el) (or (org-element-property :caption el)
 	      (lambda (el) (or (org-element-property :caption el)
 			  (org-element-property :name el)))))
 			  (org-element-property :name el)))))
 	    (title-fmt (org-e-ascii--translate
 	    (title-fmt (org-e-ascii--translate

+ 7 - 21
contrib/lisp/org-export.el

@@ -2865,8 +2865,7 @@ INFO is a plist holding export options."
 ;; `org-export-get-ordinal' associates a sequence number to any object
 ;; `org-export-get-ordinal' associates a sequence number to any object
 ;; or element.
 ;; or element.
 
 
-(defun org-export-get-ordinal
-  (element info &optional types within-section predicate)
+(defun org-export-get-ordinal (element info &optional types predicate)
   "Return ordinal number of an element or object.
   "Return ordinal number of an element or object.
 
 
 ELEMENT is the element or object considered.  INFO is the plist
 ELEMENT is the element or object considered.  INFO is the plist
@@ -2876,15 +2875,11 @@ Optional argument TYPES, when non-nil, is a list of element or
 object types, as symbols, that should also be counted in.
 object types, as symbols, that should also be counted in.
 Otherwise, only provided element's type is considered.
 Otherwise, only provided element's type is considered.
 
 
-When optional argument WITHIN-SECTION is non-nil, narrow counting
-to the section containing ELEMENT.
-
 Optional argument PREDICATE is a function returning a non-nil
 Optional argument PREDICATE is a function returning a non-nil
 value if the current element or object should be counted in.  It
 value if the current element or object should be counted in.  It
-accepts one argument: the element or object being considered.
-This argument allows to count only a certain type of objects,
-like inline images, which are a subset of links (in that case,
-`org-export-inline-image-p' might be an useful predicate).
+accepts two arguments: the element or object being considered and
+the plist used as a communication channel.  This allows to count
+only a certain type of objects (i.e. inline images).
 
 
 Return value is a list of numbers if ELEMENT is an headline or an
 Return value is a list of numbers if ELEMENT is an headline or an
 item.  It is nil for keywords.  It represents the footnote number
 item.  It is nil for keywords.  It represents the footnote number
@@ -2920,24 +2915,15 @@ objects of the same type."
       ((footnote definition footnote-reference)
       ((footnote definition footnote-reference)
        (org-export-get-footnote-number element info))
        (org-export-get-footnote-number element info))
       (otherwise
       (otherwise
-       (let ((counter 0)
-	     ;; Determine if search should apply to current section,
-	     ;; in which case it should be retrieved first, or to full
-	     ;; parse tree.  As a special case, an element or object
-	     ;; without a parent headline will also trigger a full
-	     ;; search, notwithstanding WITHIN-SECTION value.
-	     (data
-	      (if (not within-section) (plist-get info :parse-tree)
-		(or (org-export-get-parent-headline element info)
-		    (plist-get info :parse-tree)))))
+       (let ((counter 0))
 	 ;; Increment counter until ELEMENT is found again.
 	 ;; Increment counter until ELEMENT is found again.
 	 (org-element-map
 	 (org-element-map
-	  data (or types (org-element-type element))
+	  (plist-get info :parse-tree) (or types (org-element-type element))
 	  (lambda (el)
 	  (lambda (el)
 	    (cond
 	    (cond
 	     ((equal element el) (1+ counter))
 	     ((equal element el) (1+ counter))
 	     ((not predicate) (incf counter) nil)
 	     ((not predicate) (incf counter) nil)
-	     ((funcall predicate el) (incf counter) nil)))
+	     ((funcall predicate el info) (incf counter) nil)))
 	  info 'first-match))))))
 	  info 'first-match))))))