mirror of
https://git.savannah.gnu.org/git/emacs/org-mode.git
synced 2024-09-29 19:37:52 +00:00
org-latex-verse-block: Fix regression from 3f60acff7
* lisp/ox-latex.el (org-latex-verse-block): Fix logic replacing sole paragraph breaks according to the new template. * testing/lisp/test-ox-latex.el: New test file. (org-test-with-exported-text): New macro for testing export. (test-ox-latex/verse): New test. * mk/default.mk (BTEST_RE): Select the new test by default. Reported-by: Juan Manuel Macías <maciaschain@posteo.net> Link: https://orgmode.org/list/875ygk6a8z.fsf@posteo.net
This commit is contained in:
parent
4b010e8dc3
commit
5fa66c7ffc
|
@ -4105,7 +4105,8 @@ contextual information."
|
|||
(replace-regexp-in-string
|
||||
"^[ \t]+" (lambda (m) (format "\\hspace*{%dem}" (length m)))
|
||||
(replace-regexp-in-string
|
||||
"^[ \t]*\\\\\\\\$" "\\vspace*{1em}"
|
||||
(concat "^[ \t]*" (regexp-quote org-latex-line-break-safe) "$")
|
||||
"\\vspace*{1em}"
|
||||
(replace-regexp-in-string
|
||||
"\\([ \t]*\\\\\\\\\\)?[ \t]*\n"
|
||||
(concat org-latex-line-break-safe "\n")
|
||||
|
|
|
@ -72,7 +72,7 @@ REPRO_ARGS ?=
|
|||
req-ob-lang = --eval '(require '"'"'ob-$(ob-lang))'
|
||||
lst-ob-lang = ($(ob-lang) . t)
|
||||
req-extra = --eval '(require '"'"'$(req))'
|
||||
BTEST_RE ?= \\(org\\|ob\\)
|
||||
BTEST_RE ?= \\(org\\|ob\\|ox\\)
|
||||
BTEST_LOAD = \
|
||||
--eval '(add-to-list '"'"'load-path (concat default-directory "lisp"))' \
|
||||
--eval '(add-to-list '"'"'load-path (concat default-directory "testing"))'
|
||||
|
|
74
testing/lisp/test-ox-latex.el
Normal file
74
testing/lisp/test-ox-latex.el
Normal file
|
@ -0,0 +1,74 @@
|
|||
;;; test-ox-latex.el --- tests for ox-latex.el -*- lexical-binding: t; -*-
|
||||
|
||||
;; Copyright (C) 2022 Ihor Radchenko
|
||||
|
||||
;; Author: Ihor Radchenko <yantar92@posteo.net>
|
||||
|
||||
;; This program is free software; you can redistribute it and/or modify
|
||||
;; it under the terms of the GNU General Public License as published by
|
||||
;; the Free Software Foundation, either version 3 of the License, or
|
||||
;; (at your option) any later version.
|
||||
|
||||
;; This program is distributed in the hope that it will be useful,
|
||||
;; but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
;; GNU General Public License for more details.
|
||||
|
||||
;; You should have received a copy of the GNU General Public License
|
||||
;; along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
|
||||
;;; Commentary:
|
||||
|
||||
;; Tests checking validity of Org LaTeX export output.
|
||||
|
||||
;;; Code:
|
||||
|
||||
(require 'ox-latex nil t)
|
||||
(unless (featurep 'ox-latex)
|
||||
(signal 'missing-test-dependency "org-export-latex"))
|
||||
|
||||
(defmacro org-test-with-exported-text (backend source &rest body)
|
||||
"Run BODY in export buffer for SOURCE string via BACKEND."
|
||||
(declare (indent 2))
|
||||
`(org-test-with-temp-text ,source
|
||||
(let ((export-buffer (generate-new-buffer "Org temporary export")))
|
||||
(unwind-protect
|
||||
(progn
|
||||
(org-export-to-buffer ,backend export-buffer)
|
||||
(with-current-buffer export-buffer
|
||||
,@body))
|
||||
(kill-buffer export-buffer)))))
|
||||
|
||||
|
||||
|
||||
(ert-deftest test-ox-latex/verse ()
|
||||
"Test verse blocks."
|
||||
(org-test-with-exported-text
|
||||
'latex
|
||||
"#+begin_verse
|
||||
lorem ipsum dolor
|
||||
lorem ipsum dolor
|
||||
|
||||
lorem ipsum dolor
|
||||
lorem ipsum dolor
|
||||
|
||||
lorem ipsum dolor
|
||||
lorem ipsum dolor
|
||||
#+end_verse
|
||||
"
|
||||
(goto-char (point-min))
|
||||
(should
|
||||
(search-forward
|
||||
"\\begin{verse}
|
||||
lorem ipsum dolor\\\\\\empty
|
||||
lorem ipsum dolor\\\\\\empty
|
||||
\\vspace*{1em}
|
||||
lorem ipsum dolor\\\\\\empty
|
||||
lorem ipsum dolor\\\\\\empty
|
||||
\\vspace*{1em}
|
||||
lorem ipsum dolor\\\\\\empty
|
||||
lorem ipsum dolor\\\\\\empty
|
||||
\\end{verse}"))))
|
||||
|
||||
(provide 'test-ox-latex)
|
||||
;;; test-ox-latex.el ends here
|
Loading…
Reference in a new issue