Tinderbox User-to-User Forum (for formal tech support please email: info@eastgate.com)
Tinderbox Users >> Exporting from Tinderbox >> Exporting to Freemind

Message started by PW on May 31st, 2012, 3:19pm

Title: Exporting to Freemind
Post by PW on May 31st, 2012, 3:19pm

Here's a little diversion for Tinderbox users who use mind mapping on the desktop or iPad.  Freemind, an open source Java-based mind-mapper (http://freemind.sourceforge.net/wiki/index.php/Main_Page) has a very simple XML-based document structure.  The Freemind ".mm" file is recognized by many free and commercial applications, such as MindJet, Novamind, XMind, Freeplane (a Freemind fork) on OS X, and iThoughtsHD and other apps on iOS.

The ".mm" structure is very simple and easy to implement in Tinderbox templates.  The approach parallels the recently-added OPML templates in Tinderbox: a main template for the outer node of the file, that calls a nested template for the inner nodes and their children.

There can be only one parent -- in Tinderbox this would be a container that holds the outline and its children.  Assign the main Freemind template to the parent, and the rest is taken care of.  The main template invokes the node template for the children -- this sweeps up the grandchildren, and so forth, up and down the outline.

So, here are the two templates.  I put them inside a container "/Templates/Freemind", but you can put them anywhere you wish and modify the references in the template accordingly.  These templates don't do indenting or pretty printing like the inbuilt OPML templates -- Freemind doesn't care about this.  But feel free to tidy up the approach however you wish.  Another adaptation would be to use $Text rather than $Name for the TEXT value in a ".mm" node.  Your choice.

The Main template:

<?xml version="1.0"?>
<map version="0.9.0">
<attribute_registry SHOW_ATTRIBUTES="hide"/>
<node CREATED="1338489484055" ID="^value($ID)^" MODIFIED="1338489484055" TEXT="^value(attributeEncode($Name))^" >

The Node template:

<node CREATED="1338489484055" ID="^value($ID)^" MODIFIED="1338489484055" TEXT="^value(attributeEncode($Name))^" >

I spoofed the created and modified date (hard coded them).  One possible adaptation of the template is to get the real date-time stamp for each note.  The template uses Tinderbox's ID attribute as the Freemind ID attribute.  This can make enhancements to the template that incorporate links easier to code.  I will eventually publish my template for adding Tinderbox's links to the Freemind export.

Anyway, this is experimental stuff.  The portability of the ".mm" document can be a useful extension of your work in Tinderbox, I think.

(A caveat - some versions of Freemind will give you a nattering message about the file being "an older version" -- just accept the message and all will be well.)

Title: Re: Exporting to Freemind
Post by Mark Anderson on May 31st, 2012, 4:01pm

What date format are the Created/Modified values?

Title: Re: Exporting to Freemind
Post by Mark Bernstein on May 31st, 2012, 4:08pm

a) Everyone knows that Tinderbox can read Freemind files, right?

b) Mark Anderson: IIRC, I think those obscure numbers for CREATED and MODIFIED are Unix times -- the number of seconds elapsed since the first moment of Jan. 1, 1970.

Title: Re: Exporting to Freemind
Post by PW on May 31st, 2012, 5:09pm

Mark B. is correct - Created and Modified are the elapsed seconds since the Unix epoch - including milliseconds - hence the extra 3 digits at the end.  One could use, e.g., run command to populate attributes with the Unix value and pad the last three (or eight) positions with zeros to get nice round dates.

The values used in my example are static and do not matter to Freemind unless you would use the newer "ToDo" attribute in the format.  I don't.

Yes, I forgot to mention that Tinderbox reads ".mm" documents.

Title: Re: Exporting to Freemind
Post by Mark Anderson on May 31st, 2012, 6:13pm

My guess was a millesecond count but I thought best to ask.  aTbREf mentions FreeMind .mm file import here.  I'll add some reference to export.

Title: Re: Exporting to Freemind
Post by Mark Anderson on Jun 1st, 2012, 9:41am

To export the Unix-epoch based string of a TB $Created date:

^value((eval(minutes(date("01/01/1970 00:00"),$Created))*60000).precision(0))^

  • TB uses Unix-style millisecond-based sates for internal date arithmetic but stores such data in ISO 8602 form. It offer no millisecond number output format for dates.
  • The Unix epoch start is 00:00:00 UTC on 1 January 1970, 1970-01-01T00:00:00Z in ISO 8601 (UTC was only invested in 1972!)
  • TB only stores date times accurate to the last minute.
  • minutes(dateA,dateB)
    gives us the minutes between 2 date/times.
  • A minute is 60,000 milliseconds.
  • minutes(date("01/01/1970 00:00"),$Created) is the number of minutes between epoch minutes and our attribute date. Tif the attribute stores a date pre-epoch the date will be negative.
  • To multiply the number of minutes output by minutes() with out minutes-to-milliseconds factor we either need to first store it in a number attribute, or so as to still do everything in one code expression, we wrap the minutes() command in an eval().
  • The millisecond total as I write is displayed by number attributes as 1.33856e+12 - and the same if coerced to a string. An interesting trick is that using .precision(0) on Number-type data will return a large number in non-exponential form and with no decimal places - just what we want.
Now, substituting the right date attribute name, you can use the above formula to add Unix-style date strings for $Created and $Modified in your mm-export template.  ;)

Oh, and for internal uses (whatever they may be) $MyDate in Unix form is, as String-type data:

(eval(minutes(date("01/01/1970 00:00"),$Created))*60000).precision(0)

or as Number-type data:

(eval(minutes(date("01/01/1970 00:00"),$Created))*60000)

Tinderbox User-to-User Forum (for formal tech support please email: info@eastgate.com) » Powered by YaBB 2.2.1!
YaBB © 2000-2008. All Rights Reserved.