summaryrefslogtreecommitdiff
path: root/doc/ox-texinfo+.el
blob: c8f4f6d4a0d412c2b2639959197a53373a46b851 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
(require 'ox-texinfo)

(defun org-texinfo-keyword+ (keyword contents info)
  (let* ((v (org-element-property :value keyword))
         (k (org-element-property :key keyword))
         (c (org-texinfo-keyword keyword contents info)))
    (if c c
      (when (string-match  "\\(?:\\`\\(?1:.+\\)INDEX\\'\\)" k)
        (format "@%sindex %s" (downcase (match-string 1 k)) v)))))

(defun org-texinfo-export-to-texinfo+ ()
  (interactive)
  (let ((outfile (org-export-output-file-name ".texi"))
        (org-export-coding-system org-texinfo-coding-system))
    (org-export-to-file 'my-texinfo outfile)))

(org-export-define-derived-backend 'my-texinfo 'texinfo
  :translate-alist '((keyword . org-texinfo-keyword+)))

(provide 'ox-texinfo+)