Welcome, Guest. Please Login
Tinderbox
  News:
IMPORTANT MESSAGE! This forum has now been replaced by a new forum at http://forum.eastgate.com and no further posting or member registration is allowed. The forum is still accessible via read-only access for reference purposes. If you wish to discuss content here, please use the new forum. N.B. - posting in the new forum requires a fresh registration in the new forum (sorry - member data can't be ported).
  HomeHelpSearchLogin  
 
Pages: 1
Send Topic Print
Export notes as separate text files (Read 12197 times)
Derek Van Ittersum
Full Member
*
Offline



Posts: 168

Export notes as separate text files
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!
Back to top
 
 
  IP Logged
Mark Anderson
YaBB Administrator
*
Offline

User - not staff!

Posts: 5689
Southsea, UK
Re: Export notes as separate text files
Reply #1 - 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
Back to top
 
 

--
Mark Anderson
TB user and Wiki Gardener
aTbRef v6
(TB consulting - email me)
WWW shoantel   IP Logged
radar71
Full Member
*
Offline



Posts: 2

Re: Export notes as separate text files
Reply #2 - 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?
Back to top
 
 
  IP Logged
Mark Bernstein
YaBB Administrator
*
Offline

designer of
Tinderbox

Posts: 2871
Eastgate Systems, Inc.
Re: Export notes as separate text files
Reply #3 - 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.
Back to top
 
 
WWW   IP Logged
Marcelo Mirage
Full Member
*
Offline



Posts: 133
Brazil
Re: Export notes as separate text files
Reply #4 - 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.

Back to top
 
« Last Edit: Feb 21st, 2012, 6:49pm by Marcelo Mirage »  
Marcelo Mirage Marcelo Mirage MMUmeda misantropov@yahoo.com   IP Logged
radar71
Full Member
*
Offline



Posts: 2

Re: Export notes as separate text files
Reply #5 - Feb 22nd, 2012, 3:03am
 
This is great thanks. I'll play with this and see if I can get it to behave..
Back to top
 
 
  IP Logged
Christian Zwieb
Full Member
*
Offline



Posts: 26

Re: Export notes as separate text files
Reply #6 - 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.
Back to top
 
 
czwieb   IP Logged
Mark Bernstein
YaBB Administrator
*
Offline

designer of
Tinderbox

Posts: 2871
Eastgate Systems, Inc.
Re: Export notes as separate text files
Reply #7 - 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?
Back to top
 
« Last Edit: Feb 23rd, 2012, 11:10am by Mark Bernstein »  
WWW   IP Logged
Marcelo Mirage
Full Member
*
Offline



Posts: 133
Brazil
Re: Export notes as separate text files
Reply #8 - 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.
Back to top
 
 
Marcelo Mirage Marcelo Mirage MMUmeda misantropov@yahoo.com   IP Logged
Mark Bernstein
YaBB Administrator
*
Offline

designer of
Tinderbox

Posts: 2871
Eastgate Systems, Inc.
Re: Export notes as separate text files
Reply #9 - 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.
Back to top
 
 
WWW   IP Logged
Mark Anderson
YaBB Administrator
*
Offline

User - not staff!

Posts: 5689
Southsea, UK
Re: Export notes as separate text files
Reply #10 - 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.
Back to top
 
 

--
Mark Anderson
TB user and Wiki Gardener
aTbRef v6
(TB consulting - email me)
WWW shoantel   IP Logged
Pages: 1
Send Topic Print