From 9fdc77a3cdd28f35c4e053d4282dc644477b2478 Mon Sep 17 00:00:00 2001 From: Nicolas Goaziou Date: Thu, 8 Jun 2017 23:26:26 +0200 Subject: [PATCH] ox-texinfo: Improve entities handling * lisp/ox-texinfo.el (org-texinfo-entity): Use Texinfo specific commands whenever possible. --- lisp/ox-texinfo.el | 38 +++++++++++++++++++++++++++++++++++++- 1 file changed, 37 insertions(+), 1 deletion(-) diff --git a/lisp/ox-texinfo.el b/lisp/ox-texinfo.el index 034065d9d..e01ee5a9a 100644 --- a/lisp/ox-texinfo.el +++ b/lisp/ox-texinfo.el @@ -733,7 +733,43 @@ holding contextual information." (defun org-texinfo-entity (entity _contents _info) "Transcode an ENTITY object from Org to Texinfo." - (org-element-property :utf-8 entity)) + ;; Since there is not specific Texinfo entry in entities, use + ;; Texinfo-specific commands whenever possible, and fallback to + ;; UTF-8 otherwise. + (pcase (org-element-property :name entity) + ("AElig" "@AE{}") + ("aelig" "@ae{}") + ((or "bull" "bullet") "@bullet{}") + ("copy" "@copyright{}") + ((or "dots" "hellip") "@dots{}") + ("equiv" "@equiv{}") + ((or "euro" "EUR") "@euro{}") + ((or "ge" "geq") "@geq{}") + ("laquo" "@guillemetleft{}") + ("iexcl" "@exclamdown{}") + ("imath" "@dotless{i}") + ("iquest" "@questiondown{}") + ("jmath" "@dotless{j}") + ((or "le" "leq") "@leq{}") + ("lsaquo" "@guilsinglleft{}") + ("mdash" "---") + ("minus" "@minus{}") + ("nbsp" "@tie{}") + ("ndash" "--") + ("OElig" "@OE{}") + ("oelig" "@oe{}") + ("ordf" "@ordf{}") + ("ordm" "@ordm{}") + ("pound" "@pound{}") + ("raquo" "@guillemetright{}") + ((or "rArr" "Rightarrow") "@result{}") + ((or "rightarrow" "to" "rarr") "@arrow{}") + ("rsaquo" "@guilsinglright{}") + ("thorn" "@th{}") + ("THORN" "@TH{}") + ((and (pred (string-prefix-p "_")) name) ;spacing entities. + (format "@w{%s}" (substring name 1))) + (_ (org-element-property :utf-8 entity)))) ;;;; Example Block