mirror of
https://git.savannah.gnu.org/git/emacs/org-mode.git
synced 2024-08-25 01:32:52 +00:00
lisp/ox-ascii.el: Fix justification of special blocks
* lisp/ox-ascii.el (org-ascii--current-justification): Fix typos in the code. * testing/lisp/test-ox-ascii.el (test-ox-ascii/justify): Add test. Reported-by: Gregor Zattler <telegraph@gmx.net> Link: https://orgmode.org/list/87o7ft8gxo.fsf@no.lan
This commit is contained in:
parent
819cd73cb4
commit
0740e62df8
|
@ -633,16 +633,16 @@ INFO is a plist used as a communication channel."
|
||||||
Return value is a symbol among `left', `center', `right' and
|
Return value is a symbol among `left', `center', `right' and
|
||||||
`full'."
|
`full'."
|
||||||
(or (org-element-lineage-map
|
(or (org-element-lineage-map
|
||||||
element
|
element
|
||||||
(lambda (el)
|
(lambda (el)
|
||||||
(pcase (org-element-type el)
|
(pcase (org-element-type el)
|
||||||
(`center-block 'center)
|
(`center-block 'center)
|
||||||
(`special-block
|
(`special-block
|
||||||
(let ((name (org-element-property :type element)))
|
(let ((name (org-element-property :type el)))
|
||||||
(cond ((string= name "JUSTIFYRIGHT") 'right)
|
(cond ((string= name "JUSTIFYRIGHT") 'right)
|
||||||
((string= name "JUSTIFYLEFT") 'left))))))
|
((string= name "JUSTIFYLEFT") 'left))))))
|
||||||
'(center-block 'special-block)
|
'(center-block special-block)
|
||||||
nil 'first-match)
|
nil 'first-match)
|
||||||
;; default
|
;; default
|
||||||
'left))
|
'left))
|
||||||
|
|
||||||
|
|
|
@ -66,5 +66,21 @@
|
||||||
(search-forward
|
(search-forward
|
||||||
"1. bar")))))
|
"1. bar")))))
|
||||||
|
|
||||||
|
(ert-deftest test-ox-ascii/justify ()
|
||||||
|
"Test justification."
|
||||||
|
;; Right justify.
|
||||||
|
(org-test-with-exported-text
|
||||||
|
'ascii
|
||||||
|
"#+OPTIONS: author:nil *:t
|
||||||
|
#+BEGIN_JUSTIFYRIGHT
|
||||||
|
left or right
|
||||||
|
#+END_JUSTIFYRIGHT
|
||||||
|
"
|
||||||
|
(goto-char (point-min))
|
||||||
|
(search-forward
|
||||||
|
"left or right")
|
||||||
|
(should
|
||||||
|
(equal org-ascii-text-width (org-current-text-column)))))
|
||||||
|
|
||||||
(provide 'test-ox-ascii)
|
(provide 'test-ox-ascii)
|
||||||
;;; test-ox-ascii.el ends here
|
;;; test-ox-ascii.el ends here
|
||||||
|
|
Loading…
Reference in a new issue