[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Additional indices in TexInfo exporter: FR or may be just a note ...
From: |
Ramesh Nedunchezian |
Subject: |
Additional indices in TexInfo exporter: FR or may be just a note ... |
Date: |
Fri, 30 Apr 2021 12:55:11 +0530 |
User-agent: |
Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.5.0 |
TLDR:
1. (May be) support for additional indices in TexInfo exporter.
2. Use `info' function--as opposed to `info' binary--to open an
exported INFO file. IOW, don't use `org-open-file', but use `info'
function directly.
(2) would be nice to have.
----------------
I had a need to create an index of EIEIO classes in =helm= package.
See
(info "(texinfo) New Indices")
I had to customize the default TexInfo exporter to achieve this
end. You can see the end result here:
https://rnchzn.github.io/helm/doc/helm-classes.html#Class-Index
This is what I did to create the additional index.
(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+)))
Since I had to do multiple edit, compile, preview passes, I also
created the following "make-shift" command to make the process more
easier.
(global-set-key (kbd "<f10>")
(defun make-shift ()
(interactive)
(let* ((info-buf-name (format "*info: %s*"
(file-name-sans-extension
(file-name-nondirectory
(buffer-file-name))))))
(when-let ((info-buf (get-buffer info-buf-name)))
(kill-buffer info-buf))
(info (org-texinfo-compile (org-texinfo-export-to-texinfo+))
info-buf-name))))
- Additional indices in TexInfo exporter: FR or may be just a note ...,
Ramesh Nedunchezian <=