* [Orgmode] WISH: link expansion in Freemind export
@ 2011-06-06 20:42 Filip Buric
0 siblings, 0 replies; only message in thread
From: Filip Buric @ 2011-06-06 20:42 UTC (permalink / raw)
To: emacs-orgmode
[-- Attachment #1: Type: text/plain, Size: 2170 bytes --]
Hello,
I thought it would be nice to be able to replace a local link with the
contents of the target file
when exporting to Freemind and I couldn't figure out how to do this with the
existing options
(just started using org-mode). I wanted to be able to make linked notes and
then visualise
them as a mind map. For instance, exporting something like:
* TODO todo-list
* stuff
* more stuff
[[./file.org][testlink]]
would produce:
...
<p>DATA</p>
...
where 'DATA' is the actual contents of file.org, instead of <p><a
href=...></a></p>
I already modified my copy of org-freemind.el to try this out.
I just modified org-free-mind-convert-links-from-org to insert the target
contents instead of the html link:
(defun org-freemind-convert-links-from-org (org-str)
"Convert org links in ORG-STR to freemind links and return the result."
(let ((fm-str (replace-regexp-in-string
(rx (not (any "[\""))
(submatch
"http"
(opt ?\s)
"://"
(1+
(any "-%.?@a-zA-Z0-9()_/:~=&#"))))
"[[\\1][\\1]]"
org-str)))
(with-temp-buffer
(insert-file-contents(substring fm-str
(+ (string-match "\\[\\[" fm-str) 2)
(string-match "\\]\\[" fm-str)))
(buffer-string))))
(It's been a long time since I've written (*)lisp code so this might not be
the best way to do this.)
Ideally this expansion would be recursive (and replace links in target
files). I only handled one level since this is my usual use case (main note
- satellite notes)
and making it recursive would also imply doing more restructuring through
org-freemind.el, which is out of my way right now.
I just dived in to get the functionality through this hack. (This is also
why the above code is not in patch notation.)
A proper solution would probably be to add more options to org-exp.el and
additional code in org-freemind.el.
I suppose other export formats, such as ASCII, or just normal editing, might
use this option as well.
Best regards,
Filip
[-- Attachment #2: Type: text/html, Size: 2811 bytes --]
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2011-06-06 20:42 UTC | newest]
Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-06-06 20:42 [Orgmode] WISH: link expansion in Freemind export Filip Buric
Code repositories for project(s) associated with this public inbox
https://git.savannah.gnu.org/cgit/emacs/org-mode.git
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).