summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNicolas Goaziou <mail@nicolasgoaziou.fr>2017-06-08 23:26:26 +0200
committerNicolas Goaziou <mail@nicolasgoaziou.fr>2017-06-08 23:26:26 +0200
commit9fdc77a3cdd28f35c4e053d4282dc644477b2478 (patch)
tree8a54540d784a2fa15a21dd1716527405292b63a3
parenta138fedfd2ac41d3192294d06bafdb4b043ec09c (diff)
downloadorg-mode-9fdc77a3cdd28f35c4e053d4282dc644477b2478.tar.gz
ox-texinfo: Improve entities handling
* lisp/ox-texinfo.el (org-texinfo-entity): Use Texinfo specific commands whenever possible.
-rw-r--r--lisp/ox-texinfo.el38
1 files changed, 37 insertions, 1 deletions
diff --git a/lisp/ox-texinfo.el b/lisp/ox-texinfo.el
index 034065d..e01ee5a 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