From mboxrd@z Thu Jan 1 00:00:00 1970 From: Bill Day Subject: Re: freemind.el does not convert org links to links in Freemind Date: Wed, 19 Sep 2012 04:23:06 -0400 Message-ID: References: <87vcfb7hkv.fsf@bzg.ath.cx> Mime-Version: 1.0 Content-Type: multipart/alternative; boundary=047d7b33d3465df34404ca09b777 Return-path: Received: from eggs.gnu.org ([208.118.235.92]:54708) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TEFYr-0008SH-Q8 for emacs-orgmode@gnu.org; Wed, 19 Sep 2012 04:23:14 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1TEFYp-0001Qx-Kg for emacs-orgmode@gnu.org; Wed, 19 Sep 2012 04:23:09 -0400 Received: from mail-vc0-f169.google.com ([209.85.220.169]:34135) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TEFYp-0001Pw-Bm for emacs-orgmode@gnu.org; Wed, 19 Sep 2012 04:23:07 -0400 Received: by vcbfl17 with SMTP id fl17so912848vcb.0 for ; Wed, 19 Sep 2012 01:23:06 -0700 (PDT) In-Reply-To: List-Id: "General discussions about Org-mode." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org Sender: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org To: Bastien Cc: emacs-orgmode@gnu.org --047d7b33d3465df34404ca09b777 Content-Type: text/plain; charset=ISO-8859-1 This is how Freedmind natively outputs the same link: 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
. ;; ;; (concat "
" ;; "\""" ;; "
" ;; "" text "" ;; "
") (concat "
" "\""" "
" "" text "" "
") (concat "" text "")))) (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)) ;; "]]") "\\[\\[\\(.*?\\)]\\[\\(.*?\\)]]" ;;"\\2" '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 wrote: > Sorry, yes, I mistyped -- it is org-freemind.el. > > When I type: > > * Mind Map > ** test [[http://orgmode.org][Org Mode]] > > I get this: > > > > > > > > > > Is this the expected behavior? > > > > On Tue, Sep 18, 2012 at 3:30 AM, Bastien wrote: > >> Hi Bill, >> >> Bill Day 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 link. >> >> in .mm >> >> HTH, >> >> -- >> Bastien >> > > > > -- > Bill Day > williamson.day@gmail.com > -- Bill Day williamson.day@gmail.com --047d7b33d3465df34404ca09b777 Content-Type: text/html; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable This is how Freedmind natively outputs the same link:

<map versio= n=3D"0.9.0">
<!-- To view this file, download free mind = mapping software FreeMind from = http://freemind.sourceforge.net -->
<node CREATED=3D"1348041631372" ID=3D"ID_319286743" = MODIFIED=3D"1348042704516" TEXT=3D"Mind Map">
<= ;node CREATED=3D"1348041642465" ID=3D"ID_207824320" LIN= K=3D"http://orgmode.org" MODIF= IED=3D"1348041668536" POSITION=3D"right" TEXT=3D"t= est"/>
</node>
</map>

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

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

(defun org-freemind-convert-links-from-org (org-str)
=A0 "Conve= rt org links in ORG-STR to freemind links and return the result."
= =A0 (let ((fm-str (replace-regexp-in-string
=A0=A0=A0=A0=A0=A0=A0=A0=A0= =A0=A0=A0=A0=A0=A0=A0 ;;(rx (not (any "[\""))
=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0 ;;=A0=A0=A0 (submatch
= =A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0 ;;=A0=A0=A0=A0 "http&= quot;
=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0 ;;=A0=A0=A0=A0 (o= pt ?\s)
=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0 ;;=A0=A0=A0=A0 = "://"
=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0 ;;=A0= =A0=A0=A0 (1+
=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0 ;;=A0=A0= =A0=A0=A0 (any "-%.?@a-zA-Z0-9()_/:~=3D&#"))))
=A0=A0=A0 =A0=A0=A0 =A0"[^\"[]\\(http ?://[--:#%&()=3D?-Z_a-z= ~]+\\)"
=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0 "[[\\= 1][\\1]]"
=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0 org-str<= br>=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0 nil ;; fixedcase
=A0= =A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0 nil ;; literal
=A0=A0=A0= =A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0 1=A0=A0 ;; subexp
=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0 )))
=A0=A0=A0 (replace-= regexp-in-string
=A0=A0=A0=A0 ;;(rx "[["
=A0=A0=A0=A0 ;;=A0= =A0=A0 =A0(submatch (*? nonl))
=A0=A0=A0=A0 ;; "]["
=A0=A0= =A0=A0 ;; (submatch (*? nonl))
=A0=A0=A0=A0 ;; "]]")
=A0=A0= =A0=A0 "\\[\\[\\(.*?\\)]\\[\\(.*?\\)]]"
=A0=A0=A0=A0 ;;"<a href=3D\"\\1\">\\2</a>"<= br>=A0=A0=A0=A0 'org-freemind-convert-links-helper
=A0=A0=A0=A0 fm-s= tr t t)))


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


On Tue, Sep 18, 2012 at 10:12 PM, Bill D= ay <williamson.day@gmail.com> wrote:
Sorry, yes, I mistyped -- it is org-freemind.el.

When I type:
* Mind Map
** test [[h= ttp://orgmode.org][Org Mode]]

I get this:

<map version= =3D"0.9.0">
<!-- To view this file, download free mind mapping software FreeMind fro= m http://free= mind.sourceforge.net -->
<node text=3D"Mind Map">=
<node text=3D"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.=A0 Freemind.el seems to<= br> > convert nodes from org to Freemind with no problem, but it simply
> copies the code for links from org to Freemind without converting
> it.=A0

I'm not sure i understand -- are you talking about org-freemind.e= l?

http://orgmode.org/w/?p=3Dorg-m= ode.git;a=3Dblob_plain;f=3Dlisp/org-freemind.el;hb=3DHEAD

> Has anyone else had this problem?

AFAIU I don't.

This link in .org:

=A0 A [[http://orgmode.org= ][link]].

gets exported as

=A0 A <a href=3D"h= ttp://orgmode.org">link</a>.

in .mm

HTH,

--
=A0Bastien



--
Bill Day
williamson.day@gmail.com



--
Bill Day<= br>
williamson.day@gmail.com=
--047d7b33d3465df34404ca09b777--