Timeline for parsing org-mode files from command line
Current License: CC BY-SA 4.0
6 events
| when toggle format | what | by | license | comment | |
|---|---|---|---|---|---|
| May 16, 2024 at 22:03 | comment | added | Daniel Krajnik | true, I will give it a try | |
| May 15, 2024 at 13:20 | comment | added | NickD | " ... quite a few steps ...": like most things, it looks complicated when it is described (and I tend to run on in the mouth sometimes), but it is easier done than said. If you spend half an hour with the answer and try it out, you will see that it is pretty simple - but it's never going to be a one-liner, not in awk, not in xpath, not in anything - not in the generality you are talking about. | |
| May 15, 2024 at 13:09 | comment | added | NickD | "... some simple one-liner ..." - that's a dream we all have but it's only a dream. If you want to use Emacs for parsing Org mode documents you will need to learn the Org mode API for getting things out of files and enough Elisp so that you can string things together. There is no royal road to geometry or anything else for that matter. Converting to XML and using xpath might work in simple cases, but it's a lossy conversion so infinite extensibility is just not going to happen. You have to be realistic about these things: pandoc is not a panacea. | |
| May 15, 2024 at 12:33 | comment | added | Daniel Krajnik | thank you, that would work, but involves quite a few steps and I was hoping to find some simple one-liner that could be also modified in the future to different queries. The closest approach that I could come up with since posting the question was converting it to xml and then using xpath like this (it doesn't quite work yet though): pandoc -f org -t docbook input.org | xmllint --format --xpath '/<XPATH>'. That would allow one to freely modify xpath in an expressive and relatively easy way. I don't suppose that there is an "xpath for org-mode" equivalent? Sorry if this isn't emacs-specific. | |
| May 14, 2024 at 18:16 | history | edited | NickD | CC BY-SA 4.0 | added 99 characters in body |
| May 14, 2024 at 14:14 | history | answered | NickD | CC BY-SA 4.0 |