branch: externals/org
commit ac0727b6ee46eb4000e0e412ce62ba262b2fe879
Author: Derek Chen-Becker <[email protected]>
Commit: Ihor Radchenko <[email protected]>

    lisp/ox-latex.el: Properly format priority values
    
    Fix LaTeX export so that it properly handles numeric priority values in
    addition to characters.
    
    * lisp/ox-latex.el (org-latex-format-headline-default-function): Change
    format of priorities to use the `org-priority-to-string' function instead
    of assuming a character value.
    * testing/lisp/test-ox-latex.el: Fix a typo in the
    `test-ox-latex/protect-square-brackets' test so that its name matches the
    rest of the tests.  Add unit tests for LaTeX export of headlines with
    priorities for both numeric and character values.
---
 lisp/ox-latex.el              |  2 +-
 testing/lisp/test-ox-latex.el | 29 ++++++++++++++++++++++++++++-
 2 files changed, 29 insertions(+), 2 deletions(-)

diff --git a/lisp/ox-latex.el b/lisp/ox-latex.el
index cf4f10f2a2..af4196e098 100644
--- a/lisp/ox-latex.el
+++ b/lisp/ox-latex.el
@@ -2525,7 +2525,7 @@ holding contextual information."
 See `org-latex-format-headline-function' for details."
   (concat
    (and todo (format "{\\bfseries\\sffamily %s} " todo))
-   (and priority (format "\\framebox{\\#%c} " priority))
+   (and priority (format "\\framebox{\\#%s} " (org-priority-to-string 
priority)))
    text
    (and tags
        (format "\\hfill{}\\textsc{%s}"
diff --git a/testing/lisp/test-ox-latex.el b/testing/lisp/test-ox-latex.el
index 35088deeec..64ab7d4677 100644
--- a/testing/lisp/test-ox-latex.el
+++ b/testing/lisp/test-ox-latex.el
@@ -29,7 +29,7 @@
 
 
 
-(ert-deftest text-ox-latex/protect-square-brackets ()
+(ert-deftest test-ox-latex/protect-square-brackets ()
   "Test [foo] being interpreted as plain text even after LaTeX commands."
   (org-test-with-exported-text
       'latex
@@ -284,5 +284,32 @@ is suppressed
     (should (search-forward
              "\\section[\\(\\psi\\) wraps too]{\\(\\phi\\) wraps}"))))
 
+(ert-deftest test-ox-latex/numeric-priority-headline ()
+  "Test numeric priorities in headlines."
+  (org-test-with-exported-text
+   'latex
+   "#+OPTIONS: pri:t
+* [#3] Test
+"
+   (goto-char (point-min))
+   (should (search-forward "\\framebox{\\#3}")))
+  (org-test-with-exported-text
+   'latex
+   "#+OPTIONS: pri:t
+* [#42] Test
+"
+   (goto-char (point-min))
+   (should (search-forward "\\framebox{\\#42}"))))
+
+(ert-deftest test-ox-latex/alphabetical-priority-headline ()
+  "Test numeric priorities in headlines."
+  (org-test-with-exported-text
+   'latex
+   "#+OPTIONS: pri:t
+* [#C] Test
+"
+   (goto-char (point-min))
+   (should (search-forward "\\framebox{\\#C}"))))
+
 (provide 'test-ox-latex)
 ;;; test-ox-latex.el ends here

Reply via email to