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
javascript or html output in files (Read 4858 times)
Ryan Ware
Full Member
*
Offline



Posts: 7

javascript or html output in files
Jan 18th, 2008, 1:48pm
 
I know Tinderbox will output to html, but how would one include javascript or specialized html in the output files? I'm sure Tinderbox has this capability, but I wanted to be sure before buying.

Thanks,

Ryan
Back to top
 
« Last Edit: Jan 18th, 2008, 1:49pm by Ryan Ware »  
  IP Logged
Mark Bernstein
YaBB Administrator
*
Offline

designer of
Tinderbox

Posts: 2871
Eastgate Systems, Inc.
Re: javascript or html output in files
Reply #1 - Jan 18th, 2008, 2:15pm
 
Easily done.

First, javascript or HTML can be included verbatim in your templates.  This, in fact, is what you'd typically do -- simply add the javascript links to the <head> of your template, or include the scripts in a script block in the template.

Sometimes, you might want to do something very fancy, assembling a script that varies for each note.  That's fairly easy, too.  For example, the script could be placed in a string attribute and included by reference:

<!-- script goes here --> ^get(CustomScript)

If you need to get VERY fancy, Tinderbox has a fairly complete repertoire for interpolating Tinderbox attributes into arbitrary strings.  

We say "HTML export" as a shorthand; Tinderbox is equally facile with HTML and XML, and can readily build CSS, javascript, and even LaTeX.
Back to top
 
 
WWW   IP Logged
Mark Anderson
YaBB Administrator
*
Offline

User - not staff!

Posts: 5689
Southsea, UK
Re: javascript or html output in files
Reply #2 - Jan 18th, 2008, 2:38pm
 
Further to Mark's comments, you can even export a whole note as a '.js' JavaScript library file. Set
HTMLExportExtension to '.js' instead of the default '.html' (though only for this note - and any others of the same type on export).

You also want to ensure that for such a note that HTMLQuoteHTML is false (default = false) and that HTMLEntities is false (default = true). The latter ensure one of your code is turned into HTML entities. You want x < y.length to be exactly that on export and not turned into x &lt; y.length.

By the same token, you could be making a Perl library or an ASP page. Just set the attributes for that page appropriately.
Back to top
 
 

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



Posts: 7

Re: javascript or html output in files
Reply #3 - Jan 18th, 2008, 3:43pm
 
Thanks Mark and Mark.

I just became a Tinderbox owner and picked up Flint while I was at it.
Back to top
 
 
  IP Logged
Pages: 1
Send Topic Print