Simple Export Exercise Needed


(Douglas Johnson) #1

Although I’ve become reasonably proficient using Tinderbox’s “internals”, mastering exporting still eludes. It would be very helpful to see a very simple file that exports successfully. I tried building my own based on an example in The Tinderbox Way, v2, pp. 279-280 but all I get in the exported HTML pages is “unable to find template”.

I am happy to attach my small file but am not seeing how that would be done in this environment. The file consists of the exact notes shown on p.279 (page number in document, not PDF page #). Plus, there is a note, SimpleOutline, which is designated a template. Finally, there is a line of code in the Main Page note as shown on p. 280. However, when I do Export as HTML in my TinderBoxSix v6.5.5, all I see is “unable to find this template.” All the pages are generated, but are empty but for this phrase. I am not getting the illustration shown on the bottom of page 280.

If I could see a simple example of a file that exports as expected, I could mimic it in my own work.

In an exchange with Mark Bernstein, he advises the 3rd ed. of TBW will be stronger on exporting. In the meantime, he suggested I check in here. I’ve used and appreciated your work, Mark Anderson.

I’m also quite open to being referred to docs or resources that might help.

Thank you,
Doug


(Mark Anderson) #2

Try out the demos in this set of files.


(Douglas Johnson) #3

Terrific! Will do! Thanks very much.


(Douglas Johnson) #4

Have successfully worked the first three exercises; will finish tomorrow.

The big aha moment was the realization that exporting is a combination of 1) code placed in notes and 2) HTML attributes. Somehow I had missed totally the role of the attributes. Makes perfect sense and I am well along toward being dangerous with exporting.

Thanks so much for the well done exercises. Easy, direct and elegant.

Doug


(Douglas Johnson) #5

Your exercises are perfect. Recursion is always a challenging concept but your elegant examples clearly demonstrate its operation. Thank you again for those.


(Kay Krämer) #6

I have gone through those exercises just a few seconds ago. Awesome! This explains quite a bit of the export logic. Thanks a lot!
Is there anything similar with a bit more difficult examples?

By the way: How do I jump back to the parents? I experimented a bit with the ^ancestors^, but had no results at all.


(Mark Anderson) #7

Are you looking like a breadcrumb nav trail like in the grey bar at the top of aTbRef pages? The code producing that section of the page is:

^ancestors("",""," : ","")^

The source TBX for aTbRef is freely downloadable and includes all the templates used to make the site, as well as CSS, Javascript etc. You might find it useful to look at the template ‘5basic_all’ which is the rather complicated template that produces the vast majority of the site’s HTML pages. It has a lots of includes and conditional sections. A good learning exercise is to see if you can trace how all those work and from whence the includes are drawn (hint: everything is within the TBX).

Now you understand the basics it’s worth holding on to the fact that Tinderbox exports static pages so outline position of source notes is relevant in planning. You can still produce complex pages via agents, or via includes (which are actually transcludes).

One current limitation is that you can’t preserve (i.e. export) a link between two notes if the destination note is not exported in it’s own right as a page. This can be worked around, with a bit of planning and a small amount of post export shell scripting. This is how I produce the single PDF version of the Tinderbox Help from the same source TBX used to populate the app’s Help files. As you may guess, the export templates are an envelope/letter pair with the latter recursively producing the main content. I’d link to a tutorial on than but Clarify closed down and I’ve yet to republish all my tutorials from that site.


(Kay Krämer) #8

This breadcrumb nav trail would be the next step. First something as easy as navigating back to the root, e.g. the index.html. Is this possible?

Although the breadcrumb is very nice.

Btw., I am trying and looking around a lot in your aTbRef file, and guess what: I’m getting crazy with this! :joy::joy::joy:

There are waaaay to many of those ^^^^^little puppies…


(Mark Anderson) #9

To link to your home page look at ^linkTo()^ or ^url()^. The latter gives a relative link so might be best in your case.

Yes, the ^ (carets) do get confusing. It isn’t obligatory to use a closing claret on an export code , i.e. ^text vs. ^text^. If you don’t use a closing caret, Tinderbox will figure out (in most cases correctly) where the code loses. Of course, the more complex your export code, the greater the chance of a wrong guess. For that reason, I treat the closing caret as if mandatory so as to remove ambiguity as to my intent.

Also, if you want to describe export code in text you’re exporting, you need to escape the carets by doubling them. So, if you want to export $Text of “I like using the ^text^ command”, you’ll need to change the source $Text to “I like using the ^^text^^ command”. It does look a bit strange, when you read the text within Tinderbox but it does export OK.

Although it’s labelled as ‘HTML export’, it’s basically just formatted text. You can set up your templates to export XML, CSS, etc…

If you find any errors in aTbref do please let me know. It’s a while since I spend time going through the export code pages which were originally added >10 years ago. It’s generally easy to fix errors - once I know they’re there/. I’m a rather dyslexic typist so there are still more typos than I’d wish - though generally not in the code samples. Anyway, errors/corrections always gratefully received.

Happy exporting!


(Kay Krämer) #10

Ok… I’m getting a little bit of light into the darkness. The basics work. Rest will follow :wink:.

Thanks again.


(Mark Anderson) #11

No worries and by all means fire up a new thread if you’ve a new export angle you need to look into. The flexibility of Tinderbox’s (HTML) export is one of it’s lesser known secrets.