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 >> Unexpected Line Break
http://www.eastgate.com/Tinderbox/forum//YaBB.cgi?num=1316103488

Message started by Simon Knight on Sep 15th, 2011, 12:18pm

Title: Unexpected Line Break
Post by Simon Knight on Sep 15th, 2011, 12:18pm

I have only just started looking at export templates and I have created a text output template that grabs data from my notes attributes using the following line ^value($Date),      ^value($Text),      ^value($HoursWorked),      ^value($Charge) the line ends with the default mac line end i.e. I just pressed the return key.  When used some longer entries in $Text cause the output to wrap to a second (and I guess subsequent) line.  Where is this wrap being set?  I have looked at the attributes but not found anything.

Thanks
Simon

Title: Re: Unexpected Line Break
Post by Mark Anderson on Sep 15th, 2011, 6:05pm

What tool are you using to view the output? Might that be soft-wrapping to output for display?

Title: Re: Unexpected Line Break
Post by Simon Knight on Sep 16th, 2011, 2:15am

Mark,

You are quite correct, both text edit and Tinderbox are adding a line break at the righthand end of the document.

Thanks (again!)

Simon

Title: Re: Unexpected Line Break
Post by Ema on Oct 8th, 2011, 7:55am

I made the same mistake but it took long for me to understand it.You are lucky to get it instantly.Thanks to Mark.

[edit]user deleted - signature spam[/edit]

Title: Re: Unexpected Line Break
Post by Mark Bernstein on Oct 8th, 2011, 9:09am

We add an implicit return after $Text because that's what we expected most people would expect.  For the simplest case, a beginner who tries the template

    ^title ^text

might be surprised to find that the second note's title collides with the first note's text.  (Simon Knight might reorder the fields so $Text is the last column, and then all might be well)

We'd be open to suggestions for handling this question.

Title: Re: Unexpected Line Break
Post by Carol smith on Oct 21st, 2011, 3:50am

hey mark can you please explain that in a bit detail, i got confused in the collision between the second note and the first note text. ::) :-/

[edit]user deleted - signature spam[/edit]

Title: Re: Unexpected Line Break
Post by Mark Bernstein on Oct 21st, 2011, 10:46am

Let's suppose we have the text export template

    ^title: ^text

This is perhaps the first thing that people will try, after all.  We try exporting, and what we expect is:

    Chaucer: Cressida
    Shakespeare: Juliet
    Austen: Darcy

but what we actually see is

    Chaucer: CressidaShakespeare: JulietAusten: Darcy

To avoid this very common puzzle, we add an implicit carriage return at the end of ^text.

Title: Re: Unexpected Line Break
Post by Robert Matzken on Oct 27th, 2011, 10:47am

Mark B asked for suggestions:

1) You might consider introducing a new System Attribute called $TextNR.
NR stands for No Return.
The Attribute $TextNR does not actually exist: during export Tbx would still use the value of $Text, but without adding the carriage return. This way, all existing scripts remain unaffected, but you simply add an option for export. I would make it non-editable in the Attribute Inspector.

2) Other approach: An extra checkbox in the HTML Export dialog window. Next to "Quote HTML" there is room for an extra checkbox option: "Add CR to text". The System default will be to have this box checked (again, so all existing script remain valid) but it will allow users to override the automatic addition of the CR.

Title: Re: Unexpected Line Break
Post by Mark Anderson on Oct 27th, 2011, 11:39am

Turning Robert's idea around, item #2 would be a preference seeding a #1, Boolean $TextNR. As - for better or worse - most export related attributes live in the 'HTML' system group so $TextNR too might go there (though perhaps as $HTMLExportTextReturn or $ExportTextReturn).

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.