forked from mirrors/org-mode
org-export: Add optional argument to `org-export-read-attribute'
* contrib/lisp/org-export.el (org-export-read-attribute): Add optional argument to `org-export-read-attribute'. * contrib/lisp/org-e-ascii.el (org-e-ascii-horizontal-rule): Use additional argument.
This commit is contained in:
parent
86ff4cde98
commit
1b64d9582e
|
@ -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) ?― ?-))))
|
||||
|
||||
|
|
|
@ -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
|
||||
|
|
Loading…
Reference in New Issue