From 37142cea78b97498ff9c99ba86c8f05d0ab31ca9 Mon Sep 17 00:00:00 2001 From: Nicolas Goaziou Date: Thu, 19 Oct 2017 21:51:31 +0200 Subject: [PATCH] ox-man: Fix verbatim markup * lisp/ox-man.el (org-man--protect-text): New function. (org-man-code): Use new function. (org-man-verbatim): Use inline markup. --- lisp/ox-man.el | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/lisp/ox-man.el b/lisp/ox-man.el index 58083ca5c..8396df64d 100644 --- a/lisp/ox-man.el +++ b/lisp/ox-man.el @@ -285,6 +285,10 @@ This function shouldn't be used for floats. See output (concat (format "%s\n.br\n" label) output)))) +(defun org-man--protect-text (text) + "Protect minus and backslash characters in string TEXT." + (replace-regexp-in-string "-" "\\-" nil t)) + ;;; Template @@ -351,7 +355,8 @@ holding contextual information." (defun org-man-code (code _contents _info) "Transcode a CODE object from Org to Man." - (format "\\fC%s\\fP" (org-element-property :value code))) + (format "\\fC%s\\fP" + (org-man--protect-text (org-element-property :value code)))) ;;; Drawer @@ -1029,7 +1034,8 @@ holding contextual information." (defun org-man-verbatim (verbatim _contents _info) "Transcode a VERBATIM object from Org to Man." - (format ".nf\n%s\n.fi" (org-element-property :value verbatim))) + (format "\\fI%s\\fP" + (org-man--protect-text (org-element-property :value verbatim)))) ;;; Verse Block