0

I'm contemplating an improved indexing of Info pages with Sphinx. But in order to do this, I'd need some way of programmatically extracting all nodes (in order to then insert the contents of each node into a database via xmlpipe). But, I don't see a way to do this programmatically, do you have any suggestions on how to do it?

This is tagged "Emacs" because Emacs can be used as Info browser, and if the original Info program can't produce such a list, then using Emacs Lisp for that purpose would be OK too.


PS. Someone with more rep. please add "info" tag, it's hard enough to google it as it is.


Edit, I think I'm getting somewhere:

info --subnodes -o ./info.txt

This is almost what I want, except it gives too much information (not only the node list, but also some description and decoration).


OK, writing it appears to be easier than searching, well, after all the point of this entire effort is to make search easier, so, I think, no harm done! :D

(defun sphinx-info-nodes ()
  (let ((tmp-file (make-temp-file "info")))
    (shell-command (format "info --subnodes -o '%s'" tmp-file))
    (with-temp-buffer
      (insert-file-contents tmp-file)
      (cl-loop while (re-search-forward "^\\*\\s-*\\([^:]+\\):" nil t)
               collect (match-string 1)))))
Drew
  • 2,144
wvxvw
  • 883

0 Answers0