forked from mirrors/org-mode
org-element: Allow duals keywords with only secondary value
* lisp/org-element.el (org-element--collect-affiliated-keywords): Allow duals keywords with only secondary value. * testing/lisp/test-org-element.el: Add test. This patch allows to parse correctly the following: #+CAPTION[short caption]: #+CAPTION: Very long caption Some paragraph.
This commit is contained in:
parent
f6e936c2b9
commit
98d5666bac
|
@ -3822,7 +3822,8 @@ position of point and CDR is nil."
|
||||||
;; Now set final shape for VALUE.
|
;; Now set final shape for VALUE.
|
||||||
(when parsedp
|
(when parsedp
|
||||||
(setq value (org-element-parse-secondary-string value restrict)))
|
(setq value (org-element-parse-secondary-string value restrict)))
|
||||||
(when dualp (setq value (and value (cons value dual-value))))
|
(when dualp
|
||||||
|
(setq value (and (or value dual-value) (cons value dual-value))))
|
||||||
(when (or (member kwd org-element-multiple-keywords)
|
(when (or (member kwd org-element-multiple-keywords)
|
||||||
;; Attributes can always appear on multiple lines.
|
;; Attributes can always appear on multiple lines.
|
||||||
(string-match "^ATTR_" kwd))
|
(string-match "^ATTR_" kwd))
|
||||||
|
|
|
@ -208,6 +208,11 @@ Some other text
|
||||||
(equal
|
(equal
|
||||||
'((("l2") "s2") (("l1") "s1"))
|
'((("l2") "s2") (("l1") "s1"))
|
||||||
(org-test-with-temp-text "#+CAPTION[s1]: l1\n#+CAPTION[s2]: l2\nParagraph"
|
(org-test-with-temp-text "#+CAPTION[s1]: l1\n#+CAPTION[s2]: l2\nParagraph"
|
||||||
|
(org-element-property :caption (org-element-at-point)))))
|
||||||
|
(should
|
||||||
|
(equal
|
||||||
|
'((("l1")) (nil "s1"))
|
||||||
|
(org-test-with-temp-text "#+CAPTION[s1]:\n#+CAPTION: l1\nParagraph"
|
||||||
(org-element-property :caption (org-element-at-point))))))
|
(org-element-property :caption (org-element-at-point))))))
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue