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
html export of outline into a structured html doc (Read 4002 times)
Steve Scott
Full Member
*
Offline



Posts: 169

html export of outline into a structured html doc
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
Back to top
 
« Last Edit: Aug 15th, 2013, 10:37am by Steve Scott »  
  IP Logged
Mark Anderson
YaBB Administrator
*
Offline

User - not staff!

Posts: 5689
Southsea, UK
Re: html export of outline into a structured html doc
Reply #1 - 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.
Back to top
 
 

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



Posts: 169

Re: html export of outline into a structured html doc
Reply #2 - 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
Back to top
 
« Last Edit: Aug 15th, 2013, 4:29pm by Mark Anderson »  
  IP Logged
Steve Scott
Full Member
*
Offline



Posts: 169

Re: html export of outline into a structured html doc
Reply #3 - 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^
Back to top
 
 
  IP Logged
Mark Anderson
YaBB Administrator
*
Offline

User - not staff!

Posts: 5689
Southsea, UK
Re: html export of outline into a structured html doc
Reply #4 - 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]
Back to top
 
« Last Edit: Aug 15th, 2013, 4:30pm by Mark Anderson »  

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