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 >> html export of outline into a structured html doc
http://www.eastgate.com/Tinderbox/forum//YaBB.cgi?num=1376577188

Message started by Steve Scott on Aug 15th, 2013, 10:33am

Title: html export of outline into a structured html doc
Post by Steve Scott on Aug 15th, 2013, 10:33am

Could someone help me figure out how to take an outline of notes which is structured like this:

Reptile
     Snake
           Poisonous
                 Rattlesnake
                 Cobra
           Not Poisonous
                 Garden
                 Python
     Turtle
           Water
                 Loggerhead
                 Leatherback
           Land
                 Box
                 Snapping


I want to keep the structured layout when I export and create an html page which looks like:


<h1>Reptiles</h1>

<h2>Snake</h2>

<h3>Poisonous</h3>

<ul>
<li>Rattlesnake</li>
<li>Cobra</li>
</ul>

<h3>Not Poisonous</h3>

<ul>
<li>Garden</li>
<li>Python</li>
</ul>

<h2>Turtle</h2>

<h3>Water</h3>

<ul>
<li>Loggerhead</li>
<li>Leatherback</li>
</ul>

<h3>Land</h3>

<ul>
<li>Box</li>
<li>Snapping</li>
</ul>

Thanks,
Steve

Title: Re: html export of outline into a structured html doc
Post by Mark Anderson on Aug 15th, 2013, 11:09am

Assumption: The 'start' note ("Reptile") is at root level - i.e. $OutlineDepth is 1.

You need 3 HTML template notes. The following template names aren't fixed but bear in mind if you change a template name later on, you'll need to find and edit all inline references to it in other templates (or code in notes) as TB wont - can't - update that for you.:

"HTML page":

Code:
<!DOCTYPE html>
<html>
<head>
     <meta http-equiv="content-type" content="text/html; charset=utf-8">
     <title>^title^</title>
</head>
<body>
<h1>^title^</h1>
^children("HTML item")^
</body>
</html>

"HTML item" (code includes trailing line break at end):

Code:
<h^value($OutlineDepth)^>^title^</h^value($OutlineDepth)^>
^if($OutlineDepth<3)^^children("HTML item")^^else^<ul>
^children("List item")^</ul>^endIf^

"List item"  (code includes trailing line break at end):

Code:
<h^value($OutlineDepth)^>^title^</h^value($OutlineDepth)^>
^if($OutlineDepth<3)^^children("HTML item")^^else^<ul>
^children("List item")^</ul>^endIf^

Now, simple set Reptile to use template "HTML page" and export. Done!

Notes:
  • See how "HTML item" sets heading levels and checks how far down to recurse.
  • If your base note was a $OutlineDepth 4 then you'd need to put appropriate numerical offsets into the level dependent arguments in "HTML item".
  • ^if^, ^else^ and ^/endIf^ markers may appear on different lines of the template than you first intuit. This is to get correct whitespace/line breaks in the code.
  • Tab inenting levels is an exercise left to the reader.

Title: Re: html export of outline into a structured html doc
Post by Steve Scott on Aug 15th, 2013, 11:23am

Mark,

Thank you so much!  I am looking forward to trying this.  I can't tell you how many hours I have spent trying to do this.  

[deleted side discussion re email]

Steve

Title: Re: html export of outline into a structured html doc
Post by Steve Scott on Aug 15th, 2013, 12:21pm

Hi Mark,

When I tried to implement this I ended up with:

<h1>Reptile</h1>
<h2>Snake</h2>

<h3>Poisonous</h3>

<ul>
<h4>Rattlesnake</h4>
<ul>
</ul>
     

To simplify things so I can hopefully get it, lets just update all of the notes as HTML Headers and include text from the notes.

I'm not sure how to set the outline depth without the conditional. . .

This only exports the top two notes:

<h^value($OutlineDepth)^>^title^</h^value($OutlineDepth)^>
^text^

Title: Re: html export of outline into a structured html doc
Post by Mark Anderson on Aug 15th, 2013, 1:17pm

If you're trying to get the process to work, I'd suggest not adding ^text^ until you've got the headings to work. It just offer more scope for confusion.

From what you describe, I'd hazard a guess the tree isn't nested correctly. Also you may have made templates either with the wrong name (case sensitive!) and/or not set the notes to be templates. The 'cascade' all works from the source container. If that is in the correct place and attached to the right template all should just flow.

I've emailed you the working demo I made to answer the original question.

[deleted side discussion re email]

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.