Tinderbox User-to-User Forum (for formal tech support please email: info@eastgate.com)
http://www.eastgate.com/Tinderbox/forum//YaBB.cgi
Tinderbox Users >> Exporting from Tinderbox >> Export notes as separate text files
http://www.eastgate.com/Tinderbox/forum//YaBB.cgi?num=1303497830

Message started by Derek Van Ittersum on Apr 22nd, 2011, 2:43pm

Title: Export notes as separate text files
Post by Derek Van Ittersum on Apr 22nd, 2011, 2:43pm

Every time I feel like a tbx wizard, I get stumped with something and am humbled.

How can I export the children of a container as separate txt files?  Every way I can think of currently ends up with a single file that contains all the text of the children, rather than individual text files.

Thanks!

Title: Re: Export notes as separate text files
Post by Mark Anderson on Apr 22nd, 2011, 4:15pm

Use HTML export rather than Nakakoji view - which is what - reading between the lines you're likely using. Simply make & set export templates to use something like just ^text^ or ^text(plain)^ without any HTML markup

Title: Re: Export notes as separate text files
Post by radar71 on Feb 21st, 2012, 5:25pm

Hi,

I have the same problem. Want to export 67 notes as separate text files with titles as title, text as text..

Why isn't this possible? I am absolutely incapable of writing code..

please help. I can copy and paste, but is there a tutorial that makes this easy?

Title: Re: Export notes as separate text files
Post by Mark Bernstein on Feb 21st, 2012, 6:23pm

This is very easy. Just write a simple export template in a template note to show Tinderbox what you want.  Perhaps something like this:

    ^title

    ^text(plain)
   

You might not want the title, or you might want other information from the note -- that's why Tinderbox needs a template that shows it what you want.

Title: Re: Export notes as separate text files
Post by Marcelo Mirage on Feb 21st, 2012, 6:41pm

Just complementing, I thought I'd make the steps more explicit:

1. We have to create a template, as the built-in 'title and text' doesn't quite render pure text (the title would get a h2 tag):

  • Call the template, say, "title and text txt"


obs. If you just want the text, just use the "plain-text" built-in template.

2. Open text view on the template and write a simple:


Code:
^title^
^text^


or any other element you wish. Again, if you just want the text, select the "plain-text" template

3. Create a prototype, say, "*txt"

4. opt+cmd+H for HTML view of "*txt":
  • Assign the "title and text txt" template
  • Set the "File Extension" to ".txt"


5. Select all the notes you wish to export as separate .txt file and assign them the "*txt" prototype.

6. shift + cmd + H ... choose destination folder... that's it.


Title: Re: Export notes as separate text files
Post by radar71 on Feb 22nd, 2012, 3:03am

This is great thanks. I'll play with this and see if I can get it to behave..

Title: Re: Export notes as separate text files
Post by Christian Zwieb on Feb 22nd, 2012, 8:27pm

Unlike with Nakakoji view, HTML cannot be summoned when I select more than one note in an outline. Maybe this is the stumbling block.

Title: Re: Export notes as separate text files
Post by Mark Bernstein on Feb 23rd, 2012, 11:09am

HTML View lets you export one note, and the HTML Export menu lets you export ALL your notes.  So, export everything and grab the part you want. (You can use of HTMLDontExport to avoid exporting notes you don't care about.)

If your notes are scattered in different places, consider using an agent or container to gather aliases of the notes you want in one place.  Export; you'll have a folder that contains all the files of interest.

What's the goal here?  What's the destination of the exported text?

Title: Re: Export notes as separate text files
Post by Marcelo Mirage on Feb 23rd, 2012, 3:35pm

The only issue to be concerned regarding $HTMLDontExport is not to let get carried away and try to sanitize every single file to be exported. Some are not meant to be opened independently, but serve as data for another note. I can't reproduce, but I suspect that for notes that are tagged not to export will not export either itself nor its contents indirectly, am I correct? Is there a reason for that or maybe this becomes a suggestion: $HTMLDontExport won't export the note, but the content can be exported onto another note.

Title: Re: Export notes as separate text files
Post by Mark Bernstein on Feb 23rd, 2012, 4:29pm

Marcelo: that's right: HTMLDontExport also prevents the note from being included in another note.

Setting $HTMLExportChildren to false is another good way of not exporting unwanted files; notes inside a container with $HTMLExportChildren set to false can be included in other notes but aren't exported as separate files.

Title: Re: Export notes as separate text files
Post by Mark Anderson on Feb 23rd, 2012, 5:24pm

The issue Marcelo raised is also addressed in this article.

Having stubbed my toe on this facet of export, I'd say it's not immediately intuitive, but that's not to say there's an obvious alternative. Once you get the 'rules' (as in the link above) it works pretty well. The main limit is you can't have a root level note that doesn't export a file but does get used as an import. If you need such a note is does need to be at $OutlineDepth of 2 or greater so it's parent containers $HTMLExportChildren can be set appropriately.

If export is a primary task of your TBX, then a little incremental formalisation can help> However, don't worry at outset.  Sort out your templates, then export the document. See initially what exports that you don't needs and start setting $HTMLDontExport and $HTMLExportChildren accordingly to close off unwanted exported pages.

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.