curious, i’ve realized that i have never seen any html template systems that
use new tags. for some reason i’ve always assumed there was a reason for it,
but now i thinking about it and i’m not sure what it would be. for ex-
is there a good reason for not doing something like this?
curious, i’ve realized that i have never seen any html template systems that
use new tags. for some reason i’ve always assumed there was a reason for it,
but now i thinking about it and i’m not sure what it would be. for ex-
is there a good reason for not doing something like this?
Some HTML editors play well with templating systems so long as the editor has a clear way of distinguishing between explicit HTML
and template code/markup.
Dreamweave (as far as I recall) can be told about special syntax for things like ASP or PHP. Using PIs (<?var value goes here
?> )for template code also aids this distinction. This may be less of an issue for non-WYSIWYG tools.
On the other hand, JSP taglibs involves custom elements, distinguished by namespaces:
curious, i’ve realized that i have never seen any html template
systems that use new tags. for some reason i’ve always assumed there
was a reason for it, but now i thinking about it and i’m not sure what
it would be. for ex-
is there a good reason for not doing something like this?
The major browsers, for a while, had fun adding new tags every now and
again. Which isn’t the best when your templating language wants to
use some of its own.
These days, with XHTML, you could, theoretically, use xml namespaces and
have rubbish like:
<eruby:var name=“fnar” value=“4” />
But damn that’s verbose. [My major complaint about HTML/XML and other
SGML derivatives (and SGML itself) is about the verbosity.]
curious, i’ve realized that i have never seen any html template systems that
use new tags. for some reason i’ve always assumed there was a reason for it,
but now i thinking about it and i’m not sure what it would be. for ex-
is there a good reason for not doing something like this?
The Perl module HTML::Template, the choice for writing pure views in
Perl, has
‘’ is part of HTML 4 and does not have a ‘name’ property. This
clearly illustrates the reason why one should not use new tags. Be-
sides this there is no reason to invent new tags, the existing ones
are sufficient. I often use something like this:
In the browser’s interpretation that’s simply a comment tag that is
not being displayed. In the interpretation done by the preprocessing
Ruby script that means “append to this tag the size of the file
‘books.html’ that resides in the same directory as this document” (I
am too lazy to use begin and end tags but that’s no conceptual
issue). It is obvious that the same kind of comment tags can also be
used for templating. The advantage of comments is that they will
never interfere with newly added tags and can therefore remain in the
document. This is especially helpful if all document processing is
done offline as it is the case with my web pages.
curious, i’ve realized that i have never seen any html template systems that
use new tags. for some reason i’ve always assumed there was a reason for it,
but now i thinking about it and i’m not sure what it would be. for ex-
I would interpret your question a bit differently than others in this
thread…
I see all kinds of html template system that use new tags - for
example, JSP uses <%…%> tags PHP uses <?foo ?> tags; ColdFusion uses
<cf*> tags (where * represents such commands like loop, var, etc…).
In fact, the preponderance of non-pure html templating systems led one
blogger on O’Reilly to bemoan why there are no solutions that leave
HTML code in HTML space, and business logic in the programming space.
[O'Reilly Media - Technology and Business Training]
I’m working on a templating system right now that works as an abstract
class. It will scan a well-formed (in the XML sense) HTML document,
and grab subtrees where the root of the subtree has a code attribute -
this attribute isn’t in any of the published standards, so I feel
pretty safe using it for now. The subtrees are then passed into
methods that do the business logic.
I also add a rule that if I have any unprocessed subtrees, that they
are removed from the document before sending the results to the client.
I am fairly close to being done, but I’ve hit some snags; if anyone is
interested in the project, please let me know.
PS: Only after I started the project did I discover that there were
templating systems available to Ruby - at least one of which is quite
close to my ideas. Too bad they have names that meant nothing about
html templating, or I’d have learned about it sooner…
-rh
···
On Thursday, February 13, 2003, at 09:20 PM, Tom Sawyer wrote:
curious, i’ve realized that i have never seen any html template
systems that
use new tags. for some reason i’ve always assumed there was a reason
for it,
but now i thinking about it and i’m not sure what it would be. for ex-
is there a good reason for not doing something like this?
I wrote a templating system once which used 'class', so for example you
could write
My name is <span class="name">foo</span>
and it replaced 'foo' with the appropriate content. I just looked at Amrita
and it seems to use exactly the same idea. It gives the side benefit of
being able to stylise the inserted content if you so wish.
Is that what you were thinking about? Or is there some reason to use a
different attribute than 'class'?
Regards,
Brian.
···
On Sun, Feb 16, 2003 at 05:51:22AM +0900, Robert Hahn wrote:
I see all kinds of html template system that use new tags - for
example, JSP uses <%...%> tags PHP uses <?foo ?> tags; ColdFusion uses
<cf*> tags (where * represents such commands like loop, var, etc...).
In fact, the preponderance of non-pure html templating systems led one
blogger on O'Reilly to bemoan why there are no solutions that leave
HTML code in HTML space, and business logic in the programming space.
[http://www.oreillynet.com/pub/wlg/2423\]
I'm working on a templating system right now that works as an abstract
class. It will scan a well-formed (in the XML sense) HTML document,
and grab subtrees where the root of the subtree has a code attribute -
I’m working on a templating system right now that works as an abstract
class. It will scan a well-formed (in the XML sense) HTML document,
and grab subtrees where the root of the subtree has a code attribute -
this attribute isn’t in any of the published standards, so I feel
pretty safe using it for now.
Um, pretty sure XHTML strict, for example, won’t allow arbitrary attributes.
For example, using the ‘border’ attribute on an img element will break validation.
Any elements or attributes not defined in the corresponding DTD or scheme would need to be removed before the results are sent to a
browser.
This is one reason PIs (processing instructions; <?name target ?>) work well, or else non-HTML/XML markup (e.g. <% %>) that gets
removed before any HTML/XML tools see the text.
I’m working on a templating system right now that works as an abstract
class. It will scan a well-formed (in the XML sense) HTML document,
and grab subtrees where the root of the subtree has a code attribute -
I wrote a templating system once which used ‘class’, so for example you
could write
My name is foo
and it replaced ‘foo’ with the appropriate content. I just looked at
Amrita
and it seems to use exactly the same idea. It gives the side benefit of
being able to stylise the inserted content if you so wish.
Is that what you were thinking about? Or is there some reason to use a
different attribute than ‘class’?
Yeah, pretty much. But I think there’s a very important reason not to
use class, or id (which I believe Amrita uses) - you’re overloading the
meaning of that attribute.
In the case of class, that attribute is designed to be used with
Cascading Style Sheets. In that light, then, what if a web designer
designed a particular area of the page where several elements used
the same value for class, and your templating system only wanted one
particular one?
The same general logic can be applied to the id tag, which is designed
to be used when creating DHTML effects. The possibility of the
programmer’s wishes conflicting with the designers is, in my humble
opinion, too great to risk designing a templating system around.
All that said, it’s a trivial process for anyone with a copy of the
templating script to simply use a different attribute. I chose ‘code’
specifically because there is no tag for which there is a code
attribute, and to ensure that all browsers are happy, I make sure I
clean up after myself, removing either the attribute-value pair, or the
whole subtree.
I’m working on a templating system right now that works as an abstract
class. It will scan a well-formed (in the XML sense) HTML document,
and grab subtrees where the root of the subtree has a code attribute -
this attribute isn’t in any of the published standards, so I feel
pretty safe using it for now.
Um, pretty sure XHTML strict, for example, won’t allow arbitrary
attributes.
For example, using the ‘border’ attribute on an img element will break
validation.
no argument here.
Any elements or attributes not defined in the corresponding DTD or
scheme would need to be removed before the results are sent to a
browser.
that’s part of my design, yes.
This is one reason PIs (processing instructions; <?name target ?>)
work well, or else non-HTML/XML markup (e.g. <% %>) that gets
removed before any HTML/XML tools see the text.
Not to put too fine a point on it, but most of the currently available
templating systems that use such tags are embedding ‘code’ into the
HTML - such as loops, branching conditions, etc.
While I recognize that there’s a time and place to mix business logic
into HTML, there are also many cases where you’ll want web developers
to just mark up a page, turn it over to a developer, who just ‘hints’
it with these attributes, and keeps the business logic in the script.
If a web page developer then has to tweak the page, s/he won’t have to
slough through lines of ‘code’ to find their markup for tweaking.
Besides, PI’s and non HTML/XML markup aren’t really designed to
encapsulate subtrees within a document, and what I was trying to
accomplish was to ‘hint’ a subtree for processing by the script.
I could change the port that the Flash EXE connects on, but it must be above
1024…
As for any problems with the Ruby file main.rb:
I use the one-click Windows installer -
C:>ruby -v
ruby 1.7.2 (2002-07-02) [i386-mswin32]
I’m not sure if any of the code needs to be changed, but here’s the code
that might need modifications:
< code >
require “socket”
class Container
def error(message)
puts "ERROR: "+message
end
def event(param)
puts "Recieved: "+param
end
def property(param)
puts "Property: "+param
end
end
$myContainer = Container.new
begin
loop do
localRec=$s.gets(“\0”)
if(localRec==nil) then exit end
puts “[ “+localRec.dump+” ]”
$myContainer.send(localRec.split(“|”)[0],localRec.split(“|”)[1])
end
end
< / code >
-Rich
···
----- Original Message -----
From: “MikkelFJ” mikkelfj-anti-spam@bigfoot.com
Sent: Saturday, February 15, 2003 1:41 PM
Subject: Re: [ANN] Flash and Ruby GUI prototype
Nice
I would be nice if you could have a flash application running on your
webserver to which you connect from a browser with flash plugin.
main.rb shuts down immediately - mainBrowser.rb works fine - using Ruby
1.7.3 PragProg installer.
What about commecial applications? You can’t ship a flash player, but you
might depend on users having flash plugin in web-browsers.
What about firewalls. You create an arbitrary socket - this might not work
out of the box without making it look like a web-server somehow…?
Yeah, pretty much. But I think there’s a very important reason not to
use class, or id (which I believe Amrita uses) - you’re overloading the
meaning of that attribute.
The possibility of the
programmer’s wishes conflicting with the designers is, in my humble
opinion, too great to risk designing a templating system around.
Amrita does use ‘id’, it’s true, but I believe you can change this at runtime
to anything you want, if that becomes a problem. ‘id’ is just the default.
To expand on this (for those that don’t subscribe to amrita-users), the
following methods can be used:
(1) keep_id
If you set this options of Amrita::Template object like
template.keep_id = true
amrita dose not delete id attributes.
(2) amrita_id
If you set a name of attribute to this option, amrita use the
attributes with that name for template expansion.
(3) escaped_id
If you set a name of attribute to this option, amrita will
convert the attribute of that name to 'id=' for output.
(the above courtesy of Nakajima-san)
// Bruce
···
On Saturday 15 February 2003 10:37 pm, Tim Bates wrote:
On Sun, 16 Feb 2003 01:34 pm, Robert Hahn wrote:
Yeah, pretty much. But I think there’s a very important reason not to
use class, or id (which I believe Amrita uses) - you’re overloading the
meaning of that attribute.
The possibility of the
programmer’s wishes conflicting with the designers is, in my humble
opinion, too great to risk designing a templating system around.
Amrita does use ‘id’, it’s true, but I believe you can change this at
runtime to anything you want, if that becomes a problem. ‘id’ is just the
default.