emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
From: Bill Day <williamson.day@gmail.com>
To: Bastien <bzg@altern.org>
Cc: emacs-orgmode@gnu.org
Subject: Re: freemind.el does not convert org links to links in Freemind
Date: Wed, 19 Sep 2012 04:23:06 -0400	[thread overview]
Message-ID: <CAJKu5kUptQQAipeRahMOT5jxh=gk3hwTN2exRi=SmZkf9q-6Tg@mail.gmail.com> (raw)
In-Reply-To: <CAJKu5kUj-Co6Xy3GNqnX6Vo6NJ-iEhjW0Xk0d2NTnPvK-d16=Q@mail.gmail.com>

[-- Attachment #1: Type: text/plain, Size: 4176 bytes --]

This is how Freedmind natively outputs the same link:

<map version="0.9.0">
<!-- To view this file, download free mind mapping software FreeMind from
http://freemind.sourceforge.net -->
<node CREATED="1348041631372" ID="ID_319286743" MODIFIED="1348042704516"
TEXT="Mind Map">
<node CREATED="1348041642465" ID="ID_207824320" LINK="http://orgmode.org"
MODIFIED="1348041668536" POSITION="right" TEXT="test"/>
</node>
</map>

I am not much at reading elisp, but it seems that the following code in
org-freemind.el might be intended to achieve the above result.

(defun org-freemind-convert-links-helper (matched)
  "Helper for `org-freemind-convert-links-from-org'.
MATCHED is the link just matched."
  (let* ((link (match-string 1 matched))
         (text (match-string 2 matched))
         (ext (file-name-extension link))
         (col-pos (org-string-match-p ":" link))
         (is-img (and (image-type-from-file-name link)
                      (let ((url-type (substring link 0 col-pos)))
                        (member url-type '("file" "http" "https")))))
     )
    (if is-img
        ;; Fix-me: I can't find a way to get the border to "shrink
        ;; wrap" around the image using <div>.
        ;;
        ;; (concat "<div style=\"border: solid 1px #ddd; width:auto;\">"
        ;;         "<img src=\"" link "\" alt=\"" text "\" />"
        ;;         "<br />"
        ;;         "<i>" text "</i>"
        ;;         "</div>")
        (concat "<table border=\"0\" style=\"border: solid 1px
#ddd;\"><tr><td>"
                "<img src=\"" link "\" alt=\"" text "\" />"
                "<br />"
                "<i>" text "</i>"
                "</td></tr></table>")
      (concat "<a href=\"" link "\">" text "</a>"))))

(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()_/:~=&#"))))
         "[^\"[]\\(http ?://[--:#%&()=?-Z_a-z~]+\\)"
                 "[[\\1][\\1]]"
                 org-str
                 nil ;; fixedcase
                 nil ;; literal
                 1   ;; subexp
                 )))
    (replace-regexp-in-string
     ;;(rx "[["
     ;;     (submatch (*? nonl))
     ;; "]["
     ;; (submatch (*? nonl))
     ;; "]]")
     "\\[\\[\\(.*?\\)]\\[\\(.*?\\)]]"
     ;;"<a href=\"\\1\">\\2</a>"
     'org-freemind-convert-links-helper
     fm-str t t)))


I am not trying to muddy the waters here, it is just that when I type a
link into org-mode, I do not seem to get a usable freemind link as a result.


On Tue, Sep 18, 2012 at 10:12 PM, Bill Day <williamson.day@gmail.com> wrote:

> Sorry, yes, I mistyped -- it is org-freemind.el.
>
> When I type:
>
> * Mind Map
> ** test [[http://orgmode.org][Org Mode]]
>
> I get this:
>
> <map version="0.9.0">
> <!-- To view this file, download free mind mapping software FreeMind from
> http://freemind.sourceforge.net -->
> <node text="Mind Map">
> <node text="test [[http://orgmode.org][Org Mode]]">
> </node>
> </node>
> </map>
>
> Is this the expected behavior?
>
>
>
> On Tue, Sep 18, 2012 at 3:30 AM, Bastien <bzg@altern.org> wrote:
>
>> Hi Bill,
>>
>> Bill Day <williamson.day@gmail.com> writes:
>>
>> > I am using org-mode 7.9.1 and Freemind 0.9.0.  Freemind.el seems to
>> > convert nodes from org to Freemind with no problem, but it simply
>> > copies the code for links from org to Freemind without converting
>> > it.
>>
>> I'm not sure i understand -- are you talking about org-freemind.el?
>>
>>
>> http://orgmode.org/w/?p=org-mode.git;a=blob_plain;f=lisp/org-freemind.el;hb=HEAD
>>
>> > Has anyone else had this problem?
>>
>> AFAIU I don't.
>>
>> This link in .org:
>>
>>   A [[http://orgmode.org][link]].
>>
>> gets exported as
>>
>>   A <a href="http://orgmode.org">link</a>.
>>
>> in .mm
>>
>> HTH,
>>
>> --
>>  Bastien
>>
>
>
>
> --
> Bill Day
> williamson.day@gmail.com
>



-- 
Bill Day
williamson.day@gmail.com

[-- Attachment #2: Type: text/html, Size: 6719 bytes --]

  parent reply	other threads:[~2012-09-19  8:23 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-09-11 13:35 freemind.el does not convert org links to links in Freemind Bill Day
2012-09-18  7:30 ` Bastien
2012-09-19  2:12   ` Bill Day
2012-09-19  7:24     ` Bastien
2012-09-19  8:23     ` Bill Day [this message]
2012-09-19  8:47       ` Bastien

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='CAJKu5kUptQQAipeRahMOT5jxh=gk3hwTN2exRi=SmZkf9q-6Tg@mail.gmail.com' \
    --to=williamson.day@gmail.com \
    --cc=bzg@altern.org \
    --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).