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 >> I don't know why it is doing this?
http://www.eastgate.com/Tinderbox/forum//YaBB.cgi?num=1219596497

Message started by Sebastian Stephenson on Aug 24th, 2008, 12:48pm

Title: I don't know why it is doing this?
Post by Sebastian Stephenson on Aug 24th, 2008, 12:48pm

ok so I have made a template for my todo tinderbox and here is what I am trying to do

Quote:
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN"
  "http://www.w3.org/TR/html4/strict.dtd">

<html lang="en">
<head>
     <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
     <title>Tasks for today</title>
     <meta name="generator" content="TextMate http://macromates.com/">
     <meta name="author" content="sebastian stephenson">
     <link rel="stylesheet" type="text/css"
     href="tasks.css" />
     <!-- Date: 2008-08-24 -->
</head>
<body>
<p>Good day Mr.Stephenson here is what you need to do today:</p>
<div class="todos">
<ul>
<li>^justChildren</li>
</ul>
</div>
</body>
</html>


then I add to one of my notes and I get this as the result

Quote:
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN"
  "http://www.w3.org/TR/html4/strict.dtd">

<html lang="en">
<head>
     <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
     <title>Tasks for today</title>
     <meta name="generator" content="TextMate http://macromates.com/">
     <meta name="author" content="sebastian stephenson">
     <link rel="stylesheet" type="text/css"
     href="tasks.css" />
     <!-- Date: 2008-08-24 -->
</head>
<body>
<p>Good day Mr.Stephenson here is what you need to do today:</p>
<div class="todos">
<ul>
<li><!--   ** Standard Tinderbox Template <normal> **  -->
<h1>make the template for the tinderbox tasks document</h1>

<!--   ** Standard Tinderbox Template <normal> **  -->
<h1>open textmate with a template</h1>


<!--   ** Standard Tinderbox Template <normal> **  -->
<h1>put h1 tags and put just chridern</h1>
<p>see in the docs want else it takes with it</p>
<!--   ** Standard Tinderbox Template <normal> **  -->
<h1>make the style sheet </h1>
<p> mess about with it but have it so that it is easy to read on the iphone </p>

</li>
</ul>
</div>
</body>
</html>


so why is it doing this and how can I stop it thanks
it also ignores my stylesheet  

Quote:
body {
     border: medium dashed #7979ff;
     font: 2em "Helvetica Neue", Arial, Helvetica, Geneva, sans-serif;
     background-color: #fff;
     position: relative;
}
body p{
     position: relative;
     left: .5em;
     right: 2em;
}

.todos {
     list-style-image: url(assets/right.png);
     position: relative;
     left: 2em;
     font: 2em "Lucida Grande", Lucida, Verdana, sans-serif;
     color: maroon;
}

please help thanks

Title: Re: I don't know why it is doing this?
Post by Mark Bernstein on Aug 24th, 2008, 12:59pm

When Tinderbox comes to ^justChildren, it includes each of the note's children using that child's template.  In your case, the child's template is a page template, and so you're asking Tinderbox to apply the page template to each child.

That's your problem.

Title: Re: I don't know why it is doing this?
Post by Sebastian Stephenson on Aug 24th, 2008, 1:22pm

ok so how can I get it to comply with my template?

Title: Re: I don't know why it is doing this?
Post by Mark Bernstein on Aug 24th, 2008, 1:53pm

Tinderbox is complying with your template.

You're saying, "the default template is the page template."  And you're saying, "Include each child here, using the default template."  Tinderbox is doing just that.

You can solve this in several ways.

* Change the default template, and assign a special page template to the page note, OR

* Change the template used by the children, OR

* Change ^justChildren to specify the template you want: ^justChildren(myTaskTemplate)

Title: Re: I don't know why it is doing this?
Post by Sebastian Stephenson on Aug 24th, 2008, 2:51pm

mark I keep clicking update and its not putting in the information here is what the code looks like


Quote:
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN"
  "http://www.w3.org/TR/html4/strict.dtd">

<html lang="en">
<head>
     <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
     <title>Tasks for today</title>
     <meta name="generator" content="TextMate http://macromates.com/">
     <meta name="author" content="sebastian stephenson">
     <link rel="stylesheet" type="text/css"
     href="tasks.css" />
     <!-- Date: 2008-08-24 -->
</head>
<body>
<p>Good day Mr.Stephenson here is what you need to do today:</p>
<div class="todos">
<ul>
<li>^justChildren(todotemplate)</li>
</ul>
</div>
</body>
</html>


here is todotemplate.html


Quote:
^title^
^text


anymore info just ask thanks

Title: Re: I don't know why it is doing this?
Post by Sebastian Stephenson on Aug 25th, 2008, 8:37am

ok its nearly working but  I have something like this in the html view


Quote:
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN"
  "http://www.w3.org/TR/html4/strict.dtd">

<html lang="en">
<head>
     <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
     <title>Tasks for today</title>
     <meta name="generator" content="TextMate http://macromates.com/">
     <meta name="author" content="sebastian stephenson">

     <!-- Date: 2008-08-24 -->
</head>
<body>
<p>Good day Mr.Stephenson here is what you need to do today:</p>
<div class="todos">

<!--   ** Standard Tinderbox Template <normal> **  -->
<h1>Subcove to the new media minute</h1>
 

<ul>
<li>Sort out a insert stuff here studio</li>


<p>Sent from my iPhone </p>

</ul><!--   ** Standard Tinderbox Template <normal> **  -->
<h1>make the template for the tinderbox tasks document</h1>

<ul>
<li>open textmate with a template</li>


</ul><ul>
<li>put h1 tags and put just chridern</li>
<p>see in the docs want else it takes with it</p>
</ul><ul>
<li>make the style sheet </li>
<p> mess about with it but have it so that it is easy to read on the iphone </p>

</ul>

</div>
</body>
</html>


I also changed to the default template todo template but I have three tasks


Quote:
<h1>Subcove to the new media minute</h1>
<li>Sort out a insert stuff here studio</li>
<h1>make the template for the tinderbox tasks document</h1>


as you can see one of them is a simple action in GTD terms but it has h1 tag I don't want that then there is another action and that one is in an li tags thats what I want for all of them and finally we have a project and the


Quote:
<h1>make the template for the tinderbox tasks document</h1>

has h1 tags and I don't what that and for the actions for that project I want them indented how can I do this thanks for your help

Title: Re: I don't know why it is doing this?
Post by Sebastian Stephenson on Aug 25th, 2008, 9:05am

ok so I have gotten all of them to have li except that I can't get it to show the project its actions only the project name so any help thanks

Title: Re: I don't know why it is doing this?
Post by Mark Bernstein on Aug 25th, 2008, 10:33am

I'd recommend sitting down at this point and reviewing the manual chapter on export templates, and perhaps the appendix on template codes.  Just a brush-up review; now that you pretty well understand how export templates work and have more Tinderbox experience, I think you may find a few minutes of study will repay the effort.

Next, I'd put aside this project and sketch out a small and simple file with a similar structure.  Decide how the export should look, and then compose the templates and compare what you get with what you want.  

Next, look at the results.  Do you see where everything comes from?  There is no magic or mystery here; you should be able to understand exactly why everything exports the way it does.  Make small changes: does the exported code look like what you expected?  Make more changes.

An hour or two of this exercise should equip you to diagnose the problem in your larger and more complex document.

Title: Re: I don't know why it is doing this?
Post by Sebastian Stephenson on Aug 25th, 2008, 11:32am

thanks I have progressed a little so I say that I have the children but now only one of them is showing as part of a list so I will charge on as such thanks

Title: Re: I don't know why it is doing this?
Post by Mark Anderson on Aug 25th, 2008, 5:36pm

Mark B's advice about taking a step back is correct. I went through exactly this problem when I first tried templates - I wanted it to 'just work' and got lost in what didn't work instead of looking at what did work. Small steps is the trick here - it's not complex (really!) if approached methodically. Let me try to help...

At this point my hunch is you've a container, each child of which is a note (or alias) representing a To Do task. Even if you haven't got that, humour me by making a new TBX with a container and 3 items. OK, now I also guess you want each task's Name to appear as a list in an HTML page.  So, more specifically, you want the ^title^ of each child to be the contents of an <li> HTML element.

Currently, you've put the <li></li> in the parent template and are trying to put ^justChildren^ into it. However, if you've read the aTbRef section on Export code types you'll see ^justChildren is effectively a data include. That's the clue to the fact you want the repeating part of the HTML - the <li></li>  -in the child's template and not the parent's.

So for the parent we now have:

Code:
<html>
<head></head>
<body>
<p>Good day Mr.Stephenson here is what you need to do today:</p>
<ul>
^justChildren(list_item)^
</ul>
</body>
</html>

For now, don't worry about the <div>s and CSS fetc., as that's easily added once the structure's in place.

Next, we need the 'list_item' template that each To Do note/alias will use as its template:

Code:
<li>^title^</li>

Don't worry if you want to use an attribute other than the Name (i.e ^title^). Again, that substitution can follow.

Assume for a moment you've three To Do tasks called "Task A", "Task B" and "Task C" (again the simplicity is deliberate to help illustrate the underlying concept). Using the above, the actual HTML output (also as seen in HTML view) should be:

Code:
<html>
<head></head>
<body>
<p>Good day Mr.Stephenson here is what you need to do today:</p>
<ul>
<li>Task A</li>
<li>Task B</li>
<li>Task C</li>
</ul>
</body>
</html>

Now, hopefully you see the same result, and you can easily adapt the concept for your project by adding in the <div>s, DOCTYPE, etc.  Hopefully it's now clear how/where the HTML 'split' in items of what is in the parent and what is in the child.

Maybe you need more info from each note. For example, let's assume we've a number attribute TaskPriority and we want that after the title in a <span> of class "priority". So list_item becomes:

Code:
<li>^title^ - <span class="priority">^get(TaskPriority)^</span></li>

...and so on.

Sorry for the very trivial nature of my examples. They're not meant to be patronising but rather to help show the building blocks.

I remember treating this path - it gets better rapidly!

Title: Re: I don't know why it is doing this?
Post by Sebastian Stephenson on Aug 28th, 2008, 10:56am

sorry mark only saw it now and yes thank you thats what I needed thank you

but one more thing

Quote:
<il>task 1</il>
<il>task 2 </il>
            <il>task 2.1</il>
            <il>task 2.2</il>
<il>task3</il>


I can't seem to do this

this is what I have in my "list_item" template


Quote:
<h2>^title^</h2>
^text^
^justChildren(todosubtemplate)^


and here is my todosubtemplate


Quote:
<li>^title^</li>
     <li>^text^</li>


so whats wrong?

if this is off any help I'll so you

the template that has the good day mr.stephenson is on top
then the task are below the mr stephenson container
then there are some task that are containers and that task  is broken into several tasks is below that task that is broken down so that is the order

Title: Re: I don't know why it is doing this?
Post by Sebastian Stephenson on Aug 28th, 2008, 12:30pm

ok nearly have it but one more thing (yes I know but )

the tasks that are nested in the task are warping around each other and I can think of a way to prevent this help
http://homepage.mac.com/sebey/today.html

thanks and read the previous post if you know what I am talking about

Title: Re: I don't know why it is doing this?
Post by Mark Anderson on Aug 28th, 2008, 1:51pm

Just looking at the bigger issue, but a code error (though browsers seem to cope) is the code<il>. It should be <li> - with the two letters the other way around.

The 'li' stands for 'list item' if that makes it easier to remember.

The other problem is nesting which wasn't in the original question, which is why it wasn't discussed. Before looking at that, and in the spirit of small steps can you change the list item code and publish a test with just one level of todo so we can see if that works. Better to build from a clean base!

Title: Re: I don't know why it is doing this?
Post by Mark Anderson on Aug 28th, 2008, 4:57pm

OK, had a chance to test and I think this is what you need for list_item:

Code:
<li><h2>^title^</h2>
^text^
^if(^children)<ul>
^justChildren(list_item)
</ul>^endIf^</li>

The secret is recursion - either familiar of you program or often hard to get if you don't. In short, the template keeps calling itself and thus including code so that it goes all the way to the bottom of the bunch.

I tested with a note structure like:
List Parent
  Task A
  Task B
     Task B1
        Task B1A
     Task B2
  Task C

... and all notes showed up.

The list_item is effectively what you had before but now it checks and *if*, and only if, there are any children, it starts a new sublist. Within the memory available this ought to crawl a large outline (i.e. a some point - probably beyond your normal doc size) the code being created in memory may exceed resources but that an app/OS issue and not a TB limit.

For HTML source code prettification purposes, with the list_item template you can experiment with whether the </ul>^endIf^ and </li> go on the same line and so on. Such tweaks shouldn't affect the data structure being exported.

Title: Re: I don't know why it is doing this?
Post by Sebastian Stephenson on Aug 29th, 2008, 9:20am

cool thanks  have it all set up now if you want to see the results

here it is homepage.mac.com/sebey/today.html

css is petty basic and I may modify it later on but this will be a great reference (thread) when I come round to it so thanks you very much

Title: Re: I don't know why it is doing this?
Post by Mark Anderson on Aug 29th, 2008, 11:35am

Thanks for the specimen page. It renders but only because the browser is guessing the structure.  <li> elements should be inside a <ul></ul> or <ol></element>. Your output has niether.  I also can't work out why the last two lines =- which appear to be from the same sentence -- are split between an <li> and <p> element.

If you post your 2 templates, I'll try and figure out the errors so the output is proper code. As you're using a 'STRICT' DTD I assume that's what you'd like to achieve. However, if it's 'good enough' as is, that's fine. The code is only a means to an end, not an end in itself.

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.