Antville Project

macro design

i think we really could need some guidelines or at least a basic principle of how macros are designed. i think it makes the the macro coders' lifes easier.

e.g. i consider the topic_macro badly designed (or badly named in this case), because it returns the name of the topic as link. i would expect this functionality to be in topiclink_macro. and topic_macro should return the plain topic's name only.

another example are macros which render html tags. imho it is very important to give access to (almost) all of the html attribiutes via the macro. if that's too much hassle, please take in account at least "style", "class" and "id" to let the people control the element via cascading style sheets.

again, i think this will release a lot of pressure from the antville developers because users get the power to play their individual games without permanently crying for changes in antville source code.

if you want me to, i happily will browse through the macro code and try to develop some consistent practice how they generally should be implemented. whatcha say?

comment    

 
robert, March 29, 2002 at 1:40:28 PM CET

go for it!

i definetly appreciate your will to "standardize" macros :-) regarding your example with the topic_macro(), i'd vote for not creating two macros but instead using parameters (like as="link" or linkto="main" ...) to define if the name of the topic should appear as link or not (ev. we should rewrite the whole functions involved in creating a link).

link  

 
tobi, March 29, 2002 at 2:33:30 PM CET

you're right

i remember having seen other macros working like this already. but that's the point: i will collect the different macro designs and try to make some suggestions how we could unify them. so please stand-by, i hope to provide first results in a week or so...

link  


... comment
 
kris, March 30, 2002 at 2:10:41 PM CET

good idea.

i am particularly sensitive when it comes to these issues. that's why i asked you about it. antville is a sexy web application and not a siemens telephone, innit?

link  


... comment
 
tobi, April 4, 2002 at 3:57:05 PM CEST

first result, indeed

although i certainly did not finished browsing through the quite impressive collection of antville macros, i would like to already make a first proposal (because it could affect my further proceeding):

could we extend the macro support built-in into hop insuchaway that the prefix and suffix parameters are evaluated by hop and not by custom macro code anymore?

these two params are a really glorious idea and they once more underline how beautiful helma can separate content from code. they always work like this: when the value of the macro is null they are omitted. otherwise the value of prefix is inserted at the beginning and suffix is added to the end of the value (ie. a string).

however, there is one twist that could rain on my parade. hop should be able to apply this new behaviour to macro structures like this:

<% this.title prefix="<p>" suffix="<br>" %>

function title_macro(param) { res.write("here comes some stuff "); res.write(this.title); res.write(" and here comes some stuff, too"); }

question is if hop can be aware of that prefix hast to be inserted before "here" and suffix has to be added after "too"? ie. the correct output should be:

<p>here comes some stuff TITLE and here comes some stuff, too<br>

(i know that the macro code could be rewritten but regarding antville that possibly could mean more work than the feature could provide as benefit.)

link  

 
hns, April 4, 2002 at 4:15:52 PM CEST

that's exaclty

what helma is doing already (to be precise, since the 26. 11. 2001 snapshot - see helma.org ). In other words, you should be able to strip everything prefix/suffix related from the antville macros and things should continue working the same as before.

link  

 
tobi, April 4, 2002 at 4:23:34 PM CEST

i'm stunned...

you are so great. i am not worthy. ;->

just to be sure: it does work with various string buffers as well? nah, i'll just check it out with a simple test script...

update: it works with functions that contain a return statement but not with those directly writing to the response object (as outlined above)...

link  

 
hns, April 4, 2002 at 5:05:37 PM CEST

that will

likely stay that way. I can't tell from the skin rendering process when a macro writes to the response object, and if it does, it's already to late to insert the prefix.

Wait, no, it's doable. Please file a bug if you want that fixed.

link  

 
tobi, April 4, 2002 at 5:23:20 PM CEST

bug report

committed. thanks for your efforts.

link  


... comment


The Antville Server Fund has been a great success. Thanks to everybody who contributed!
online for 8550 Days
last updated: 1/4/11, 10:22 AM
status
Youre not logged in ... Login
menu
November 2024
SunMonTueWedThuFriSat
12
3456789
10111213141516
17181920212223
24252627282930
July
recent
zfuture's house here is zfuture's
house
by zfuture (7/31/03, 2:59 AM)
i understand your concerns however,
i hardly can think of a solution. certainly, if the...
by tobi (7/29/03, 9:47 AM)
Found several more similar sites
listed This is getting to be quite a concern to...
by cobalt123 (7/27/03, 7:56 PM)
Second Post Alert on Referrer
bug livecatz I put this into "help" and now here:...
by cobalt123 (7/26/03, 7:14 PM)
well it's not easy to
find from here, anyway. think we should include a link,...
by tobi (7/24/03, 11:25 AM)
So finally I found
the helma Bugzilla - stupid me.
by mdornseif (7/24/03, 10:28 AM)
clock not that it's particularly
earthshattering but the antclock is running slow by about 15...
by kohlehydrat (7/23/03, 8:25 PM)
but blogosphere.us isn't can't really
be rated as spam can it?
by kohlehydrat (7/23/03, 8:08 PM)
More referrer spam www.webfrost.com
by Irene (7/23/03, 7:55 PM)
How to log skin names
I accessed to console?? Hi, I would like to know...
by winson (7/23/03, 4:12 PM)

Click here to get an XML version of this weblog.

Made with Antville
powered by
Helma Object Publisher