From: Filip Buric <filip.buric@gmail.com>
To: emacs-orgmode@gnu.org
Subject: [Orgmode] WISH: link expansion in Freemind export
Date: Mon, 6 Jun 2011 23:42:00 +0300 [thread overview]
Message-ID: <BANLkTikGHBekZRQEf8kpuhREJxMNby9mkg@mail.gmail.com> (raw)
[-- 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 --]
reply other threads:[~2011-06-06 20:42 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
List information: https://www.orgmode.org/
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=BANLkTikGHBekZRQEf8kpuhREJxMNby9mkg@mail.gmail.com \
--to=filip.buric@gmail.com \
--cc=emacs-orgmode@gnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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).