W3C home > Mailing lists > Public > www-style@w3.org > August 2006

Re: Macros for CSS

From: Joao Eiras <joao.eiras@gmail.com>
Date: Mon, 28 Aug 2006 16:31:37 +0100
To: www-style@w3.org
Message-ID: <op.tez2qzk4xl3at9@dragast>

I wonder if 4 years later this request would be more fit for CSS 3 ?
It has my vote.
This is very usefully when  stylesheet aren't generated dynamically by the  
web server, and one want to keep authoring as simple as possible but  
providing alternative styles to one's page.


> From: Etan Wexler <ewexler@stickdog.com>Date: Wed, 6 Nov 2002 18:35:03  
> -0500
> Message-Id: <v03102806b9e82416a20a@[64.24.91.50]>To: www-style@w3.org
>The recent discussion of multi-property declarations [1] prompted some
> thought on a generalized macro scheme for property values.
>Naturally, we would need a way to define macros and a way to invoke them.
> Consider the following syntactical definitions for an at-rule to define
> macros.
>macro-rule
>   : MACRO_SYM b+ IDENT b*
>     '{' [ any | block | ATKEYWORD b* ]+ '}'
>   ;
> b
>   : [ S | COMMENT ]
>   ;
>"@macro"    {return MACRO_SYM;}
>Now consider usage scenarios.  People could use macros to stand for  
> entire
> values, as in the following rules.
>@macro big-length {1em}
> e { padding-top: macro(big-length); }
>However, people could also use macros to stand for just part of a value,  
> as
> in the following rules.
>@macro small-length {0.1em}
> e { border-spacing: 0.25em macro(small-length); }
>More likely to arise in actual use is something like the following rules.
>@macro big-length {1em}
> @macro small-length {0.1em}
> table { border-spacing: macro(small-length) macro(big-length); }
> th, td { padding: macro(big-length) macro(small-length); }
>There is some flexibility in our choice of invocation syntax, so let us  
> not
> fret over the one in my example.  The definition syntax, on the other  
> hand,
> will need to be of the block form in order to accomodate the full range  
> of
> core syntax property values.
>[1]  Christopher Lee.
> "[Suggestion] Multiple 'property' tokens in 'declaration' syntax".
> 29 August 2002.
> <mid:20020829115408.47515.qmail@web13605.mail.yahoo.com> /
> <http://lists.w3.org/Archives/Public/www-style/2002Aug/0379.html>.
>--
> Etan Wexler <mailto:ewexler@stickdog.com>
Received on Monday, 28 August 2006 15:32:55 GMT

This archive was generated by hypermail 2.2.0+W3C-0.50 : Monday, 27 April 2009 13:54:46 GMT