emacs-orgmode
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [O] freemind.el does not convert org links to links in Freemind


From: Bill Day
Subject: Re: [O] freemind.el does not convert org links to links in Freemind
Date: Wed, 19 Sep 2012 04:23:06 -0400

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 "address@hidden()_/:~=&#"))))
         "[^\"[]\\(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="">     '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 <address@hidden> 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 <address@hidden> wrote:
Hi Bill,

Bill Day <address@hidden> 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="" href="http://orgmode.org" target="_blank">http://orgmode.org">link</a>.

in .mm

HTH,

--
 Bastien



--
Bill Day
address@hidden



--
Bill Day
address@hidden

reply via email to

[Prev in Thread] Current Thread [Next in Thread]