Browse Source

ox-ascii: Fix indentation for description lists with links in tags

* lisp/ox-ascii.el (org-ascii--current-text-width): Compute contents'
  text width according to exported tag instead of original one.

Reported-by: Rasmus <rasmus@gmx.us>
<http://permalink.gmane.org/gmane.emacs.orgmode/94416>
Nicolas Goaziou 10 years ago
parent
commit
e1862b5c44
1 changed files with 8 additions and 7 deletions
  1. 8 7
      lisp/ox-ascii.el

+ 8 - 7
lisp/ox-ascii.el

@@ -604,28 +604,29 @@ INFO is a plist used as a communication channel."
 	     ;; indentation of current item.  If that's the case,
 	     ;; compute it with the help of `:structure' property from
 	     ;; parent item, if any.
-	     (let ((parent-item
+	     (let ((item
 		    (if (eq (org-element-type element) 'item) element
 		      (loop for parent in genealogy
 			    when (eq (org-element-type parent) 'item)
 			    return parent))))
-	       (if (not parent-item) 0
+	       (if (not item) 0
 		 ;; Compute indentation offset of the current item,
 		 ;; that is the sum of the difference between its
 		 ;; indentation and the indentation of the top item in
 		 ;; the list and current item bullet's length.  Also
 		 ;; remove checkbox length, and tag length (for
 		 ;; description lists) or bullet length.
-		 (let ((struct (org-element-property :structure parent-item))
-		       (beg-item (org-element-property :begin parent-item)))
+		 (let ((struct (org-element-property :structure item))
+		       (beg-item (org-element-property :begin item)))
 		   (+ (- (org-list-get-ind beg-item struct)
 			 (org-list-get-ind
 			  (org-list-get-top-point struct) struct))
-		      (string-width (or (org-ascii--checkbox parent-item info)
+		      (string-width (or (org-ascii--checkbox item info)
 					""))
 		      (string-width
-		       (or (org-list-get-tag beg-item struct)
-			   (org-list-get-bullet beg-item struct)))))))))))))
+		       (let ((tag (org-element-property :tag item)))
+			 (if tag (org-export-data tag info)
+			   (org-element-property :bullet item))))))))))))))
 
 (defun org-ascii--current-justification (element)
   "Return expected justification for ELEMENT's contents.