diff --git a/contrib/lisp/org-e-ascii.el b/contrib/lisp/org-e-ascii.el index 0881e9499..185127305 100644 --- a/contrib/lisp/org-e-ascii.el +++ b/contrib/lisp/org-e-ascii.el @@ -1100,16 +1100,8 @@ holding contextual information." "Transcode an HORIZONTAL-RULE object from Org to ASCII. CONTENTS is nil. INFO is a plist holding contextual information." - (let ((attr - (read - (format - "(%s)" - (mapconcat - #'identity - (org-element-property :attr_ascii horizontal-rule) - " "))))) - (make-string (or (and (wholenump (plist-get attr :width)) - (plist-get attr :width)) + (let ((width (org-export-read-attribte :attr_ascii horizontal-rule :width))) + (make-string (or (and (wholenump width) width) (org-e-ascii--current-text-width horizontal-rule info)) (if (eq (plist-get info :ascii-charset) 'utf-8) ?― ?-)))) diff --git a/contrib/lisp/org-export.el b/contrib/lisp/org-export.el index 224260e4c..8daa335e6 100644 --- a/contrib/lisp/org-export.el +++ b/contrib/lisp/org-export.el @@ -2706,14 +2706,20 @@ file should have." ;; as a plist. It can be used to normalize affiliated keywords' ;; syntax. -(defun org-export-read-attribute (attribute element) +(defun org-export-read-attribute (attribute element &optional property) "Turn ATTRIBUTE property from ELEMENT into a plist. + +When optional argument PROPERTY is non-nil, return the value of +that property within attributes. + This function assumes attributes are defined as \":keyword value\" pairs. It is appropriate for `:attr_html' like properties." - (let ((value (org-element-property attribute element))) - (and value - (read (format "(%s)" (mapconcat 'identity value " ")))))) + (let ((attributes + (let ((value (org-element-property attribute element))) + (and value + (read (format "(%s)" (mapconcat 'identity value " "))))))) + (if property (plist-get attributes property) attributes))) ;;;; For Export Snippets