Ok. Complex and hopefully interesting story ...
I presume you're using Direct domain, or Mason domain. Please advise if
this is not so.
Context: Each of the methods which return a response dict to the server
provide for a content type to be specified (usually) as the last
argument as a mime type. Most domains default to returning a
pseudo-type: x-text/html-fragment. There's a post-processing step
handled by Convert.tcl which attempts to transform content into a mime
type that the client has requested. So, returning an
x-text/html-fragment type will lead to its conversion into text/html (if
that's what the client was expecting.)
x-text/html-fragment applies some response dict elements to the
generated code. So -title will be emitted as <title> and so forth. You
can see, from conversions.tcl proc .x-text/html-fragment.text/html
precisely what extras are added in, if you like.
Html.tcl (which should be present everywhere code's running) provides a
series of helper commands to do the messy manipulation for you, and I
would recommend their use (or their improvement, if they don't do what
you want.) In any case, I think they're the appropriate level of
intervention.
[Html header r text] adds arbitrary text to <head> section of response
[Html prescript r url] will cause $url to be added as a <script> to <head>
[Html script r url] will cause the appropriate <script> to be added at
the *end* of content
[Html postscript r script] will cause the verbatim <script> to be added
at the end of content
[Html style r url] will cause the $url <style> to be added to <head>
[Html prestyle r style] will cause the verbatim <style> to be added to
the end of content
Each of these returns a suitably modified response dict. I see that
there's some conflict and inconsistency in the naming of these, and
would like feedback on how they should be named.
This set of operations generally supports the notion that it's quicker
and better to add <style> to <head>, and <script> to <body> where
possible, as doing it that way means stuff gets rendered quicker.
Anyway, feedback welcome.
Colin.
Where'd that come from? The one I mean is in Wub/conversions.tcl ...
> It doesn't look like<title> is doing anything useful. I don't see
> anyplace for "extras" to get included, either. I'm very confused about
> how this proc is supposed to work, especially since I thought the
> correct tag was<head> and not<header>.
>
>> [Html prescript r url] will cause $url to be added as a<script> to<head>
> So I put this in at the same place I'm setting the page title:
>
> Html prescript r template.js
>
> When I try it, it causes a Server Error:
>
> unknown or ambiguous subcommand "prescript": must be argsplit,
> attr, default, dict2json, dict2table, dir2table, links, menulist,
> olinks, parseAttr, postscript, script, style, table, template, or
> ulinks
>
> I'm probably doing something wrong that's both stupid and obvious, but
> I don't see what.
What version is this?
Colin.
Where'd that come from? The one I mean is in Wub/conversions.tcl ...
> unknown or ambiguous subcommand "prescript": must be argsplit,
> attr, default, dict2json, dict2table, dir2table, links, menulist,
> olinks, parseAttr, postscript, script, style, table, template, or
> ulinks
>
> I'm probably doing something wrong that's both stupid and obvious, but
> I don't see what.What version is this?
On Thursday, April 7, 2011 10:03:00 AM UTC-4, mcccol wrote:Where'd that come from? The one I mean is in Wub/conversions.tcl ...
Oops. I found that proc in *Convert.tcl*, right after conversion.tcl in an alphabetical directory listing. I'll ignore it and focus on the one in the proper file.But now I'm unsure about when and why it gets called.
If my code already explicitly sets the mimetype to text/html, does that mean that I'm responsible for wrapping everything I want in the <html><head></head><body></body></html> tags myself? Actual html headers like Cache-control appear to be working correctly, but now I see that content like <title> isn't.
> unknown or ambiguous subcommand "prescript": must be argsplit,
> attr, default, dict2json, dict2table, dir2table, links, menulist,
> olinks, parseAttr, postscript, script, style, table, template, or
> ulinks
>
> I'm probably doing something wrong that's both stupid and obvious, but
> I don't see what.What version is this?
Wub-4.0.0 (the one labeled "Lastest Wub + WubTk"). I downloaded it last November just before I started serious work on my application, apparently just a few days before 5.0.0 was posted. I guess I'm behind the times, huh? I'll save off my app code and install the new version. I hope there isn't anything different about the way my custom Application.tcl and site.config files have to be written...?
If my code already explicitly sets the mimetype to text/html, does that mean that I'm responsible for wrapping everything I want in the <html><head></head><body></body></html> tags myself? Actual html headers like Cache-control appear to be working correctly, but now I see that content like <title> isn't.
Yeah, I wouldn't do that. Direct defaults to x-text/html-fragment, and that will do the postprocessing transformation, which is (I think) what you want.
You can assemble it all yourself if you want, but why bother?
Grab the svn version, that's got fewer and newer bugs.