The Tree of Widsdom

智慧の樹

Controlling export with agents


When you export your entire TBX using File > Export > as HTML, bstMainPage is applied to every content note of your TBX. It’s a universal application of a set of templates to all your notes. Templates can be assigned by prototypal inheritance, and this turns out to be a functional logical division.

All this is the same for every note that gets exported. Notes are exported according to $OutlineOrder, and container notes are processed recursively. But some notes will be passed over, and this is good—it saves time. Notes whose $HTMLDontExport is true will be passed over.

BoxPress has an agent that sets $HTMLDontExport for you automatically—the @export POSTS/PAGES agent. The notes up for consideration? Here’s the $AgentQuery:

descendedFrom("Blog POSTS") & ($OutlineDepth(original)=4)

This says that every note descended from Blog PAGES and Blog POSTS whose prototype is normal_note will be collected for consideration.

Then, the $AgentAction that will be applied to this collection:

if($blogReady & $blogExpOpt!="include"){$HTMLDontExport=;$Color=;}else{$HTMLDontExport=1;$Color="dark _norm";};

The default value of $blogReady is false—which means that all sub-posts will export unless $blogExpOpt has been set to either SKIP or FOOTNOTE. This default value also means that every post requires your explicit consent—a prophylactic against accidental private note taking.